ビジョンを使ったエージェント

画像を処理・解析できるエージェントを作成します。

クイックスタート#

完全なサンプルをクローンする#

最も簡単な始め方は、完全なサンプルリポジトリをクローンすることです。

bash
git clone https://github.com/astreus-ai/examples
cd examples/agent-with-vision
npm install

またはパッケージのみをインストール#

ゼロから構築したい場合は次のようにします。

bash
npm install @astreus-ai/astreus

環境設定#

bash
# .env
# Vision-capable model API key
OPENAI_API_KEY=sk-your-openai-api-key-here

# Database for agent persistence
DB_URL=sqlite://./astreus.db

ビジョンエージェント#

typescript
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

サンプルの実行#

リポジトリをクローンした場合は次を実行します。

bash
npm run dev

リポジトリ#

完全なサンプルはGitHubで公開されています: examples/agent-with-vision