A Python adapter for using Google Gemini with OpenAI Agents SDK
Project description
AgentSDK Gemini Adapter
A Python adapter for using Google Gemini with OpenAI Agents SDK. This package provides a seamless integration between Google's Gemini models and the OpenAI Agents SDK.
Installation
pip install agentsdk-gemini-adapter
Quick Start
- Set up your Gemini API key in a
.envfile:
GEMINI_API_KEY=your_gemini_api_key_here
- Import and use the config:
from agentsdk_gemini_adapter import config
# Now you can use the config with OpenAI Agents SDK
# The config includes a pre-configured Gemini model
Features
- Pre-configured Gemini 2.0 Flash model
- Seamless integration with OpenAI Agents SDK
Requirements
- Python 3.7+
- Gemini API Key
- OpenAI Agents SDK
Dependencies
This package requires openai-agents to be installed separately:
pip install openai-agents
Note: python-dotenv will be installed automatically as a dependency of openai-agents.
Usage Example
from agents import Agent, Runner
from agentsdk_gemini_adapter import config
# Create an agent using OpenAI Agents SDK
agent = Agent(
name="Assistant",
instructions="You are a helpful assistant.",
)
# Pass the Gemini configuration in run_config to any Runner method
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.", run_config=config)
print(result.final_output)
Configuration
The package automatically:
- Loads your
GEMINI_API_KEYfrom environment variables - Configures the Gemini client with the correct base URL
- Sets up the Gemini 2.0 Flash model
- Creates a ready-to-use
RunConfigobject
License
MIT License - see LICENSE file for details.
Contribution
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentsdk_gemini_adapter-0.1.0.tar.gz.
File metadata
- Download URL: agentsdk_gemini_adapter-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7269dcef449f87b035c971ba61c3effaff29ca2ddc6a610e75ef56713794bf3e
|
|
| MD5 |
cdcea24a4aafc5e13635ba3e979223f6
|
|
| BLAKE2b-256 |
647bf9b7e9c9079fb64f4dc1ea56717b1baeefbedffc334c57aca1c1980d0692
|
File details
Details for the file agentsdk_gemini_adapter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agentsdk_gemini_adapter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e6ff55c0e779570e0e62ff303d311e78180d4825f216464bbf724f0688302ab
|
|
| MD5 |
71a57cfb21b439c8a3e78216002cf64c
|
|
| BLAKE2b-256 |
4f0f16bc6c92785234ea848792aa1668f46e3380382036419891dc91ef8eac77
|