airflow.providers.cohere.operators.embedding

Classes

CohereEmbeddingOperator

Creates the embedding base by interacting with cohere hosted services.

Module Contents

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]

Bases: airflow.models.BaseOperator

Creates the embedding base by interacting with cohere hosted services.

See also

For more information on how to use this operator, take a look at the guide: CohereEmbeddingOperator

Parameters:
  • input_text (list[str] | str) – single string text or list of text items that need to be embedded.

  • conn_id (str) – Optional. The name of the Airflow connection to get connection information for Cohere. Defaults to “cohere_default”.

  • timeout (int | None) – Timeout in seconds for Cohere API.

  • max_retries (int | None) – Number of times to retry before failing.

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

    Request-specific configuration. Fields: - timeout_in_seconds: int. The number of seconds to await an API call before timing out.

    • max_retries: int. The max number of retries to attempt if the API call fails.

    • additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request’s header dict

    • additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request’s query parameters dict

    • additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request’s body parameters dict

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]

Return an instance of the CohereHook.

execute(context)[source]

Embed texts using Cohere embed services.

Was this entry helpful?