-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyScript.js
29 lines (23 loc) · 840 Bytes
/
myScript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import {getSecret} from 'wix-secrets-backend';
export function test(){
const cohere = require("cohere-ai");
return getSecret("cohere_API_Key").then(async function(product) {
console.log("THE API KEY IS:")
console.log(product)
cohere.init(product);
const response = await cohere.generate({ prompt: 'Once upon a time in a magical land called' });
console.log("THE RESPONSE IS:")
console.log(response)
return(response);
});
}
export function chGenerate(chat){
const cohere = require("cohere-ai");
return getSecret("cohere_API_Key").then(async function(product) {
console.log(product)
cohere.init(product);
const response = await cohere.generate({ prompt: chat, stop_sequences: ["\n"]});
console.log(response)
return(response);
});
}