You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/docs/guides/function-calling.md
+24-6Lines changed: 24 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,8 +63,14 @@ tools = [
63
63
64
64
completion_payload = {
65
65
"messages": [
66
-
{"role": "system", "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user."},
67
-
{"role": "user", "content": "Hi, can you tell me the delivery date for my order?"},
66
+
{
67
+
"role": "system",
68
+
"content": 'You have access to the following CUSTOM functions:\n\n<CUSTOM_FUNCTIONS>\n\nIf a you choose to call a function ONLY reply in the following format:\n<{start_tag}={function_name}>{parameters}{end_tag}\nwhere\n\nstart_tag => `<function`\nparameters => a JSON dict with the function argument name as key and function argument value as value.\nend_tag => `</function>`\n\nHere is an example,\n<function=example_function_name>{"example_name": "example_value"}</function>\n\nReminder:\n- Function calls MUST follow the specified format\n- Required parameters MUST be specified\n- You can call one or more functions at a time, but remember only chose correct function\n- Put the entire function call reply on one line\n- Always add your sources when using search results to answer the user query\n- If you can not find correct parameters or arguments corresponding to function in the user\'s message, ask user again to provide, do not make assumptions.\n- No explanation are needed when calling a function.\n\nYou are a helpful assistant.',
69
+
},
70
+
{
71
+
"role": "user",
72
+
"content": "Hi, can you tell me the delivery date for my order?"
73
+
},
68
74
]
69
75
}
70
76
@@ -126,10 +132,22 @@ Once the user provides their order ID:
126
132
```python
127
133
completion_payload = {
128
134
"messages": [
129
-
{"role": "system", "content": "You are a helpful customer support assistant. Use the supplied tools to assist the user."},
130
-
{"role": "user", "content": "Hi, can you tell me the delivery date for my order?"},
131
-
{"role": "assistant", "content": "Of course! Please provide your order ID so I can look it up."},
132
-
{"role": "user", "content": "i think it is order_70705"},
135
+
{
136
+
"role": "system",
137
+
"content": 'You have access to the following CUSTOM functions:\n\n<CUSTOM_FUNCTIONS>\n\nIf a you choose to call a function ONLY reply in the following format:\n<{start_tag}={function_name}>{parameters}{end_tag}\nwhere\n\nstart_tag => `<function`\nparameters => a JSON dict with the function argument name as key and function argument value as value.\nend_tag => `</function>`\n\nHere is an example,\n<function=example_function_name>{"example_name": "example_value"}</function>\n\nReminder:\n- Function calls MUST follow the specified format\n- Required parameters MUST be specified\n- You can call one or more functions at a time, but remember only chose correct function\n- Put the entire function call reply on one line\n- Always add your sources when using search results to answer the user query\n- If you can not find correct parameters or arguments corresponding to function in the user\'s message, ask user again to provide, do not make assumptions.\n- No explanation are needed when calling a function.\n\nYou are a helpful assistant.',
138
+
},
139
+
{
140
+
"role": "user",
141
+
"content": "Hi, can you tell me the delivery date for my order?"
142
+
},
143
+
{
144
+
"role": "assistant",
145
+
"content": "Of course! Please provide your order ID so I can look it up."
0 commit comments