feat: Initialize test-ai-sdk project with Bun
- Add README.md with installation and usage instructions. - Create bun.lock and pnpm-lock.yaml for dependency management. - Implement main functionality in index.ts to test AI providers. - Add opencode.json configuration for various AI providers. - Create package.json to define project dependencies and scripts. - Add TypeScript configuration in tsconfig.json for project setup. - Implement test scripts for different AI providers in src directory.
This commit is contained in:
23
src/test-bailian.ts
Normal file
23
src/test-bailian.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
||||
import { createAnthropic } from '@ai-sdk/anthropic';
|
||||
import { generateText } from 'ai';
|
||||
import 'dotenv/config';
|
||||
|
||||
// 尝试不同的端点配置
|
||||
const bailian = createOpenAICompatible({
|
||||
baseURL: 'https://coding.dashscope.aliyuncs.com/v1',
|
||||
name: 'custom-bailian',
|
||||
apiKey: process.env.BAILIAN_CODE_API_KEY!,
|
||||
});
|
||||
// const bailian = createAnthropic({
|
||||
// baseURL: 'https://coding.dashscope.aliyuncs.com/apps/anthropic/messages',
|
||||
// name: 'custom-bailian',
|
||||
// apiKey: process.env.BAILIAN_CODE_API_KEY!,
|
||||
// });
|
||||
|
||||
const { text } = await generateText({
|
||||
model: bailian('qwen3-coder-plus'),
|
||||
prompt: 'What is an agent?',
|
||||
});
|
||||
|
||||
console.log('Response:', text);
|
||||
Reference in New Issue
Block a user