ClovaEmbeddings#
- class langchain_community.embeddings.clova.ClovaEmbeddings[source]#
Bases:
BaseModel
,Embeddings
Clova’s embedding service.
To use this service,
you should have the following environment variables set with your API tokens and application ID, or pass them as named parameters to the constructor:
CLOVA_EMB_API_KEY
: API key for accessing Clova’s embedding service.CLOVA_EMB_APIGW_API_KEY
: API gateway key for enhanced security.CLOVA_EMB_APP_ID
: Application ID for identifying your application.
Example
from langchain_community.embeddings import ClovaEmbeddings embeddings = ClovaEmbeddings( clova_emb_api_key='your_clova_emb_api_key', clova_emb_apigw_api_key='your_clova_emb_apigw_api_key', app_id='your_app_id' ) query_text = "This is a test query." query_result = embeddings.embed_query(query_text) document_text = "This is a test document." document_result = embeddings.embed_documents([document_text])
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- param app_id: SecretStr | None = None#
Application ID for identifying your application.
- param clova_emb_api_key: SecretStr | None = None#
API key for accessing Clova’s embedding service.
- param clova_emb_apigw_api_key: SecretStr | None = None#
API gateway key for enhanced security.
- param endpoint_url: str = 'https://clovastudio.apigw.ntruss.com/testapp/v1/api-tools/embedding'#
Endpoint URL to use.
- param model: str = 'clir-emb-dolphin'#
Embedding model name to use.
- async aembed_documents(texts: list[str]) list[list[float]] #
Asynchronous Embed search docs.
- Parameters:
texts (list[str]) – List of text to embed.
- Returns:
List of embeddings.
- Return type:
list[list[float]]
- async aembed_query(text: str) list[float] #
Asynchronous Embed query text.
- Parameters:
text (str) – Text to embed.
- Returns:
Embedding.
- Return type:
list[float]
Examples using ClovaEmbeddings