Skip to content

Commit 1c16a24

Browse files
committed
Make check case insensitive
1 parent 1a1c612 commit 1c16a24

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

genai/controller/generate_controller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ def generate():
9090
messages (List[Dict]): Full conversation history, each with 'role' and 'content'
9191
Example:
9292
[
93-
{"role": "user", "content": "I have eggs and tomatoes."},
94-
{"role": "assistant", "content": "You could make shakshuka."}
93+
{"role": "USER", "content": "I have eggs and tomatoes."},
94+
{"role": "ASSISTANT", "content": "You could make shakshuka."}
9595
]
9696
9797
Returns:

genai/service/rag_service.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,18 @@ def prepare_prompt(system_prompt: str,
3333

3434
return prompt
3535

36+
3637
def process_raw_messages(raw_messages: List[Dict]) -> List[BaseMessage]:
3738
"""Turns raw messages into BaseMessages, so they can be passed into LLM"""
3839
processed_messages = []
3940
for msg in raw_messages:
4041
role = msg.get("role")
4142
content = msg.get("content")
4243

43-
if role == "user":
44+
if role.upper() == "USER":
4445
processed_messages.append(HumanMessage(content=content))
4546

46-
elif role == "assistant":
47+
elif role.upper() == "ASSISTANT":
4748
processed_messages.append(AIMessage(content=content))
4849

4950
return processed_messages

0 commit comments

Comments
 (0)