Severian commited on
Commit
881e9c1
1 Parent(s): 2fc33a9

Update llm_handler.py

Browse files
Files changed (1) hide show
  1. llm_handler.py +8 -4
llm_handler.py CHANGED
@@ -24,11 +24,15 @@ settings.stream = True
24
 
25
  def send_to_llm(provider, msg_list):
26
  try:
27
-
28
- # Call get_chat_response without the settings parameter
29
- response = agent.get_chat_response(msg_list, llm_sampling_settings=settings)
 
 
 
 
 
30
  return response.content, None # We don't have usage info in this case
31
  except Exception as e:
32
  print(f"Error in send_to_llm: {str(e)}")
33
  return f"Error: {str(e)}", None
34
-
 
24
 
25
  def send_to_llm(provider, msg_list):
26
  try:
27
+ # Convert the msg_list to the correct format expected by the agent
28
+ formatted_messages = [
29
+ {"role": msg["role"], "content": msg["content"]}
30
+ for msg in msg_list
31
+ ]
32
+
33
+ # Call get_chat_response with the formatted messages
34
+ response = agent.get_chat_response(formatted_messages, llm_sampling_settings=settings)
35
  return response.content, None # We don't have usage info in this case
36
  except Exception as e:
37
  print(f"Error in send_to_llm: {str(e)}")
38
  return f"Error: {str(e)}", None