Are you sure you want to delete this access key?
This example demonstrates how to use Google AI Studio's function calling, search capabilities, code execution, and URL context features with promptfoo.
You can run this example with:
npx promptfoo@latest init --example google-aistudio-tools
GOOGLE_API_KEY
in your environmentThis example shows how to:
The function calling configuration (promptfooconfig.yaml
) demonstrates:
tools.json
Run with:
promptfoo eval -c promptfooconfig.yaml
The search grounding configuration (promptfooconfig.search.yaml
) demonstrates:
Run with:
promptfoo eval -c promptfooconfig.search.yaml
The code execution configuration (promptfooconfig.codeexecution.yaml
) demonstrates:
Run with:
promptfoo eval -c promptfooconfig.codeexecution.yaml
The URL context configuration (promptfooconfig.urlcontext.yaml
) demonstrates:
Run with:
promptfoo eval -c promptfooconfig.urlcontext.yaml
promptfooconfig.yaml
: Function calling configurationpromptfooconfig.search.yaml
: Search grounding configurationpromptfooconfig.codeexecution.yaml
: Code execution configurationpromptfooconfig.urlcontext.yaml
: URL context configurationtools.json
: Function definition for the weather exampleWhen using Search grounding in your own applications:
This example demonstrates three approaches to search:
Search as a tool (Gemini 2.5): Allows the model to decide when to use search
tools:
- googleSearch: {}
Search with thinking (Gemini 2.5): Adds thinking capabilities for better reasoning
generationConfig:
thinkingConfig:
thinkingBudget: 1024
tools:
- googleSearch: {}
Dynamic retrieval (Gemini 1.5): Controls when to use search with threshold settings
tools:
- googleSearchRetrieval:
dynamicRetrievalConfig:
mode: 'MODE_DYNAMIC'
dynamicThreshold: 0 # 0 = always use search, 1 = never use search
Press p or to see the previous file or, n or to see the next file
Browsing data directories saved to S3 is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with AWS S3!
Are you sure you want to delete this access key?
Browsing data directories saved to Google Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with Google Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to Azure Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with Azure Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to S3 compatible storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with your S3 compatible storage!
Are you sure you want to delete this access key?