How can I make my chatbot respond according to the files the user inserted in the vector store?
I’m not using the assistant, just a simple chat completion, and I don’t intend to use the assistant.
I believe the procedure to be done is to take the user input, embed that input, and then use similarity search to compare the user input with each of the files in the vector store. But I don’t know how to make this comparison, and due to the structure of my project, I can’t import any library.
I’m referring to the pdf file that I upload to the files endpoint and then linked to the vector store.
From what I’ve seen, this process of processing the file and then doing the embedding is done automatically, I’ll even leave a print of the image where this is said.
So I want to know if, when getting these files from the vector store, they will still be embeddings so I can make the cosine similarity with the user input embedding. Or if I will have to embedding the files first and then do the cosine similarity.
I apologize if I ended up being confusing, or if my question is very stupid, this is the first time I’m dealing with artificial intelligence and the openai api.
using assistants may not be the worst idea if you just want to slap something together as a PoC.
I’m not using assistants, but my understanding is that you won’t need to deal with cosine similarity and all that, you just attach it to your assistant and OpenAI does the rest.
Or more plainly: In assistants, a vector store is accessible only by a file search function the AI might call, and only in that endpoint.
You would have to make your own embeddings-based vector database for chat completions, and then for each input that you want to automatically inject knowledge, run an embeddings AI model call on the input (and perhaps more context or language transformation) to get an input vector back which you can use for an exhaustive search against all database entries, to return the top results in a format the AI can understand when placed into context, such as a system message “you have this additional knowledge automatically added for fulfillment of the most recent user input…”
It can then be automatic, be based on a quality threshold, use semantic or manual chunking techniques, not need an AI decision to call a tool or double the internal calls and costs, and all other ways you can be better than Assistants.