An integration package connecting Mistral and LangChain
Project description
langchain-mistralai
This package contains the LangChain integrations for MistralAI through their mistralai SDK.
Installation
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.
export MISTRAL_API_KEY=your-api-key
Then initialize
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:
# For async...
await chat.ainvoke(messages)
# For streaming...
for chunk in chat.stream(messages):
print(chunk.content, end="", flush=True)
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
Close
Hashes for langchain_mistralai-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e8396306b8f826d81b6e53e9f289770e440a80061aa3866d7039e26c450a2d1 |
|
MD5 | abf34d08339ba3d127bd8b51f82038f9 |
|
BLAKE2b-256 | bac26c65ede51d9c50355be212fa55e478702e18fefc387761657de8dff53689 |
Close
Hashes for langchain_mistralai-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 334ed39cf49642a0f6e93b8e8a3d178fff4ff325e6ffdeb44f38f3d065de0390 |
|
MD5 | dd4e0bea7fae704ea095c2c6ffe156f8 |
|
BLAKE2b-256 | ad91f12acd7e09fdfa31c238c9050f3da17e277984c4c4086f6d9e35d0b54f5d |