@ljoukov/llm 5.0.0 → 5.0.2

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/index.cjs CHANGED
@@ -6097,6 +6097,23 @@ function toOpenAiToolOutput(value) {
6097
6097
  }
6098
6098
  return mergeToolOutput(value);
6099
6099
  }
6100
+ function toChatGptToolOutput(value) {
6101
+ const toolOutput = toOpenAiToolOutput(value);
6102
+ if (typeof toolOutput === "string") {
6103
+ return toolOutput;
6104
+ }
6105
+ return toolOutput.map((item) => {
6106
+ if (item.type !== "input_image") {
6107
+ return item;
6108
+ }
6109
+ return {
6110
+ type: "input_image",
6111
+ ...item.file_id ? { file_id: item.file_id } : {},
6112
+ ...item.image_url ? { image_url: item.image_url } : {},
6113
+ ...item.detail ? { detail: item.detail } : {}
6114
+ };
6115
+ });
6116
+ }
6100
6117
  function toGeminiToolOutputItems(value) {
6101
6118
  if (isLlmToolOutputContentItem(value)) {
6102
6119
  return [value];
@@ -8781,7 +8798,7 @@ async function runToolLoop(request) {
8781
8798
  toolOutputs.push({
8782
8799
  type: "custom_tool_call_output",
8783
8800
  call_id: entry.ids.callId,
8784
- output: toOpenAiToolOutput(outputPayload)
8801
+ output: toChatGptToolOutput(outputPayload)
8785
8802
  });
8786
8803
  } else {
8787
8804
  toolOutputs.push({
@@ -8795,7 +8812,7 @@ async function runToolLoop(request) {
8795
8812
  toolOutputs.push({
8796
8813
  type: "function_call_output",
8797
8814
  call_id: entry.ids.callId,
8798
- output: toOpenAiToolOutput(outputPayload)
8815
+ output: toChatGptToolOutput(outputPayload)
8799
8816
  });
8800
8817
  }
8801
8818
  }