Name | metorial-google JSON |
Version |
1.0.0rc2
JSON |
| download |
home_page | None |
Summary | Google (Gemini) provider for Metorial |
upload_time | 2025-07-26 12:17:43 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT |
keywords |
ai
gemini
google
llm
metorial
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# metorial-google
Google (Gemini) provider integration for Metorial - enables using Metorial tools with Google's Gemini models through function calling.
## Installation
```bash
pip install metorial-google
# or
uv add metorial-google
# or
poetry add metorial-google
```
## Features
- 🤖 **Gemini Integration**: Full support for Gemini Pro, Gemini Flash, and other Google AI models
- 🛠️ **Function Calling**: Native Google function calling support
- 📡 **Session Management**: Automatic tool lifecycle handling
- 🔄 **Format Conversion**: Converts Metorial tools to Google function declaration format
- ⚡ **Async Support**: Full async/await support
## Usage
### Basic Usage
```python
import asyncio
import google.generativeai as genai
from metorial import Metorial
from metorial_google import MetorialGoogleSession
async def main():
# Initialize clients
metorial = Metorial(api_key="your-metorial-api-key")
genai.configure(api_key="your-google-api-key")
# Create session with your server deployments
async with metorial.session(["your-server-deployment-id"]) as session:
# Create Google-specific wrapper
google_session = MetorialGoogleSession(session.tool_manager)
model = genai.GenerativeModel(
model_name="gemini-pro",
tools=google_session.tools
)
response = model.generate_content("What can you help me with?")
# Handle function calls if present
if response.candidates[0].content.parts:
function_calls = [
part.function_call for part in response.candidates[0].content.parts
if hasattr(part, 'function_call') and part.function_call
]
if function_calls:
tool_response = await google_session.call_tools(function_calls)
# Continue conversation with tool_response
asyncio.run(main())
```
### Using Convenience Functions
```python
from metorial_google import build_google_tools, call_google_tools
async def example_with_functions():
# Get tools in Google format
tools = build_google_tools(tool_manager)
# Call tools from Google response
response = await call_google_tools(tool_manager, function_calls)
```
## API Reference
### `MetorialGoogleSession`
Main session class for Google integration.
```python
session = MetorialGoogleSession(tool_manager)
```
**Properties:**
- `tools`: List of tools in Google function declaration format
**Methods:**
- `async call_tools(function_calls)`: Execute function calls and return user content
### `build_google_tools(tool_mgr)`
Build Google-compatible tool definitions.
**Returns:** List of tool definitions in Google format
### `call_google_tools(tool_mgr, function_calls)`
Execute function calls from Google response.
**Returns:** User content with function responses
## Tool Format
Tools are converted to Google's function declaration format:
```python
[{
"function_declarations": [
{
"name": "tool_name",
"description": "Tool description",
"parameters": {
"type": "object",
"properties": {...},
"required": [...]
}
}
]
}]
```
## Error Handling
```python
try:
response = await google_session.call_tools(function_calls)
except Exception as e:
print(f"Tool execution failed: {e}")
```
Tool errors are returned as error objects in the response format.
## Dependencies
- `google-generativeai>=0.3.0`
- `metorial-mcp-session>=1.0.0`
- `typing-extensions>=4.0.0`
## License
MIT License - see [LICENSE](../../LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "metorial-google",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "ai, gemini, google, llm, metorial",
"author": null,
"author_email": "Metorial Team <support@metorial.com>",
"download_url": "https://files.pythonhosted.org/packages/eb/48/c5d9f71e7fad89c6d330bfba1a266e517096bf135a0ae552424170226b55/metorial_google-1.0.0rc2.tar.gz",
"platform": null,
"description": "# metorial-google\n\nGoogle (Gemini) provider integration for Metorial - enables using Metorial tools with Google's Gemini models through function calling.\n\n## Installation\n\n```bash\npip install metorial-google\n# or\nuv add metorial-google\n# or\npoetry add metorial-google\n```\n\n## Features\n\n- \ud83e\udd16 **Gemini Integration**: Full support for Gemini Pro, Gemini Flash, and other Google AI models\n- \ud83d\udee0\ufe0f **Function Calling**: Native Google function calling support\n- \ud83d\udce1 **Session Management**: Automatic tool lifecycle handling\n- \ud83d\udd04 **Format Conversion**: Converts Metorial tools to Google function declaration format\n- \u26a1 **Async Support**: Full async/await support\n\n## Usage\n\n### Basic Usage\n\n```python\nimport asyncio\nimport google.generativeai as genai\nfrom metorial import Metorial\nfrom metorial_google import MetorialGoogleSession\n\nasync def main():\n # Initialize clients\n metorial = Metorial(api_key=\"your-metorial-api-key\")\n genai.configure(api_key=\"your-google-api-key\")\n \n # Create session with your server deployments\n async with metorial.session([\"your-server-deployment-id\"]) as session:\n # Create Google-specific wrapper\n google_session = MetorialGoogleSession(session.tool_manager)\n \n model = genai.GenerativeModel(\n model_name=\"gemini-pro\",\n tools=google_session.tools\n )\n \n response = model.generate_content(\"What can you help me with?\")\n \n # Handle function calls if present\n if response.candidates[0].content.parts:\n function_calls = [\n part.function_call for part in response.candidates[0].content.parts\n if hasattr(part, 'function_call') and part.function_call\n ]\n \n if function_calls:\n tool_response = await google_session.call_tools(function_calls)\n # Continue conversation with tool_response\n\nasyncio.run(main())\n```\n\n### Using Convenience Functions\n\n```python\nfrom metorial_google import build_google_tools, call_google_tools\n\nasync def example_with_functions():\n # Get tools in Google format\n tools = build_google_tools(tool_manager)\n \n # Call tools from Google response\n response = await call_google_tools(tool_manager, function_calls)\n```\n\n## API Reference\n\n### `MetorialGoogleSession`\n\nMain session class for Google integration.\n\n```python\nsession = MetorialGoogleSession(tool_manager)\n```\n\n**Properties:**\n- `tools`: List of tools in Google function declaration format\n\n**Methods:**\n- `async call_tools(function_calls)`: Execute function calls and return user content\n\n### `build_google_tools(tool_mgr)`\n\nBuild Google-compatible tool definitions.\n\n**Returns:** List of tool definitions in Google format\n\n### `call_google_tools(tool_mgr, function_calls)`\n\nExecute function calls from Google response.\n\n**Returns:** User content with function responses\n\n## Tool Format\n\nTools are converted to Google's function declaration format:\n\n```python\n[{\n \"function_declarations\": [\n {\n \"name\": \"tool_name\",\n \"description\": \"Tool description\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {...},\n \"required\": [...]\n }\n }\n ]\n}]\n```\n\n## Error Handling\n\n```python\ntry:\n response = await google_session.call_tools(function_calls)\nexcept Exception as e:\n print(f\"Tool execution failed: {e}\")\n```\n\nTool errors are returned as error objects in the response format.\n\n## Dependencies\n\n- `google-generativeai>=0.3.0`\n- `metorial-mcp-session>=1.0.0`\n- `typing-extensions>=4.0.0`\n\n## License\n\nMIT License - see [LICENSE](../../LICENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Google (Gemini) provider for Metorial",
"version": "1.0.0rc2",
"project_urls": {
"Documentation": "https://metorial.com/docs",
"Homepage": "https://metorial.com",
"Repository": "https://github.com/metorial/metorial-enterprise"
},
"split_keywords": [
"ai",
" gemini",
" google",
" llm",
" metorial"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c3ea70ac93a19fda3830b477c278f6cb7b068fe946a81b90570f5a901b3f6d0d",
"md5": "08eba3b13508b0776b201705b9d9d76f",
"sha256": "dc48a389e37a25521617a9deb867f2a7498e841c513be918046e6dbaae7e5933"
},
"downloads": -1,
"filename": "metorial_google-1.0.0rc2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "08eba3b13508b0776b201705b9d9d76f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 4799,
"upload_time": "2025-07-26T12:17:40",
"upload_time_iso_8601": "2025-07-26T12:17:40.357792Z",
"url": "https://files.pythonhosted.org/packages/c3/ea/70ac93a19fda3830b477c278f6cb7b068fe946a81b90570f5a901b3f6d0d/metorial_google-1.0.0rc2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "eb48c5d9f71e7fad89c6d330bfba1a266e517096bf135a0ae552424170226b55",
"md5": "c0e7c7f87e192edb8f6939bb22e77c69",
"sha256": "a4023075060845c687ee5c35aaef81d6977ce969acadc020cfd661e9da296fa5"
},
"downloads": -1,
"filename": "metorial_google-1.0.0rc2.tar.gz",
"has_sig": false,
"md5_digest": "c0e7c7f87e192edb8f6939bb22e77c69",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5783,
"upload_time": "2025-07-26T12:17:43",
"upload_time_iso_8601": "2025-07-26T12:17:43.587024Z",
"url": "https://files.pythonhosted.org/packages/eb/48/c5d9f71e7fad89c6d330bfba1a266e517096bf135a0ae552424170226b55/metorial_google-1.0.0rc2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-26 12:17:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "metorial",
"github_project": "metorial-enterprise",
"github_not_found": true,
"lcname": "metorial-google"
}