Spaces:
Paused
Paused
matt HOFFNER
commited on
Commit
·
3a7e216
1
Parent(s):
ac5a6cc
debug
Browse files- src/pages/api/llm.js +1 -0
- src/pages/api/stream.js +3 -0
src/pages/api/llm.js
CHANGED
|
@@ -20,6 +20,7 @@ const handler = async (req, res) => {
|
|
| 20 |
const functions = {
|
| 21 |
googleCustomSearch
|
| 22 |
};
|
|
|
|
| 23 |
|
| 24 |
const promptToSend = "You are a helpful assistant, a search term is provided and you are given search results to help provide a useful response.";
|
| 25 |
const stream = await LLMStream({ id: "gpt-3.5-turbo-0613" }, promptToSend, 0.8, messages, functions);
|
|
|
|
| 20 |
const functions = {
|
| 21 |
googleCustomSearch
|
| 22 |
};
|
| 23 |
+
console.log(messages);
|
| 24 |
|
| 25 |
const promptToSend = "You are a helpful assistant, a search term is provided and you are given search results to help provide a useful response.";
|
| 26 |
const stream = await LLMStream({ id: "gpt-3.5-turbo-0613" }, promptToSend, 0.8, messages, functions);
|
src/pages/api/stream.js
CHANGED
|
@@ -80,6 +80,8 @@ export const LLMStream = async (
|
|
| 80 |
controller.close();
|
| 81 |
return;
|
| 82 |
} else if (json.choices[0].finish_reason === "function_call") {
|
|
|
|
|
|
|
| 83 |
const fnName = json.choices[0].message.function_call.name;
|
| 84 |
const args = json.choices[0].message.function_call.arguments;
|
| 85 |
|
|
@@ -88,6 +90,7 @@ export const LLMStream = async (
|
|
| 88 |
|
| 89 |
console.log(`Function call: ${fnName}, Arguments: ${args}`);
|
| 90 |
console.log(`Calling Function ${fnName} Result: ` + result);
|
|
|
|
| 91 |
}
|
| 92 |
const text = json.choices[0].delta.content;
|
| 93 |
const queue = encoder.encode(text);
|
|
|
|
| 80 |
controller.close();
|
| 81 |
return;
|
| 82 |
} else if (json.choices[0].finish_reason === "function_call") {
|
| 83 |
+
console.log(json, 'function');
|
| 84 |
+
/*
|
| 85 |
const fnName = json.choices[0].message.function_call.name;
|
| 86 |
const args = json.choices[0].message.function_call.arguments;
|
| 87 |
|
|
|
|
| 90 |
|
| 91 |
console.log(`Function call: ${fnName}, Arguments: ${args}`);
|
| 92 |
console.log(`Calling Function ${fnName} Result: ` + result);
|
| 93 |
+
*/
|
| 94 |
}
|
| 95 |
const text = json.choices[0].delta.content;
|
| 96 |
const queue = encoder.encode(text);
|