Name | langchain-mistralai JSON |
Version |
0.2.7
JSON |
| download |
home_page | None |
Summary | An integration package connecting Mistral and LangChain |
upload_time | 2025-02-20 17:43:38 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <4.0,>=3.9 |
license | MIT |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# langchain-mistralai
This package contains the LangChain integrations for [MistralAI](https://docs.mistral.ai) through their [mistralai](https://pypi.org/project/mistralai/) SDK.
## Installation
```bash
pip install -U langchain-mistralai
```
## Chat Models
This package contains the `ChatMistralAI` class, which is the recommended way to interface with MistralAI models.
To use, install the requirements, and configure your environment.
```bash
export MISTRAL_API_KEY=your-api-key
```
Then initialize
```python
from langchain_core.messages import HumanMessage
from langchain_mistralai.chat_models import ChatMistralAI
chat = ChatMistralAI(model="mistral-small")
messages = [HumanMessage(content="say a brief hello")]
chat.invoke(messages)
```
`ChatMistralAI` also supports async and streaming functionality:
```python
# For async...
await chat.ainvoke(messages)
# For streaming...
for chunk in chat.stream(messages):
print(chunk.content, end="", flush=True)
```
## Embeddings
With `MistralAIEmbeddings`, you can directly use the default model 'mistral-embed', or set a different one if available.
### Choose model
`embedding.model = 'mistral-embed'`
### Simple query
`res_query = embedding.embed_query("The test information")`
### Documents
`res_document = embedding.embed_documents(["test1", "another test"])`
Raw data
{
"_id": null,
"home_page": null,
"name": "langchain-mistralai",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/46/70/938414c1b3a085b6c7c04a722a66f000e01703459a79d0107a6286a3d2ff/langchain_mistralai-0.2.7.tar.gz",
"platform": null,
"description": "# langchain-mistralai\n\nThis package contains the LangChain integrations for [MistralAI](https://docs.mistral.ai) through their [mistralai](https://pypi.org/project/mistralai/) SDK.\n\n## Installation\n\n```bash\npip install -U langchain-mistralai\n```\n\n## Chat Models\n\nThis package contains the `ChatMistralAI` class, which is the recommended way to interface with MistralAI models.\n\nTo use, install the requirements, and configure your environment.\n\n```bash\nexport MISTRAL_API_KEY=your-api-key\n```\n\nThen initialize\n\n```python\nfrom langchain_core.messages import HumanMessage\nfrom langchain_mistralai.chat_models import ChatMistralAI\n\nchat = ChatMistralAI(model=\"mistral-small\")\nmessages = [HumanMessage(content=\"say a brief hello\")]\nchat.invoke(messages)\n```\n\n`ChatMistralAI` also supports async and streaming functionality:\n\n```python\n# For async...\nawait chat.ainvoke(messages)\n\n# For streaming...\nfor chunk in chat.stream(messages):\n print(chunk.content, end=\"\", flush=True)\n```\n\n## Embeddings\n\nWith `MistralAIEmbeddings`, you can directly use the default model 'mistral-embed', or set a different one if available.\n\n### Choose model\n\n`embedding.model = 'mistral-embed'`\n\n### Simple query\n\n`res_query = embedding.embed_query(\"The test information\")`\n\n### Documents\n\n`res_document = embedding.embed_documents([\"test1\", \"another test\"])`",
"bugtrack_url": null,
"license": "MIT",
"summary": "An integration package connecting Mistral and LangChain",
"version": "0.2.7",
"project_urls": {
"Release Notes": "https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain-mistralai%3D%3D0%22&expanded=true",
"Source Code": "https://github.com/langchain-ai/langchain/tree/master/libs/partners/mistralai",
"repository": "https://github.com/langchain-ai/langchain"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4dbbaeb45f005995672b9a5438e7ce521890df70247ee43ec9b17c2c717f8516",
"md5": "fb50de50bb43d83d6b6758546021a5e3",
"sha256": "2e8fc581f6c798b63a53fb8ec389f6e559027af1f3c01dfa3e228bdc58bafa9c"
},
"downloads": -1,
"filename": "langchain_mistralai-0.2.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb50de50bb43d83d6b6758546021a5e3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 15997,
"upload_time": "2025-02-20T17:43:37",
"upload_time_iso_8601": "2025-02-20T17:43:37.116437Z",
"url": "https://files.pythonhosted.org/packages/4d/bb/aeb45f005995672b9a5438e7ce521890df70247ee43ec9b17c2c717f8516/langchain_mistralai-0.2.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4670938414c1b3a085b6c7c04a722a66f000e01703459a79d0107a6286a3d2ff",
"md5": "848fa1f6e30ed0e5debccc9b3dc00a7f",
"sha256": "957c99104679a4fa74df28f92de50367bd9d2001572a58c522d6761aa439f04b"
},
"downloads": -1,
"filename": "langchain_mistralai-0.2.7.tar.gz",
"has_sig": false,
"md5_digest": "848fa1f6e30ed0e5debccc9b3dc00a7f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 19991,
"upload_time": "2025-02-20T17:43:38",
"upload_time_iso_8601": "2025-02-20T17:43:38.863821Z",
"url": "https://files.pythonhosted.org/packages/46/70/938414c1b3a085b6c7c04a722a66f000e01703459a79d0107a6286a3d2ff/langchain_mistralai-0.2.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-20 17:43:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "langchain-ai",
"github_project": "langchain",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "langchain-mistralai"
}