VolcanoEmbeddings#

class langchain_community.embeddings.volcengine.VolcanoEmbeddings[source]#

Bases: BaseModel, Embeddings

Volcengine Embeddings 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 chunk_size: int = 100#

Chunk size when multiple texts are input

param client: Any [Required]#

volcano client

param host: str = 'maas-api.ml-platform-cn-beijing.volces.com'#

host learn more from https://www.volcengine.com/docs/82379/1174746

param model: str = 'bge-large-zh'#

Model name you could get from https://www.volcengine.com/docs/82379/1174746 for now, we support bge_large_zh

param region: str = 'cn-beijing'#

region learn more from https://www.volcengine.com/docs/82379/1174746

param version: str = '1.0'#

model version

param volcano_ak: str | None = None#

volcano access key learn more from: https://www.volcengine.com/docs/6459/76491#ak-sk

param volcano_sk: str | None = None#

volcano secret key learn more from: https://www.volcengine.com/docs/6459/76491#ak-sk

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

Embeds a list of text documents using the AutoVOT algorithm.

Parameters:

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

Returns:

A list of embeddings for each document in the input list.

Each embedding is represented as a list of float values.

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]

classmethod validate_environment(values: Dict) Dict[source]#

Validate whether volcano_ak and volcano_sk in the environment variables or configuration file are available or not.

init volcano embedding client with ak, sk, host, region

Parameters:
  • values (Dict) – a dictionary containing configuration information, must include the

  • volcano_sk (fields of volcano_ak and)

Returns:

a dictionary containing configuration information. If volcano_ak and volcano_sk are not provided in the environment variables or configuration file,the original values will be returned; otherwise, values containing volcano_ak and volcano_sk will be returned.

Raises:
  • ValueError – volcengine package not found, please install it with

  • pip install volcengine

Return type:

Dict

Examples using VolcanoEmbeddings