@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.js CHANGED
@@ -5983,6 +5983,23 @@ function toOpenAiToolOutput(value) {
5983
5983
  }
5984
5984
  return mergeToolOutput(value);
5985
5985
  }
5986
+ function toChatGptToolOutput(value) {
5987
+ const toolOutput = toOpenAiToolOutput(value);
5988
+ if (typeof toolOutput === "string") {
5989
+ return toolOutput;
5990
+ }
5991
+ return toolOutput.map((item) => {
5992
+ if (item.type !== "input_image") {
5993
+ return item;
5994
+ }
5995
+ return {
5996
+ type: "input_image",
5997
+ ...item.file_id ? { file_id: item.file_id } : {},
5998
+ ...item.image_url ? { image_url: item.image_url } : {},
5999
+ ...item.detail ? { detail: item.detail } : {}
6000
+ };
6001
+ });
6002
+ }
5986
6003
  function toGeminiToolOutputItems(value) {
5987
6004
  if (isLlmToolOutputContentItem(value)) {
5988
6005
  return [value];
@@ -8667,7 +8684,7 @@ async function runToolLoop(request) {
8667
8684
  toolOutputs.push({
8668
8685
  type: "custom_tool_call_output",
8669
8686
  call_id: entry.ids.callId,
8670
- output: toOpenAiToolOutput(outputPayload)
8687
+ output: toChatGptToolOutput(outputPayload)
8671
8688
  });
8672
8689
  } else {
8673
8690
  toolOutputs.push({
@@ -8681,7 +8698,7 @@ async function runToolLoop(request) {
8681
8698
  toolOutputs.push({
8682
8699
  type: "function_call_output",
8683
8700
  call_id: entry.ids.callId,
8684
- output: toOpenAiToolOutput(outputPayload)
8701
+ output: toChatGptToolOutput(outputPayload)
8685
8702
  });
8686
8703
  }
8687
8704
  }