feat(matching): rank with semantic embeddings and explain matches by evidence

This commit is contained in:
shira committed 2026-10-11 10:39:46 +03:00
1 parent facc1789b1
commit 24b64d698a
215 files changed
+16951 -327

No files matched your search

+109
View File
@@ -1,3 +1,109 @@
EmbeddingInputKind:
type: string
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.
- query: the side that searches, such as a hiring need or one requirement of it. The service prepends the retrieval instruction of the model.
- document: the side that is searched, such as a candidate card or one item of it. The service adds no prompt.'
enum:
- query
- document
EmbeddingText:
type: string
minLength: 1
maxLength: 8000
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.
EmbeddingRequest:
type: object
description: 'Texts to encode in one call. The service encodes them in a fixed, deterministic way: texts are ordered by length with the request position as the tie-breaker, encoded in micro-batches of the configured size, and returned in request order. The same texts in the same request on the same image and thread count give the same vectors.'
additionalProperties: false
required:
- kind
- texts
properties:
model:
type: string
minLength: 1
maxLength: 200
pattern: ^[A-Za-z0-9._/-]+$
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`.
kind:
$ref: '#/EmbeddingInputKind'
texts:
type: array
minItems: 1
maxItems: 32
items:
$ref: '#/EmbeddingText'
EmbeddingModel:
type: object
description: The model that produced the vectors. A caller stores these values with every vector and never compares vectors of different models, revisions, or prompt versions.
additionalProperties: false
required:
- id
- revision
- dimension
- max_tokens
- prompt_version
properties:
id:
type: string
minLength: 1
maxLength: 200
pattern: ^[A-Za-z0-9._/-]+$
description: Model repository identifier, for example ai-sage/Giga-Embeddings-instruct-480M-0826.
revision:
type: string
minLength: 1
maxLength: 64
pattern: ^[A-Za-z0-9._-]+$
description: Pinned revision of the weights, a commit hash for a published model.
dimension:
type: integer
format: int32
minimum: 1
maximum: 4096
description: Length of every vector.
max_tokens:
type: integer
format: int32
minimum: 1
maximum: 32768
description: Token limit after which a text is truncated.
prompt_version:
type: string
minLength: 1
maxLength: 64
pattern: ^[a-z0-9._-]+$
description: Version of the prompt and pooling recipe of the service. A change of the query instruction or the pooling changes it.
EmbeddingVector:
type: array
description: L2-normalized vector of one text, in float32 precision. The cosine of two vectors of the same model is their dot product.
minItems: 1
maxItems: 4096
items:
type: number
format: float
EmbeddingResponse:
type: object
description: Vectors in the order of the request texts.
additionalProperties: false
required:
- model
- kind
- vectors
properties:
model:
$ref: '#/EmbeddingModel'
kind:
$ref: '#/EmbeddingInputKind'
vectors:
type: array
minItems: 1
maxItems: 32
items:
$ref: '#/EmbeddingVector'
MLHealthResponse:
type: object
additionalProperties: false
@@ -92,6 +198,8 @@ ProblemCode:
- not_implemented (501): the operation is in the contract but not implemented yet.
- service_unavailable (503): the service cannot serve the request now, for example while a model loads; retry later.
The 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.'
enum:
@@ -115,6 +223,7 @@ ProblemCode:
- rate_limited
- internal
- not_implemented
- service_unavailable
ProblemFieldError:
type: object
description: One reason why a request field or parameter is invalid.
@@ -0,0 +1,127 @@
schemas:
EmbeddingInputKind:
type: string
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.
- query: the side that searches, such as a hiring need or one requirement of it. The service prepends the retrieval instruction of the model.
- document: the side that is searched, such as a candidate card or one item of it. The service adds no prompt.
enum:
- query
- document
EmbeddingText:
type: string
minLength: 1
maxLength: 8000
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.
EmbeddingRequest:
type: object
description: >-
Texts to encode in one call. The service encodes them in a fixed,
deterministic way: texts are ordered by length with the request position
as the tie-breaker, encoded in micro-batches of the configured size, and
returned in request order. The same texts in the same request on the same
image and thread count give the same vectors.
additionalProperties: false
required:
- kind
- texts
properties:
model:
type: string
minLength: 1
maxLength: 200
pattern: "^[A-Za-z0-9._/-]+$"
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`.
kind:
$ref: "#/schemas/EmbeddingInputKind"
texts:
type: array
minItems: 1
maxItems: 32
items:
$ref: "#/schemas/EmbeddingText"
EmbeddingModel:
type: object
description: >-
The model that produced the vectors. A caller stores these values with
every vector and never compares vectors of different models, revisions,
or prompt versions.
additionalProperties: false
required:
- id
- revision
- dimension
- max_tokens
- prompt_version
properties:
id:
type: string
minLength: 1
maxLength: 200
pattern: "^[A-Za-z0-9._/-]+$"
description: Model repository identifier, for example ai-sage/Giga-Embeddings-instruct-480M-0826.
revision:
type: string
minLength: 1
maxLength: 64
pattern: "^[A-Za-z0-9._-]+$"
description: Pinned revision of the weights, a commit hash for a published model.
dimension:
type: integer
format: int32
minimum: 1
maximum: 4096
description: Length of every vector.
max_tokens:
type: integer
format: int32
minimum: 1
maximum: 32768
description: Token limit after which a text is truncated.
prompt_version:
type: string
minLength: 1
maxLength: 64
pattern: "^[a-z0-9._-]+$"
description: >-
Version of the prompt and pooling recipe of the service. A change of
the query instruction or the pooling changes it.
EmbeddingVector:
type: array
description: >-
L2-normalized vector of one text, in float32 precision. The cosine of two
vectors of the same model is their dot product.
minItems: 1
maxItems: 4096
items:
type: number
format: float
EmbeddingResponse:
type: object
description: Vectors in the order of the request texts.
additionalProperties: false
required:
- model
- kind
- vectors
properties:
model:
$ref: "#/schemas/EmbeddingModel"
kind:
$ref: "#/schemas/EmbeddingInputKind"
vectors:
type: array
minItems: 1
maxItems: 32
items:
$ref: "#/schemas/EmbeddingVector"
@@ -86,6 +86,7 @@ schemas:
- rate_limited (429): too many requests; see Retry-After.
- internal (500): unexpected server error.
- not_implemented (501): the operation is in the contract but not implemented yet.
- service_unavailable (503): the service cannot serve the request now, for example while a model loads; retry later.
The 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.
enum:
@@ -109,6 +110,7 @@ schemas:
- rate_limited
- internal
- not_implemented
- service_unavailable
ProblemFieldError:
type: object
description: One reason why a request field or parameter is invalid.