AI Search technology overview
AI Search comprises AI Studio tools and technologies that enable models to generate responses grounded in verified data, such as corporate documents, internal knowledge bases, or internet content.
AI Search provides search tools for the following two types of sources:
- File Search to search within proprietary user data (documents, guides, FAQ).
- Web Search to search across selected internet domains.
You can use either of the tools when creating voice agents with Realtime API or in Responses API when creating text agents and calling text generation models to generate accurate, relevant, and verifiable responses. Both tools can be enabled simultaneously, but the model will select the most appropriate one based on the user's query, tool description, and prompt.
How AI Search works
To generate text, models can only refer to their training data or information provided in the request context. Thus, if you want your selected Model Gallery model to integrate your information in its response, you need to prepare the data and add it to the request context. Context enrichment is a multi-stage process:
-
Data indexing. By default, AI Studio automatically prepares data for search. All you need to do is upload files in the management console or via the Files API and create a Vector Store search index. After that, AI Studio will break the data into chunks of the required size, i.e., fragments of text from a few lines to several paragraphs, and then tokenize them and store them in the search index.
To avoid possible loss of meaning when preparing files, you can split the data into chunks yourself and upload them to AI Studio in JSONL
format. -
Generating a search query. Depending on the task at hand and conditions for using search tools described in the prompt, the model generates a query to either file search or internet search tools.
-
Getting fragments. The tool returns the most relevant information from the search index as chunks and adds it to the model context.
-
Generating a response. The model relies on the retrieved information for facts, maintaining the tone, style, and instructions from the prompt.