Skip to content

Commit c5582f8

Browse files
committed
complete semantic searcher evaluation and update to multi point indexing strategy
1 parent 591b119 commit c5582f8

11 files changed

Lines changed: 1854 additions & 739 deletions

File tree

DSL/Ruuter.public/rag-search/POST/api-tools/search.yml

Lines changed: 0 additions & 81 deletions
This file was deleted.

src/api_tool_indexer/constants.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,19 @@ class ApiToolIndexerConstants:
3030
RETRY_DELAY_BASE = 2 # Exponential backoff base (2^attempt seconds)
3131
REQUEST_TIMEOUT = 60 # seconds
3232

33+
# Number of example queries generated per endpoint.
34+
# Each example becomes its own Qdrant point so its vector sits in the exact
35+
# language region of the embedding space, enabling short-query matching.
36+
EXAMPLE_QUERY_COUNT = 5
37+
3338
# Context Enrichment Template
34-
# Mirrors the service workflow (intent_data_enrichment/constants.py).
3539
# Full template goes in chunk_prompt; document_prompt is left empty.
36-
# The LLM summarises the chunk content into a rich semantic context.
40+
#
41+
# Multi-point indexing strategy:
42+
# - Each example query line is extracted and stored as its own Qdrant point,
43+
# embedded from that individual sentence alone.
44+
# - The prose + all examples combined become one summary point.
45+
# All in the same language as the endpoint description — no bilingual duplication.
3746
CONTEXT_TEMPLATE = """<document>
3847
{full_endpoint_info}
3948
</document>
@@ -52,18 +61,17 @@ class ApiToolIndexerConstants:
5261
- Related concepts and use cases
5362
- Common ways users might ask for this functionality in natural language
5463
55-
Then, on a new line, add a section exactly as shown below with 6 to 8 realistic and diverse example questions a real user might ask when they need this endpoint. Cover different phrasings, synonyms, and indirect ways of askingdo not just repeat the description verbatim.
64+
IMPORTANT: Generate the prose context and the example questions in the SAME LANGUAGE as the endpoint description above. However, always use the exact section header "Example queries:" in English regardless of languagethis is a required machine-readable marker.
5665
5766
IMPORTANT for example queries: This is a system built for Estonian government digital services (Bürokratt). Ground the examples in an Estonian context — use Estonian cities (Tallinn, Tartu, Pärnu, Narva), Estonian institutions, and Estonia-relevant scenarios. Only use non-Estonian locations if the endpoint is explicitly about comparing or fetching data for multiple countries.
5867
68+
Then add a section with exactly {example_count} realistic and diverse example questions a real user might ask when they need this endpoint. Cover different phrasings, synonyms, and indirect ways of asking — do not just repeat the description verbatim.
69+
5970
Example queries:
6071
- <example question 1>
6172
- <example question 2>
6273
- <example question 3>
6374
- <example question 4>
6475
- <example question 5>
65-
- <example question 6>
66-
67-
IMPORTANT: Generate everything in the SAME LANGUAGE as the endpoint description above. If the description is in Estonian, respond in Estonian. If in English, respond in English. If in Russian, respond in Russian.
6876
6977
Answer only with the enriched context and example queries — nothing else."""

0 commit comments

Comments
 (0)