mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-16 15:04:13 +00:00
docs: Standardize QianfanEmbeddingsEndpoint (#24786)
- **Description:** Standardize QianfanEmbeddingsEndpoint, include: - docstrings, the issue #21983 - model init arg names, the issue #20085
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
"""Test Baidu Qianfan Embedding Endpoint."""
|
||||
|
||||
from typing import cast
|
||||
|
||||
from langchain_core.pydantic_v1 import SecretStr
|
||||
|
||||
from langchain_community.embeddings.baidu_qianfan_endpoint import (
|
||||
QianfanEmbeddingsEndpoint,
|
||||
)
|
||||
@@ -38,3 +42,17 @@ def test_rate_limit() -> None:
|
||||
assert len(output) == 2
|
||||
assert len(output[0]) == 384
|
||||
assert len(output[1]) == 384
|
||||
|
||||
|
||||
def test_initialization_with_alias() -> None:
|
||||
"""Test qianfan embedding model initialization with alias."""
|
||||
api_key = "your-api-key"
|
||||
secret_key = "your-secret-key"
|
||||
|
||||
embeddings = QianfanEmbeddingsEndpoint( # type: ignore[arg-type, call-arg]
|
||||
api_key=api_key, # type: ignore[arg-type]
|
||||
secret_key=secret_key, # type: ignore[arg-type]
|
||||
)
|
||||
|
||||
assert cast(SecretStr, embeddings.qianfan_ak).get_secret_value() == api_key
|
||||
assert cast(SecretStr, embeddings.qianfan_sk).get_secret_value() == secret_key
|
||||
|
Reference in New Issue
Block a user