mirror of
https://github.com/JackChen-me/open-multi-agent.git
synced 2026-10-19 01:29:57 -05:00
DeepSeek retired the V4-Flash model and named the current generation `deepseek-flash`, with no version in the name. `deepseek-v4-flash` is still accepted, but DeepSeek documents it as a temporary compatibility name and already serves those requests from V4.1-Flash. The repository handed that name to users in the places most likely to be copied: the `oma` CLI default for `provider: 'deepseek'`, the adapter JSDoc that ships in the type declarations, the provider table in docs, the scaffolder env template, and every DeepSeek example. A copied name that the vendor calls temporary has an expiry date the reader cannot see. The provider table and the adapter JSDoc also stated that `deepseek-v4-flash` resolves to DeepSeek-V4-Flash-0731. That model is retired, so the sentence described a routing that no longer happens. Two corrections of the same kind travel with it. The thinking-mode note claimed the V4 models run at `high` effort, but the adapter forwards whatever effort the caller passes and sets none itself, so the claim is dropped rather than restated. Three `examples/basics` headers offered `deepseek-chat`, which DeepSeek retired outright on 2026-07-24 and which no longer resolves at all. The release bot moves to the same name. Callers that pass an explicit model are unaffected, and the old name keeps working for as long as DeepSeek accepts it. Left unchanged on purpose: `bench/config.json`, whose values are frozen controls for an already-run benchmark; the AtlasCloud pages, whose IDs come from that vendor's own model library; and the changelog history.
82 lines
2.5 KiB
TypeScript
82 lines
2.5 KiB
TypeScript
/**
|
|
* Structured Multimodal Input
|
|
*
|
|
* Send an image and caller-owned message history through runAgent() without
|
|
* bypassing OMA's hooks, tracing, budgets, progress, or evaluation path.
|
|
*
|
|
* Run:
|
|
* npx tsx packages/core/examples/basics/structured-input.ts ./photo.png
|
|
*
|
|
* Prerequisites:
|
|
* ANTHROPIC_API_KEY env var must be set (default provider). To use any
|
|
* other built-in provider, set OMA_PROVIDER and OMA_MODEL plus that
|
|
* provider's key, for example:
|
|
* OMA_PROVIDER=deepseek OMA_MODEL=deepseek-flash DEEPSEEK_API_KEY=...
|
|
* OMA_PROVIDER=openai OMA_MODEL=gpt-5.4 OPENAI_API_KEY=...
|
|
* The model must accept image input. See docs/providers.md for the full
|
|
* provider and env var list.
|
|
* The image must be PNG, JPEG, GIF, or WebP.
|
|
*/
|
|
|
|
import { readFile } from 'node:fs/promises'
|
|
import { extname } from 'node:path'
|
|
|
|
import { OpenMultiAgent, type LLMMessage, type SupportedProvider } from '../../src/index.js'
|
|
|
|
// Defaults to Claude. Any built-in provider works: set OMA_PROVIDER and
|
|
// OMA_MODEL plus that provider's API key (see docs/providers.md).
|
|
const provider = (process.env.OMA_PROVIDER ?? 'anthropic') as SupportedProvider
|
|
const model = process.env.OMA_MODEL ?? 'claude-sonnet-4-6'
|
|
|
|
const imagePath = process.argv[2]
|
|
if (!imagePath) {
|
|
throw new Error('Pass an image path: npx tsx packages/core/examples/basics/structured-input.ts ./photo.png')
|
|
}
|
|
|
|
const mediaTypes: Readonly<Record<string, string>> = {
|
|
'.gif': 'image/gif',
|
|
'.jpeg': 'image/jpeg',
|
|
'.jpg': 'image/jpeg',
|
|
'.png': 'image/png',
|
|
'.webp': 'image/webp',
|
|
}
|
|
const mediaType = mediaTypes[extname(imagePath).toLowerCase()]
|
|
if (!mediaType) {
|
|
throw new Error('Unsupported image extension. Use PNG, JPEG, GIF, or WebP.')
|
|
}
|
|
|
|
const imageData = (await readFile(imagePath)).toString('base64')
|
|
const messages: LLMMessage[] = [
|
|
{
|
|
role: 'user',
|
|
content: [{ type: 'text', text: 'When I share an image, describe only visible facts.' }],
|
|
},
|
|
{
|
|
role: 'assistant',
|
|
content: [{ type: 'text', text: 'Understood.' }],
|
|
},
|
|
{
|
|
role: 'user',
|
|
content: [
|
|
{ type: 'text', text: 'Describe this image in three concise bullet points.' },
|
|
{
|
|
type: 'image',
|
|
source: {
|
|
type: 'base64',
|
|
media_type: mediaType,
|
|
data: imageData,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
]
|
|
|
|
const oma = new OpenMultiAgent({
|
|
defaultProvider: provider,
|
|
defaultModel: model,
|
|
})
|
|
const result = await oma.runAgent({ name: 'vision-assistant' }, messages)
|
|
|
|
if (!result.success) throw new Error(result.output)
|
|
console.log(result.output)
|