Error message using RAG with OPEN AI

I uploaded a PDF file to OPENAI and when I ask questions that should be answered using the content of that file, I repeatedly receive the message:

HTTP error code: 400
{
"error": {
"message": "Invalid input: Expected file type to be a supported format: .jpeg, .jpg, .png, .gif, .webp but got .pdf.",
"type": "invalid_request_error",
"param": "input",
"code": null
}
}

The PDF file contains only text suggesting JSON generation for sales questions. An example question: How much did I sell in January 2025, accumulated by day?

Another question is that I always need to use getfiles for the agent to respond based on the uploaded files. Is this the default behavior?

Did you do this according to the sample implemented in the demo AIFiles.dproj that is included?
For OpenAI, you need to use the Assistants API here and run a thread using this assistant:

    TMSFNCCloudAI1.GetAssistants(procedure(AResponse: TTMSFNCCloudAIResponse; AHttpStatusCode: Integer; AHttpResult: string)
     var
       id: string;
     begin
       if AHttpStatusCode div 100 = 2 then
       begin
         if TMSFNCCloudAI1.Assistants.Count > 0 then
         begin
           id := TMSFNCCloudAI1.Assistants[0].ID;
           RunThread(id);
         end
         else
           TMSFNCCloudAI1.CreateAssistant('My assistant','you assist me with files',[aitFileSearch], procedure(const AID: string)
             begin
               id := AID;
               RunThread(id);
             end);

       end;
     end);
  end