mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-15 22:44:36 +00:00
mistralai[minor]: Add embeddings (#15282)
- **Description:** Adds MistralAIEmbeddings class for embeddings, using the new official API. - **Dependencies:** mistralai - **Tag maintainer**: @efriis, @hwchase17 - **Twitter handle:** @LMS_David_RS Create `integrations/text_embedding/mistralai.ipynb`: an example notebook for MistralAIEmbeddings class Modify `embeddings/__init__.py`: Import the class Create `embeddings/mistralai.py`: The embedding class Create `integration_tests/embeddings/test_mistralai.py`: The test file. --------- Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
"""Test MistralAI Embedding"""
|
||||
from langchain_mistralai import MistralAIEmbeddings
|
||||
|
||||
|
||||
def test_mistralai_embedding_documents() -> None:
|
||||
"""Test MistralAI embeddings for documents."""
|
||||
documents = ["foo bar", "test document"]
|
||||
embedding = MistralAIEmbeddings()
|
||||
output = embedding.embed_documents(documents)
|
||||
assert len(output) == 2
|
||||
assert len(output[0]) == 1024
|
||||
|
||||
|
||||
def test_mistralai_embedding_query() -> None:
|
||||
"""Test MistralAI embeddings for query."""
|
||||
document = "foo bar"
|
||||
embedding = MistralAIEmbeddings()
|
||||
output = embedding.embed_query(document)
|
||||
assert len(output) == 1024
|
Reference in New Issue
Block a user