CohereEmbeddingOperator

Use the CohereEmbeddingOperator to interact with Cohere APIs to create embeddings for a given text.

Using the Operator

The CohereEmbeddingOperator requires the input_text as an input to embedding API. Use the conn_id parameter to specify the Cohere connection to use to connect to your account.

Example Code:

tests/system/providers/cohere/example_cohere_embedding_operator.py[source]

texts = [
    "On Kernel-Target Alignment. We describe a family of global optimization procedures",
    " that automatically decompose optimization problems into smaller loosely coupled",
    " problems, then combine the solutions of these with message passing algorithms.",
]

CohereEmbeddingOperator(input_text=texts, task_id="embedding_via_text")
CohereEmbeddingOperator(input_text=texts[0], task_id="embedding_via_task")

Was this entry helpful?