@just-every/ensemble 0.2.170 → 0.2.171

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.
Files changed (2) hide show
  1. package/README.md +79 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -183,6 +183,85 @@ Key configuration options:
183
183
  - `maxToolCallRoundsPerTurn` - Limits sequential rounds where each round can have multiple parallel tool calls
184
184
  - `modelSettings` - Provider-specific parameters like temperature, max_tokens, etc.
185
185
 
186
+ ### Multimodal Input (Images)
187
+
188
+ For multimodal models, pass content as an array of typed parts. In addition to `input_text` and `input_image`, Ensemble now accepts a simpler `image` part that can take base64 data or a URL.
189
+
190
+ Supported image fields:
191
+ - `type: 'image'`
192
+ - `data`: base64 string **or** full `data:<mime>;base64,...` URL
193
+ - `url`: http(s) URL
194
+ - `file_id`: provider file reference (when supported)
195
+ - `mime_type`: image mime type (recommended when passing raw base64)
196
+ - `detail`: `high` | `low` | `auto` (for providers that support detail hints)
197
+
198
+ ```ts
199
+ import { ensembleRequest } from '@just-every/ensemble';
200
+
201
+ const messages = [
202
+ {
203
+ type: 'message',
204
+ role: 'user',
205
+ content: [
206
+ { type: 'input_text', text: 'Describe this image.' },
207
+ { type: 'image', data: myPngBase64, mime_type: 'image/png' }
208
+ // or: { type: 'image', url: 'https://example.com/cat.png' }
209
+ ],
210
+ },
211
+ ];
212
+
213
+ for await (const event of ensembleRequest(messages, { model: 'gemini-3-flash-preview' })) {
214
+ if (event.type === 'message_complete' && 'content' in event) {
215
+ console.log(event.content);
216
+ }
217
+ }
218
+ ```
219
+
220
+ ### Structured JSON Output
221
+
222
+ Use `modelSettings.json_schema` to request a JSON-only response. The schema is validated by providers that support it.
223
+
224
+ The example below combines **image input** with **JSON output**:
225
+
226
+ ```ts
227
+ import { ensembleRequest, ensembleResult } from '@just-every/ensemble';
228
+
229
+ const agent = {
230
+ model: 'gemini-3-flash-preview',
231
+ modelSettings: {
232
+ max_tokens: 256,
233
+ temperature: 0.2,
234
+ json_schema: {
235
+ name: 'image_analysis',
236
+ type: 'json_schema',
237
+ schema: {
238
+ type: 'object',
239
+ properties: {
240
+ dominant_color: { type: 'string' },
241
+ confidence: { type: 'number' },
242
+ },
243
+ required: ['dominant_color', 'confidence'],
244
+ },
245
+ },
246
+ },
247
+ };
248
+
249
+ const messages = [
250
+ {
251
+ type: 'message',
252
+ role: 'user',
253
+ content: [
254
+ { type: 'input_text', text: 'Analyze this image and return JSON.' },
255
+ { type: 'image', data: myPngBase64, mime_type: 'image/png' },
256
+ ],
257
+ },
258
+ ];
259
+
260
+ const result = await ensembleResult(ensembleRequest(messages, agent));
261
+ const parsed = JSON.parse(result.message);
262
+ console.log(parsed.dominant_color, parsed.confidence);
263
+ ```
264
+
186
265
  ### Advanced Features
187
266
 
188
267
  - **Parallel Tool Execution** - Tools run concurrently by default within each round
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@just-every/ensemble",
3
- "version": "0.2.170",
3
+ "version": "0.2.171",
4
4
  "description": "LLM provider abstraction layer with unified streaming interface",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.cjs",