samsar-js 0.48.5 → 0.48.6

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 CHANGED
@@ -115,6 +115,21 @@ const assistant = await samsar.createAssistantCompletion({
115
115
  });
116
116
  console.log(assistant.data.output_text);
117
117
 
118
+ // Generate an image in the assistant response using the OpenAI-compatible image_generation tool
119
+ const assistantImage = await samsar.createAssistantCompletion({
120
+ session_id: videoFromImages.data.session_id ?? videoFromImages.data.request_id!,
121
+ input: 'Create a clean launch poster image for this session.',
122
+ tools: [{ type: 'image_generation', size: '1024x1024', quality: 'high' }],
123
+ tool_choice: { type: 'image_generation' },
124
+ });
125
+ const generatedImage = assistantImage.data.output?.find(
126
+ (item) => item.type === 'image_generation_call' && typeof item.result === 'string',
127
+ );
128
+ console.log(generatedImage?.result); // base64 image payload
129
+
130
+ // Continue the same multimodal assistant thread by reusing the same session_id.
131
+ // Samsar preserves the underlying OpenAI response chain for follow-up image edits.
132
+
118
133
  // Create embeddings from a JSON array
119
134
  const embedding = await samsar.createEmbedding({
120
135
  name: 'listings',
package/dist/index.d.ts CHANGED
@@ -316,6 +316,22 @@ export interface AssistantReasoningConfig {
316
316
  effort?: 'low' | 'medium' | 'high' | string;
317
317
  [key: string]: unknown;
318
318
  }
319
+ export interface AssistantImageGenerationTool {
320
+ type: 'image_generation';
321
+ size?: string;
322
+ quality?: 'auto' | 'low' | 'medium' | 'high' | string;
323
+ format?: 'png' | 'jpeg' | 'webp' | string;
324
+ background?: 'auto' | 'transparent' | 'opaque' | string;
325
+ compression?: number;
326
+ partial_images?: number;
327
+ action?: 'auto' | 'generate' | 'edit' | string;
328
+ [key: string]: unknown;
329
+ }
330
+ export type AssistantToolDefinition = AssistantImageGenerationTool | Record<string, unknown>;
331
+ export type AssistantToolChoice = 'auto' | 'none' | 'required' | {
332
+ type?: string;
333
+ [key: string]: unknown;
334
+ } | Record<string, unknown>;
319
335
  export interface AssistantSetSystemPromptRequest {
320
336
  system_prompt?: string | null;
321
337
  systemPrompt?: string | null;
@@ -332,6 +348,8 @@ export interface AssistantCompletionRequest {
332
348
  session_id?: string;
333
349
  sessionId?: string;
334
350
  id?: string;
351
+ previous_response_id?: string;
352
+ previousResponseId?: string;
335
353
  input?: string | AssistantInputMessage | AssistantInputMessage[] | AssistantInputContentItem[];
336
354
  message?: string | AssistantInputMessage | AssistantInputMessage[] | AssistantInputContentItem[];
337
355
  messages?: AssistantInputMessage[];
@@ -343,8 +361,8 @@ export interface AssistantCompletionRequest {
343
361
  metadata?: Record<string, unknown>;
344
362
  user?: string;
345
363
  text?: Record<string, unknown>;
346
- tools?: unknown[];
347
- tool_choice?: unknown;
364
+ tools?: AssistantToolDefinition[];
365
+ tool_choice?: AssistantToolChoice;
348
366
  parallel_tool_calls?: boolean;
349
367
  reasoning?: AssistantReasoningConfig;
350
368
  reasoning_effort?: 'low' | 'medium' | 'high' | string;
@@ -361,6 +379,9 @@ export interface AssistantResponseOutputItem {
361
379
  type?: string;
362
380
  role?: string;
363
381
  content?: AssistantResponseContentItem[];
382
+ status?: string;
383
+ revised_prompt?: string;
384
+ result?: string;
364
385
  [key: string]: unknown;
365
386
  }
366
387
  export interface AssistantCompletionResponse {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "samsar-js",
3
- "version": "0.48.5",
3
+ "version": "0.48.6",
4
4
  "description": "TypeScript client for the Samsar Processor API routes.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",