UNPKG

dart-openai-sdk

Version:

OpenAI api-reference sdk

30 lines (21 loc) 1.35 kB
'use strict' import OpenAI from './index.js'; const AI = new OpenAI('Your API KEY', 'Your Organization'); (async () => { // let res = await AI.models(); // console.log(JSON.stringify(res, null, 2)); // let res1 = await AI.retrieveModel('text-search-ada-doc-001'); // console.log(JSON.stringify(res1, null, 2)); // let response = await AI.chat('帮我写一篇修仙小说的修炼等级说明', '1'); // console.log(JSON.stringify(response, null, 2)); // let response1 = await AI.chat('帮我完善更高的等级说明', '1'); // console.log(JSON.stringify(response1, null, 2)); // let response3 = await AI.chat('帮我完善功法的说明', '1'); // console.log(JSON.stringify(response3, null, 2)); // let response2 = await AI.image('Female wearing cybernetic exoskeleton character design, concept design sheet, white background, style of yoji shinkawa', '1', 1, '512x512', 'url'); // console.log(JSON.stringify(response2, null, 2)); // let response6 = await AI.chatByStream('请用一个字回答 1+1的答案', '1'); // console.log(JSON.stringify(response6, null, 2)); // let response5 = await AI.chatByStream('我是一名Java开发工程师的求职者,请帮我优化简历: ' + s, '1'); // console.log(JSON.stringify(response5, null, 2)); })();