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
File details
Details for the file langchain_mistralai-0.0.2.post1.tar.gz
.
File metadata
- Download URL: langchain_mistralai-0.0.2.post1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 485c9d2483536b9d48edcea54c74b6bd3227f5c3b9422ab7fa61fcfc935d1589 |
|
MD5 | e64eccb1a91a23d0a9366d45de5c2d38 |
|
BLAKE2b-256 | 26d4d7b907df10b72e5cbd3ed8c682fa1b399b43b65d5cdf0b3a0bb4baa83d90 |
File details
Details for the file langchain_mistralai-0.0.2.post1-py3-none-any.whl
.
File metadata
- Download URL: langchain_mistralai-0.0.2.post1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0005cc94e87f511d8631e67e310ff96091c3e0ee621949aa24cfeb02f02fce3 |
|
MD5 | b1c14431b3a6d4fa44b20a29770aa137 |
|
BLAKE2b-256 | 03be3c7ac306673f7b699199a53e99ad47dc7b8d9f504e0114a2ec124310091e |