Name | metorial-mistral JSON |
Version |
1.0.0rc2
JSON |
| download |
home_page | None |
Summary | Mistral AI provider for Metorial |
upload_time | 2025-07-26 12:17:51 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT |
keywords |
ai
llm
metorial
mistral
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# metorial-mistral
Mistral AI provider integration for Metorial - enables using Metorial tools with Mistral's language models through function calling.
## Installation
```bash
pip install metorial-mistral
# or
uv add metorial-mistral
# or
poetry add metorial-mistral
```
## Features
- 🤖 **Mistral Integration**: Full support for Mistral Large, Codestral, and other Mistral models
- 🛠️ **Function Calling**: Native Mistral function calling support
- 📡 **Session Management**: Automatic tool lifecycle handling
- 🔄 **Format Conversion**: Converts Metorial tools to Mistral function format
- ✅ **Strict Mode**: Built-in strict parameter validation
- ⚡ **Async Support**: Full async/await support
## Usage
### Basic Usage
```python
import asyncio
from mistralai.client import MistralClient
from mistralai.models.chat_completion import ChatMessage
from metorial import Metorial
from metorial_mistral import MetorialMistralSession
async def main():
# Initialize clients
metorial = Metorial(api_key="your-metorial-api-key")
mistral = MistralClient(api_key="your-mistral-api-key")
# Create session with your server deployments
async with metorial.session(["your-server-deployment-id"]) as session:
# Create Mistral-specific wrapper
mistral_session = MetorialMistralSession(session.tool_manager)
messages = [
ChatMessage(role="user", content="What are the latest commits?")
]
response = mistral.chat(
model="mistral-large-latest",
messages=messages,
tools=mistral_session.tools
)
# Handle tool calls
if response.choices[0].message.tool_calls:
tool_responses = await mistral_session.call_tools(response.choices[0].message.tool_calls)
# Add assistant message and tool responses
messages.append(response.choices[0].message)
messages.extend(tool_responses)
# Continue conversation...
asyncio.run(main())
```
### Using Convenience Functions
```python
from metorial_mistral import build_mistral_tools, call_mistral_tools
async def example_with_functions():
# Get tools in Mistral format
tools = build_mistral_tools(tool_manager)
# Call tools from Mistral response
tool_messages = await call_mistral_tools(tool_manager, tool_calls)
```
## API Reference
### `MetorialMistralSession`
Main session class for Mistral integration.
```python
session = MetorialMistralSession(tool_manager)
```
**Properties:**
- `tools`: List of tools in Mistral format
**Methods:**
- `async call_tools(tool_calls)`: Execute tool calls and return tool messages
### `build_mistral_tools(tool_mgr)`
Build Mistral-compatible tool definitions.
**Returns:** List of tool definitions in Mistral format
### `call_mistral_tools(tool_mgr, tool_calls)`
Execute tool calls from Mistral response.
**Returns:** List of tool messages
## Tool Format
Tools are converted to Mistral's function calling format:
```python
{
"type": "function",
"function": {
"name": "tool_name",
"description": "Tool description",
"parameters": {
"type": "object",
"properties": {...},
"required": [...]
},
"strict": True
}
}
```
## Error Handling
```python
try:
tool_messages = await mistral_session.call_tools(tool_calls)
except Exception as e:
print(f"Tool execution failed: {e}")
```
Tool errors are returned as tool messages with error content.
## Dependencies
- `mistralai>=1.0.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-mistral",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "ai, llm, metorial, mistral",
"author": null,
"author_email": "Metorial Team <support@metorial.com>",
"download_url": "https://files.pythonhosted.org/packages/51/f8/453f060bd1c3168037ea980ca057e8db20fa9cc4845c7bd955695ecdf717/metorial_mistral-1.0.0rc2.tar.gz",
"platform": null,
"description": "# metorial-mistral\n\nMistral AI provider integration for Metorial - enables using Metorial tools with Mistral's language models through function calling.\n\n## Installation\n\n```bash\npip install metorial-mistral\n# or\nuv add metorial-mistral\n# or\npoetry add metorial-mistral\n```\n\n## Features\n\n- \ud83e\udd16 **Mistral Integration**: Full support for Mistral Large, Codestral, and other Mistral models\n- \ud83d\udee0\ufe0f **Function Calling**: Native Mistral function calling support\n- \ud83d\udce1 **Session Management**: Automatic tool lifecycle handling\n- \ud83d\udd04 **Format Conversion**: Converts Metorial tools to Mistral function format\n- \u2705 **Strict Mode**: Built-in strict parameter validation\n- \u26a1 **Async Support**: Full async/await support\n\n## Usage\n\n### Basic Usage\n\n```python\nimport asyncio\nfrom mistralai.client import MistralClient\nfrom mistralai.models.chat_completion import ChatMessage\nfrom metorial import Metorial\nfrom metorial_mistral import MetorialMistralSession\n\nasync def main():\n # Initialize clients\n metorial = Metorial(api_key=\"your-metorial-api-key\")\n mistral = MistralClient(api_key=\"your-mistral-api-key\")\n \n # Create session with your server deployments\n async with metorial.session([\"your-server-deployment-id\"]) as session:\n # Create Mistral-specific wrapper\n mistral_session = MetorialMistralSession(session.tool_manager)\n \n messages = [\n ChatMessage(role=\"user\", content=\"What are the latest commits?\")\n ]\n \n response = mistral.chat(\n model=\"mistral-large-latest\",\n messages=messages,\n tools=mistral_session.tools\n )\n \n # Handle tool calls\n if response.choices[0].message.tool_calls:\n tool_responses = await mistral_session.call_tools(response.choices[0].message.tool_calls)\n \n # Add assistant message and tool responses\n messages.append(response.choices[0].message)\n messages.extend(tool_responses)\n \n # Continue conversation...\n\nasyncio.run(main())\n```\n\n### Using Convenience Functions\n\n```python\nfrom metorial_mistral import build_mistral_tools, call_mistral_tools\n\nasync def example_with_functions():\n # Get tools in Mistral format\n tools = build_mistral_tools(tool_manager)\n \n # Call tools from Mistral response\n tool_messages = await call_mistral_tools(tool_manager, tool_calls)\n```\n\n## API Reference\n\n### `MetorialMistralSession`\n\nMain session class for Mistral integration.\n\n```python\nsession = MetorialMistralSession(tool_manager)\n```\n\n**Properties:**\n- `tools`: List of tools in Mistral format\n\n**Methods:**\n- `async call_tools(tool_calls)`: Execute tool calls and return tool messages\n\n### `build_mistral_tools(tool_mgr)`\n\nBuild Mistral-compatible tool definitions.\n\n**Returns:** List of tool definitions in Mistral format\n\n### `call_mistral_tools(tool_mgr, tool_calls)`\n\nExecute tool calls from Mistral response.\n\n**Returns:** List of tool messages\n\n## Tool Format\n\nTools are converted to Mistral's function calling format:\n\n```python\n{\n \"type\": \"function\",\n \"function\": {\n \"name\": \"tool_name\",\n \"description\": \"Tool description\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {...},\n \"required\": [...]\n },\n \"strict\": True\n }\n}\n```\n\n## Error Handling\n\n```python\ntry:\n tool_messages = await mistral_session.call_tools(tool_calls)\nexcept Exception as e:\n print(f\"Tool execution failed: {e}\")\n```\n\nTool errors are returned as tool messages with error content.\n\n## Dependencies\n\n- `mistralai>=1.0.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": "Mistral AI 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",
" llm",
" metorial",
" mistral"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "db1253ddd27b91754fa81d8b5cb660cf0d6861d93c02d519c7f054849d48962f",
"md5": "997935b6f8eeac7042005cdecbaaa165",
"sha256": "67fa074153a9eddfa791c0a5888f9b303bebe078d7c21af7dcec27b5e8443a87"
},
"downloads": -1,
"filename": "metorial_mistral-1.0.0rc2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "997935b6f8eeac7042005cdecbaaa165",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 4821,
"upload_time": "2025-07-26T12:17:46",
"upload_time_iso_8601": "2025-07-26T12:17:46.017365Z",
"url": "https://files.pythonhosted.org/packages/db/12/53ddd27b91754fa81d8b5cb660cf0d6861d93c02d519c7f054849d48962f/metorial_mistral-1.0.0rc2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "51f8453f060bd1c3168037ea980ca057e8db20fa9cc4845c7bd955695ecdf717",
"md5": "56c8117ae73cba0fdb623957b24d7900",
"sha256": "358e206f169f403fac30c2a9ffed707f0a989450eddd9e10272c3ebefc45b1a1"
},
"downloads": -1,
"filename": "metorial_mistral-1.0.0rc2.tar.gz",
"has_sig": false,
"md5_digest": "56c8117ae73cba0fdb623957b24d7900",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5811,
"upload_time": "2025-07-26T12:17:51",
"upload_time_iso_8601": "2025-07-26T12:17:51.650142Z",
"url": "https://files.pythonhosted.org/packages/51/f8/453f060bd1c3168037ea980ca057e8db20fa9cc4845c7bd955695ecdf717/metorial_mistral-1.0.0rc2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-26 12:17:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "metorial",
"github_project": "metorial-enterprise",
"github_not_found": true,
"lcname": "metorial-mistral"
}