Spaces:
Paused
Paused
Commit
·
1bb6e90
1
Parent(s):
b37005e
Update src/pages/api/llm.js
Browse files- src/pages/api/llm.js +4 -9
src/pages/api/llm.js
CHANGED
|
@@ -3,28 +3,23 @@ import { LLMError, LLMStream } from './stream';
|
|
| 3 |
|
| 4 |
const handler = async (req) => {
|
| 5 |
try {
|
| 6 |
-
const { question } = (await req.json());
|
| 7 |
-
|
| 8 |
const googleCustomSearch = new GoogleCustomSearch({
|
| 9 |
apiKey: process.env.API_KEY,
|
| 10 |
-
googleCSEId: process.env.CONTEXT_KEY
|
| 11 |
});
|
| 12 |
|
| 13 |
const messages = [
|
| 14 |
{
|
| 15 |
role: "user",
|
| 16 |
-
content: question
|
| 17 |
},
|
| 18 |
];
|
| 19 |
|
| 20 |
const functions = {
|
| 21 |
-
googleCustomSearch
|
| 22 |
};
|
| 23 |
|
| 24 |
-
let promptToSend =
|
| 25 |
-
if (!promptToSend) {
|
| 26 |
-
promptToSend = "";
|
| 27 |
-
}
|
| 28 |
|
| 29 |
let temperatureToUse = temperature;
|
| 30 |
if (temperatureToUse == null) {
|
|
|
|
| 3 |
|
| 4 |
const handler = async (req) => {
|
| 5 |
try {
|
|
|
|
|
|
|
| 6 |
const googleCustomSearch = new GoogleCustomSearch({
|
| 7 |
apiKey: process.env.API_KEY,
|
| 8 |
+
googleCSEId: process.env.CONTEXT_KEY
|
| 9 |
});
|
| 10 |
|
| 11 |
const messages = [
|
| 12 |
{
|
| 13 |
role: "user",
|
| 14 |
+
content: req.query.question
|
| 15 |
},
|
| 16 |
];
|
| 17 |
|
| 18 |
const functions = {
|
| 19 |
+
googleCustomSearch
|
| 20 |
};
|
| 21 |
|
| 22 |
+
let promptToSend = "You are a helpful assistant";
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
let temperatureToUse = temperature;
|
| 25 |
if (temperatureToUse == null) {
|