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 EmbedInputType Configuration

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

Overview

Concrete type definitions for configuring embedding input purposes and output formats in the Cohere API.

Description

EmbedInputType is a Literal type alias restricting input_type to "search_document", "search_query", "classification", "clustering", or "image". EmbeddingType is a Literal type alias for output format: "float", "int8", "uint8", "binary", "ubinary". These are used as parameters to Client.embed() and V2Client.embed().

Usage

Import and pass these as parameters when calling the embed method. Always specify input_type explicitly.

Code Reference

  • Source Location: Repository cohere-ai/cohere-python https://github.com/cohere-ai/cohere-python
    • File src/cohere/types/embed_input_type.py, Lines L1-7
    • File src/cohere/types/embedding_type.py, Lines L1-5
  • Signature:
EmbedInputType = typing.Literal["search_document", "search_query", "classification", "clustering", "image"]
EmbeddingType = typing.Literal["float", "int8", "uint8", "binary", "ubinary"]
  • Import: from cohere import EmbedInputType, EmbeddingType (or use string literals directly)

I/O Contract

Inputs

User selects from predefined literal values.

Outputs

  • EmbedInputType string for input_type parameter
  • EmbeddingType string(s) for embedding_types parameter

Usage Examples

from cohere import Client

client = Client()

# For document indexing
response = client.embed(
    texts=["Document text here"],
    model="embed-english-v3.0",
    input_type="search_document",
    embedding_types=["float", "int8"],  # Get both formats
)

# For query encoding
response = client.embed(
    texts=["User query here"],
    model="embed-english-v3.0",
    input_type="search_query",
)

Related Pages

Page Connections

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