File Search Functionality: API vs DASHBOARD

Hi,

I’ve been having real trouble for a few days with this issue.
I created my assistant using the OpenAI Dashboard. I enabled the file search functionality and added a vector store file.
When I run the assistant in the OpenAI Playground, it works perfectly, using file search and returning exactly what I’m asking for.
However, when I switch to using the API (calling the assistant via an API request), it seems like file search isn’t being used.

For context, I have a function in my backend that formats the OpenAI response. Could this be the reason it seems like file search isn’t being used?

I’m looking for other users who may have experienced a similar problem.
I’ll share the part of my code where I call OpenAI.

Thanks in advance for your help, community!

export function runWithWorkoutGeneration({
  assistantName,
  message,
  threadId,
  additionalAthleteInfos,
}: {
  assistantName: OpenAiAssistantNameType;
  message: string;
  threadId: string;
  additionalAthleteInfos: AdditionalAthleteInfos;
}): Promise<OpenAiThreadRunType> {
  const { age, goal, sexe } = additionalAthleteInfos;

  return openaiInstance.beta.threads.runs.createAndPoll(
    threadId,
    {
      additional_messages: [{ content: message, role: "user" }],
      additional_instructions: `
        Here is some user information I know, therefore don't need to ask for them:
        - user age: ${age}
        - user objective: ${goal}
        - user sexe: ${sexe}
        Retrieve the exercise names by using filesearch functionnality to retrieve them from Vector store for Test esiea
      `,
      assistant_id: OPENAI_ASSISTANTS_IDS[assistantName],
      truncation_strategy: {
        type: "last_messages",
        last_messages: 5,
      },
      tools: [
        zodFunction({
          name: openAiTools.functions.formatWorkout.name,
          description: openAiTools.functions.formatWorkout.description,
          parameters: openAiTools.functions.formatWorkout.parameters,
        }),
      ],
      parallel_tool_calls: false,
    },
    {
      pollIntervalMs: 500,
      timeout: OPENAI_REQUEST_TIMEOUT_IN_MS,
    }
  );
}