Hi @groverkartik25 ,
the APIs give the ability to retrieve the list of chunks that the vector store passed to the LLM before it elaborated the response. You need to identify the correct run step to analize and then call it this way
curl -g https://api.openai.com/v1/threads/thread_abc123/runs/run_abc123/steps/step_abc123?include[]=step_details.tool_calls[*].file_search.results[*].content \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "OpenAI-Beta: assistants=v2"
It will return a useful list, see my example:
If you don’t know how to identify the run step to request to the API, use the /threads/runs/steps call. provide it the thread_id and run_id in the following way:
https://api.openai.com/v1/threads/${thread_id}/runs/${run_id}/steps
Now the response should return a list of step ids with multiple attributes inside.
Search for the step with the attribute: step details.tool_calls.type = “file_search”
That is the step that contains the chunks coming from the vector db.
Use the step ID you just identified to perform the first api call. See my example below:
there’s a little bit of information about this in the File search documentation as well. link: https://platform.openai.com/docs/assistants/tools/file-search
Hope this helps!