I've been trying to get Chat Gpt to read the prompt and read the document to summize it here is the code (also the api key works i've just blanked it out)
import os
# Check if the file exists
file_path = "C:\\Users\\hayde\\OneDrive\\Desktop\\Test.txt"
if os.path.exists(file_path):
print("The file exists!")
else:
print("The file does not exist.")
openai.api_key = "API-KEY"
with open("C:\\Users\\hayde\\OneDrive\\Desktop\\Test.txt", "r") as file:
prompt = file.read()
response = openai.Completion.create(
engine="text-davinci-002",
prompt=prompt,
temperature=0.4,
max_tokens=100
)
# Print the text from the response
print(response["choices"][0]["text"]) ```