This API query worked great with gpt-4o:
model: "gpt-4o",
tool_choice: "required",
tools: [{
type: "file_search",
vector_store_ids: ['abcdefg12345'],
max_num_results: 20
}],
input: "some prompt",
text: my_json_return_schema,
temperature: 0.2
Obviously with gpt-5 we need to change the model, eliminate temperature, and change the tool call to something more like the documentation:
“tool_choice”: {
“type”: “allowed_tools”,
“mode”: “auto”,
“tools”: [
{ “type”: “function”, “name”: “get_weather” },
{ “type”: “mcp”, “server_label”: “deepwiki” },
{ “type”: “image_generation” }
]
}
But I cannot for the life of me figure out how to structure an API call that allows/requires use of the file_search tool and gives it a vector_store_id to use. The documentation is so skinny that it doesn’t appear and GPT-5 can’t figure it out when asked. My best guess is:
model: "gpt-5",
tool_choice: {
type: "allowed_tools",
mode: "auto",
tools: [{
type: "file_search",
vector_store_ids: ["abcdefg12345"]
}]
},
input: "some prompt"
But this just gives:
OpenAI HTTP Error: {“error” => {“message” => “Unknown parameter: ‘tool_choice.tools[0].vector_store_ids’.”, “type” => “invalid_request_error”, “param” => “tool_choice.tools[0].vector_store_ids”, “code” => “unknown_parameter”}}
Any ideas on how to structure an API call to use file_search? I’ve tried many permutations with no luck. Is this tool even usable by GPT-5 yet? The cookbook only talks about custom tools…