Skip to content

Commit c054e4f

Browse files
committed
Update prompt ending to prevent verbose responses
1 parent d77f549 commit c054e4f

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

packages/slackBotFunction/query_reformulator.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# flake8: noqa: E501
12
import os
23
import json
34
import boto3
@@ -14,21 +15,22 @@ def reformulate_query(user_query: str) -> str:
1415
client = boto3.client("bedrock-runtime", region_name=os.environ["AWS_REGION"])
1516
model_id = os.environ["QUERY_REFORMULATION_MODEL_ID"]
1617

17-
prompt = f"""You are a query reformulation assistant for the NHS EPS API documentation system.
18+
prompt = f"""You are a query reformulation assistant for the NHS EPS (Electronic Prescription Service) API documentation system.
1819
19-
Reformulate user queries to improve retrieval from a knowledge base containing FHIR NHS EPS API documentation.
20+
Your task is to reformulate user queries to improve retrieval from a knowledge base containing FHIR NHS EPS API documentation, onboarding guides, and technical specifications.
2021
21-
Guidelines:
22-
- Expand abbreviations (EPS = Electronic Prescription Service, FHIR = Fast Healthcare Interoperability Resources)
23-
- Add relevant technical context (API, prescription, dispensing, healthcare)
24-
- Convert casual language to technical terminology
25-
- Include synonyms for better matching
26-
- Keep the core intent intact
27-
- Focus on NHS, healthcare, prescription, and API-related terms
22+
Guidelines:
23+
- Expand abbreviations (EPS = Electronic Prescription Service, FHIR = Fast Healthcare Interoperability Resources)
24+
- Add relevant technical context (API, prescription, dispensing, healthcare)
25+
- Convert casual language to technical terminology
26+
- Include synonyms for better matching
27+
- Keep the core intent intact
28+
- Focus on NHS, healthcare, prescription, and API-related terms
29+
- Maintain question format with proper punctuation
2830
29-
User Query: {user_query}
31+
User Query: {user_query}
3032
31-
Reformulated Query:"""
33+
Return only the reformulated query as a complete question:"""
3234

3335
response = client.invoke_model(
3436
modelId=model_id,

0 commit comments

Comments
 (0)