WatsonxEmbeddings#

class langchain_ibm.embeddings.WatsonxEmbeddings[source]#

Bases: BaseModel, Embeddings

IBM watsonx.ai embedding models.

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 apikey: SecretStr | None [Optional]#

API key to the Watson Machine Learning or CPD instance.

param instance_id: SecretStr | None [Optional]#

Instance_id of the CPD instance.

param model_id: str [Required]#

Type of model to use.

param params: dict | None = None#

Model parameters to use during request generation.

param password: SecretStr | None [Optional]#

Password to the CPD instance.

param project_id: str | None = None#

ID of the Watson Studio project.

param space_id: str | None = None#

ID of the Watson Studio space.

param token: SecretStr | None [Optional]#

Token to the CPD instance.

param url: SecretStr [Optional]#

URL to the Watson Machine Learning or CPD instance.

param username: SecretStr | None [Optional]#

Username to the CPD instance.

param verify: str | bool | None = None#

You can pass one of following as verify: * the path to a CA_BUNDLE file * the path of directory with certificates of trusted CAs * True - default path to truststore will be taken * False - no verification will be made

param version: SecretStr | None = None#

Version of the CPD instance.

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]

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

Embed search docs.

Parameters:

texts (List[str])

Return type:

List[List[float]]

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

Embed query text.

Parameters:

text (str)

Return type:

List[float]