You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/api_tool_indexer/constants.py
+26-4Lines changed: 26 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -30,8 +30,19 @@ class ApiToolIndexerConstants:
30
30
RETRY_DELAY_BASE=2# Exponential backoff base (2^attempt seconds)
31
31
REQUEST_TIMEOUT=60# seconds
32
32
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
+
33
38
# Context Enrichment Template
34
-
# Used to generate a rich semantic context for each endpoint before embedding
39
+
# Full template goes in chunk_prompt; document_prompt is left empty.
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.
35
46
CONTEXT_TEMPLATE="""<document>
36
47
{full_endpoint_info}
37
48
</document>
@@ -44,12 +55,23 @@ class ApiToolIndexerConstants:
44
55
</endpoint>
45
56
46
57
Please generate a rich, detailed context that describes this API endpoint comprehensively for semantic search.
47
-
Include information about:
58
+
Keep the prose context general and country-agnostic. Include information about:
48
59
- What the user wants to accomplish by calling this endpoint
49
60
- Key terms and synonyms for this action
50
61
- Related concepts and use cases
51
62
- Common ways users might ask for this functionality in natural language
52
63
53
-
IMPORTANT: Generate the context 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.
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 language — this is a required machine-readable marker.
65
+
66
+
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.
67
+
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
+
70
+
Example queries:
71
+
- <example question 1>
72
+
- <example question 2>
73
+
- <example question 3>
74
+
- <example question 4>
75
+
- <example question 5>
54
76
55
-
Answer only with the enriched context and nothing else."""
77
+
Answer only with the enriched context and example queries — nothing else."""
0 commit comments