ClovaXEmbeddings#

class langchain_community.embeddings.naver.ClovaXEmbeddings[source]#

Bases: BaseModel, Embeddings

NCP ClovaStudio Embedding API.

following environment variables set or passed in constructor in lower case: - NCP_CLOVASTUDIO_API_KEY - NCP_APIGW_API_KEY - NCP_CLOVASTUDIO_APP_ID

Example

from langchain_community import ClovaXEmbeddings

model = ClovaXEmbeddings(model="clir-emb-dolphin")
output = embedding.embed_documents(documents)

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: str | None = None#
param base_url: str | None = None#

Automatically inferred from env are NCP_CLOVASTUDIO_API_BASE_URL if not provided.

param model_name: str = 'clir-emb-dolphin'#

NCP ClovaStudio embedding model name

param ncp_apigw_api_key: SecretStr | None = None (alias 'apigw_api_key')#

Automatically inferred from env are NCP_APIGW_API_KEY if not provided.

param ncp_clovastudio_api_key: SecretStr | None = None (alias 'api_key')#

Automatically inferred from env are NCP_CLOVASTUDIO_API_KEY if not provided.

param service_app: bool = False#

false: use testapp, true: use service app on NCP Clova Studio

param timeout: int = 60#
Constraints:
  • gt = 0

async aembed_documents(texts: List[str]) List[List[float]][source]#

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][source]#

Asynchronous Embed query text.

Parameters:

text (str) – Text to embed.

Returns:

Embedding.

Return type:

List[float]

default_headers() Dict[str, Any][source]#
Return type:

Dict[str, Any]

embed_documents(texts: List[str]) List[List[float]][source]#

Embed search docs.

Parameters:

texts (List[str]) – List of text to embed.

Returns:

List of embeddings.

Return type:

List[List[float]]

embed_query(text: str) List[float][source]#

Embed query text.

Parameters:

text (str) – Text to embed.

Returns:

Embedding.

Return type:

List[float]