mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-01 05:15:17 +00:00
Reopened as a personal repo outside the organization. ## Description - Naver HyperCLOVA X community package - Add chat model & embeddings - Add unit test & integration test - Add chat model & embeddings docs - I changed partner package(https://github.com/langchain-ai/langchain/pull/24252) to community package on this PR - Could this embeddings(https://github.com/langchain-ai/langchain/pull/21890) be deprecated? We are trying to replace it with embedding model(**ClovaXEmbeddings**) in this PR. Twitter handle: None. (if needed, contact with joonha.jeon@navercorp.com) --- you can check our previous discussion below: > one question on namespaces - would it make sense to have these in .clova namespaces instead of .naver? I would like to keep it as is, unless it is essential to unify the package name. (ClovaX is a branding for the model, and I plan to add other models and components. They need to be managed as separate classes.) > also, could you clarify the difference between ClovaEmbeddings and ClovaXEmbeddings? There are 3 models that are being serviced by embedding, and all are supported in the current PR. In addition, all the functionality of CLOVA Studio that serves actual models, such as distinguishing between test apps and service apps, is supported. The existing PR does not support this content because it is hard-coded. --------- Co-authored-by: Erick Friis <erick@langchain.dev> Co-authored-by: Vadym Barda <vadym@langchain.dev>
38 lines
1020 B
Python
38 lines
1020 B
Python
"""Test Naver embeddings."""
|
|
|
|
from langchain_community.embeddings import ClovaXEmbeddings
|
|
|
|
|
|
def test_embedding_documents() -> None:
|
|
"""Test cohere embeddings."""
|
|
documents = ["foo bar"]
|
|
embedding = ClovaXEmbeddings()
|
|
output = embedding.embed_documents(documents)
|
|
assert len(output) == 1
|
|
assert len(output[0]) > 0
|
|
|
|
|
|
async def test_aembedding_documents() -> None:
|
|
"""Test cohere embeddings."""
|
|
documents = ["foo bar"]
|
|
embedding = ClovaXEmbeddings()
|
|
output = await embedding.aembed_documents(documents)
|
|
assert len(output) == 1
|
|
assert len(output[0]) > 0
|
|
|
|
|
|
def test_embedding_query() -> None:
|
|
"""Test cohere embeddings."""
|
|
document = "foo bar"
|
|
embedding = ClovaXEmbeddings()
|
|
output = embedding.embed_query(document)
|
|
assert len(output) > 0
|
|
|
|
|
|
async def test_aembedding_query() -> None:
|
|
"""Test cohere embeddings."""
|
|
document = "foo bar"
|
|
embedding = ClovaXEmbeddings()
|
|
output = await embedding.aembed_query(document)
|
|
assert len(output) > 0
|