cli[patch]: add embedding to integration template (#14881)

This commit is contained in:
Erick Friis
2023-12-19 09:58:21 -08:00
committed by GitHub
parent 7b96de3d5d
commit 9ef2feb674
6 changed files with 207 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
"""Test __ModuleName__ embeddings."""
from __module_name__.embeddings import __ModuleName__Embeddings
def test___module_name___embedding_documents() -> None:
"""Test cohere embeddings."""
documents = ["foo bar"]
embedding = __ModuleName__Embeddings()
output = embedding.embed_documents(documents)
assert len(output) == 1
assert len(output[0]) > 0
def test___module_name___embedding_query() -> None:
"""Test cohere embeddings."""
document = "foo bar"
embedding = __ModuleName__Embeddings()
output = embedding.embed_query(document)
assert len(output) > 0

View File

@@ -0,0 +1,9 @@
"""Test embedding model integration."""
from __module_name__.embeddings import __ModuleName__Embeddings
def test_initialization() -> None:
"""Test embedding model initialization."""
__ModuleName__Embeddings()

View File

@@ -1,6 +1,11 @@
from __module_name__ import __all__
EXPECTED_ALL = ["__ModuleName__LLM", "Chat__ModuleName__", "__ModuleName__VectorStore"]
EXPECTED_ALL = [
"__ModuleName__LLM",
"Chat__ModuleName__",
"__ModuleName__VectorStore",
"__ModuleName__Embeddings",
]
def test_all_imports() -> None: