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

@@ -22,6 +22,12 @@ export const matchSearchResponseGroupsMainItemPublicContextWorkFormatsOneMax = 3
export const matchSearchResponseGroupsMainItemEvidenceSummaryMax = 12;
export const matchSearchResponseGroupsMainItemSemanticEvidenceItemRequirementTextMax = 300;
export const matchSearchResponseGroupsMainItemSemanticEvidenceItemProjectTitleOneMax = 100;
export const matchSearchResponseGroupsMainItemSemanticEvidenceMax = 12;
export const matchSearchResponseGroupsMainItemComponentsFitMin = 0;
export const matchSearchResponseGroupsMainItemComponentsFitMax = 1;
@@ -62,6 +68,12 @@ export const matchSearchResponseGroupsNearItemPublicContextWorkFormatsOneMax = 3
export const matchSearchResponseGroupsNearItemEvidenceSummaryMax = 12;
export const matchSearchResponseGroupsNearItemSemanticEvidenceItemRequirementTextMax = 300;
export const matchSearchResponseGroupsNearItemSemanticEvidenceItemProjectTitleOneMax = 100;
export const matchSearchResponseGroupsNearItemSemanticEvidenceMax = 12;
export const matchSearchResponseGroupsNearItemComponentsFitMin = 0;
export const matchSearchResponseGroupsNearItemComponentsFitMax = 1;
@@ -102,6 +114,12 @@ export const matchSearchResponseGroupsUnconfirmedItemPublicContextWorkFormatsOne
export const matchSearchResponseGroupsUnconfirmedItemEvidenceSummaryMax = 12;
export const matchSearchResponseGroupsUnconfirmedItemSemanticEvidenceItemRequirementTextMax = 300;
export const matchSearchResponseGroupsUnconfirmedItemSemanticEvidenceItemProjectTitleOneMax = 100;
export const matchSearchResponseGroupsUnconfirmedItemSemanticEvidenceMax = 12;
export const matchSearchResponseGroupsUnconfirmedItemComponentsFitMin = 0;
export const matchSearchResponseGroupsUnconfirmedItemComponentsFitMax = 1;
@@ -156,6 +174,14 @@ export const MatchSearchResponse = zod.object({
"code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'),
"state": zod.enum(['supports', 'partial', 'gap', 'declared_only'])
}).describe('A templated, non-text evidence explanation.')).max(matchSearchResponseGroupsMainItemEvidenceSummaryMax),
"semantic_evidence": zod.array(zod.object({
"requirement_kind": zod.enum(['required_skill', 'desired_skill', 'task']).describe('Kind of the need requirement that an explanation item answers.'),
"requirement_text": zod.string().min(1).max(matchSearchResponseGroupsMainItemSemanticEvidenceItemRequirementTextMax).describe('Confirmed skill name or task text of the need. Plain text; show it as text, never as HTML.'),
"item_kind": zod.enum(['project', 'stack', 'roles']).describe('Kind of the published card item that matched a requirement.\n\n- project: one published project; `project_title` names it.\n- stack: the recognized technology codes of the card.\n- roles: the specializations and grades that the card shows.'),
"project_title": zod.union([zod.string().min(1).max(matchSearchResponseGroupsMainItemSemanticEvidenceItemProjectTitleOneMax),zod.null()]).describe('Published project title for `project`, otherwise null. Plain text; show it as text, never as HTML.'),
"repository_verified": zod.boolean().describe('True only for a project whose linked repository the latest server check found public on GitHub ("backed by a public repository"). It does not prove authorship.'),
"similarity": zod.enum(['high', 'medium']).describe('Coarse band of the cosine similarity between the requirement and the matched item under the versioned policy thresholds. `high` and `medium` are the only values; a weaker similarity produces no item. The band is a computed similarity of two texts, not a judgement of the candidate.')
}).describe('Why the entry is in the result: one confirmed requirement of the need and the published card item with the highest semantic similarity to it. The server computes it from stored vectors and the versioned thresholds; no model writes text into it. `requirement_text` is the confirmed text of the organization\'s own need. `project_title` is the title the candidate published with the `projects` card field and is null for other kinds. No repository address, owner, or fetched repository text is ever part of it.')).max(matchSearchResponseGroupsMainItemSemanticEvidenceMax).describe('Semantic explanation items in a stable order: `high` before `medium`, then by similarity, then by the order of the requirements in the need. At most the versioned per-entry limit is returned. It is empty for a bank search, while vectors are not ready, when ML is unavailable, and when no requirement reaches a band; `unknown_flags` names `ml_unavailable` when the semantic component itself is unknown.'),
"components": zod.object({
"fit": zod.number().min(matchSearchResponseGroupsMainItemComponentsFitMin).max(matchSearchResponseGroupsMainItemComponentsFitMax).describe('A normalized FR09 ranking component from 0 to 1.'),
"coverage": zod.number().min(matchSearchResponseGroupsMainItemComponentsCoverageMin).max(matchSearchResponseGroupsMainItemComponentsCoverageMax).describe('A normalized FR09 ranking component from 0 to 1.'),
@@ -193,6 +219,14 @@ export const MatchSearchResponse = zod.object({
"code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'),
"state": zod.enum(['supports', 'partial', 'gap', 'declared_only'])
}).describe('A templated, non-text evidence explanation.')).max(matchSearchResponseGroupsNearItemEvidenceSummaryMax),
"semantic_evidence": zod.array(zod.object({
"requirement_kind": zod.enum(['required_skill', 'desired_skill', 'task']).describe('Kind of the need requirement that an explanation item answers.'),
"requirement_text": zod.string().min(1).max(matchSearchResponseGroupsNearItemSemanticEvidenceItemRequirementTextMax).describe('Confirmed skill name or task text of the need. Plain text; show it as text, never as HTML.'),
"item_kind": zod.enum(['project', 'stack', 'roles']).describe('Kind of the published card item that matched a requirement.\n\n- project: one published project; `project_title` names it.\n- stack: the recognized technology codes of the card.\n- roles: the specializations and grades that the card shows.'),
"project_title": zod.union([zod.string().min(1).max(matchSearchResponseGroupsNearItemSemanticEvidenceItemProjectTitleOneMax),zod.null()]).describe('Published project title for `project`, otherwise null. Plain text; show it as text, never as HTML.'),
"repository_verified": zod.boolean().describe('True only for a project whose linked repository the latest server check found public on GitHub ("backed by a public repository"). It does not prove authorship.'),
"similarity": zod.enum(['high', 'medium']).describe('Coarse band of the cosine similarity between the requirement and the matched item under the versioned policy thresholds. `high` and `medium` are the only values; a weaker similarity produces no item. The band is a computed similarity of two texts, not a judgement of the candidate.')
}).describe('Why the entry is in the result: one confirmed requirement of the need and the published card item with the highest semantic similarity to it. The server computes it from stored vectors and the versioned thresholds; no model writes text into it. `requirement_text` is the confirmed text of the organization\'s own need. `project_title` is the title the candidate published with the `projects` card field and is null for other kinds. No repository address, owner, or fetched repository text is ever part of it.')).max(matchSearchResponseGroupsNearItemSemanticEvidenceMax).describe('Semantic explanation items in a stable order: `high` before `medium`, then by similarity, then by the order of the requirements in the need. At most the versioned per-entry limit is returned. It is empty for a bank search, while vectors are not ready, when ML is unavailable, and when no requirement reaches a band; `unknown_flags` names `ml_unavailable` when the semantic component itself is unknown.'),
"components": zod.object({
"fit": zod.number().min(matchSearchResponseGroupsNearItemComponentsFitMin).max(matchSearchResponseGroupsNearItemComponentsFitMax).describe('A normalized FR09 ranking component from 0 to 1.'),
"coverage": zod.number().min(matchSearchResponseGroupsNearItemComponentsCoverageMin).max(matchSearchResponseGroupsNearItemComponentsCoverageMax).describe('A normalized FR09 ranking component from 0 to 1.'),
@@ -226,6 +260,14 @@ export const MatchSearchResponse = zod.object({
"code": zod.enum(['confirmed_category', 'required_skill_evidence', 'desired_skill_evidence', 'domain_alignment', 'task_alignment', 'work_conditions_match', 'salary_compatibility', 'declared_grade']).describe('Template code for an explanation derived from allowed evidence. It carries no free text, raw answer, or reason for withheld FSP data.'),
"state": zod.enum(['supports', 'partial', 'gap', 'declared_only'])
}).describe('A templated, non-text evidence explanation.')).max(matchSearchResponseGroupsUnconfirmedItemEvidenceSummaryMax),
"semantic_evidence": zod.array(zod.object({
"requirement_kind": zod.enum(['required_skill', 'desired_skill', 'task']).describe('Kind of the need requirement that an explanation item answers.'),
"requirement_text": zod.string().min(1).max(matchSearchResponseGroupsUnconfirmedItemSemanticEvidenceItemRequirementTextMax).describe('Confirmed skill name or task text of the need. Plain text; show it as text, never as HTML.'),
"item_kind": zod.enum(['project', 'stack', 'roles']).describe('Kind of the published card item that matched a requirement.\n\n- project: one published project; `project_title` names it.\n- stack: the recognized technology codes of the card.\n- roles: the specializations and grades that the card shows.'),
"project_title": zod.union([zod.string().min(1).max(matchSearchResponseGroupsUnconfirmedItemSemanticEvidenceItemProjectTitleOneMax),zod.null()]).describe('Published project title for `project`, otherwise null. Plain text; show it as text, never as HTML.'),
"repository_verified": zod.boolean().describe('True only for a project whose linked repository the latest server check found public on GitHub ("backed by a public repository"). It does not prove authorship.'),
"similarity": zod.enum(['high', 'medium']).describe('Coarse band of the cosine similarity between the requirement and the matched item under the versioned policy thresholds. `high` and `medium` are the only values; a weaker similarity produces no item. The band is a computed similarity of two texts, not a judgement of the candidate.')
}).describe('Why the entry is in the result: one confirmed requirement of the need and the published card item with the highest semantic similarity to it. The server computes it from stored vectors and the versioned thresholds; no model writes text into it. `requirement_text` is the confirmed text of the organization\'s own need. `project_title` is the title the candidate published with the `projects` card field and is null for other kinds. No repository address, owner, or fetched repository text is ever part of it.')).max(matchSearchResponseGroupsUnconfirmedItemSemanticEvidenceMax).describe('Semantic explanation items in a stable order: `high` before `medium`, then by similarity, then by the order of the requirements in the need. At most the versioned per-entry limit is returned. It is empty for a bank search, while vectors are not ready, when ML is unavailable, and when no requirement reaches a band; `unknown_flags` names `ml_unavailable` when the semantic component itself is unknown.'),
"components": zod.object({
"fit": zod.number().min(matchSearchResponseGroupsUnconfirmedItemComponentsFitMin).max(matchSearchResponseGroupsUnconfirmedItemComponentsFitMax).describe('Job fit for this specialization, never an assessment score.'),
"coverage": zod.number().min(matchSearchResponseGroupsUnconfirmedItemComponentsCoverageMin).max(matchSearchResponseGroupsUnconfirmedItemComponentsCoverageMax).describe('Coverage of confirmed need skills by allowed public evidence.')