mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-08 22:42:05 +00:00
add embeddings integration tests (#25508)
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
"""Test Ollama embeddings."""
|
||||
|
||||
from typing import Type
|
||||
|
||||
from langchain_standard_tests.integration_tests import EmbeddingsIntegrationTests
|
||||
|
||||
from langchain_ollama.embeddings import OllamaEmbeddings
|
||||
|
||||
|
||||
def test_langchain_ollama_embedding_documents() -> None:
|
||||
"""Test cohere embeddings."""
|
||||
documents = ["foo bar"]
|
||||
embedding = OllamaEmbeddings(model="llama3")
|
||||
output = embedding.embed_documents(documents)
|
||||
assert len(output) == 1
|
||||
assert len(output[0]) > 0
|
||||
class TestOllamaEmbeddings(EmbeddingsIntegrationTests):
|
||||
@property
|
||||
def embeddings_class(self) -> Type[OllamaEmbeddings]:
|
||||
return OllamaEmbeddings
|
||||
|
||||
|
||||
def test_langchain_ollama_embedding_query() -> None:
|
||||
"""Test cohere embeddings."""
|
||||
document = "foo bar"
|
||||
embedding = OllamaEmbeddings(model="llama3")
|
||||
output = embedding.embed_query(document)
|
||||
assert len(output) > 0
|
||||
@property
|
||||
def embedding_model_params(self) -> dict:
|
||||
return {"model": "llama3:latest"}
|
||||
|
Reference in New Issue
Block a user