curl -X POST https://generativelanguage.googleapis.com/v1beta/interactions \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.6-flash",
"tools": [{
"type": "file_search",
"file_search_store_names": ["fileSearchStores/m64d1sevsr4y-xfyawui3fxqg"]
}],
"input": "Who is the author of the book?"
}'
from google import genai
client = genai.Client()
# Create a file search store so we have a valid one to use.
store = client.file_search_stores.create()
response = client.interactions.create(
model="gemini-3.6-flash",
tools=[{
"type": "file_search",
"file_search_store_names": [store.name]
}],
input="What documents are available?"
)
print(response.output_text)
# [cleanup]
client.file_search_stores.delete(name=store.name)
# [/cleanup]
import {GoogleGenAI} from '@google/genai';
const ai = new GoogleGenAI({});
// Create a file search store so we have a valid one to use.
const store = await ai.fileSearchStores.create({});
if (!store.name) {
throw new Error('Store creation failed: Name is undefined');
}
const interaction = await ai.interactions.create({
model: 'gemini-3.6-flash',
tools: [{
type: 'file_search',
file_search_store_names: [store.name]
}],
input: 'What documents are available?'
});
console.log(interaction.output_text);
// [cleanup]
await ai.fileSearchStores.delete({name: store.name});
// [/cleanup]
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.FileSearch;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
import com.google.genai.gaos.models.operations.CreateInteractionResponse;
import com.google.genai.types.CreateFileSearchStoreConfig;
import com.google.genai.types.FileSearchStore;
import java.util.List;
Client client = new Client();
// Create a file search store so we have a valid one to use.
FileSearchStore store = client.fileSearchStores.create(CreateFileSearchStoreConfig.builder().build());
String storeName = store.name().orElseThrow();
FileSearch tool = FileSearch.builder()
.fileSearchStoreNames(List.of(storeName))
.build();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model("gemini-3.6-flash")
.tools(List.of(tool))
.input(InteractionsInput.of("What documents are available?"))
.build();
CreateInteractionResponse response =
client.interactions.create(CreateInteractionRequestBody.of(params));
Interaction interaction =
response.interaction().orElseThrow(() -> new RuntimeException("No interaction returned"));
System.out.println(interaction.outputText().orElse(""));
// [cleanup]
client.fileSearchStores.delete(storeName, null);
// [/cleanup]