Skip to content

Commit adf4837

Browse files
committed
chore: force calling getStockPrice
1 parent 6a12ebf commit adf4837

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/src/functions/assistant.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ async function* processQuery(userQuery, context) {
102102
const run = openai.beta.threads.runs.stream(thread.id, {
103103
assistant_id: assistant.id,
104104
stream: true,
105+
tool_choice: { "type": "function", "function": { "name": "getStockPrice" } }
105106
});
106107

107108
context.log('Step 5: Read streamed response', { run });
@@ -126,7 +127,7 @@ async function* processQuery(userQuery, context) {
126127
}
127128

128129
async function* handleRequiresAction(openai, run, runId, threadId, context) {
129-
context.log('Handle Function Calling', {required_action: run.required_action.submit_tool_outputs.tool_calls});
130+
context.log('Handle Function Calling', { required_action: run.required_action.submit_tool_outputs.tool_calls });
130131
try {
131132
const toolOutputs = await Promise.all(
132133
run.required_action.submit_tool_outputs.tool_calls.map(

0 commit comments

Comments
 (0)