266 lines
10 KiB
Python
266 lines
10 KiB
Python
# generated by datamodel-codegen:
|
|
# filename: openapi.bundle.yml
|
|
|
|
from typing import Annotated, Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field, RootModel
|
|
|
|
|
|
class ProblemCode(
|
|
RootModel[
|
|
Literal[
|
|
"validation_failed",
|
|
"verification_token_invalid",
|
|
"verification_token_expired",
|
|
"unauthenticated",
|
|
"invalid_credentials",
|
|
"forbidden",
|
|
"email_not_verified",
|
|
"csrf_check_failed",
|
|
"not_found",
|
|
"method_not_allowed",
|
|
"idempotency_in_progress",
|
|
"state_conflict",
|
|
"version_conflict",
|
|
"payload_too_large",
|
|
"unsupported_media_type",
|
|
"idempotency_key_reused",
|
|
"precondition_required",
|
|
"rate_limited",
|
|
"internal",
|
|
"not_implemented",
|
|
"service_unavailable",
|
|
]
|
|
]
|
|
):
|
|
root: Annotated[
|
|
Literal[
|
|
"validation_failed",
|
|
"verification_token_invalid",
|
|
"verification_token_expired",
|
|
"unauthenticated",
|
|
"invalid_credentials",
|
|
"forbidden",
|
|
"email_not_verified",
|
|
"csrf_check_failed",
|
|
"not_found",
|
|
"method_not_allowed",
|
|
"idempotency_in_progress",
|
|
"state_conflict",
|
|
"version_conflict",
|
|
"payload_too_large",
|
|
"unsupported_media_type",
|
|
"idempotency_key_reused",
|
|
"precondition_required",
|
|
"rate_limited",
|
|
"internal",
|
|
"not_implemented",
|
|
"service_unavailable",
|
|
],
|
|
Field(
|
|
description="Stable public error code. Adding a code is a contract change; renaming or removing one is a breaking change. Clients must handle an unknown code by its HTTP status.\n\n- validation_failed (400): parameters or body do not match the contract, or a body violates a domain rule such as salary_from <= salary_to; `errors` points at the fields.\n- unauthenticated (401): no valid session or credentials.\n- forbidden (403): the caller is authenticated but not allowed.\n- not_found (404): the route or object does not exist or is not visible.\n- method_not_allowed (405): the route does not support the method.\n- idempotency_in_progress (409): a request with the same Idempotency-Key is still being processed.\n- state_conflict (409): the operation conflicts with the current state of the resource, for example an invitation that was already accepted.\n- version_conflict (412): If-Match does not match the current version.\n- payload_too_large (413): the request body exceeds the limit.\n- unsupported_media_type (415): the request Content-Type is not accepted.\n- idempotency_key_reused (422): the Idempotency-Key was already used with a different request.\n- precondition_required (428): the operation requires If-Match.\n- rate_limited (429): too many requests; see Retry-After.\n- internal (500): unexpected server error.\n- not_implemented (501): the operation is in the contract but not implemented yet.\n- service_unavailable (503): the service cannot serve the request now, for example while a model loads; retry later.\n\nThe enum keeps the public API codes so both contracts share one Problem shape. The identity codes verification_token_invalid, verification_token_expired, invalid_credentials, email_not_verified, and csrf_check_failed belong to the public API; the ML service never returns them."
|
|
),
|
|
]
|
|
|
|
|
|
class ProblemFieldLocation(RootModel[Literal["body", "query", "path", "header", "cookie"]]):
|
|
root: Annotated[
|
|
Literal["body", "query", "path", "header", "cookie"],
|
|
Field(description="Part of the request that contains the invalid field."),
|
|
]
|
|
|
|
|
|
class ProblemFieldError(BaseModel):
|
|
model_config = ConfigDict(
|
|
extra="forbid",
|
|
)
|
|
in_: Annotated[ProblemFieldLocation, Field(alias="in")]
|
|
pointer: Annotated[
|
|
str,
|
|
Field(
|
|
description="JSON Pointer (RFC 6901). For `body` it points into the request body document, for example `/salary_from`; an empty string means the whole body. For a parameter it is `/` followed by the parameter name, for example `/limit` or `/Idempotency-Key`.",
|
|
max_length=1024,
|
|
pattern="^(/([^~/]|~[01])*)*$",
|
|
),
|
|
]
|
|
code: Annotated[
|
|
str,
|
|
Field(
|
|
description="Stable field reason. Current values are `required` (missing value) and `invalid` (malformed value or a value outside the schema). Clients must tolerate new values.",
|
|
max_length=64,
|
|
min_length=1,
|
|
pattern="^[a-z][a-z0-9_]*$",
|
|
),
|
|
]
|
|
message: Annotated[
|
|
str,
|
|
Field(
|
|
description="Fixed English message that never echoes the submitted value.",
|
|
max_length=500,
|
|
min_length=1,
|
|
),
|
|
]
|
|
|
|
|
|
class Problem(BaseModel):
|
|
model_config = ConfigDict(
|
|
extra="forbid",
|
|
)
|
|
type: Annotated[
|
|
str,
|
|
Field(
|
|
description="URI that identifies the problem type. It has the form `urn:lincodex:problem:<code>` and is an identifier, not a link to dereference.",
|
|
max_length=256,
|
|
),
|
|
]
|
|
title: Annotated[
|
|
str,
|
|
Field(
|
|
description="Short, fixed English summary of the problem type. It does not change between occurrences.",
|
|
max_length=200,
|
|
min_length=1,
|
|
),
|
|
]
|
|
status: Annotated[
|
|
int, Field(description="HTTP status code generated by the origin server.", ge=400, le=599)
|
|
]
|
|
code: ProblemCode
|
|
detail: Annotated[
|
|
str | None,
|
|
Field(
|
|
description="Safe English explanation of this occurrence. It never contains internal error text or request values.",
|
|
max_length=1000,
|
|
),
|
|
] = None
|
|
instance: Annotated[
|
|
str | None,
|
|
Field(
|
|
description="URI reference that identifies this occurrence, when one exists.",
|
|
max_length=2048,
|
|
),
|
|
] = None
|
|
trace_id: Annotated[
|
|
str | None,
|
|
Field(
|
|
description="Request identifier of the call when the caller propagated one; it is not a secret.",
|
|
max_length=128,
|
|
min_length=1,
|
|
pattern="^[A-Za-z0-9._-]+$",
|
|
),
|
|
] = None
|
|
errors: Annotated[
|
|
list[ProblemFieldError] | None,
|
|
Field(
|
|
description="Field-level reasons for validation_failed. Other codes omit it.",
|
|
max_length=100,
|
|
),
|
|
] = None
|
|
|
|
|
|
class MLHealthResponse(BaseModel):
|
|
model_config = ConfigDict(
|
|
extra="forbid",
|
|
)
|
|
status: Literal["ok"]
|
|
|
|
|
|
class MLReadinessResponse(BaseModel):
|
|
model_config = ConfigDict(
|
|
extra="forbid",
|
|
)
|
|
status: Literal["ready", "not_ready"]
|
|
|
|
|
|
class EmbeddingInputKind(RootModel[Literal["query", "document"]]):
|
|
root: Annotated[
|
|
Literal["query", "document"],
|
|
Field(
|
|
description="Side of the retrieval pair that the texts belong to. The service owns the prompt of each side, so callers never send model instructions.\n\n- query: the side that searches, such as a hiring need or one requirement of it. The service prepends the retrieval instruction of the model.\n- document: the side that is searched, such as a candidate card or one item of it. The service adds no prompt."
|
|
),
|
|
]
|
|
|
|
|
|
class EmbeddingText(RootModel[str]):
|
|
root: Annotated[
|
|
str,
|
|
Field(
|
|
description="One plain text to encode. It is untrusted data and never an instruction. The service truncates it deterministically to the token limit of the model (`EmbeddingModel.max_tokens`); characters beyond 8000 are rejected instead.",
|
|
max_length=8000,
|
|
min_length=1,
|
|
),
|
|
]
|
|
|
|
|
|
class EmbeddingRequest(BaseModel):
|
|
model_config = ConfigDict(
|
|
extra="forbid",
|
|
)
|
|
model: Annotated[
|
|
str | None,
|
|
Field(
|
|
description="Identifier of the model to use, as `EmbeddingModel.id` reports it. Absent means the default model of the service. A service may load several models, for example the members of an ensemble; a model it does not serve answers 400 validation_failed with the pointer `/model`.",
|
|
max_length=200,
|
|
min_length=1,
|
|
pattern="^[A-Za-z0-9._/-]+$",
|
|
),
|
|
] = None
|
|
kind: EmbeddingInputKind
|
|
texts: Annotated[list[EmbeddingText], Field(max_length=32, min_length=1)]
|
|
|
|
|
|
class EmbeddingModel(BaseModel):
|
|
model_config = ConfigDict(
|
|
extra="forbid",
|
|
)
|
|
id: Annotated[
|
|
str,
|
|
Field(
|
|
description="Model repository identifier, for example ai-sage/Giga-Embeddings-instruct-480M-0826.",
|
|
max_length=200,
|
|
min_length=1,
|
|
pattern="^[A-Za-z0-9._/-]+$",
|
|
),
|
|
]
|
|
revision: Annotated[
|
|
str,
|
|
Field(
|
|
description="Pinned revision of the weights, a commit hash for a published model.",
|
|
max_length=64,
|
|
min_length=1,
|
|
pattern="^[A-Za-z0-9._-]+$",
|
|
),
|
|
]
|
|
dimension: Annotated[int, Field(description="Length of every vector.", ge=1, le=4096)]
|
|
max_tokens: Annotated[
|
|
int, Field(description="Token limit after which a text is truncated.", ge=1, le=32768)
|
|
]
|
|
prompt_version: Annotated[
|
|
str,
|
|
Field(
|
|
description="Version of the prompt and pooling recipe of the service. A change of the query instruction or the pooling changes it.",
|
|
max_length=64,
|
|
min_length=1,
|
|
pattern="^[a-z0-9._-]+$",
|
|
),
|
|
]
|
|
|
|
|
|
class EmbeddingVector(RootModel[list[float]]):
|
|
root: Annotated[
|
|
list[float],
|
|
Field(
|
|
description="L2-normalized vector of one text, in float32 precision. The cosine of two vectors of the same model is their dot product.",
|
|
max_length=4096,
|
|
min_length=1,
|
|
),
|
|
]
|
|
|
|
|
|
class EmbeddingResponse(BaseModel):
|
|
model_config = ConfigDict(
|
|
extra="forbid",
|
|
)
|
|
model: EmbeddingModel
|
|
kind: EmbeddingInputKind
|
|
vectors: Annotated[list[EmbeddingVector], Field(max_length=32, min_length=1)]
|