Update lib/@randydev/together/qwen-ai.js
Browse files
lib/@randydev/together/qwen-ai.js
CHANGED
@@ -1,23 +1,21 @@
|
|
1 |
import got from 'got';
|
2 |
|
3 |
async function CloudFlareQwenTogether(message, { system_prompt = "" } = {}) {
|
4 |
-
const run = await got.post(`https://api.cloudflare.com/client/v4/accounts/${process.env['ACCOUNT_ID']}/ai/run
|
5 |
headers: {
|
6 |
-
'Authorization':
|
7 |
'Content-Type': 'application/json'
|
8 |
},
|
9 |
json: {
|
10 |
'messages': [
|
11 |
-
|
12 |
-
|
13 |
-
{'role': 'user', 'content': message}
|
14 |
],
|
15 |
'max_tokens': 200,
|
16 |
'stream': false
|
17 |
}
|
18 |
-
});
|
19 |
-
|
20 |
-
return response.result.response;
|
21 |
}
|
22 |
|
23 |
async function AlibabaTogether(message, { system_prompt = "" } = {}) {
|
|
|
1 |
import got from 'got';
|
2 |
|
3 |
async function CloudFlareQwenTogether(message, { system_prompt = "" } = {}) {
|
4 |
+
const run = await got.post(`https://api.cloudflare.com/client/v4/accounts/${process.env['ACCOUNT_ID']}/ai/run/@cf/qwen/qwen1.5-1.8b-chat`, {
|
5 |
headers: {
|
6 |
+
'Authorization': `Bearer ${process.env['CLOUDFLARE_API_KEY']}`,
|
7 |
'Content-Type': 'application/json'
|
8 |
},
|
9 |
json: {
|
10 |
'messages': [
|
11 |
+
{"role": "system", "content": system_prompt},
|
12 |
+
{"role": "user", "content": message}
|
|
|
13 |
],
|
14 |
'max_tokens': 200,
|
15 |
'stream': false
|
16 |
}
|
17 |
+
}).json();
|
18 |
+
return run.result.response;
|
|
|
19 |
}
|
20 |
|
21 |
async function AlibabaTogether(message, { system_prompt = "" } = {}) {
|