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 Finetuning BaseModel Type

From Leeroopedia
Knowledge Sources
Domains SDK, Fine_Tuning
Last Updated 2026-02-15 14:00 GMT

Overview

The BaseModel class defines the data model for representing base models used in Cohere fine-tuning operations.

Description

BaseModel is a Pydantic-based data class that encapsulates the properties of a base model upon which fine-tuning is performed. It includes the model's name, version (read-only), base type (such as generative, classification, rerank, or chat), and an optional fine-tuning strategy. The class extends UncheckedBaseModel and supports both Pydantic v1 and v2 through a compatibility layer, allowing extra fields to be passed without raising validation errors.

Usage

Use this class when you need to specify or inspect the base model configuration for a fine-tuning job. It is typically used as a nested field within a broader fine-tuned model definition, representing which foundation model the fine-tuning is built upon.

Code Reference

Source Location

  • Repository: Cohere Python SDK
  • File: src/cohere/finetuning/finetuning/types/base_model.py

Signature

class BaseModel(UncheckedBaseModel):
    """
    The base model used for fine-tuning.
    """

    name: typing.Optional[str] = pydantic.Field(default=None)
    version: typing.Optional[str] = pydantic.Field(default=None)
    base_type: BaseType = pydantic.Field()
    strategy: typing.Optional[Strategy] = pydantic.Field(default=None)

Import

from cohere.finetuning.finetuning.types import BaseModel

I/O Contract

Fields

Field Type Required Default Description
name typing.Optional[str] No None The name of the base model.
version typing.Optional[str] No None Read-only. The version of the base model.
base_type BaseType Yes (none) The type of the base model. One of: "BASE_TYPE_UNSPECIFIED", "BASE_TYPE_GENERATIVE", "BASE_TYPE_CLASSIFICATION", "BASE_TYPE_RERANK", "BASE_TYPE_CHAT".
strategy typing.Optional[Strategy] No None Deprecated. The fine-tuning strategy. One of: "STRATEGY_UNSPECIFIED", "STRATEGY_VANILLA", "STRATEGY_TFEW".

Usage Examples

Creating a BaseModel instance

from cohere.finetuning.finetuning.types import BaseModel

# Minimal usage with only the required field
base_model = BaseModel(base_type="BASE_TYPE_CHAT")

print(base_model.base_type)  # "BASE_TYPE_CHAT"
print(base_model.name)       # None
print(base_model.version)    # None

Creating a fully specified BaseModel

from cohere.finetuning.finetuning.types import BaseModel

base_model = BaseModel(
    name="command",
    version="2024-01",
    base_type="BASE_TYPE_GENERATIVE",
    strategy="STRATEGY_VANILLA",
)

print(base_model.name)       # "command"
print(base_model.version)    # "2024-01"
print(base_model.base_type)  # "BASE_TYPE_GENERATIVE"
print(base_model.strategy)   # "STRATEGY_VANILLA"

Related Pages

Page Connections

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