Skip to content

feat: implement google genai provider #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c388c67
feat: implement google genai provider
monotykamary Apr 30, 2025
1155da9
feat: implement feature-complete Google LLM provider
monotykamary Apr 30, 2025
106754b
fix: revert default google model
monotykamary Apr 30, 2025
7920d76
feat: improve Google LLM tool and schema handling
monotykamary Apr 30, 2025
60256e1
fix(google-provider): Correctly handle history and tool call conversion
monotykamary Apr 30, 2025
029aa36
feat: use ImageContent mimeType in google converter
monotykamary Apr 30, 2025
a74bfef
fix: Exclude $schema from Google tool schema conversion
monotykamary May 1, 2025
5da2bc1
add opentelemetry for genai, add alias
evalstate May 4, 2025
fca0262
add gemini2 to more tests
evalstate May 4, 2025
7f8d897
feat: implement google genai provider
monotykamary Apr 30, 2025
5a4b188
feat: implement feature-complete Google LLM provider
monotykamary Apr 30, 2025
01d08d1
fix: revert default google model
monotykamary Apr 30, 2025
0088138
feat: improve Google LLM tool and schema handling
monotykamary Apr 30, 2025
3b08f57
fix(google-provider): Correctly handle history and tool call conversion
monotykamary Apr 30, 2025
34f972f
feat: use ImageContent mimeType in google converter
monotykamary Apr 30, 2025
2498a07
fix: Exclude $schema from Google tool schema conversion
monotykamary May 1, 2025
7fe39ef
add opentelemetry for genai, add alias
evalstate May 4, 2025
c8a1dc2
add gemini2 to more tests
evalstate May 4, 2025
39e6653
fix: Handle unsupported JSON schema formats in Google converter
monotykamary May 4, 2025
ebdf44a
fix(llm/google): enable native structured output and correct history …
monotykamary May 4, 2025
3310b1d
add 25 models, update multimodal test, increase default max_iterations
evalstate May 4, 2025
d630783
expand gemini2/2.5 coverate, tool conversion
evalstate May 4, 2025
6907b1c
fix: Correctly handle multimodal tool results for Google provider
monotykamary May 8, 2025
e997478
fix(test): align prompt and adjust text assertion
monotykamary May 9, 2025
7eb87c7
Merge remote-tracking branch 'upstream/main' into feat/implement-goog…
monotykamary May 10, 2025
2cf3ec8
Merge branch 'feat/implement-google-genai-provider' of https://github…
evalstate May 11, 2025
0d1b154
Merge remote-tracking branch 'origin/main' into pr/monotykamary/134
evalstate May 11, 2025
91fb25f
Merge branch 'feat/implement-google-genai-provider' of https://github…
evalstate May 11, 2025
1ccf0f2
basic PDF support, UDPATE -- make tool calling work same
evalstate May 11, 2025
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
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ dependencies = [
"a2a-types>=0.1.0",
"opentelemetry-instrumentation-openai>=0.39.3",
"opentelemetry-instrumentation-anthropic>=0.39.3",
"google-genai",
"opentelemetry-instrumentation-google-genai>=0.2b0",
"tensorzero>=2025.4.7",
"google-genai",
"opentelemetry-instrumentation-google-genai>=0.2b0",
]

[project.optional-dependencies]
Expand Down
2 changes: 2 additions & 0 deletions src/mcp_agent/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor
from opentelemetry.instrumentation.google_genai import GoogleGenAiSdkInstrumentor
from opentelemetry.instrumentation.openai import OpenAIInstrumentor
from opentelemetry.propagate import set_global_textmap
from opentelemetry.sdk.resources import Resource
Expand Down Expand Up @@ -111,6 +112,7 @@ async def configure_otel(config: "Settings") -> None:
trace.set_tracer_provider(tracer_provider)
AnthropicInstrumentor().instrument()
OpenAIInstrumentor().instrument()
GoogleGenAiSdkInstrumentor().instrument()


async def configure_logger(config: "Settings") -> None:
Expand Down
6 changes: 6 additions & 0 deletions src/mcp_agent/llm/model_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ class ModelFactory:
"claude-3-opus-20240229": Provider.ANTHROPIC,
"claude-3-opus-latest": Provider.ANTHROPIC,
"deepseek-chat": Provider.DEEPSEEK,
"gemini-2.0-flash": Provider.GOOGLE,
"gemini-2.5-flash-preview-04-17": Provider.GOOGLE,
"gemini-2.5-pro-preview-03-25": Provider.GOOGLE,
# "deepseek-reasoner": Provider.DEEPSEEK, reinstate on release
}

Expand All @@ -101,6 +104,9 @@ class ModelFactory:
"opus3": "claude-3-opus-latest",
"deepseekv3": "deepseek-chat",
"deepseek": "deepseek-chat",
"gemini2": "gemini-2.0-flash",
"gemini25": "gemini-2.5-flash-preview-04-17",
"gemini25pro": "gemini-2.5-pro-preview-03-25",
}

# Mapping of providers to their LLM classes
Expand Down
Loading
Loading