Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0e35f04
Add agent-framework-gemini package
holtvogt Mar 23, 2026
33f437f
Add AGENTS.md documentation
holtvogt Mar 23, 2026
38d3d28
Add LICENSE file
holtvogt Mar 23, 2026
29ed60c
Add README.md for agent-framework-gemini package
holtvogt Mar 23, 2026
0dace12
Add Google Gemini API keys to .env.example
holtvogt Mar 23, 2026
06de5cf
Add Google Gemini chat client implementation
holtvogt Mar 23, 2026
24fdbeb
Add tests for GeminiChatClient
holtvogt Mar 23, 2026
dbc1709
Add Google Gemini agent examples
holtvogt Mar 23, 2026
41e7f6e
Merge branch 'main' into feat/add-gemini-client
holtvogt Mar 23, 2026
85a86a1
Fix client inheritence order
holtvogt Mar 23, 2026
db6521b
Update Gemini agent examples
holtvogt Mar 23, 2026
54af10b
Update documentation
holtvogt Mar 23, 2026
cf4a6fb
Update AGENTS.md
holtvogt Mar 23, 2026
0b0afd1
Add tests for JSON string handling in GeminiChatClient
holtvogt Mar 23, 2026
8964929
Add final response assembly test in GeminiChatClient
holtvogt Mar 23, 2026
533aa7c
Add tests for handling empty candidates in GeminiChatClient
holtvogt Mar 23, 2026
308c474
Improve Pydantic response handling in GeminiChatClient
holtvogt Mar 23, 2026
80580fc
Add tests for function result resolution and callable tool normalization
holtvogt Mar 23, 2026
aeda903
Add test for function result resolution when call_id is generated
holtvogt Mar 23, 2026
ff52460
Refactor GeminiChatClient to correct inheritance order
holtvogt Mar 23, 2026
c7529f9
Enhance documentation and clarify Gemini-specific fields
holtvogt Mar 23, 2026
5a839e6
Update ThinkingConfig with new attributes and type
holtvogt Mar 23, 2026
6a86850
Add tests for GoogleSearch and GoogleMaps configs
holtvogt Mar 23, 2026
093e211
Suppress valid-type mypy error on GeminiChatOptionsT
holtvogt Mar 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions python/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ COPILOTSTUDIOAGENT__AGENTAPPID=""
# Anthropic
ANTHROPIC_API_KEY=""
ANTHROPIC_MODEL=""
# Google Gemini
GEMINI_API_KEY=""
GEMINI_CHAT_MODEL_ID=""
# Ollama
OLLAMA_ENDPOINT=""
OLLAMA_MODEL=""
Expand Down
27 changes: 27 additions & 0 deletions python/packages/gemini/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Gemini Package (agent-framework-gemini)

Integration with Google's Gemini API via the `google-genai` SDK.

## Core Classes

- **`GeminiChatClient`** - Chat client for Google Gemini models
- **`GeminiChatOptions`** - Options TypedDict for Gemini-specific parameters
- **`GeminiSettings`** - Settings loaded from environment variables
- **`ThinkingConfig`** - Configuration for extended thinking

## Gemini Options

- **`thinking_config`** - Enable extended thinking via `ThinkingConfig`
- **`google_search_grounding`** - Responses with live Google Search results
- **`google_maps_grounding`** - Responses with Google Maps data
- **`code_execution`** - Let the model write and run code in a sandboxed environment

## Usage

```python
from agent_framework import Content, Message
from agent_framework_gemini import GeminiChatClient

client = GeminiChatClient(model_id="gemini-2.5-flash")
response = await client.get_response([Message(role="user", contents=[Content.from_text("Hello")])])
```
21 changes: 21 additions & 0 deletions python/packages/gemini/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
29 changes: 29 additions & 0 deletions python/packages/gemini/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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.

## Authentication

Obtain an API key from [Google AI Studio](https://aistudio.google.com/apikey) and set it via environment variable:

```bash
export GEMINI_API_KEY="your-api-key"
export GEMINI_CHAT_MODEL_ID="gemini-2.5-flash"
```

## Examples

See the [Google Gemini samples](../../samples/02-agents/providers/google/) for runnable end-to-end scripts covering:

- Basic agent with tool calling and streaming
- Extended thinking with `ThinkingConfig`
- Google Search grounding
- Built-in code execution
18 changes: 18 additions & 0 deletions python/packages/gemini/agent_framework_gemini/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) Microsoft. All rights reserved.

import importlib.metadata

from ._chat_client import GeminiChatClient, GeminiChatOptions, GeminiSettings, ThinkingConfig

try:
__version__ = importlib.metadata.version(__name__)
except importlib.metadata.PackageNotFoundError:
__version__ = "0.0.0"

__all__ = [
"GeminiChatClient",
"GeminiChatOptions",
"GeminiSettings",
"ThinkingConfig",
"__version__",
]
Loading