matt HOFFNER commited on
Commit
74edd3f
·
1 Parent(s): 048048c
Files changed (1) hide show
  1. src/pages/api/stream.js +2 -5
src/pages/api/stream.js CHANGED
@@ -84,11 +84,9 @@ export const LLMStream = async (
84
  }
85
 
86
  const json = JSON.parse(data);
87
- console.log(json);
88
 
89
  if (Array.isArray(json.choices) && json.choices.length > 0) {
90
  const choice = json.choices[0];
91
- console.log(choice);
92
  const delta = choice.delta;
93
 
94
  if (choice.finish_reason === "stop") {
@@ -107,9 +105,8 @@ export const LLMStream = async (
107
 
108
  if (choice.finish_reason === "function_call") {
109
  // function call here using func_call
110
- console.log(func_call.name, choice);
111
- const fn = functions[func_call.name]['googleCustomSearch'];
112
- const funcResult = await fn(JSON.parse(func_call.arguments));
113
  const serpQueue = encoder.encode(JSON.stringify(funcResult));
114
  controller.enqueue(serpQueue);
115
  }
 
84
  }
85
 
86
  const json = JSON.parse(data);
 
87
 
88
  if (Array.isArray(json.choices) && json.choices.length > 0) {
89
  const choice = json.choices[0];
 
90
  const delta = choice.delta;
91
 
92
  if (choice.finish_reason === "stop") {
 
105
 
106
  if (choice.finish_reason === "function_call") {
107
  // function call here using func_call
108
+ const fn = functions[func_call.name][func_call.name];
109
+ const funcResult = await fn(func_call.arguments);
 
110
  const serpQueue = encoder.encode(JSON.stringify(funcResult));
111
  controller.enqueue(serpQueue);
112
  }