Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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)

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"])

Metadata

Release files for langchain-mistralai 0.1.0rc0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-mistralai 0.1.0rc0
File Size Uploaded Provenance Actions
langchain_mistralai-0.1.0rc0.tar.gz 9.8 kB Without provenance Details for langchain_mistralai-0.1.0rc0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-mistralai 0.1.0rc0
File Interpreter ABI Platform Actions
langchain_mistralai-0.1.0rc0-py3-none-any.whl Python 3 none any Details for langchain_mistralai-0.1.0rc0-py3-none-any.whl

Total release size: 20.5 kB

Release files / langchain_mistralai-0.1.0rc0.tar.gz

Download URL langchain_mistralai-0.1.0rc0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bcf937b78c02541a098c14d0d97726ccd614183f93042ada7b778a720f2dd561
BLAKE2b-256 checksum
How to use checksums
cb95f854b06f23398b2d5bf934e77419516a5bed6b61c0072584dd4c3194d593
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / langchain_mistralai-0.1.0rc0-py3-none-any.whl

Download URL langchain_mistralai-0.1.0rc0-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c64b1a9e5c6a23090cbfc0bc74d7501558363a8bdbd02f2eadcdd51cf39d61a
BLAKE2b-256 checksum
How to use checksums
fe0986d7f67c93a4ff2a943195cf65280b27ded4908374f886ed02ec1492546e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Security for langchain-mistralai 0.1.0rc0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page