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 if the input data cannot be parsed to form a valid model.
- param app_id: SecretStr | None = None#
Application ID for identifying your application.
- Constraints:
type = string
writeOnly = True
format = password
- param clova_emb_api_key: SecretStr | None = None#
API key for accessing Clova’s embedding service.
- Constraints:
type = string
writeOnly = True
format = password
- param clova_emb_apigw_api_key: SecretStr | None = None#
API gateway key for enhanced security.
- Constraints:
type = string
writeOnly = True
format = password
- 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