Niansuh commited on
Commit
99f105b
·
verified ·
1 Parent(s): f732405

Update api/utils.py

Browse files
Files changed (1) hide show
  1. api/utils.py +4 -3
api/utils.py CHANGED
@@ -61,6 +61,7 @@ def message_to_dict(message) -> Dict[str, Any]:
61
 
62
  # Function to retrieve agent modes for a specific model
63
  def get_agent_modes(model: str) -> Dict[str, Any]:
 
64
  agent_mode = AGENT_MODE.get(model, {})
65
  trending_agent_mode = TRENDING_AGENT_MODE.get(model, {})
66
 
@@ -79,7 +80,7 @@ async def process_streaming_response(request: ChatRequest):
79
  chat_id = generate_chat_id()
80
  logger.info(f"Generated Chat ID: {chat_id} - Model: {request.model}")
81
 
82
- # Retrieve agent modes based on the model
83
  agent_modes = get_agent_modes(request.model)
84
  headers = get_headers()
85
 
@@ -107,7 +108,7 @@ async def process_streaming_response(request: ChatRequest):
107
  "visitFromDelta": False,
108
  }
109
 
110
- logger.debug(f"Data Payload: {json_data}") # Inspect payload for accuracy
111
  async with httpx.AsyncClient() as client:
112
  try:
113
  async with client.stream(
@@ -164,7 +165,7 @@ async def process_non_streaming_response(request: ChatRequest):
164
  "visitFromDelta": False,
165
  }
166
 
167
- logger.debug(f"Data Payload: {json_data}") # Inspect payload for accuracy
168
  full_response = ""
169
  async with httpx.AsyncClient() as client:
170
  try:
 
61
 
62
  # Function to retrieve agent modes for a specific model
63
  def get_agent_modes(model: str) -> Dict[str, Any]:
64
+ """Returns specific agent mode configurations for agent models."""
65
  agent_mode = AGENT_MODE.get(model, {})
66
  trending_agent_mode = TRENDING_AGENT_MODE.get(model, {})
67
 
 
80
  chat_id = generate_chat_id()
81
  logger.info(f"Generated Chat ID: {chat_id} - Model: {request.model}")
82
 
83
+ # Check if the model is an agent model and apply corresponding agent modes
84
  agent_modes = get_agent_modes(request.model)
85
  headers = get_headers()
86
 
 
108
  "visitFromDelta": False,
109
  }
110
 
111
+ logger.debug(f"Data Payload for {request.model}: {json_data}") # Inspect payload for accuracy
112
  async with httpx.AsyncClient() as client:
113
  try:
114
  async with client.stream(
 
165
  "visitFromDelta": False,
166
  }
167
 
168
+ logger.debug(f"Data Payload for {request.model}: {json_data}") # Inspect payload for accuracy
169
  full_response = ""
170
  async with httpx.AsyncClient() as client:
171
  try: