@zenmux/rosetta-ai 1.0.37 → 1.0.38

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.
@@ -22,6 +22,7 @@ export declare class ChatCompletionToResponsesConverter {
22
22
  private convertReasoningInput;
23
23
  private generateId;
24
24
  private convertAssistantMessage;
25
+ private convertInputText;
25
26
  private convertUserContent;
26
27
  private convertTools;
27
28
  private convertToolChoice;
@@ -39,6 +39,9 @@ class ChatCompletionToResponsesConverter {
39
39
  if (params.prompt_cache_key != null) {
40
40
  result.prompt_cache_key = params.prompt_cache_key;
41
41
  }
42
+ if (params.prompt_cache_options != null) {
43
+ result.prompt_cache_options = params.prompt_cache_options;
44
+ }
42
45
  if (params.prompt_cache_retention != null) {
43
46
  result.prompt_cache_retention = params.prompt_cache_retention;
44
47
  }
@@ -317,7 +320,7 @@ class ChatCompletionToResponsesConverter {
317
320
  input.push({
318
321
  role: msg.role,
319
322
  type: "message",
320
- content: msg.content.map(p => ({ type: "input_text", text: p.text })),
323
+ content: msg.content.map(p => this.convertInputText(p)),
321
324
  });
322
325
  }
323
326
  }
@@ -385,7 +388,7 @@ class ChatCompletionToResponsesConverter {
385
388
  else if (msg.role === "tool") {
386
389
  const output = typeof msg.content === "string"
387
390
  ? msg.content
388
- : msg.content.map(p => ({ type: "input_text", text: p.text }));
391
+ : msg.content.map(p => this.convertInputText(p));
389
392
  input.push({
390
393
  type: toolCallTypes.get(msg.tool_call_id) === "custom"
391
394
  ? "custom_tool_call_output"
@@ -450,7 +453,13 @@ class ChatCompletionToResponsesConverter {
450
453
  if (Array.isArray(content)) {
451
454
  const parts = content.map(part => part.type === "refusal"
452
455
  ? { type: "refusal", refusal: part.refusal }
453
- : { type: "output_text", text: part.text });
456
+ : {
457
+ type: "output_text",
458
+ text: part.text,
459
+ ...(part.prompt_cache_breakpoint != null
460
+ ? { prompt_cache_breakpoint: part.prompt_cache_breakpoint }
461
+ : {}),
462
+ });
454
463
  if (message.refusal != null && !content.some(part => part.type === "refusal")) {
455
464
  parts.push({ type: "refusal", refusal: message.refusal });
456
465
  }
@@ -476,17 +485,29 @@ class ChatCompletionToResponsesConverter {
476
485
  content: "",
477
486
  };
478
487
  }
488
+ convertInputText(part) {
489
+ return {
490
+ type: "input_text",
491
+ text: part.text,
492
+ ...(part.prompt_cache_breakpoint != null
493
+ ? { prompt_cache_breakpoint: part.prompt_cache_breakpoint }
494
+ : {}),
495
+ };
496
+ }
479
497
  convertUserContent(parts) {
480
498
  const content = [];
481
499
  for (const part of parts) {
482
500
  if (part.type === "text") {
483
- content.push({ type: "input_text", text: part.text });
501
+ content.push(this.convertInputText(part));
484
502
  }
485
503
  else if (part.type === "image_url") {
486
504
  content.push({
487
505
  type: "input_image",
488
506
  image_url: part.image_url.url,
489
507
  detail: part.image_url.detail ?? "auto",
508
+ ...(part.prompt_cache_breakpoint != null
509
+ ? { prompt_cache_breakpoint: part.prompt_cache_breakpoint }
510
+ : {}),
490
511
  });
491
512
  }
492
513
  else if (part.type === "file") {
@@ -495,6 +516,9 @@ class ChatCompletionToResponsesConverter {
495
516
  file_data: part.file.file_data,
496
517
  file_id: part.file.file_id,
497
518
  filename: part.file.filename,
519
+ ...(part.prompt_cache_breakpoint != null
520
+ ? { prompt_cache_breakpoint: part.prompt_cache_breakpoint }
521
+ : {}),
498
522
  });
499
523
  }
500
524
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenmux/rosetta-ai",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "Universal translator between AI provider protocols",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",