I am trying to use OpenAI’s GPT-4 model to analyze the content of an uploaded file. The file is a scan with text, and I need the model to read and analyze its contents. Here is my request to the /chat/completions endpoint:
{
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You are an AI that helps with file analysis."
},
{
"role": "user",
"content": "Find the file with the following ID: file-V2bPkcexJmkzCQbWghxnqijC"
},
{
"role": "user",
"content": "What is in this file ?"
}
],
"functions": [
{
"name": "file_search",
"parameters": {
"type": "object",
"properties": {
"file_id": {
"type": "string",
"description": "ID of the uploaded file"
}
},
"required": ["file_id"]
}
}
]
}
The response I get is:
{
"id": "chatcmpl-9eGUZAroGcRWoTknJmJ2xHmYWi75C",
"object": "chat.completion",
"created": 1719383543,
"model": "gpt-4o-2024-05-13",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"function_call": {
"name": "file_search",
"arguments": "{"file_id":"file-V2bPkcexJmkzCQbWghxnqijC"}"
}
},
"logprobs": null,
"finish_reason": "function_call"
}
],
"usage": {
"prompt_tokens": 91,
"completion_tokens": 32,
"total_tokens": 123
},
"system_fingerprint": "fp_ce0793330f"
}
How can I ask the model to read and analyze the content of this uploaded file? The file is a scan with text.
Any help would be appreciated!