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 嵌入服務嵌入文字。

此條目有幫助嗎?