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
+14-6Lines changed: 14 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -30,10 +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
-
# Mirrors the service workflow (intent_data_enrichment/constants.py).
35
39
# 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.
37
46
CONTEXT_TEMPLATE="""<document>
38
47
{full_endpoint_info}
39
48
</document>
@@ -52,18 +61,17 @@ class ApiToolIndexerConstants:
52
61
- Related concepts and use cases
53
62
- Common ways users might ask for this functionality in natural language
54
63
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 asking — do 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 language — this is a required machine-readable marker.
56
65
57
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.
58
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
+
59
70
Example queries:
60
71
- <example question 1>
61
72
- <example question 2>
62
73
- <example question 3>
63
74
- <example question 4>
64
75
- <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.
68
76
69
77
Answer only with the enriched context and example queries — nothing else."""
0 commit comments