@blueharford/scrypted-spatial-awareness 0.6.10 → 0.6.11

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/out/plugin.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueharford/scrypted-spatial-awareness",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "description": "Cross-camera object tracking for Scrypted NVR with spatial awareness",
5
5
  "author": "Joshua Seidel <blueharford>",
6
6
  "license": "Apache-2.0",
@@ -154,51 +154,23 @@ export type LlmProvider = 'openai' | 'anthropic' | 'scrypted' | 'unknown';
154
154
 
155
155
  /**
156
156
  * Build image content block for ChatCompletion API
157
- * Supports OpenAI, Anthropic, and @scrypted/llm formats
157
+ *
158
+ * IMPORTANT: @scrypted/llm uses OpenAI-compatible format for ALL providers.
159
+ * The plugin internally converts this format to the appropriate provider format.
160
+ * So we ALWAYS use the OpenAI image_url format with data URI.
161
+ *
158
162
  * @param imageData - Image data with base64 and media type
159
- * @param provider - The LLM provider type
163
+ * @param provider - The LLM provider type (currently unused, kept for logging)
160
164
  */
161
165
  export function buildImageContent(imageData: ImageData, provider: LlmProvider = 'unknown'): any {
162
- if (provider === 'openai') {
163
- // OpenAI format: uses data URL with image_url wrapper
164
- return {
165
- type: 'image_url',
166
- image_url: {
167
- url: `data:${imageData.mediaType};base64,${imageData.base64}`,
168
- detail: 'auto',
169
- },
170
- };
171
- } else if (provider === 'anthropic') {
172
- // Anthropic official format: uses 'data' key
173
- return {
174
- type: 'image',
175
- source: {
176
- type: 'base64',
177
- media_type: imageData.mediaType,
178
- data: imageData.base64,
179
- },
180
- };
181
- } else if (provider === 'scrypted') {
182
- // @scrypted/llm format: uses 'base64' key (per error path .image.source.base64)
183
- return {
184
- type: 'image',
185
- source: {
186
- type: 'base64',
187
- media_type: imageData.mediaType,
188
- base64: imageData.base64,
189
- },
190
- };
191
- } else {
192
- // Unknown provider: try @scrypted/llm format first
193
- return {
194
- type: 'image',
195
- source: {
196
- type: 'base64',
197
- media_type: imageData.mediaType,
198
- base64: imageData.base64,
199
- },
200
- };
201
- }
166
+ // @scrypted/llm uses OpenAI-compatible format for ALL providers
167
+ // The plugin handles internal conversion to Anthropic/other formats
168
+ return {
169
+ type: 'image_url',
170
+ image_url: {
171
+ url: `data:${imageData.mediaType};base64,${imageData.base64}`,
172
+ },
173
+ };
202
174
  }
203
175
 
204
176
  /** Check if an error indicates vision/multimodal content format issue (should try alternate format) */