Daniel00611 commited on
Commit
c244259
·
verified ·
1 Parent(s): de866c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -168,22 +168,25 @@ async def chat(request: ChatRequest):
168
  contexto = obtener_extractos(args["query"])
169
 
170
  # Añadir la respuesta de la tool al historial de mensajes
 
171
  messages.append({
172
  "role": "assistant",
173
  "content": None,
174
- "tool_calls": [{
175
- "id": tool_call.id,
176
- "type": "function",
177
- "function": {
178
- "name": tool_call.function.name,
179
- "arguments": tool_call.function.arguments
 
 
180
  }
181
- }]
182
  })
183
  messages.append({
184
  "role": "tool",
185
- "tool_call_id": tool_call.id,
186
- "name": "obtener_extractos",
187
  "content": contexto
188
  })
189
 
 
168
  contexto = obtener_extractos(args["query"])
169
 
170
  # Añadir la respuesta de la tool al historial de mensajes
171
+ tool_call_id = tool_call.id
172
  messages.append({
173
  "role": "assistant",
174
  "content": None,
175
+ "tool_calls": [
176
+ {
177
+ "id": tool_call_id,
178
+ "type": "function",
179
+ "function": {
180
+ "name": name,
181
+ "arguments": tool_call.function.arguments # debe ser string (JSON serializado)
182
+ }
183
  }
184
+ ]
185
  })
186
  messages.append({
187
  "role": "tool",
188
+ "tool_call_id": tool_call_id,
189
+ "name": name,
190
  "content": contexto
191
  })
192