Skip to content

Commit ce6e31f

Browse files
committed
Function calling es fix
1 parent a680c01 commit ce6e31f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

spanish/function_calling_call.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,11 @@ def lookup_weather(city_name=None, zip_code=None):
7474
tool_choice="auto",
7575
)
7676

77-
print(f"Respuesta de {API_HOST}: \n")
78-
print(response.choices[0].message.tool_calls[0].function.name)
79-
print(response.choices[0].message.tool_calls[0].function.arguments)
80-
77+
print(f"Respuesta de {MODEL_NAME} en {API_HOST}: \n")
8178

8279
if response.choices[0].message.tool_calls:
83-
function_name = response.choices[0].message.tool_calls[0].function.name
84-
arguments = json.loads(response.choices[0].message.tool_calls[0].function.arguments)
80+
tool_call = response.choices[0].message.tool_calls[0]
81+
function_name = tool_call.function.name
82+
arguments = json.loads(tool_call.function.arguments)
8583
if function_name == "lookup_weather":
8684
lookup_weather(**arguments)

0 commit comments

Comments
 (0)