randydev commited on
Commit
3e97dd2
·
verified ·
1 Parent(s): 8aef4b8

Update lib/@randydev/together/qwen-ai.js

Browse files
Files changed (1) hide show
  1. lib/@randydev/together/qwen-ai.js +6 -8
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': 'Bearer ' + process.env['CLOUDFLARE_API_KEY'],
7
  'Content-Type': 'application/json'
8
  },
9
  json: {
10
  'messages': [
11
- {"role": "system", "content": system_prompt},
12
-
13
- {'role': 'user', 'content': message}
14
  ],
15
  'max_tokens': 200,
16
  'stream': false
17
  }
18
- });
19
- const response = run("@cf/qwen/qwen1.5-1.8b-chat").json();
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 = "" } = {}) {