db620d33df
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
52 lines
1.6 KiB
Markdown
52 lines
1.6 KiB
Markdown
# Get Started with Microsoft Agent Framework Gemini
|
|
|
|
Install the provider package:
|
|
|
|
```bash
|
|
pip install agent-framework-gemini --pre
|
|
```
|
|
|
|
## Gemini Integration
|
|
|
|
The Gemini integration enables Microsoft Agent Framework applications to call Google Gemini models with familiar chat abstractions, including streaming, tool/function calling, and structured output.
|
|
|
|
## Structured Output
|
|
|
|
Gemini structured output can be configured with either a Pydantic model in `response_format`, a JSON schema mapping in `response_format`, or a Gemini-specific `response_schema`. Declarative agents that define `outputSchema` pass that schema through `response_format`.
|
|
|
|
## Authentication
|
|
|
|
The connector supports both `google-genai` authentication modes.
|
|
|
|
### Gemini Developer API
|
|
|
|
Obtain an API key from [Google AI Studio](https://aistudio.google.com/apikey) and set either the package-prefixed or SDK-standard environment variable:
|
|
|
|
```bash
|
|
export GEMINI_API_KEY="your-api-key"
|
|
# or: export GOOGLE_API_KEY="your-api-key"
|
|
export GEMINI_MODEL="gemini-2.5-flash-lite"
|
|
# or: export GOOGLE_MODEL="gemini-2.5-flash-lite"
|
|
```
|
|
|
|
### Vertex AI
|
|
|
|
Set the standard Vertex AI environment variables used by `google-genai`:
|
|
|
|
```bash
|
|
export GOOGLE_GENAI_USE_VERTEXAI=true
|
|
export GOOGLE_CLOUD_PROJECT="your-project-id"
|
|
export GOOGLE_CLOUD_LOCATION="global"
|
|
export GOOGLE_MODEL="gemini-2.5-flash-lite"
|
|
```
|
|
|
|
## Examples
|
|
|
|
See the [Google Gemini samples](samples/) for runnable end-to-end scripts covering:
|
|
|
|
- Basic agent with tool calling and streaming
|
|
- Extended thinking with `ThinkingConfig`
|
|
- Google Search grounding
|
|
- Google Maps grounding
|
|
- Built-in code execution
|