@yanickxia/agent-vision 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -11
- package/dist/cli.js +51 -2
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +79 -14
- package/dist/config.js.map +1 -1
- package/dist/generate.d.ts +16 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +167 -0
- package/dist/generate.js.map +1 -0
- package/dist/generation-provider.d.ts +24 -0
- package/dist/generation-provider.d.ts.map +1 -0
- package/dist/generation-provider.js +101 -0
- package/dist/generation-provider.js.map +1 -0
- package/dist/image.d.ts +1 -0
- package/dist/image.d.ts.map +1 -1
- package/dist/image.js +1 -1
- package/dist/image.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +36 -1
- package/dist/server.js.map +1 -1
- package/package.json +3 -2
- package/skills/agent-vision/SKILL.md +51 -8
- package/skills/agent-vision/references/configuration.md +107 -5
|
@@ -27,12 +27,20 @@ The first location that exists wins:
|
|
|
27
27
|
"models": ["gpt-4o"]
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
|
+
"generationProviders": [
|
|
31
|
+
{
|
|
32
|
+
"name": "image-api",
|
|
33
|
+
"baseUrl": "https://your-image-api.example/v1",
|
|
34
|
+
"apiKey": "sk-...",
|
|
35
|
+
"models": ["your-image-generation-model"]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
30
38
|
"maxTokens": 4096,
|
|
31
39
|
"timeoutMs": 120000
|
|
32
40
|
}
|
|
33
41
|
```
|
|
34
42
|
|
|
35
|
-
-
|
|
43
|
+
- Each vision provider (`providers`) × model combination is a target. With several targets, all
|
|
36
44
|
of them are requested **concurrently** and the first successful answer
|
|
37
45
|
wins; the remaining requests are aborted. Note the cost: N targets means
|
|
38
46
|
up to N paid completions per analysis.
|
|
@@ -47,9 +55,65 @@ The first location that exists wins:
|
|
|
47
55
|
- The file may contain API keys: keep it out of version control and run
|
|
48
56
|
`chmod 600` on it.
|
|
49
57
|
|
|
58
|
+
## Image generation
|
|
59
|
+
|
|
60
|
+
`generationProviders` uses the same connection fields as `providers`:
|
|
61
|
+
required `baseUrl` and non-empty `models`, optional `name`, `apiKey`, and
|
|
62
|
+
`headers`, plus a generation-only `type`: `openai-images` (default for old
|
|
63
|
+
configs) or `volcengine-ark`. Unknown types are rejected; protocol selection
|
|
64
|
+
is explicit, not inferred from the hostname or model name. You may configure
|
|
65
|
+
either capability alone or both in one file. Both adapters use synchronous
|
|
66
|
+
`POST /images/generations` responses with `data[0].b64_json` or `data[0].url`.
|
|
67
|
+
|
|
68
|
+
Generation targets are tried **sequentially in file order**, stopping at the
|
|
69
|
+
first valid image. They are not raced because multiple successful generations
|
|
70
|
+
would waste money. Failure fallback can still incur multiple charges, especially
|
|
71
|
+
after timeouts. Configure one target to avoid automatic fallback.
|
|
72
|
+
|
|
73
|
+
Each call requests one image. `size` is optional; `quality` is optional and
|
|
74
|
+
only supported by `openai-images`. Omitting them keeps provider defaults.
|
|
75
|
+
The OpenAI adapter omits `response_format`, because some models reject it.
|
|
76
|
+
This supports text-to-image, not image edits or async jobs.
|
|
77
|
+
|
|
78
|
+
Generation shares `timeoutMs`, `maxImageMb`, `headers`, and `allowPrivateUrls`
|
|
79
|
+
with analysis. Increase `timeoutMs` for slower generation models. API-returned
|
|
80
|
+
image URLs and redirects are subject to the same private-URL restrictions as
|
|
81
|
+
input images; API credentials are not forwarded to the download host.
|
|
82
|
+
|
|
83
|
+
### Volcengine Ark (Seedream)
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"generationProviders": [
|
|
88
|
+
{
|
|
89
|
+
"type": "volcengine-ark",
|
|
90
|
+
"name": "volcengine",
|
|
91
|
+
"baseUrl": "https://ark.cn-beijing.volces.com/api/v3",
|
|
92
|
+
"models": ["doubao-seedream-5-0-lite-260128"]
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Supply a provider `apiKey`, or set `ARK_API_KEY`; an explicit
|
|
99
|
+
`AGENT_VISION_GENERATION_API_KEY` overrides the latter. Model IDs must be
|
|
100
|
+
enabled for the account; `ep-...` IDs pointing to image models also work.
|
|
101
|
+
|
|
102
|
+
The Ark adapter requests `response_format: "b64_json"` (still accepts URL
|
|
103
|
+
responses), never sends OpenAI's `n` or `quality`, and uses the server's
|
|
104
|
+
single-image/non-streaming defaults. It omits model-specific group/stream flags
|
|
105
|
+
so the same payload also works for opaque endpoint IDs. Watermark and output
|
|
106
|
+
format remain at provider defaults. `--quality` is rejected before the request;
|
|
107
|
+
use a supported `--size`, such as `2K`, or leave it unset. Images commonly use
|
|
108
|
+
JPEG; choosing a `.png` filename does not convert the bytes.
|
|
109
|
+
|
|
110
|
+
This is the [Ark Seedream API](https://ark.volcengine.com/region:cn-beijing/docs/image-generation-api.md),
|
|
111
|
+
not the separate Volcengine Visual Intelligence/Jimeng AK/SK-signed API.
|
|
112
|
+
Image editing, image groups and layer decomposition are not implemented.
|
|
113
|
+
|
|
50
114
|
## Environment variables (fallback)
|
|
51
115
|
|
|
52
|
-
|
|
116
|
+
For image/video understanding when no settings file providers are used:
|
|
53
117
|
|
|
54
118
|
```bash
|
|
55
119
|
export AGENT_VISION_BASE_URL="https://your-openai-compatible-endpoint/v1"
|
|
@@ -61,15 +125,53 @@ export AGENT_VISION_MODEL="your-vision-model"
|
|
|
61
125
|
not require authentication. The server also recognizes `VISION_*` and
|
|
62
126
|
`OPENAI_*` aliases.
|
|
63
127
|
|
|
128
|
+
For generation when no `generationProviders` are defined:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
export AGENT_VISION_GENERATION_BASE_URL="https://your-image-api.example/v1"
|
|
132
|
+
export AGENT_VISION_GENERATION_API_KEY="your-key"
|
|
133
|
+
export AGENT_VISION_GENERATION_MODEL="your-image-generation-model"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`AGENT_VISION_GENERATION_TYPE` defaults to `openai-images`. In that mode, the
|
|
137
|
+
generation URL and key fall back to the corresponding `AGENT_VISION_*` values
|
|
138
|
+
and their aliases. With `volcengine-ark`, the URL defaults to
|
|
139
|
+
`https://ark.cn-beijing.volces.com/api/v3` and the key falls back to `ARK_API_KEY`;
|
|
140
|
+
neither inherits the vision/OpenAI URL or key, to avoid sending another
|
|
141
|
+
provider's credentials to Ark. Explicit `AGENT_VISION_GENERATION_BASE_URL` and
|
|
142
|
+
`AGENT_VISION_GENERATION_API_KEY` override these defaults.
|
|
143
|
+
|
|
144
|
+
For an environment-only Ark setup:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
export AGENT_VISION_GENERATION_TYPE="volcengine-ark"
|
|
148
|
+
export AGENT_VISION_GENERATION_MODEL="doubao-seedream-5-0-lite-260128"
|
|
149
|
+
export ARK_API_KEY="your-ark-key"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The generation model must be explicit: it never falls back to a vision/chat
|
|
153
|
+
model. File provider keys use their own type's fallback; an explicit
|
|
154
|
+
`"apiKey": ""` disables key fallback for an unauthenticated local provider.
|
|
155
|
+
File providers default to `openai-images` independently of the environment's
|
|
156
|
+
generation type.
|
|
157
|
+
|
|
158
|
+
`AGENT_VISION_GENERATION_HEADERS` adds generation-only headers. Header precedence
|
|
159
|
+
(last wins): `AGENT_VISION_HEADERS` → `AGENT_VISION_GENERATION_HEADERS` →
|
|
160
|
+
file top-level `headers` → provider `headers`. File `generationProviders` take
|
|
161
|
+
precedence over the environment's generation target.
|
|
162
|
+
|
|
64
163
|
Optional variables:
|
|
65
164
|
|
|
66
165
|
- `AGENT_VISION_MAX_TOKENS` (default `4096`)
|
|
67
166
|
- `AGENT_VISION_TIMEOUT_MS` (default `120000`)
|
|
68
|
-
- `AGENT_VISION_MAX_IMAGE_MB` (default `20
|
|
167
|
+
- `AGENT_VISION_MAX_IMAGE_MB` (default `20`, also applies to generated images)
|
|
69
168
|
- `AGENT_VISION_MAX_VIDEO_MB` (default `200`)
|
|
70
169
|
- `AGENT_VISION_HEADERS` (JSON object of extra HTTP headers)
|
|
71
|
-
- `AGENT_VISION_ALLOW_PRIVATE_URLS=true` (allow private image
|
|
170
|
+
- `AGENT_VISION_ALLOW_PRIVATE_URLS=true` (allow private input and generated-image URLs)
|
|
72
171
|
- `AGENT_VISION_FFMPEG_PATH` (override ffmpeg; otherwise PATH, then bundled binary)
|
|
73
172
|
|
|
74
173
|
The configured API endpoint itself may be private; the private-URL guard only
|
|
75
|
-
applies to
|
|
174
|
+
applies to image/video source URLs and API-returned generated-image URLs.
|
|
175
|
+
|
|
176
|
+
`agent-vision doctor` lists both capabilities without sending API requests.
|
|
177
|
+
Generation-only setups do not need a vision target or ffmpeg.
|