Even after specifying the “file_search”: { “max_num_results”: 2 } in an assistant createRun the response sometimes fetching more than 2 annotations from the vector store. Is this a bug or is there another way to do this…
CODE:
const createRunAndPollStatus = async (threadId, tools = [{
"type": "file_search",
"file_search": { "max_num_results": 2 }
}]) => {
const delay = ms => new Promise(res => setTimeout(res, ms));
const maxAttempts = 10; // Adjust based on your needs
try {
const createResponse = await axios.post(`https://api.openai.com/v1/threads/${threadId}/runs`, {
assistant_id: assistantId,
tools: tools
}, {
headers: {
"Authorization": `Bearer ${process.env.OPENAI_API_KEY}`,
"OpenAI-Beta": "assistants=v2"
}
});
Thanks