randydev commited on
Commit
b486d09
·
verified ·
1 Parent(s): 10e1d3f

Create qwen-ai.js

Browse files
Files changed (1) hide show
  1. lib/@randydev/together/qwen-ai.js +20 -0
lib/@randydev/together/qwen-ai.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import got from 'got';
2
+
3
+ async function AlibabaTogether(message, { system_prompt = "" } = {}) {
4
+ const response = await got.post('https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions', {
5
+ headers: {
6
+ 'Authorization': 'Bearer ' + process.env['ALIBABA_API_KEY'],
7
+ 'Content-Type': 'application/json'
8
+ },
9
+ json: {
10
+ 'model': 'qwen-plus',
11
+ 'messages': [
12
+ {"role": "system", "content": system_prompt},
13
+
14
+ {'role': 'user', 'content': message}
15
+ ],
16
+ }
17
+ }).json();
18
+ return response.choices[0].message.content;
19
+ }
20
+ export { AlibabaTogether };