Skip to content

Commit fb010a6

Browse files
committed
precommit
1 parent 37c54c4 commit fb010a6

File tree

1 file changed

+16
-38
lines changed

1 file changed

+16
-38
lines changed

function_calling_fewshots.py

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -93,53 +93,31 @@ def search_database(search_query: str, price_filter: dict | None = None) -> dict
9393
{"role": "system", "content": "You are a product search assistant."},
9494
{"role": "user", "content": "good options for climbing gear that can be used outside?"},
9595
{
96-
"role": "assistant",
97-
"content": None,
98-
"tool_calls": [
99-
{
100-
"id": "call_abc123",
101-
"type": "function",
102-
"function": {
103-
"name": "search_database",
104-
"arguments": '{"search_query":"climbing gear outside"}',
105-
},
106-
}
107-
],
108-
},
109-
{
110-
"role": "tool",
111-
"tool_call_id": "call_abc123",
96+
"id": "madeup",
97+
"call_id": "call_abc123",
11298
"name": "search_database",
113-
"content": '{"results": [{"id": "1", "name": "Climbing Rope", "price": 45.99}, {"id": "2", "name": "Carabiners Set", "price": 25.50}]}',
99+
"arguments": '{"search_query":"climbing gear outside"}',
100+
"type": "function_call",
114101
},
115102
{
116-
"role": "assistant",
117-
"content": "I found some great climbing gear options for outdoor use, including climbing ropes and carabiner sets.",
103+
"id": "madeupoutput",
104+
"call_id": "call_abc123",
105+
"output": "Search results for climbing gear that can be used outside: ...",
106+
"type": "function_call_output",
118107
},
119108
{"role": "user", "content": "are there any shoes less than $50?"},
120109
{
121-
"role": "assistant",
122-
"content": None,
123-
"tool_calls": [
124-
{
125-
"id": "call_abc456",
126-
"type": "function",
127-
"function": {
128-
"name": "search_database",
129-
"arguments": '{"search_query":"shoes","price_filter":{"comparison_operator":"<","value":50}}',
130-
},
131-
}
132-
],
133-
},
134-
{
135-
"role": "tool",
136-
"tool_call_id": "call_abc456",
110+
"id": "madeup",
111+
"call_id": "call_abc456",
137112
"name": "search_database",
138-
"content": '{"results": [{"id": "10", "name": "Trail Running Shoes", "price": 42.00}, {"id": "11", "name": "Approach Shoes", "price": 48.99}]}',
113+
"arguments": '{"search_query":"shoes","price_filter":{"comparison_operator":"<","value":50}}',
114+
"type": "function_call",
139115
},
140116
{
141-
"role": "assistant",
142-
"content": "Yes! I found trail running shoes for $42 and approach shoes for $48.99, both under $50.",
117+
"id": "madeupoutput",
118+
"call_id": "call_abc456",
119+
"output": "Search results for shoes cheaper than 50: ...",
120+
"type": "function_call_output",
143121
},
144122
{"role": "user", "content": "Find me a red shirt under $20."},
145123
]

0 commit comments

Comments
 (0)