Skip to content

Commit 0bbc96c

Browse files
committed
fix expressions rendering
1 parent 68b234e commit 0bbc96c

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

index.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,32 @@
99
def handler(event: JsonType, context):
1010
"""
1111
Lambda handler function
12-
Args:
13-
event (JsonType): The AWS Lambda event received by the gateway.
14-
context (Any): The AWS Lambda context object.
15-
1612
"""
1713
# Log the input event for debugging purposes
18-
print("Received event:", json.dumps(event, indent=2))
14+
# print("Received event:", " ".join(json.dumps(event, indent=2).splitlines()))
1915

20-
if "body" not in event:
21-
return {
22-
"statusCode": 400,
23-
"body": "Missing 'body' key in event. Please confirm the key in the json body."
24-
}
25-
body = json.loads(event["body"])
26-
27-
if "message" not in body:
16+
if "body" in event:
17+
try:
18+
event = json.loads(event["body"])
19+
except json.JSONDecodeError:
20+
return {
21+
"statusCode": 400,
22+
"body": "Invalid JSON format in the body or body not found. Please check the input."
23+
}
24+
25+
if "message" not in event:
2826
return {
2927
"statusCode": 400,
3028
"body": "Missing 'message' key in event. Please confirm the key in the json body."
3129
}
32-
if "params" not in body:
30+
if "params" not in event:
3331
return {
3432
"statusCode": 400,
3533
"body": "Missing 'params' key in event. Please confirm the key in the json body. Make sure it contains the necessary conversation_id."
3634
}
3735

38-
message = body["message"]
39-
params = body["params"]
36+
message = event.get("message")
37+
params = event.get("params")
4038

4139
try:
4240
chatbot_response = chat_module(message, params)
@@ -49,7 +47,10 @@ def handler(event: JsonType, context):
4947
# Create a response
5048
response = {
5149
"statusCode": 200,
52-
"body": json.dumps(chatbot_response)
50+
"body": chatbot_response
5351
}
5452

53+
# Log the response for debugging purposes
54+
print("Returning response:", " ".join(json.dumps(response, indent=2).splitlines()))
55+
5556
return response

src/agents/utils/prompt_context_templates.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def format_question_header(
7373
- Description: {content}
7474
{duration_text}
7575
76-
> Note: Mathematical equations are in KaTeX format, preserve them the same. Use British English spellings.
76+
> Note: Mathematical equations are in KaTeX format, preserve them the same. Ensure mathematical equations are surrounded by one '$' for in-line equations and '$$' for block equations.
77+
Example: '$E=mc^2$' or '$$E=mc^2$$'.
78+
Use British English spellings.
7779
7880
---
7981
"""

src/agents/utils/testbench_agents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
STEP 2: Extract the parameters from the JSON
2828
"""
2929
# NOTE: #### This is the testing message!! #####
30-
message = "Hi"
30+
message = "Hi, how do I solve this problem?"
3131
# NOTE: ########################################
3232

3333
# replace "mock" in the message and conversation history with the actual message

0 commit comments

Comments
 (0)