Загрузка файлов и использование их в качестве источника знаний openai ⇐ Python
-
Anonymous
Загрузка файлов и использование их в качестве источника знаний openai
My goal is to create a chatbot that I can upload a file which holds a bunch of text, and then use openai assistants api to actually use the file when query my chatbot and it will use gpt-3.5-turbo as the model to answer the questions. essentially creating a chatbot that is using a file as its knowledge source.
The code I have is this:
file_response = client.files.create( file=open("website_content.txt", "rb"), purpose="assistants" ) query_response = client.assistants.query( assistant_id="my_assistant_id", input="Tell me about xxx?", files=[file_response['id']] ) however, this is not working, for what I think could be a few things. For one, I don't fully understand the way it is supposed to work, so was looking for some guidance. I have already created an assistant via the dashboard, but now I want to just upload a file, and then query it. Do I have to use something else, like threads via the api, or no?
How to do this?
Источник: https://stackoverflow.com/questions/780 ... rce-openai
My goal is to create a chatbot that I can upload a file which holds a bunch of text, and then use openai assistants api to actually use the file when query my chatbot and it will use gpt-3.5-turbo as the model to answer the questions. essentially creating a chatbot that is using a file as its knowledge source.
The code I have is this:
file_response = client.files.create( file=open("website_content.txt", "rb"), purpose="assistants" ) query_response = client.assistants.query( assistant_id="my_assistant_id", input="Tell me about xxx?", files=[file_response['id']] ) however, this is not working, for what I think could be a few things. For one, I don't fully understand the way it is supposed to work, so was looking for some guidance. I have already created an assistant via the dashboard, but now I want to just upload a file, and then query it. Do I have to use something else, like threads via the api, or no?
How to do this?
Источник: https://stackoverflow.com/questions/780 ... rce-openai