diff --git a/src/index.ts b/src/index.ts index d4463f3..f40fca4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1,19 @@ -console.log("Hello, LLM to Agent!"); \ No newline at end of file +import OpenAI from 'openai'; +import 'dotenv/config'; + +const client = new OpenAI({ + apiKey: process.env.OPENAI_API_KEY, + baseURL: process.env.OPENAI_BASE_URL, +}); + +const response = await client.chat.completions.create({ + model: 'deepseek-v4-pro', + messages: [ + { role: 'system', content: '你是一个直爽的编程助手,回答尽量简洁。' }, + { role: 'user', content: '什么是闭包?用一句话解释。' }, + ], + temperature: 0.7, +}); + +const reply = response.choices[0]?.message?.content; +console.log(reply); \ No newline at end of file