gen_ai_hub.batch_service.models package

class ABCBaseModel

Bases: BaseModel, ABC

Abstract base model for batch service request models.

  • extra="forbid" rejects unexpected fields.

  • by_alias=True / exclude_none=True ensure clean API payloads.

model_dump(**kwargs)
!!! abstract "Usage Documentation"

[model_dump](../concepts/serialization.md#python-mode)

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

Args:
mode: The mode in which to_python should run.

If mode is 'json', the output will only contain JSON serializable types. If mode is 'python', the output may contain non-JSON-serializable Python objects.

include: A set of fields to include in the output. exclude: A set of fields to exclude from the output. context: Additional context to pass to the serializer. by_alias: Whether to use the field's alias in the dictionary key if defined. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that are set to their default value. exclude_none: Whether to exclude fields that have a value of None. exclude_computed_fields: Whether to exclude computed fields.

While this can be useful for round-tripping, it is usually recommended to use the dedicated round_trip parameter instead.

round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,

"error" raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].

fallback: A function to call when an unknown value is encountered. If not provided,

a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.

serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. polymorphic_serialization: Whether to use model and dataclass polymorphic serialization for this call.

Returns:

A dictionary representation of the model.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BatchCancelResponse

Bases: ResponseBaseModel

Response returned by PATCH /llm-batch-service/v1/batches/{batch_id}/cancel.

Confirms that the cancellation request has been accepted. The job will transition to CANCELLING and eventually CANCELLED.

Parameters:
  • id (str, optional) -- Unique identifier (UUID) of the batch job.

  • created_at (str, optional) -- ISO 8601 timestamp of when the job was originally created.

  • message (str, optional) -- Human-readable confirmation that cancellation was scheduled.

created_at: str | None
id: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BatchCreateRequest

Bases: ABCBaseModel

Request body sent to POST /llm-batch-service/v1/batches.

Describes a new batch processing job: where to read input from, where to write output, and which model to use.

Parameters:
  • type (Literal["llm-native"]) -- Batch processing type. Currently only "llm-native" is supported.

  • input (BatchInput) -- Input file configuration.

  • output (BatchOutput) -- Output directory configuration.

  • spec (BatchSpec) -- LLM provider and model specification.

input: BatchInput
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

output: BatchOutput
spec: BatchSpec
type: Literal['llm-native']
class BatchCreateResponse

Bases: ResponseBaseModel

Response returned by POST /llm-batch-service/v1/batches.

Confirms that the batch job has been accepted and provides the assigned identifier and initial status.

Parameters:
  • id (str) -- Unique identifier (UUID) of the created batch job.

  • created_at (str, optional) -- ISO 8601 timestamp of when the job was created.

  • status (str, optional) -- Initial status of the job, typically "PENDING".

  • message (str, optional) -- Human-readable confirmation message from the service.

created_at: str | None
id: str
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

status: str | None
class BatchDeleteResponse

Bases: ResponseBaseModel

Response returned by DELETE /llm-batch-service/v1/batches/{batch_id}.

Confirms that the batch job record has been deleted. Only jobs in a terminal state (COMPLETED, FAILED, or CANCELLED) can be deleted.

Parameters:
  • id (str, optional) -- Unique identifier (UUID) of the deleted batch job.

  • created_at (str, optional) -- ISO 8601 timestamp of when the job was originally created.

  • message (str, optional) -- Human-readable confirmation of the deletion.

created_at: str | None
id: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BatchDetailResponse

Bases: ResponseBaseModel

Response returned by GET /llm-batch-service/v1/batches/{batch_id}.

Provides the full configuration and current status of a specific batch job.

Parameters:
  • id (str, optional) -- Unique identifier (UUID) of the batch job.

  • type (str, optional) -- Batch processing type (e.g. "llm-native").

  • provider (str, optional) -- LLM provider name (e.g. "azure-openai").

  • created_at (str, optional) -- ISO 8601 timestamp of when the job was created.

  • input (BatchInputDetail, optional) -- Input file configuration.

  • output (BatchOutputDetail, optional) -- Output directory configuration.

  • spec (dict, optional) -- Raw job specification dict as stored by the service.

  • status (BatchStatusDetail, optional) -- Current status details.

created_at: str | None
id: str | None
input: BatchInputDetail | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

output: BatchOutputDetail | None
provider: str | None
spec: dict | None
status: BatchStatusDetail | None
type: str | None
class BatchInput

Bases: ABCBaseModel

Input configuration for a batch job.

Points to the .jsonl file in an object store that contains the individual LLM requests to be processed.

Parameters:

uri (str) -- Fully qualified object-store URI of the input file. Must point to a .jsonl file (e.g. ai://my-store/input/requests.jsonl).

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uri: str
class BatchInputDetail

Bases: ResponseBaseModel

Input configuration as returned in a batch detail response.

Parameters:

uri (str, optional) -- Object-store URI of the input .jsonl file.

model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uri: str | None
class BatchListResponse

Bases: ResponseBaseModel

Response returned by GET /llm-batch-service/v1/batches.

Contains a count and a list of batch job summaries for the current resource group.

Parameters:
  • count (int, optional) -- Total number of batch jobs.

  • resources (list[BatchSummary], optional) -- List of batch job summaries.

count: int | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

resources: list[BatchSummary] | None
class BatchOutput

Bases: ABCBaseModel

Output configuration for a batch job.

Points to the directory in an object store where results will be written once the job completes.

Parameters:

uri (str) -- Fully qualified object-store URI of the output directory (e.g. ai://my-store/output/).

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uri: str
class BatchOutputDetail

Bases: ResponseBaseModel

Output configuration as returned in a batch detail response.

Parameters:

uri (str, optional) -- Object-store URI of the output directory.

model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uri: str | None
class BatchSpec

Bases: ABCBaseModel

Specification of the LLM to use for a batch job.

Parameters:
  • provider (str) -- LLM provider name as registered in SAP AI Core (e.g. "azure-openai").

  • model (str) -- Model name to use for inference (e.g. "gpt-4.1-mini").

model: str
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

provider: str
class BatchStatus

Bases: str, Enum

Enumeration of possible lifecycle states for a batch job.

Variables:
  • PENDING -- Job has been accepted and is waiting to be scheduled.

  • RUNNING -- Job is actively being processed.

  • COMPLETED -- Job finished successfully.

  • FAILED -- Job terminated with an error.

  • CANCELLED -- Job was cancelled by the user.

  • CANCELLING -- Cancellation has been requested and is in progress.

__new__(value)
CANCELLED = 'CANCELLED'
CANCELLING = 'CANCELLING'
COMPLETED = 'COMPLETED'
FAILED = 'FAILED'
PENDING = 'PENDING'
RUNNING = 'RUNNING'
class BatchStatusDetail

Bases: ResponseBaseModel

Status block embedded inside BatchDetailResponse.

Parameters:
  • current_status (str, optional) -- The job's current lifecycle status.

  • target_status (str, optional) -- The terminal status the job is expected to reach.

  • updated_at (str, optional) -- ISO 8601 timestamp of the last status change.

  • message (str, optional) -- Optional human-readable description of the current status.

current_status: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_status: str | None
updated_at: str | None
class BatchStatusResponse

Bases: ResponseBaseModel

Response returned by GET /llm-batch-service/v1/batches/{batch_id}/status.

Parameters:
  • current_status (str, optional) -- The job's current lifecycle status.

  • target_status (str, optional) -- The terminal status the job is expected to reach.

  • updated_at (str, optional) -- ISO 8601 timestamp of the last status change.

  • message (str, optional) -- Optional human-readable description of the current status.

current_status: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_status: str | None
updated_at: str | None
class BatchSummary

Bases: ResponseBaseModel

Summary entry for a single batch job as returned in a list response.

Parameters:
  • id (str) -- Unique identifier (UUID) of the batch job.

  • type (str, optional) -- Batch processing type (e.g. "llm-native").

  • provider (str, optional) -- LLM provider name (e.g. "azure-openai").

  • created_at (str, optional) -- ISO 8601 timestamp of when the job was created.

  • status (str, optional) -- Current status of the job.

created_at: str | None
id: str
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

provider: str | None
status: str | None
type: str | None
class ErrorResponse

Bases: ResponseBaseModel

Error response body returned by the batch service on 4xx/5xx responses.

Parameters:
  • request_id (str) -- Unique request identifier, useful for tracing the error in service logs.

  • message (str) -- Human-readable description of the error.

message: str
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

request_id: str
class ResponseBaseModel

Bases: BaseModel

Base model for API response models — allows extra fields for forward compatibility.

model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Submodules

gen_ai_hub.batch_service.models.base module

class ABCBaseModel

Bases: BaseModel, ABC

Abstract base model for batch service request models.

  • extra="forbid" rejects unexpected fields.

  • by_alias=True / exclude_none=True ensure clean API payloads.

model_dump(**kwargs)
!!! abstract "Usage Documentation"

[model_dump](../concepts/serialization.md#python-mode)

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

Args:
mode: The mode in which to_python should run.

If mode is 'json', the output will only contain JSON serializable types. If mode is 'python', the output may contain non-JSON-serializable Python objects.

include: A set of fields to include in the output. exclude: A set of fields to exclude from the output. context: Additional context to pass to the serializer. by_alias: Whether to use the field's alias in the dictionary key if defined. exclude_unset: Whether to exclude fields that have not been explicitly set. exclude_defaults: Whether to exclude fields that are set to their default value. exclude_none: Whether to exclude fields that have a value of None. exclude_computed_fields: Whether to exclude computed fields.

While this can be useful for round-tripping, it is usually recommended to use the dedicated round_trip parameter instead.

round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,

"error" raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].

fallback: A function to call when an unknown value is encountered. If not provided,

a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.

serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. polymorphic_serialization: Whether to use model and dataclass polymorphic serialization for this call.

Returns:

A dictionary representation of the model.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ResponseBaseModel

Bases: BaseModel

Base model for API response models — allows extra fields for forward compatibility.

model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

gen_ai_hub.batch_service.models.request module

Request models for the LLM Batch Service API.

class BatchCreateRequest

Bases: ABCBaseModel

Request body sent to POST /llm-batch-service/v1/batches.

Describes a new batch processing job: where to read input from, where to write output, and which model to use.

Parameters:
  • type (Literal["llm-native"]) -- Batch processing type. Currently only "llm-native" is supported.

  • input (BatchInput) -- Input file configuration.

  • output (BatchOutput) -- Output directory configuration.

  • spec (BatchSpec) -- LLM provider and model specification.

input: BatchInput
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

output: BatchOutput
spec: BatchSpec
type: Literal['llm-native']
class BatchInput

Bases: ABCBaseModel

Input configuration for a batch job.

Points to the .jsonl file in an object store that contains the individual LLM requests to be processed.

Parameters:

uri (str) -- Fully qualified object-store URI of the input file. Must point to a .jsonl file (e.g. ai://my-store/input/requests.jsonl).

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uri: str
class BatchOutput

Bases: ABCBaseModel

Output configuration for a batch job.

Points to the directory in an object store where results will be written once the job completes.

Parameters:

uri (str) -- Fully qualified object-store URI of the output directory (e.g. ai://my-store/output/).

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uri: str
class BatchSpec

Bases: ABCBaseModel

Specification of the LLM to use for a batch job.

Parameters:
  • provider (str) -- LLM provider name as registered in SAP AI Core (e.g. "azure-openai").

  • model (str) -- Model name to use for inference (e.g. "gpt-4.1-mini").

model: str
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

provider: str

gen_ai_hub.batch_service.models.response module

Response models for the LLM Batch Service API.

class BatchCancelResponse

Bases: ResponseBaseModel

Response returned by PATCH /llm-batch-service/v1/batches/{batch_id}/cancel.

Confirms that the cancellation request has been accepted. The job will transition to CANCELLING and eventually CANCELLED.

Parameters:
  • id (str, optional) -- Unique identifier (UUID) of the batch job.

  • created_at (str, optional) -- ISO 8601 timestamp of when the job was originally created.

  • message (str, optional) -- Human-readable confirmation that cancellation was scheduled.

created_at: str | None
id: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BatchCreateResponse

Bases: ResponseBaseModel

Response returned by POST /llm-batch-service/v1/batches.

Confirms that the batch job has been accepted and provides the assigned identifier and initial status.

Parameters:
  • id (str) -- Unique identifier (UUID) of the created batch job.

  • created_at (str, optional) -- ISO 8601 timestamp of when the job was created.

  • status (str, optional) -- Initial status of the job, typically "PENDING".

  • message (str, optional) -- Human-readable confirmation message from the service.

created_at: str | None
id: str
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

status: str | None
class BatchDeleteResponse

Bases: ResponseBaseModel

Response returned by DELETE /llm-batch-service/v1/batches/{batch_id}.

Confirms that the batch job record has been deleted. Only jobs in a terminal state (COMPLETED, FAILED, or CANCELLED) can be deleted.

Parameters:
  • id (str, optional) -- Unique identifier (UUID) of the deleted batch job.

  • created_at (str, optional) -- ISO 8601 timestamp of when the job was originally created.

  • message (str, optional) -- Human-readable confirmation of the deletion.

created_at: str | None
id: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BatchDetailResponse

Bases: ResponseBaseModel

Response returned by GET /llm-batch-service/v1/batches/{batch_id}.

Provides the full configuration and current status of a specific batch job.

Parameters:
  • id (str, optional) -- Unique identifier (UUID) of the batch job.

  • type (str, optional) -- Batch processing type (e.g. "llm-native").

  • provider (str, optional) -- LLM provider name (e.g. "azure-openai").

  • created_at (str, optional) -- ISO 8601 timestamp of when the job was created.

  • input (BatchInputDetail, optional) -- Input file configuration.

  • output (BatchOutputDetail, optional) -- Output directory configuration.

  • spec (dict, optional) -- Raw job specification dict as stored by the service.

  • status (BatchStatusDetail, optional) -- Current status details.

created_at: str | None
id: str | None
input: BatchInputDetail | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

output: BatchOutputDetail | None
provider: str | None
spec: dict | None
status: BatchStatusDetail | None
type: str | None
class BatchInputDetail

Bases: ResponseBaseModel

Input configuration as returned in a batch detail response.

Parameters:

uri (str, optional) -- Object-store URI of the input .jsonl file.

model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uri: str | None
class BatchListResponse

Bases: ResponseBaseModel

Response returned by GET /llm-batch-service/v1/batches.

Contains a count and a list of batch job summaries for the current resource group.

Parameters:
  • count (int, optional) -- Total number of batch jobs.

  • resources (list[BatchSummary], optional) -- List of batch job summaries.

count: int | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

resources: list[BatchSummary] | None
class BatchOutputDetail

Bases: ResponseBaseModel

Output configuration as returned in a batch detail response.

Parameters:

uri (str, optional) -- Object-store URI of the output directory.

model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uri: str | None
class BatchStatus

Bases: str, Enum

Enumeration of possible lifecycle states for a batch job.

Variables:
  • PENDING -- Job has been accepted and is waiting to be scheduled.

  • RUNNING -- Job is actively being processed.

  • COMPLETED -- Job finished successfully.

  • FAILED -- Job terminated with an error.

  • CANCELLED -- Job was cancelled by the user.

  • CANCELLING -- Cancellation has been requested and is in progress.

__new__(value)
CANCELLED = 'CANCELLED'
CANCELLING = 'CANCELLING'
COMPLETED = 'COMPLETED'
FAILED = 'FAILED'
PENDING = 'PENDING'
RUNNING = 'RUNNING'
class BatchStatusDetail

Bases: ResponseBaseModel

Status block embedded inside BatchDetailResponse.

Parameters:
  • current_status (str, optional) -- The job's current lifecycle status.

  • target_status (str, optional) -- The terminal status the job is expected to reach.

  • updated_at (str, optional) -- ISO 8601 timestamp of the last status change.

  • message (str, optional) -- Optional human-readable description of the current status.

current_status: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_status: str | None
updated_at: str | None
class BatchStatusResponse

Bases: ResponseBaseModel

Response returned by GET /llm-batch-service/v1/batches/{batch_id}/status.

Parameters:
  • current_status (str, optional) -- The job's current lifecycle status.

  • target_status (str, optional) -- The terminal status the job is expected to reach.

  • updated_at (str, optional) -- ISO 8601 timestamp of the last status change.

  • message (str, optional) -- Optional human-readable description of the current status.

current_status: str | None
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_status: str | None
updated_at: str | None
class BatchSummary

Bases: ResponseBaseModel

Summary entry for a single batch job as returned in a list response.

Parameters:
  • id (str) -- Unique identifier (UUID) of the batch job.

  • type (str, optional) -- Batch processing type (e.g. "llm-native").

  • provider (str, optional) -- LLM provider name (e.g. "azure-openai").

  • created_at (str, optional) -- ISO 8601 timestamp of when the job was created.

  • status (str, optional) -- Current status of the job.

created_at: str | None
id: str
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

provider: str | None
status: str | None
type: str | None
class ErrorResponse

Bases: ResponseBaseModel

Error response body returned by the batch service on 4xx/5xx responses.

Parameters:
  • request_id (str) -- Unique request identifier, useful for tracing the error in service logs.

  • message (str) -- Human-readable description of the error.

message: str
model_config: ClassVar[ConfigDict] = {'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

request_id: str