airflow.providers.cohere.operators.embedding

CohereEmbeddingOperator

通过与 cohere 托管服务交互创建嵌入基础。

模块内容

class airflow.providers.cohere.operators.embedding.CohereEmbeddingOperator(input_text, conn_id=CohereHook.default_conn_name, timeout=None, max_retries=None, request_options=None, **kwargs)[source]

基类: airflow.models.BaseOperator

通过与 cohere 托管服务交互创建嵌入基础。

另请参阅

有关如何使用此操作符的更多信息,请参阅指南:CohereEmbeddingOperator

参数
  • input_text (list[str] | str) – 需要嵌入的单个字符串文本或文本项列表。

  • conn_id (str) – 可选。获取 Cohere 连接信息的 Airflow 连接名称。默认为 "cohere_default"。

  • timeout (int | None) – Cohere API 的超时时间(秒)。

  • max_retries (int | None) – 失败前的重试次数。

  • request_options (cohere.core.request_options.RequestOptions | None) –

    请求特定的配置。字段: - timeout_in_seconds: int。在 API 调用超时前等待的秒数。

    • max_retries: int。API 调用失败时的最大重试次数。

    • additional_headers: typing.Dict[str, typing.Any]。一个字典,包含要展开到请求头字典中的额外参数。

    • additional_query_parameters: typing.Dict[str, typing.Any]。一个字典,包含要展开到请求查询参数字典中的额外参数。

    • additional_body_parameters: typing.Dict[str, typing.Any]。一个字典,包含要展开到请求体参数字典中的额外参数。

template_fields: collections.abc.Sequence[str] = ('input_text',)[source]
conn_id = 'cohere_default'[source]
input_text[source]
timeout = None[source]
max_retries = None[source]
request_options = None[source]
property hook: airflow.providers.cohere.hooks.cohere.CohereHook[source]

返回一个 CohereHook 实例。

execute(context)[source]

使用 Cohere 嵌入服务嵌入文本。

此条目有帮助吗?