EmbeddingsIntegrationTests#
- class langchain_tests.integration_tests.embeddings.EmbeddingsIntegrationTests[source]#
Base class for embeddings integration tests.
Test subclasses must implement the
embeddings_class
property to specify the embeddings model to be tested. You can also override theembedding_model_params
property to specify initialization parameters.Example:
from typing import Type from langchain_tests.integration_tests import EmbeddingsIntegrationTests from my_package.embeddings import MyEmbeddingsModel class TestMyEmbeddingsModelIntegration(EmbeddingsIntegrationTests): @property def embeddings_class(self) -> Type[MyEmbeddingsModel]: # Return the embeddings model class to test here return MyEmbeddingsModel @property def embedding_model_params(self) -> dict: # Return initialization parameters for the model. return {"model": "model-001"}
Note
API references for individual test methods include troubleshooting tips.
Attributes
embedding_model_params
embeddings_class
Methods
model
()test_aembed_documents
(model)Test embedding a list of strings async.
test_aembed_query
(model)Test embedding a string query async.
test_embed_documents
(model)Test embedding a list of strings.
test_embed_query
(model)Test embedding a string query.
- model() Embeddings #
- Return type:
- async test_aembed_documents(model: Embeddings) None [source]#
Test embedding a list of strings async.
Troubleshooting
If this test fails, check that:
The model will generate a list of lists of floats when calling
.aembed_documents
on a list of strings.The length of each list is the same.
- Parameters:
model (Embeddings)
- Return type:
None
- async test_aembed_query(model: Embeddings) None [source]#
Test embedding a string query async.
Troubleshooting
If this test fails, check that:
The model will generate a list of floats when calling
.aembed_query
on a string.The length of the list is consistent across different inputs.
- Parameters:
model (Embeddings)
- Return type:
None
- test_embed_documents(model: Embeddings) None [source]#
Test embedding a list of strings.
Troubleshooting
If this test fails, check that:
The model will generate a list of lists of floats when calling
.embed_documents
on a list of strings.The length of each list is the same.
- Parameters:
model (Embeddings)
- Return type:
None
- test_embed_query(model: Embeddings) None [source]#
Test embedding a string query.
Troubleshooting
If this test fails, check that:
The model will generate a list of floats when calling
.embed_query
on a string.The length of the list is consistent across different inputs.
- Parameters:
model (Embeddings)
- Return type:
None