Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Cohere ai Cohere python EmbedJobsClient Create

From Leeroopedia
Metadata
Cohere Python SDK
NLP, Embeddings, Batch_Processing
2026-02-15 14:00 GMT

Overview

Concrete method for creating server-side embedding jobs on pre-uploaded datasets.

Description

EmbedJobsClient.create() submits an embedding job to run asynchronously on Cohere infrastructure. It requires a model, dataset_id (from a pre-uploaded dataset of type "embed-input"), and input_type. The wait() utility from utils.py polls the job status at configurable intervals until completion or timeout.

Usage

Call client.embed_jobs.create() after uploading a dataset. Use client.wait() to block until the job finishes.

Code Reference

  • Source Location: Repository cohere-ai/cohere-python https://github.com/cohere-ai/cohere-python
    • File src/cohere/embed_jobs/client.py, Lines L61-140
    • File src/cohere/utils.py, Lines L93-116 (wait utility)
  • Signature:
def create(
    self,
    *,
    model: str,
    dataset_id: str,
    input_type: EmbedInputType,
    name: typing.Optional[str] = OMIT,
    embedding_types: typing.Optional[typing.Sequence[EmbeddingType]] = OMIT,
    truncate: typing.Optional[CreateEmbedJobRequestTruncate] = OMIT,
    request_options: typing.Optional[RequestOptions] = None,
) -> CreateEmbedJobResponse:

def wait(
    cohere: Client,
    awaitable: Union[CreateEmbedJobResponse, DatasetsCreateResponse],
    timeout: Optional[float] = None,
    interval: float = 2.0,
) -> Union[EmbedJob, DatasetsGetResponse]:
  • Import: Access via client.embed_jobs.create() and client.wait()

I/O Contract

Inputs

Parameter Type Required Description
model str Yes Embedding model ID
dataset_id str Yes Pre-uploaded dataset ID (type "embed-input")
input_type EmbedInputType Yes Embedding purpose
name Optional[str] No Job name
embedding_types Optional[Sequence[EmbeddingType]] No Output formats

Outputs

  • CreateEmbedJobResponse with job ID
  • After wait(): EmbedJob with status, output dataset ID

Usage Examples

from cohere import Client

client = Client()

# Create an embed job on a pre-uploaded dataset
job = client.embed_jobs.create(
    model="embed-english-v3.0",
    dataset_id="dataset-id-from-upload",
    input_type="search_document",
    name="my-embedding-job",
)

# Wait for completion
completed_job = client.wait(job)
print(f"Job status: {completed_job.status}")
print(f"Output dataset: {completed_job.output}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment