mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-15 20:12:30 +00:00
- Description: * Baidu AI Cloud's [Qianfan Platform](https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html) is an all-in-one platform for large model development and service deployment, catering to enterprise developers in China. Qianfan Platform offers a wide range of resources, including the Wenxin Yiyan model (ERNIE-Bot) and various third-party open-source models. - Issue: none - Dependencies: * qianfan - Tag maintainer: @baskaryan - Twitter handle: --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
26 lines
773 B
Python
26 lines
773 B
Python
"""Test Baidu Qianfan Embedding Endpoint."""
|
|
from langchain.embeddings.baidu_qianfan_endpoint import QianfanEmbeddingsEndpoint
|
|
|
|
|
|
def test_embedding_multiple_documents() -> None:
|
|
documents = ["foo", "bar"]
|
|
embedding = QianfanEmbeddingsEndpoint()
|
|
output = embedding.embed_documents(documents)
|
|
assert len(output) == 2
|
|
assert len(output[0]) == 384
|
|
assert len(output[1]) == 384
|
|
|
|
|
|
def test_embedding_query() -> None:
|
|
query = "foo"
|
|
embedding = QianfanEmbeddingsEndpoint()
|
|
output = embedding.embed_query(query)
|
|
assert len(output) == 384
|
|
|
|
|
|
def test_model() -> None:
|
|
documents = ["hi", "qianfan"]
|
|
embedding = QianfanEmbeddingsEndpoint(model="Embedding-V1")
|
|
output = embedding.embed_documents(documents)
|
|
assert len(output) == 2
|