Find relevant information with direct vector store searches
The File Search tool provides direct access to your vector stores, enabling semantic search to find relevant content based on the meaning of your query rather than just keyword matching.
The File Search tool connects directly to your vector stores, allowing you to search through your document collections using semantic understanding rather than just keyword matching. It’s designed for immediate results on simple, well-defined queries.
Query: “What is the maximum connection timeout value?”
Results:
From: config/database.md
The maximum connection timeout value is 300 seconds (5 minutes). This can be configured in the database settings with the DB_CONNECTION_TIMEOUT environment variable. For high-latency networks, consider increasing this value.
The filters parameter allows you to narrow search results based on document metadata:
Copy
curl --location 'http://localhost:8080/v1/responses' \--header 'Content-Type: application/json' \--header 'Authorization: Bearer $OPENAI_API_KEY' \--header 'x-model-provider: openai' \--data '{ "model": "gpt-4o", "tools": [{ "type": "file_search", "vector_store_ids": ["vs_security_docs"], "max_num_results": 5, "query": "Authentication best practices", "filters": { "type": "and", "filters": [ { "type": "eq", "key": "compliance", "value": "GDPR" }, { "type": "gt", "key": "updated_date", "value": "2023-01-01" } ] } }], "input": "What are the best practices for authentication that comply with GDPR?", "instructions": "Answer questions using information from the provided documents."}'
Filters dramatically improve search relevance by narrowing the search space. Always use them when you know specific attributes of the documents you’re looking for.
The file_search tool automatically performs the search and provides the results to the AI model in the same request. This creates a seamless RAG experience where the model can access and use the information without additional API calls.