sensorium-mcp 2.16.103 → 2.16.105
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/dist/integrations/openai/vision.d.ts +1 -10
- package/dist/integrations/openai/vision.d.ts.map +1 -1
- package/dist/integrations/openai/vision.js +1 -54
- package/dist/integrations/openai/vision.js.map +1 -1
- package/dist/openai.d.ts +1 -1
- package/dist/openai.d.ts.map +1 -1
- package/dist/openai.js +2 -2
- package/dist/openai.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenAI vision services:
|
|
2
|
+
* OpenAI vision services: video frame analysis (GPT-4o-mini).
|
|
3
3
|
*
|
|
4
4
|
* Extracted from openai.ts for modular decomposition (Phase 3C).
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* Analyze an image using GPT-4o vision capability.
|
|
8
|
-
* Sends the image as base64 with a text prompt and returns the analysis.
|
|
9
|
-
* @param imageBuffer Raw image content (JPEG, PNG, etc.).
|
|
10
|
-
* @param prompt The analysis prompt to send alongside the image.
|
|
11
|
-
* @param apiKey OpenAI API key.
|
|
12
|
-
* @returns The vision model's text response.
|
|
13
|
-
*/
|
|
14
|
-
export declare function analyzeImage(imageBuffer: Buffer, prompt: string, apiKey: string): Promise<string>;
|
|
15
6
|
/**
|
|
16
7
|
* Analyze video frames using OpenAI GPT-4o-mini vision.
|
|
17
8
|
* @param frames Array of JPEG frame buffers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vision.d.ts","sourceRoot":"","sources":["../../../src/integrations/openai/vision.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH
|
|
1
|
+
{"version":3,"file":"vision.d.ts","sourceRoot":"","sources":["../../../src/integrations/openai/vision.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,MAAM,EAAE,EAChB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CA0DjB"}
|
|
@@ -1,62 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenAI vision services:
|
|
2
|
+
* OpenAI vision services: video frame analysis (GPT-4o-mini).
|
|
3
3
|
*
|
|
4
4
|
* Extracted from openai.ts for modular decomposition (Phase 3C).
|
|
5
5
|
*/
|
|
6
6
|
import { MAX_FRAMES } from "./video.js";
|
|
7
|
-
// ─── Image / Vision Analysis ──────────────────────────────────────────────
|
|
8
|
-
/**
|
|
9
|
-
* Analyze an image using GPT-4o vision capability.
|
|
10
|
-
* Sends the image as base64 with a text prompt and returns the analysis.
|
|
11
|
-
* @param imageBuffer Raw image content (JPEG, PNG, etc.).
|
|
12
|
-
* @param prompt The analysis prompt to send alongside the image.
|
|
13
|
-
* @param apiKey OpenAI API key.
|
|
14
|
-
* @returns The vision model's text response.
|
|
15
|
-
*/
|
|
16
|
-
export async function analyzeImage(imageBuffer, prompt, apiKey) {
|
|
17
|
-
const base64 = imageBuffer.toString("base64");
|
|
18
|
-
const controller = new AbortController();
|
|
19
|
-
const timer = setTimeout(() => controller.abort(), 30_000);
|
|
20
|
-
try {
|
|
21
|
-
const response = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
22
|
-
method: "POST",
|
|
23
|
-
headers: {
|
|
24
|
-
"Content-Type": "application/json",
|
|
25
|
-
Authorization: `Bearer ${apiKey}`,
|
|
26
|
-
},
|
|
27
|
-
body: JSON.stringify({
|
|
28
|
-
model: "gpt-4o",
|
|
29
|
-
messages: [
|
|
30
|
-
{
|
|
31
|
-
role: "user",
|
|
32
|
-
content: [
|
|
33
|
-
{ type: "text", text: prompt },
|
|
34
|
-
{
|
|
35
|
-
type: "image_url",
|
|
36
|
-
image_url: {
|
|
37
|
-
url: `data:image/jpeg;base64,${base64}`,
|
|
38
|
-
detail: "low",
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
max_completion_tokens: 150,
|
|
45
|
-
temperature: 0,
|
|
46
|
-
}),
|
|
47
|
-
signal: controller.signal,
|
|
48
|
-
});
|
|
49
|
-
if (!response.ok) {
|
|
50
|
-
const errText = await response.text().catch(() => response.statusText);
|
|
51
|
-
throw new Error(`OpenAI vision analysis failed: ${response.status} ${errText}`);
|
|
52
|
-
}
|
|
53
|
-
const json = await response.json();
|
|
54
|
-
return json.choices?.[0]?.message?.content?.trim() ?? "";
|
|
55
|
-
}
|
|
56
|
-
finally {
|
|
57
|
-
clearTimeout(timer);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
7
|
// ─── Video Frame Vision Analysis ──────────────────────────────────────────
|
|
61
8
|
/**
|
|
62
9
|
* Analyze video frames using OpenAI GPT-4o-mini vision.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vision.js","sourceRoot":"","sources":["../../../src/integrations/openai/vision.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,6EAA6E;AAE7E
|
|
1
|
+
{"version":3,"file":"vision.js","sourceRoot":"","sources":["../../../src/integrations/openai/vision.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,6EAA6E;AAE7E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACpC,MAAgB,EAChB,WAAmB,EACnB,MAAc;IAEd,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,+CAA+C,CAAC;IAC3D,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,MAAM,CAAC,GA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CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACvE,MAAM,IAAI,KAAK,CAAC,kCAAkC,QAAQ,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC,CAAC;QACpF,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAEpC,CAAC;QACF,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,4BAA4B,CAAC;IACzF,CAAC;YAAS,CAAC;QACP,YAAY,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;AACL,CAAC"}
|
package/dist/openai.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ export { TTS_VOICES, type TTSVoice, textToSpeech, transcribeAudio } from "./inte
|
|
|
10
10
|
export { analyzeVoiceEmotion } from "./integrations/openai/voice-emotion.js";
|
|
11
11
|
export type { AudioEvent, Paralinguistics, VoiceAnalysisResult } from "./integrations/openai/voice-emotion.js";
|
|
12
12
|
export { extractVideoFrames } from "./integrations/openai/video.js";
|
|
13
|
-
export {
|
|
13
|
+
export { analyzeVideoFrames } from "./integrations/openai/vision.js";
|
|
14
14
|
//# sourceMappingURL=openai.d.ts.map
|
package/dist/openai.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../src/openai.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACpG,YAAY,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAG3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAG/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../src/openai.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACpG,YAAY,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAG3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAG/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/openai.js
CHANGED
|
@@ -12,6 +12,6 @@ export { TTS_VOICES, textToSpeech, transcribeAudio } from "./integrations/openai
|
|
|
12
12
|
export { analyzeVoiceEmotion } from "./integrations/openai/voice-emotion.js";
|
|
13
13
|
// Re-export video frame extraction
|
|
14
14
|
export { extractVideoFrames } from "./integrations/openai/video.js";
|
|
15
|
-
// Re-export vision analysis (
|
|
16
|
-
export {
|
|
15
|
+
// Re-export vision analysis (video frame analysis)
|
|
16
|
+
export { analyzeVideoFrames } from "./integrations/openai/vision.js";
|
|
17
17
|
//# sourceMappingURL=openai.js.map
|
package/dist/openai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../src/openai.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,kDAAkD;AAClD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGpG,gCAAgC;AAChC,OAAO,EAAE,UAAU,EAAiB,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAE3G,mCAAmC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAG7E,mCAAmC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,
|
|
1
|
+
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../src/openai.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,kDAAkD;AAClD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGpG,gCAAgC;AAChC,OAAO,EAAE,UAAU,EAAiB,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAE3G,mCAAmC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAG7E,mCAAmC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,mDAAmD;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC"}
|