带视觉能力的智能体
创建能够处理和分析图像的智能体。
快速开始#
克隆完整示例#
最简单的开始方式是克隆完整的示例仓库:
git clone https://github.com/astreus-ai/examples
cd examples/agent-with-vision
npm install或仅安装包#
如果你更喜欢从零开始构建:
npm install @astreus-ai/astreus环境配置#
# .env
# Vision-capable model API key
OPENAI_API_KEY=sk-your-openai-api-key-here
# Database for agent persistence
DB_URL=sqlite://./astreus.db视觉智能体#
import { Agent } from '@astreus-ai/astreus';
const agent = await Agent.create({
name: 'VisionBot',
model: 'gpt-6-astra',
visionModel: 'gpt-6-astra',
vision: true,
systemPrompt: 'You can analyze and describe images in detail.'
});
// Analyze an image
const result = await agent.ask("Analyze this image and describe what you see", {
attachments: [{
type: 'image',
path: './screenshot.png'
}]
});
console.log(result); // Detailed image analysis运行示例#
如果你克隆了仓库:
npm run dev仓库#
完整示例可在 GitHub 上获取:examples/agent-with-vision