mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-09 21:08:59 +00:00
## description - I refactor `Chathunyuan` using tencentcloud sdk because I found the original one can't work in my application - I add `HunyuanEmbeddings` using tencentcloud sdk - Both of them are extend the basic class of langchain. I have fully tested them in my application ## Dependencies - tencentcloud-sdk-python --------- Co-authored-by: centonhuang <centonhuang@tencent.com> Co-authored-by: Erick Friis <erick@langchain.dev>
26 lines
706 B
Python
26 lines
706 B
Python
from langchain_community.embeddings.hunyuan import HunyuanEmbeddings
|
|
|
|
|
|
def test_embedding_query() -> None:
|
|
query = "foo"
|
|
embedding = HunyuanEmbeddings()
|
|
output = embedding.embed_query(query)
|
|
assert len(output) == 1024
|
|
|
|
|
|
def test_embedding_document() -> None:
|
|
documents = ["foo bar"]
|
|
embedding = HunyuanEmbeddings()
|
|
output = embedding.embed_documents(documents)
|
|
assert len(output) == 1
|
|
assert len(output[0]) == 1024
|
|
|
|
|
|
def test_embedding_documents() -> None:
|
|
documents = ["foo", "bar"]
|
|
embedding = HunyuanEmbeddings()
|
|
output = embedding.embed_documents(documents)
|
|
assert len(output) == 2
|
|
assert len(output[0]) == 1024
|
|
assert len(output[1]) == 1024
|