promptfoo 0.125.0 → 0.125.1
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 +3 -3
- package/dist/src/accounts-BOxNYxVN.js +229 -0
- package/dist/src/accounts-BezXLdAW.cjs +276 -0
- package/dist/src/accounts-CPISMNlh.js +227 -0
- package/dist/src/accounts-vJBPs89d.js +222 -0
- package/dist/src/agentWorkspace-Bom7SpF2.js +592 -0
- package/dist/src/agentWorkspace-CEomAcws.cjs +619 -0
- package/dist/src/agentWorkspace-DPtMLrlI.js +593 -0
- package/dist/src/agentWorkspace-DkAeEYLz.js +592 -0
- package/dist/src/agentic-utils-121v7mJo.js +197 -0
- package/dist/src/agentic-utils-CBWD_rcd.cjs +237 -0
- package/dist/src/agentic-utils-D8wyQwPG.js +198 -0
- package/dist/src/agentic-utils-EP1QkQCs.js +197 -0
- package/dist/src/agents-Br3ah8iA.js +778 -0
- package/dist/src/agents-C5wj_UTv.js +777 -0
- package/dist/src/agents-C9Efp4mC.js +266 -0
- package/dist/src/agents-CQYwaVCO.js +267 -0
- package/dist/src/agents-CjCd4Vo8.js +777 -0
- package/dist/src/agents-DRWiCHYz.js +266 -0
- package/dist/src/agents-F2rhx0iL.cjs +266 -0
- package/dist/src/agents-RTYyy69h.cjs +777 -0
- package/dist/src/agents-api-CY72O86e.js +711 -0
- package/dist/src/agents-api-CsSsC21b.js +710 -0
- package/dist/src/agents-api-DN-ibDc8.js +710 -0
- package/dist/src/agents-api-cNDsCCv1.cjs +710 -0
- package/dist/src/ai.studio-Bj6Dyi6o.js +2 -0
- package/dist/src/ai.studio-C-e0LzyW.js +369 -0
- package/dist/src/ai.studio-CR8M6Aqf.cjs +391 -0
- package/dist/src/ai.studio-YKk7F0tv.js +374 -0
- package/dist/src/aimlapi-BGunsuTu.js +30 -0
- package/dist/src/aimlapi-BkzcfBsL.js +29 -0
- package/dist/src/aimlapi-DXFcEdP8.js +28 -0
- package/dist/src/aimlapi-r-8iCcAw.cjs +29 -0
- package/dist/src/anthropicMessages-7-YNRgQR.js +114 -0
- package/dist/src/anthropicMessages-C8m9Whrd.cjs +114 -0
- package/dist/src/anthropicMessages-DS1vXD0f.js +115 -0
- package/dist/src/anthropicMessages-DmvGkz-0.js +114 -0
- package/dist/src/app/assets/index-CrdXWTXm.js +392 -0
- package/dist/src/app/browser-inventory.json +4 -4
- package/dist/src/app/index.html +1 -1
- package/dist/src/audio-BLgFgyw-.cjs +104 -0
- package/dist/src/audio-C2sibT7Q.js +104 -0
- package/dist/src/audio-DXEXb03H.js +104 -0
- package/dist/src/audio-TkvojpwO.js +105 -0
- package/dist/src/authoritativeMarkupInjection-BAT9B-Wj.js +79 -0
- package/dist/src/authoritativeMarkupInjection-B_yHETKT.js +78 -0
- package/dist/src/authoritativeMarkupInjection-BfjecQ3Q.cjs +78 -0
- package/dist/src/authoritativeMarkupInjection-D-hDKrhD.js +78 -0
- package/dist/src/aws-B_9unI_-.js +1149 -0
- package/dist/src/aws-D0FY3qkc.js +2433 -0
- package/dist/src/aws-Dh1-a90n.js +2433 -0
- package/dist/src/aws-qskKGczY.cjs +2454 -0
- package/dist/src/base-CaWlBkVz.js +462 -0
- package/dist/src/base-CcViNwVs.js +255 -0
- package/dist/src/base-CsVbPJkU.cjs +467 -0
- package/dist/src/base-DNK9py25.js +255 -0
- package/dist/src/base-DlH5tjEZ.js +463 -0
- package/dist/src/base-DyLOZ_iX.js +256 -0
- package/dist/src/base-RRYXfG7l.cjs +305 -0
- package/dist/src/base-oXVgvtVn.js +462 -0
- package/dist/src/bedrock-BP17ZXbR.cjs +2 -0
- package/dist/src/bedrock-CsjM1dOt.js +1300 -0
- package/dist/src/bedrock-CzPwj8GO.js +1 -0
- package/dist/src/bedrock-eGXZw8oh.js +1 -0
- package/dist/src/bedrock-tSWjmXdj.js +2 -0
- package/dist/src/bestOfN-BQ93nUKV.js +160 -0
- package/dist/src/bestOfN-ByGGwlcb.cjs +161 -0
- package/dist/src/bestOfN-CbP7csHr.js +159 -0
- package/dist/src/bestOfN-xn6i2Xs2.js +159 -0
- package/dist/src/cache-CHq9hPz9.js +2 -0
- package/dist/src/cache-D-9eZN3I.js +754 -0
- package/dist/src/cache-DSm6t1MZ.js +741 -0
- package/dist/src/cache-DeF5zIEN.js +782 -0
- package/dist/src/cache-iG87oYan.cjs +856 -0
- package/dist/src/cerebras-CTtM4yMH.js +98 -0
- package/dist/src/cerebras-CogcJ3ce.cjs +97 -0
- package/dist/src/cerebras-DmkRypTh.js +97 -0
- package/dist/src/cerebras-GUp0B8JY.js +97 -0
- package/dist/src/chat-B4ihd3fw.js +226 -0
- package/dist/src/chat-B9cAQ_rS.js +227 -0
- package/dist/src/chat-BU7EB4R-.cjs +76 -0
- package/dist/src/chat-C8yxJ2-s.cjs +226 -0
- package/dist/src/chat-ClTFM3qq.js +934 -0
- package/dist/src/chat-Cnq0Is68.js +123 -0
- package/dist/src/chat-CwrurR57.cjs +987 -0
- package/dist/src/chat-D0lsojPv.js +124 -0
- package/dist/src/chat-D7_8yFIx.js +76 -0
- package/dist/src/chat-DCoETlLG.js +226 -0
- package/dist/src/chat-DHE7xaTR.js +76 -0
- package/dist/src/chat-DmhT6rz2.cjs +123 -0
- package/dist/src/chat-DvfMe8KI.js +123 -0
- package/dist/src/chat-DwP5kVnl.js +935 -0
- package/dist/src/chat-MB7U-QE2.js +77 -0
- package/dist/src/chat-zCWuBKAj.js +934 -0
- package/dist/src/claude-agent-sdk-23bIVI75.js +999 -0
- package/dist/src/claude-agent-sdk-BACpnIJi.cjs +1005 -0
- package/dist/src/claude-agent-sdk-BlYlmcEr.js +999 -0
- package/dist/src/claude-agent-sdk-Cr-jqJZl.js +1000 -0
- package/dist/src/client-BktbiPx9.cjs +357 -0
- package/dist/src/client-CjztEBmW.js +351 -0
- package/dist/src/client-mRs2UvH9.js +351 -0
- package/dist/src/client-uCz0ydjC.js +352 -0
- package/dist/src/cloud-BtYF555L.js +2 -0
- package/dist/src/cloud-CVSUEmAy.js +287 -0
- package/dist/src/cloud-D7Ifb-Fl.js +599 -0
- package/dist/src/cloud-DB5oK5NX.cjs +666 -0
- package/dist/src/cloud-ecu989Em.js +657 -0
- package/dist/src/cloud-ramjGURF.js +599 -0
- package/dist/src/cloudflare-ai-BfDkIjO8.js +133 -0
- package/dist/src/cloudflare-ai-D9HaXz1M.js +134 -0
- package/dist/src/cloudflare-ai-HrD5WUK8.js +132 -0
- package/dist/src/cloudflare-ai-Qdj8aKP2.cjs +133 -0
- package/dist/src/cloudflare-gateway-C81uKETQ.js +276 -0
- package/dist/src/cloudflare-gateway-CX5Z9X0k.js +276 -0
- package/dist/src/cloudflare-gateway-DW-og8gb.js +277 -0
- package/dist/src/cloudflare-gateway-iRyXo9n2.cjs +276 -0
- package/dist/src/codex-app-server-BFIrSgdy.js +2155 -0
- package/dist/src/codex-app-server-By1eDVD4.js +2 -0
- package/dist/src/codex-app-server-DKsF4qmY.js +2156 -0
- package/dist/src/codex-app-server-n7n4uZzC.cjs +2162 -0
- package/dist/src/codex-app-server-xAoELVxu.js +2155 -0
- package/dist/src/codex-sdk-C2ZLxa6r.js +1552 -0
- package/dist/src/codex-sdk-CzG02tQt.cjs +1588 -0
- package/dist/src/codex-sdk-DNxAOhiV.js +2 -0
- package/dist/src/codex-sdk-DT3aQezK.js +1557 -0
- package/dist/src/codex-sdk-pw9DpcJP.js +1557 -0
- package/dist/src/codex-security-B0bLmXJF.js +406 -0
- package/dist/src/codex-security-BhYs-3iY.js +406 -0
- package/dist/src/codex-security-DQcOfxYW.js +407 -0
- package/dist/src/codex-security-DsCWr6GZ.cjs +411 -0
- package/dist/src/cometapi-B16asPLX.cjs +55 -0
- package/dist/src/cometapi-MgTbZA_H.js +53 -0
- package/dist/src/cometapi-i33vKzPV.js +55 -0
- package/dist/src/cometapi-wK2UWK0X.js +56 -0
- package/dist/src/compatible-COj8ZCy9.js +24 -0
- package/dist/src/compatible-CRSsIUGb.cjs +24 -0
- package/dist/src/compatible-Dy1vCcNF.js +25 -0
- package/dist/src/compatible-aUItQrpk.js +24 -0
- package/dist/src/completion-Bn7COFMk.js +119 -0
- package/dist/src/completion-Bub2N48b.js +118 -0
- package/dist/src/completion-Cf2G9OlM.cjs +123 -0
- package/dist/src/conversationScoring-BiTYJ9MD.js +374 -0
- package/dist/src/conversationScoring-CKL47uIu.js +373 -0
- package/dist/src/conversationScoring-DCvQKp6k.cjs +398 -0
- package/dist/src/conversationScoring-DLNJtDZI.js +373 -0
- package/dist/src/crescendo-5iLk9WiJ.cjs +734 -0
- package/dist/src/crescendo-B5ylG7kW.js +733 -0
- package/dist/src/crescendo-BD7k6TIx.js +730 -0
- package/dist/src/crescendo-DqO2Ch0P.js +732 -0
- package/dist/src/custom-8rv_aG2K.js +617 -0
- package/dist/src/custom-BOtrIHFN.js +619 -0
- package/dist/src/custom-BvN8seCs.cjs +620 -0
- package/dist/src/custom-Cld9v_Y4.js +618 -0
- package/dist/src/dataUrl-BdHUey2l.cjs +3187 -0
- package/dist/src/dataUrl-DBMifX6C.js +3133 -0
- package/dist/src/dataUrl-DUSr-ZvI.js +2868 -0
- package/dist/src/decisions-CLazADTw.js +516 -0
- package/dist/src/decisions-D5X93awq.js +515 -0
- package/dist/src/decisions-DmaeArEn.js +515 -0
- package/dist/src/decisions-DyQJyHJz.cjs +514 -0
- package/dist/src/docker-C9NYQFeu.js +94 -0
- package/dist/src/docker-CGq3mMol.cjs +94 -0
- package/dist/src/docker-DOm7nmpl.js +95 -0
- package/dist/src/docker-skFN-Kfo.js +93 -0
- package/dist/src/embedding-0UbzkTk9.js +82 -0
- package/dist/src/embedding-DTrSDt7k.cjs +86 -0
- package/dist/src/embedding-j2ORNl5H.js +81 -0
- package/dist/src/envoy-BvS8XTQO.js +60 -0
- package/dist/src/envoy-Cn6Hzw0e.js +60 -0
- package/dist/src/envoy-DC3KWcUY.cjs +60 -0
- package/dist/src/envoy-DetHjo5B.js +61 -0
- package/dist/src/eval-Cer9dPe9.js +1920 -0
- package/dist/src/eval-CytYmI2Z.js +2 -0
- package/dist/src/evalResult-DzOq5wt9.js +1300 -0
- package/dist/src/evaluator-BxCmvGtv.js +10578 -0
- package/dist/src/evaluator-Ct7YDELm.js +2 -0
- package/dist/src/evaluatorHelpers-B_AwIrsl.js +600 -0
- package/dist/src/evaluatorHelpers-D1Tpc7gd.js +601 -0
- package/dist/src/evaluatorHelpers-DRR3rLq0.cjs +622 -0
- package/dist/src/fetch-B5KxZuKu.js +1559 -0
- package/dist/src/fetch-BG_Jl7ty.js +1556 -0
- package/dist/src/fetch-BKlgUg08.cjs +1853 -0
- package/dist/src/fetch-C9Fsja0R.js +2 -0
- package/dist/src/fetch-CM7P8KWA.cjs +14 -0
- package/dist/src/fetch-D0FkIB3G.js +9 -0
- package/dist/src/fetch-RXHsZF-J.js +1280 -0
- package/dist/src/fetch-rSECy8jR.js +10 -0
- package/dist/src/functionCallbackUtils-BB9tmf6a.cjs +262 -0
- package/dist/src/functionCallbackUtils-BXk2iY01.js +246 -0
- package/dist/src/functionCallbackUtils-B_cYp7P5.js +245 -0
- package/dist/src/functionCallbackUtils-BfXnPo0o.js +245 -0
- package/dist/src/gemini-image-BXLMADDz.js +471 -0
- package/dist/src/gemini-image-BYUZyEUx.js +472 -0
- package/dist/src/gemini-image-DSt1QubZ.cjs +471 -0
- package/dist/src/gemini-image-DdNDMiZ_.js +471 -0
- package/dist/src/goat-9b-uU_k6.js +514 -0
- package/dist/src/goat-BCJuiDd0.js +515 -0
- package/dist/src/goat-CmAHbemm.js +512 -0
- package/dist/src/goat-DdOTdyoS.cjs +515 -0
- package/dist/src/goblin-Bp5C5lyb.js +22 -0
- package/dist/src/goblin-Dmr7GItI.js +23 -0
- package/dist/src/goblin-DpM8wxlf.cjs +22 -0
- package/dist/src/goblin-cJyH6Pq-.js +22 -0
- package/dist/src/google-B6eaPAbE.js +142 -0
- package/dist/src/google-D-FStdN6.cjs +142 -0
- package/dist/src/google-DAC7BsCW.js +142 -0
- package/dist/src/google-Id18H0Va.js +143 -0
- package/dist/src/graders-BjNQWkaB.js +2 -0
- package/dist/src/graders-CqdIp_vl.js +15470 -0
- package/dist/src/hydra-6Ouh74DE.js +610 -0
- package/dist/src/hydra-BHjhZnLB.cjs +612 -0
- package/dist/src/hydra-BL6k2REV.js +2 -0
- package/dist/src/hydra-BWUc0o67.js +613 -0
- package/dist/src/hydra-CUkEOLKw.js +612 -0
- package/dist/src/image-B6hG_xhb.js +481 -0
- package/dist/src/image-BFaq7Krd.cjs +209 -0
- package/dist/src/image-Bql5C0N9.cjs +504 -0
- package/dist/src/image-BtZfI2pT.js +163 -0
- package/dist/src/image-CIM4oN7Z.cjs +163 -0
- package/dist/src/image-CbAl7Jpu.js +209 -0
- package/dist/src/image-CiYm_yFw.js +209 -0
- package/dist/src/image-DCMNvBiV.js +163 -0
- package/dist/src/image-DL7pIuUZ.js +210 -0
- package/dist/src/image-ey0kxF8o.js +164 -0
- package/dist/src/image-smgIk3rE.js +482 -0
- package/dist/src/index.cjs +27 -27
- package/dist/src/index.d.cts +8 -8
- package/dist/src/index.js +27 -27
- package/dist/src/indirectWebPwn-B_-UpWY5.js +285 -0
- package/dist/src/indirectWebPwn-Cz3SLiEq.js +434 -0
- package/dist/src/indirectWebPwn-D2s8zGiM.cjs +463 -0
- package/dist/src/indirectWebPwn-DXbj2wGu.cjs +285 -0
- package/dist/src/indirectWebPwn-D_4H44E6.js +285 -0
- package/dist/src/indirectWebPwn-L044SrpV.js +434 -0
- package/dist/src/indirectWebPwn-cnmvdavH.js +435 -0
- package/dist/src/indirectWebPwn-zUBzsqTt.js +286 -0
- package/dist/src/interactions-Bu3oVQ-j.js +850 -0
- package/dist/src/interactions-CND010Lh.cjs +850 -0
- package/dist/src/interactions-DAx7tqUz.js +851 -0
- package/dist/src/interactions-DPkIumeh.js +850 -0
- package/dist/src/iterative-BO4JRnpG.js +545 -0
- package/dist/src/iterative-CAK-k9rz.js +548 -0
- package/dist/src/iterative-CDgHc0xO.cjs +549 -0
- package/dist/src/iterative-CXJlHLl9.js +547 -0
- package/dist/src/iterativeImage-BEdGKSmh.cjs +419 -0
- package/dist/src/iterativeImage-BfL0QZw5.js +417 -0
- package/dist/src/iterativeImage-C9KhnibC.js +417 -0
- package/dist/src/iterativeImage-btjkOfWG.js +418 -0
- package/dist/src/iterativeMeta-B5Bdw6QA.js +437 -0
- package/dist/src/iterativeMeta-C3mI4gpT.js +440 -0
- package/dist/src/iterativeMeta-Co2BKyqS.cjs +439 -0
- package/dist/src/iterativeMeta-DD8ihRWD.js +439 -0
- package/dist/src/iterativeTree-AMi4GV2O.js +878 -0
- package/dist/src/iterativeTree-C8FJOEje.cjs +879 -0
- package/dist/src/iterativeTree-CvrY1f2Z.js +877 -0
- package/dist/src/iterativeTree-bPtESmaD.js +876 -0
- package/dist/src/knowledgeBase-Cf5871e3.js +163 -0
- package/dist/src/knowledgeBase-D2PQhqLH.js +164 -0
- package/dist/src/knowledgeBase-DpoMw1IH.cjs +163 -0
- package/dist/src/knowledgeBase-npGFl763.js +163 -0
- package/dist/src/litellm-BBB5DQdt.cjs +146 -0
- package/dist/src/litellm-Bo43ow7r.js +145 -0
- package/dist/src/litellm-CaU8CMLS.js +146 -0
- package/dist/src/litellm-wY7Unh8o.js +147 -0
- package/dist/src/live-5g2w-M-E.js +891 -0
- package/dist/src/live-BfaXsDyD.cjs +891 -0
- package/dist/src/live-C1xewnGD.js +2 -0
- package/dist/src/live-DaF7nYy5.js +892 -0
- package/dist/src/live-lp3urLUw.js +891 -0
- package/dist/src/luma-ray-B7zvKGVG.js +309 -0
- package/dist/src/luma-ray-DCf5fnrz.cjs +309 -0
- package/dist/src/luma-ray-DepBcn6z.js +309 -0
- package/dist/src/luma-ray-XQC4M1pt.js +310 -0
- package/dist/src/main.js +26 -26
- package/dist/src/mantleChat-7xm95vSV.js +154 -0
- package/dist/src/mantleChat-CXhAs5RD.js +155 -0
- package/dist/src/mantleChat-CcE-zjfj.cjs +154 -0
- package/dist/src/mantleChat-Cpefl7Zm.js +154 -0
- package/dist/src/mcp-B0V0ikdM.js +84 -0
- package/dist/src/mcp-CV2k2gwj.js +85 -0
- package/dist/src/memoryPoisoning-BC5FQQWZ.js +111 -0
- package/dist/src/memoryPoisoning-BDwrtZKX.js +111 -0
- package/dist/src/memoryPoisoning-BFemS_FF.js +112 -0
- package/dist/src/memoryPoisoning-DRs2rbVV.cjs +111 -0
- package/dist/src/messages-Bc5oZoAJ.js +1128 -0
- package/dist/src/messages-BkaH8fRW.js +1127 -0
- package/dist/src/messages-CoHlziS5.js +1127 -0
- package/dist/src/messages-Cv_m6kYs.cjs +1161 -0
- package/dist/src/mischievousUser-BcyFxrqJ.js +51 -0
- package/dist/src/mischievousUser-BlhOQSd2.js +52 -0
- package/dist/src/mischievousUser-BuQiKE8D.js +51 -0
- package/dist/src/mischievousUser-ChIOk6cT.cjs +51 -0
- package/dist/src/modelslab-BXIWBTgX.js +171 -0
- package/dist/src/modelslab-ChVsUiaJ.js +170 -0
- package/dist/src/modelslab-DZ6BFlDv.js +170 -0
- package/dist/src/modelslab-DhRr-vyo.cjs +170 -0
- package/dist/src/nova-reel-BL8DrN4_.js +272 -0
- package/dist/src/nova-reel-BiOMUm5q.cjs +272 -0
- package/dist/src/nova-reel-CTsya1hV.js +273 -0
- package/dist/src/nova-reel-kgBY4Svd.js +272 -0
- package/dist/src/nova-sonic-CaSSA3Jq.cjs +374 -0
- package/dist/src/nova-sonic-DLpmoGsR.js +375 -0
- package/dist/src/nova-sonic-DwWc4SoN.js +374 -0
- package/dist/src/nova-sonic-qnReTaXm.js +374 -0
- package/dist/src/novita-B5mAt3Ui.js +114 -0
- package/dist/src/novita-D57vCjDD.js +116 -0
- package/dist/src/novita-ITRtG8IJ.js +115 -0
- package/dist/src/novita-Rh3T13YO.cjs +115 -0
- package/dist/src/nscale-8V7iZ_pI.js +210 -0
- package/dist/src/nscale-BQnMv4pH.cjs +209 -0
- package/dist/src/nscale-BWZXHZVF.js +209 -0
- package/dist/src/nscale-BqrHiUqU.js +207 -0
- package/dist/src/openaiResponses-BMtGTu8R.js +317 -0
- package/dist/src/openaiResponses-CvcI_viE.js +318 -0
- package/dist/src/openaiResponses-DYPZEMX1.cjs +318 -0
- package/dist/src/openaiResponses-DZTg1-kb.js +319 -0
- package/dist/src/openclaw-BeKuig4g.js +1338 -0
- package/dist/src/openclaw-COkdQ83y.js +1337 -0
- package/dist/src/openclaw-CSoX_HQ5.cjs +1344 -0
- package/dist/src/openclaw-DJlhPGCb.js +1336 -0
- package/dist/src/opencode-sdk-BEJftEs6.cjs +1018 -0
- package/dist/src/opencode-sdk-DMvBB3V7.js +1013 -0
- package/dist/src/opencode-sdk-Df7hMjLO.js +1012 -0
- package/dist/src/opencode-sdk-bQp5Xf3W.js +1012 -0
- package/dist/src/openinterpreter-B3GgVZjK.js +431 -0
- package/dist/src/openinterpreter-BiGcU-HN.cjs +435 -0
- package/dist/src/openinterpreter-Buj2l3Eh.js +432 -0
- package/dist/src/openinterpreter-C3_Cg5b_.js +431 -0
- package/dist/src/pricing-0Pampf0q.cjs +999 -0
- package/dist/src/pricing-B8VdhEhY.js +976 -0
- package/dist/src/pricing-CtLA-rKA.js +976 -0
- package/dist/src/promptfoo-4OkHtH9P.cjs +341 -0
- package/dist/src/promptfoo-Bhpm7sH6.js +286 -0
- package/dist/src/promptfoo-BqV8ogVA.js +285 -0
- package/dist/src/promptfoo-S1Q9OHk_.js +286 -0
- package/dist/src/providers-B5zs1ZRv.js +24437 -0
- package/dist/src/providers-Cd6CJh6m.js +2 -0
- package/dist/src/providers-CpJlgHET.js +24039 -0
- package/dist/src/providers-CzvLvK6G.cjs +24180 -0
- package/dist/src/quiverai-1E_IvLHn.js +325 -0
- package/dist/src/quiverai-BXH004Vv.js +325 -0
- package/dist/src/quiverai-Ccya2z8Y.cjs +325 -0
- package/dist/src/quiverai-Cez57oe-.js +326 -0
- package/dist/src/registry-3zX_M9Ik.js +131 -0
- package/dist/src/registry-AuCrKTvS.js +132 -0
- package/dist/src/registry-CxXWKtQG.js +131 -0
- package/dist/src/registry-DG3o66JQ.cjs +131 -0
- package/dist/src/remoteGeneration-CAtvamG6.js +370 -0
- package/dist/src/remoteGeneration-CF225pDl.cjs +482 -0
- package/dist/src/remoteGeneration-DtnqocnL.js +370 -0
- package/dist/src/remoteGeneration-g3KvW-sP.js +371 -0
- package/dist/src/responses-BMbaUXQI.js +1098 -0
- package/dist/src/responses-B_TOSof-.js +1099 -0
- package/dist/src/responses-v-yANwTA.cjs +1109 -0
- package/dist/src/runtimeTransform-BBZv-oUZ.js +156 -0
- package/dist/src/runtimeTransform-DT2v5ovW.js +156 -0
- package/dist/src/runtimeTransform-GXXEIXdS.cjs +161 -0
- package/dist/src/runtimeTransform-JTwBQc-P.js +157 -0
- package/dist/src/sagemaker-B8D0L4rj.cjs +716 -0
- package/dist/src/sagemaker-CR2_AGdB.js +713 -0
- package/dist/src/sagemaker-Cd9qSQUV.js +714 -0
- package/dist/src/sagemaker-mKlltN4p.js +713 -0
- package/dist/src/scanner-PG_8lh8r.js +1971 -0
- package/dist/src/server/index.js +55 -55
- package/dist/src/server-Bmh7sd9F.js +155 -0
- package/dist/src/server-C7b8z6aC.js +63 -0
- package/dist/src/server-CAcovgtL.js +2 -0
- package/dist/src/server-CuuMfKlh.cjs +74 -0
- package/dist/src/server-DMPCj9jy.js +189 -0
- package/dist/src/session-BksXvRH_.cjs +69 -0
- package/dist/src/session-DOxUjqGQ.js +63 -0
- package/dist/src/session-Dujsc-b9.js +62 -0
- package/dist/src/session-VjtIxREd.js +62 -0
- package/dist/src/shared-Bkyz_7e5.cjs +2185 -0
- package/dist/src/shared-DDJg8ycC.js +1929 -0
- package/dist/src/shared-Dh3yfRBd.js +1927 -0
- package/dist/src/shared-tfPT8Tna.js +1928 -0
- package/dist/src/simulatedUser-6JdkyL3k.cjs +252 -0
- package/dist/src/simulatedUser-CFr2mr3M.js +248 -0
- package/dist/src/simulatedUser-DjwwUqx-.js +247 -0
- package/dist/src/slack-C_gIYiUs.js +144 -0
- package/dist/src/slack-DhNbz9CM.cjs +144 -0
- package/dist/src/slack-Dm2iI1zu.js +145 -0
- package/dist/src/strategies-BIY-bNul.js +2248 -0
- package/dist/src/strategies-C1KQQj9G.cjs +2420 -0
- package/dist/src/strategies-DM_3mReG.js +2385 -0
- package/dist/src/telemetry-BhMTibZO.js +2 -0
- package/dist/src/telemetry-C04d25BM.cjs +216 -0
- package/dist/src/telemetry-CIqy4fSC.js +201 -0
- package/dist/src/telemetry-CXozp_6C.js +205 -0
- package/dist/src/telemetry-g7PkBxmY.js +205 -0
- package/dist/src/togetherai-BvCim68-.js +50 -0
- package/dist/src/togetherai-CWyDCA9m.cjs +49 -0
- package/dist/src/togetherai-CeSE31vK.js +49 -0
- package/dist/src/togetherai-_2W0URf8.js +48 -0
- package/dist/src/traceContext-Brw3Oe41.js +1016 -0
- package/dist/src/traceContext-DpAYv27G.js +1015 -0
- package/dist/src/traceContext-KSqhzZI2.cjs +1032 -0
- package/dist/src/transcription-BySopazW.js +175 -0
- package/dist/src/transcription-DO4UPkRI.cjs +178 -0
- package/dist/src/transcription-RJGBa-pC.js +176 -0
- package/dist/src/transcription-fZenF3G5.js +175 -0
- package/dist/src/transform-BzhRc5z2.js +125 -0
- package/dist/src/transform-CPQu05u6.cjs +154 -0
- package/dist/src/transform-DAED8imp.js +126 -0
- package/dist/src/transform-DIOIQDmM.js +125 -0
- package/dist/src/typesafe-ByE0Kxfg.js +253 -0
- package/dist/src/typesafe-CFqGFY34.js +253 -0
- package/dist/src/typesafe-DCWIw-CP.cjs +253 -0
- package/dist/src/typesafe-DyHFV5Qk.js +254 -0
- package/dist/src/util-BHkj9joz.js +2049 -0
- package/dist/src/util-CICwIpmu.cjs +934 -0
- package/dist/src/util-CePiY2xZ.js +286 -0
- package/dist/src/util-CgT3uf4p.js +743 -0
- package/dist/src/util-Cj9drvOY.js +1770 -0
- package/dist/src/util-ClJRjlQA.cjs +357 -0
- package/dist/src/util-Cxf8VF2M.js +395 -0
- package/dist/src/util-D7RdV7rS.js +395 -0
- package/dist/src/util-DMNFhk47.js +351 -0
- package/dist/src/util-DNzh3M0z.js +396 -0
- package/dist/src/util-Df7rfMGb.cjs +2305 -0
- package/dist/src/util-Kf0KnG_6.js +2051 -0
- package/dist/src/util-LEbeiYw_.js +743 -0
- package/dist/src/util-WH8CgVs4.js +352 -0
- package/dist/src/util-cx6Xw8Lw.cjs +478 -0
- package/dist/src/util-qzBqirBH.js +2050 -0
- package/dist/src/vertex-CBAMfRz3.js +854 -0
- package/dist/src/vertex-CMP2IpN9.js +2 -0
- package/dist/src/vertex-CZ5YOotT.js +848 -0
- package/dist/src/vertex-DNsh1F1M.cjs +871 -0
- package/dist/src/vertexLive-BTXYj3-F.js +55 -0
- package/dist/src/vertexLive-Ba_LAqEF.cjs +55 -0
- package/dist/src/vertexLive-DM4sFaaj.js +56 -0
- package/dist/src/vertexLive-JqZOw7HC.js +55 -0
- package/dist/src/video-BY7Q2Gii.cjs +706 -0
- package/dist/src/video-CYElP-CK.js +703 -0
- package/dist/src/video-C_AdEDH0.js +702 -0
- package/dist/src/video-DGvjQ_4j.js +702 -0
- package/package.json +1 -1
- package/dist/src/accounts-Dpb43yde.cjs +0 -276
- package/dist/src/accounts-GKrO1olH.js +0 -229
- package/dist/src/accounts-e4FGOsji.js +0 -227
- package/dist/src/accounts-sUiEJfkB.js +0 -222
- package/dist/src/agentWorkspace-B8A_wuMR.cjs +0 -619
- package/dist/src/agentWorkspace-DSPIscXR.js +0 -593
- package/dist/src/agentWorkspace-DxUqd-XK.js +0 -592
- package/dist/src/agentWorkspace-n0uOJXhD.js +0 -592
- package/dist/src/agentic-utils-9bCj4twQ.js +0 -197
- package/dist/src/agentic-utils-CyCLuLoj.js +0 -197
- package/dist/src/agentic-utils-D23qtOlx.cjs +0 -237
- package/dist/src/agentic-utils-DuBMMNCw.js +0 -198
- package/dist/src/agents-6hDRNoYD.js +0 -777
- package/dist/src/agents-B8w2o7Sc.cjs +0 -777
- package/dist/src/agents-Ck0NXl7v.js +0 -777
- package/dist/src/agents-CwT3B1qB.js +0 -778
- package/dist/src/agents-DOLjfOEq.js +0 -266
- package/dist/src/agents-OcF9hq--.js +0 -267
- package/dist/src/agents-api-CnZZt8bn.cjs +0 -710
- package/dist/src/agents-api-D04u3bmL.js +0 -711
- package/dist/src/agents-api-DWw0_Vio.js +0 -710
- package/dist/src/agents-api-IWHEwp8i.js +0 -710
- package/dist/src/agents-mHt2Mh9O.cjs +0 -266
- package/dist/src/agents-sICccZCA.js +0 -266
- package/dist/src/ai.studio-Ci4rypDT.js +0 -2
- package/dist/src/ai.studio-KkQ6KaHa.js +0 -369
- package/dist/src/ai.studio-gSXK2cGI.js +0 -374
- package/dist/src/ai.studio-nQF_B4DH.cjs +0 -391
- package/dist/src/aimlapi-BeSk5BDV.js +0 -30
- package/dist/src/aimlapi-CzNUhdKu.cjs +0 -29
- package/dist/src/aimlapi-DCkazDPI.js +0 -29
- package/dist/src/aimlapi-WeH5B6K1.js +0 -28
- package/dist/src/anthropicMessages-AcNWTpYO.js +0 -115
- package/dist/src/anthropicMessages-BUtvzbpL.js +0 -114
- package/dist/src/anthropicMessages-DTWhZDCd.js +0 -114
- package/dist/src/anthropicMessages-lGVnSgyx.cjs +0 -114
- package/dist/src/app/assets/index-CyEI5aDN.js +0 -392
- package/dist/src/audio-BE_Duiu1.js +0 -104
- package/dist/src/audio-CiUd00k2.cjs +0 -104
- package/dist/src/audio-Dop6omna.js +0 -105
- package/dist/src/audio-EZNTInr_.js +0 -104
- package/dist/src/authoritativeMarkupInjection-BUqH6hNk.js +0 -78
- package/dist/src/authoritativeMarkupInjection-BmbJdJO0.cjs +0 -78
- package/dist/src/authoritativeMarkupInjection-Cpz12Y3w.js +0 -78
- package/dist/src/authoritativeMarkupInjection-W4XfcH91.js +0 -79
- package/dist/src/aws-B2Jqbnet.js +0 -2433
- package/dist/src/aws-DHtuUIzQ.js +0 -1149
- package/dist/src/aws-DLqXP6wY.js +0 -2433
- package/dist/src/aws-DfduhmwL.cjs +0 -2454
- package/dist/src/base-B9L2Xvpc.js +0 -255
- package/dist/src/base-BTZnIsuH.cjs +0 -305
- package/dist/src/base-BhaWNQPJ.js +0 -462
- package/dist/src/base-Br-G_Xou.js +0 -256
- package/dist/src/base-Bzo8hiUS.cjs +0 -467
- package/dist/src/base-C82fd2jq.js +0 -463
- package/dist/src/base-CRdQwC1W.js +0 -462
- package/dist/src/base-CjGwZNOQ.js +0 -255
- package/dist/src/bedrock-BdMru_ro.js +0 -1300
- package/dist/src/bedrock-CBUmfLX1.cjs +0 -2
- package/dist/src/bedrock-DBDxBaF9.js +0 -2
- package/dist/src/bedrock-DDrECM21.js +0 -1
- package/dist/src/bedrock-DVwkgvRS.js +0 -1
- package/dist/src/bestOfN-AKF5beq4.js +0 -159
- package/dist/src/bestOfN-C1UIVGJV.js +0 -160
- package/dist/src/bestOfN-DlkETbXy.cjs +0 -161
- package/dist/src/bestOfN-XIfEgU-g.js +0 -159
- package/dist/src/cache-BZaVoKaA.js +0 -2
- package/dist/src/cache-CEYhFUsH.js +0 -741
- package/dist/src/cache-Cbw1zH6q.js +0 -782
- package/dist/src/cache-CdaZNb75.js +0 -754
- package/dist/src/cache-DpuIzPxh.cjs +0 -856
- package/dist/src/cerebras-Bpn6FPkJ.js +0 -97
- package/dist/src/cerebras-CqJ0BRCJ.cjs +0 -97
- package/dist/src/cerebras-D4ILa_TY.js +0 -97
- package/dist/src/cerebras-DR8uc7ee.js +0 -98
- package/dist/src/chat-B7PZfaYp.cjs +0 -987
- package/dist/src/chat-BVuSjdEb.js +0 -227
- package/dist/src/chat-BsaZRjXN.js +0 -76
- package/dist/src/chat-C5liqe3Y.js +0 -226
- package/dist/src/chat-C9hyHf5B.js +0 -124
- package/dist/src/chat-CFLalAck.js +0 -226
- package/dist/src/chat-CN8JGrHu.js +0 -76
- package/dist/src/chat-CaHBBpCb.js +0 -123
- package/dist/src/chat-CcbLSghx.js +0 -123
- package/dist/src/chat-CoSN6sr2.js +0 -934
- package/dist/src/chat-CsJRFX8a.cjs +0 -226
- package/dist/src/chat-DFoZLvO_.js +0 -934
- package/dist/src/chat-DiLQvL7r.js +0 -77
- package/dist/src/chat-F6qVSDk3.cjs +0 -123
- package/dist/src/chat-Oq4FaJgI.cjs +0 -76
- package/dist/src/chat-knMfQUKz.js +0 -935
- package/dist/src/claude-agent-sdk-CJkOLpnI.js +0 -999
- package/dist/src/claude-agent-sdk-Ckn76PRD.js +0 -999
- package/dist/src/claude-agent-sdk-DX0gTr11.cjs +0 -1005
- package/dist/src/claude-agent-sdk-LMeikxoR.js +0 -1000
- package/dist/src/client-BFf1r6Z8.js +0 -352
- package/dist/src/client-CdXyDdDi.js +0 -351
- package/dist/src/client-DV8XMu7i.js +0 -351
- package/dist/src/client-iEXtOBKW.cjs +0 -357
- package/dist/src/cloud-B02qcpjf.js +0 -2
- package/dist/src/cloud-BlHP-g1v.cjs +0 -666
- package/dist/src/cloud-C9BI4isF.js +0 -287
- package/dist/src/cloud-CTTLNdvj.js +0 -657
- package/dist/src/cloud-D5X5yQ_d.js +0 -599
- package/dist/src/cloud-QxPkpsHA.js +0 -599
- package/dist/src/cloudflare-ai-DRTRT1fc.js +0 -132
- package/dist/src/cloudflare-ai-DgaXapAV.cjs +0 -133
- package/dist/src/cloudflare-ai-DkuJXijS.js +0 -134
- package/dist/src/cloudflare-ai-wy9QCHku.js +0 -133
- package/dist/src/cloudflare-gateway-9cAN8g29.cjs +0 -276
- package/dist/src/cloudflare-gateway-BVFMD292.js +0 -277
- package/dist/src/cloudflare-gateway-BuUI4p6I.js +0 -276
- package/dist/src/cloudflare-gateway-TlYHizbW.js +0 -276
- package/dist/src/codex-app-server-BPz_feug.cjs +0 -2162
- package/dist/src/codex-app-server-C9noXM9C.js +0 -2155
- package/dist/src/codex-app-server-CEmD-Y5U.js +0 -2
- package/dist/src/codex-app-server-DZolc18r.js +0 -2156
- package/dist/src/codex-app-server-Dd0A37nO.js +0 -2155
- package/dist/src/codex-sdk-BbxjBvBk.cjs +0 -1588
- package/dist/src/codex-sdk-BpXeIs-_.js +0 -1557
- package/dist/src/codex-sdk-BtQp5X0f.js +0 -1552
- package/dist/src/codex-sdk-CH0v9Bk1.js +0 -2
- package/dist/src/codex-sdk-CgrN7JB8.js +0 -1557
- package/dist/src/codex-security-B5fENNUr.js +0 -406
- package/dist/src/codex-security-C6uuJx-y.cjs +0 -411
- package/dist/src/codex-security-CifWtZR_.js +0 -407
- package/dist/src/codex-security-Kg2bOEKy.js +0 -406
- package/dist/src/cometapi-BFpIDLIx.js +0 -55
- package/dist/src/cometapi-C6O2PIrN.js +0 -56
- package/dist/src/cometapi-D5Yupc6F.js +0 -53
- package/dist/src/cometapi-DzgIwJzJ.cjs +0 -55
- package/dist/src/compatible-0jhmVfOp.js +0 -25
- package/dist/src/compatible-DdtwWdJi.cjs +0 -24
- package/dist/src/compatible-Di4nR3sU.js +0 -24
- package/dist/src/compatible-iJKLWdnf.js +0 -24
- package/dist/src/completion-B0_hVUDG.js +0 -119
- package/dist/src/completion-BdI6v0-Q.cjs +0 -123
- package/dist/src/completion-CWcJscwv.js +0 -118
- package/dist/src/conversationScoring-99EOPJRa.js +0 -373
- package/dist/src/conversationScoring-BIq4J0Cq.js +0 -374
- package/dist/src/conversationScoring-DARyeATr.cjs +0 -398
- package/dist/src/conversationScoring-DS48t4Hb.js +0 -373
- package/dist/src/crescendo-CebvXIu4.js +0 -730
- package/dist/src/crescendo-CxrLS0oo.js +0 -732
- package/dist/src/crescendo-DZQXBSkj.js +0 -733
- package/dist/src/crescendo-wjEx68uD.cjs +0 -734
- package/dist/src/custom-BiQ-aUNw.cjs +0 -620
- package/dist/src/custom-ByyB5Z93.js +0 -619
- package/dist/src/custom-C5jOevNb.js +0 -617
- package/dist/src/custom-CCrsCz8o.js +0 -618
- package/dist/src/dataUrl-C9J7wz9H.js +0 -3133
- package/dist/src/dataUrl-CGsBT7UZ.cjs +0 -3187
- package/dist/src/dataUrl-CzKvvWNO.js +0 -2868
- package/dist/src/decisions-BTusXCUx.cjs +0 -514
- package/dist/src/decisions-BYtL9edD.js +0 -515
- package/dist/src/decisions-jYix_gCF.js +0 -515
- package/dist/src/decisions-nxxfHRAN.js +0 -516
- package/dist/src/docker-DDIv4zkg.js +0 -93
- package/dist/src/docker-DVLp_5OG.js +0 -94
- package/dist/src/docker-INm9w0SY.cjs +0 -94
- package/dist/src/docker-sGuoCul_.js +0 -95
- package/dist/src/embedding-CAhqLLrR.js +0 -82
- package/dist/src/embedding-D94GAsti.cjs +0 -86
- package/dist/src/embedding-zb4MAzQy.js +0 -81
- package/dist/src/envoy-BMPszwEa.cjs +0 -60
- package/dist/src/envoy-Bp-s39_8.js +0 -60
- package/dist/src/envoy-BswDt-Ou.js +0 -61
- package/dist/src/envoy-rVbYcV80.js +0 -60
- package/dist/src/eval-B1-XfrC7.js +0 -2
- package/dist/src/eval-pC4qCvLw.js +0 -1920
- package/dist/src/evalResult-CzjCb5bd.js +0 -1300
- package/dist/src/evaluator-CNq2K7J_.js +0 -10578
- package/dist/src/evaluator-LtfxdxEu.js +0 -2
- package/dist/src/evaluatorHelpers-C5J0NYpQ.js +0 -601
- package/dist/src/evaluatorHelpers-DcdCglCs.cjs +0 -622
- package/dist/src/evaluatorHelpers-Rvb88W6B.js +0 -600
- package/dist/src/fetch-5HtnNhHg.js +0 -1556
- package/dist/src/fetch-BCwjoIFd.js +0 -1559
- package/dist/src/fetch-BhfUnKen.js +0 -1280
- package/dist/src/fetch-C08w4vVl.js +0 -9
- package/dist/src/fetch-DBxy8Tlb.cjs +0 -14
- package/dist/src/fetch-DYte6oQX.cjs +0 -1853
- package/dist/src/fetch-ElpfcAVG.js +0 -10
- package/dist/src/fetch-lM1OIaSt.js +0 -2
- package/dist/src/functionCallbackUtils-BCAdWfHO.js +0 -246
- package/dist/src/functionCallbackUtils-BYq9qOhG.js +0 -245
- package/dist/src/functionCallbackUtils-ByWkmVud.cjs +0 -262
- package/dist/src/functionCallbackUtils-D_C_JaFd.js +0 -245
- package/dist/src/gemini-image-CAlwaJhZ.js +0 -471
- package/dist/src/gemini-image-DJoVoOnZ.cjs +0 -471
- package/dist/src/gemini-image-Waio-9Xx.js +0 -472
- package/dist/src/gemini-image-vbY6Ftbf.js +0 -471
- package/dist/src/goat-BWbtyY9c.js +0 -512
- package/dist/src/goat-CXzzeCOQ.cjs +0 -515
- package/dist/src/goat-CfgvzSgZ.js +0 -514
- package/dist/src/goat-DLeoIHBp.js +0 -515
- package/dist/src/goblin-CmfCfwqk.cjs +0 -22
- package/dist/src/goblin-CtcaORRH.js +0 -22
- package/dist/src/goblin-DF6DDhM-.js +0 -22
- package/dist/src/goblin-Nai0xxBV.js +0 -23
- package/dist/src/google-ClpkLtKL.cjs +0 -142
- package/dist/src/google-CrFgKu9k.js +0 -143
- package/dist/src/google-Dj_EIBqS.js +0 -142
- package/dist/src/google-e4-vARv6.js +0 -142
- package/dist/src/graders-BN1IIa71.js +0 -15470
- package/dist/src/graders-C5sCfSP5.js +0 -2
- package/dist/src/hydra-B7RfXVBK.js +0 -2
- package/dist/src/hydra-C1cFN-Jg.js +0 -613
- package/dist/src/hydra-CK6Uc1ia.js +0 -612
- package/dist/src/hydra-Dg65rAP_.js +0 -610
- package/dist/src/hydra-Fqx8l_Xu.cjs +0 -612
- package/dist/src/image-BdlUDAtp.js +0 -163
- package/dist/src/image-C-KwEhwt.cjs +0 -163
- package/dist/src/image-C76fp6NK.cjs +0 -209
- package/dist/src/image-D75ehv3D.js +0 -482
- package/dist/src/image-DKtc5v5W.js +0 -209
- package/dist/src/image-DT_xOkJY.js +0 -163
- package/dist/src/image-DVpdllEE.js +0 -209
- package/dist/src/image-DXZ8AzMf.js +0 -481
- package/dist/src/image-DZl_1mvy.js +0 -164
- package/dist/src/image-DcTD7Ak0.cjs +0 -504
- package/dist/src/image-ndxEvBKB.js +0 -210
- package/dist/src/indirectWebPwn-70WA5x_q.js +0 -435
- package/dist/src/indirectWebPwn-BRVyd3qV.cjs +0 -463
- package/dist/src/indirectWebPwn-BsJVsu0q.js +0 -285
- package/dist/src/indirectWebPwn-Cw6yJu0i.js +0 -285
- package/dist/src/indirectWebPwn-D-PhJzo4.js +0 -286
- package/dist/src/indirectWebPwn-DRPHt2I8.js +0 -434
- package/dist/src/indirectWebPwn-DXtfFhd9.cjs +0 -285
- package/dist/src/indirectWebPwn-DvpNouzc.js +0 -434
- package/dist/src/interactions-5ixfW7Cl.js +0 -850
- package/dist/src/interactions-BOUzfmg1.cjs +0 -850
- package/dist/src/interactions-CSSXcGNc.js +0 -851
- package/dist/src/interactions-WB_sgkN0.js +0 -850
- package/dist/src/iterative-BShRNqjC.cjs +0 -549
- package/dist/src/iterative-BcW_ELtB.js +0 -548
- package/dist/src/iterative-BpHbHz8B.js +0 -547
- package/dist/src/iterative-YcchP12d.js +0 -545
- package/dist/src/iterativeImage-BMFE5Hl7.cjs +0 -419
- package/dist/src/iterativeImage-CkSaYLMY.js +0 -417
- package/dist/src/iterativeImage-DAEUlQX_.js +0 -418
- package/dist/src/iterativeImage-DeUSkEnj.js +0 -417
- package/dist/src/iterativeMeta-DbdaKdEO.cjs +0 -439
- package/dist/src/iterativeMeta-DcF9JWEK.js +0 -437
- package/dist/src/iterativeMeta-DkfPqWIC.js +0 -439
- package/dist/src/iterativeMeta-DkrpnVSs.js +0 -440
- package/dist/src/iterativeTree-CEMY1FhE.cjs +0 -879
- package/dist/src/iterativeTree-Cv5W4tX9.js +0 -877
- package/dist/src/iterativeTree-DGvomd3M.js +0 -876
- package/dist/src/iterativeTree-KbtC2Mkz.js +0 -878
- package/dist/src/knowledgeBase-AYRXn4wO.js +0 -163
- package/dist/src/knowledgeBase-BNqQfx01.js +0 -163
- package/dist/src/knowledgeBase-C0IaCCVs.js +0 -164
- package/dist/src/knowledgeBase-C2uj6wK4.cjs +0 -163
- package/dist/src/litellm-CN1ScAwZ.js +0 -147
- package/dist/src/litellm-CTjwiKSa.js +0 -146
- package/dist/src/litellm-Cd4Nj5ue.js +0 -145
- package/dist/src/litellm-DMqLpEBg.cjs +0 -146
- package/dist/src/live-Bt50-InO.cjs +0 -891
- package/dist/src/live-Bu2ujadG.js +0 -2
- package/dist/src/live-C3M52i3p.js +0 -891
- package/dist/src/live-CRfHMO3B.js +0 -892
- package/dist/src/live-iCIpO14m.js +0 -891
- package/dist/src/luma-ray-B8eHC4c8.cjs +0 -309
- package/dist/src/luma-ray-BIvkPw0s.js +0 -309
- package/dist/src/luma-ray-ChsiBxMA.js +0 -309
- package/dist/src/luma-ray-DAvKrInz.js +0 -310
- package/dist/src/mantleChat-5YeEXAZI.js +0 -154
- package/dist/src/mantleChat-D--mW3hl.js +0 -154
- package/dist/src/mantleChat-DHP3siNg.cjs +0 -154
- package/dist/src/mantleChat-wBfAX46o.js +0 -155
- package/dist/src/mcp-49jlEcTQ.js +0 -85
- package/dist/src/mcp-__PIz81I.js +0 -84
- package/dist/src/memoryPoisoning-Chxge74M.js +0 -111
- package/dist/src/memoryPoisoning-QH6NCUVE.js +0 -112
- package/dist/src/memoryPoisoning-tCxZt8Nz.js +0 -111
- package/dist/src/memoryPoisoning-ymrRItRR.cjs +0 -111
- package/dist/src/messages-BE_eZ7NA.js +0 -1127
- package/dist/src/messages-Bo638ShI.js +0 -1127
- package/dist/src/messages-BzR0-NQ1.js +0 -1128
- package/dist/src/messages-Cbg5Pfd0.cjs +0 -1161
- package/dist/src/mischievousUser-BtED2Z5Z.cjs +0 -51
- package/dist/src/mischievousUser-KqSOjrDJ.js +0 -51
- package/dist/src/mischievousUser-YMD41YNZ.js +0 -51
- package/dist/src/mischievousUser-zBxlNdCu.js +0 -52
- package/dist/src/modelslab-B8gZxtfE.js +0 -171
- package/dist/src/modelslab-C7bmVpTB.js +0 -170
- package/dist/src/modelslab-CCeQCTZg.js +0 -170
- package/dist/src/modelslab-CvBJGv7y.cjs +0 -170
- package/dist/src/nova-reel-BOEWsEKA.cjs +0 -272
- package/dist/src/nova-reel-BtyBXq5M.js +0 -273
- package/dist/src/nova-reel-C1eF3-EE.js +0 -272
- package/dist/src/nova-reel-YhgrxEKT.js +0 -272
- package/dist/src/nova-sonic-BaERP20w.js +0 -374
- package/dist/src/nova-sonic-CxgM3O-P.cjs +0 -374
- package/dist/src/nova-sonic-DJS22fC3.js +0 -375
- package/dist/src/nova-sonic-DwvwHyRX.js +0 -374
- package/dist/src/novita-D1l2tG0O.js +0 -116
- package/dist/src/novita-D84VM3v0.cjs +0 -115
- package/dist/src/novita-DGInvwfR.js +0 -115
- package/dist/src/novita-vXHkXhTg.js +0 -114
- package/dist/src/nscale-CU0Ldr00.js +0 -209
- package/dist/src/nscale-ClfKlQeM.cjs +0 -209
- package/dist/src/nscale-DxaVnF0x.js +0 -210
- package/dist/src/nscale-_poVxIrO.js +0 -207
- package/dist/src/openaiResponses-CJGsneNj.js +0 -317
- package/dist/src/openaiResponses-CKSl5Sdg.js +0 -319
- package/dist/src/openaiResponses-DC8rzFUc.js +0 -318
- package/dist/src/openaiResponses-rMHIA3dV.cjs +0 -318
- package/dist/src/openclaw-CCbvsNFW.cjs +0 -1344
- package/dist/src/openclaw-CZw1lCDZ.js +0 -1336
- package/dist/src/openclaw-ChFLgC-a.js +0 -1338
- package/dist/src/openclaw-DrPMoRrH.js +0 -1337
- package/dist/src/opencode-sdk-2EfIDhFp.cjs +0 -1018
- package/dist/src/opencode-sdk-CHw3F845.js +0 -1013
- package/dist/src/opencode-sdk-D0EGGxvy.js +0 -1012
- package/dist/src/opencode-sdk-jSS7NI2Q.js +0 -1012
- package/dist/src/openinterpreter-CY622xHC.js +0 -431
- package/dist/src/openinterpreter-DATyhuhP.js +0 -432
- package/dist/src/openinterpreter-DDUMyIf1.js +0 -431
- package/dist/src/openinterpreter-s5Tz6Lid.cjs +0 -435
- package/dist/src/pricing-C498twd2.js +0 -976
- package/dist/src/pricing-DBd_bMIh.cjs +0 -999
- package/dist/src/pricing-ISrMCskv.js +0 -976
- package/dist/src/promptfoo-6p0WG2ih.js +0 -286
- package/dist/src/promptfoo-BQRfgNs_.js +0 -285
- package/dist/src/promptfoo-Bqo88z20.cjs +0 -341
- package/dist/src/promptfoo-Cq5AVI3I.js +0 -286
- package/dist/src/providers-ATbeMX5E.cjs +0 -24180
- package/dist/src/providers-B7F1FiNI.js +0 -2
- package/dist/src/providers-DazIw8mI.js +0 -24039
- package/dist/src/providers-QvGlNAD0.js +0 -24437
- package/dist/src/quiverai-BPlNcLkV.cjs +0 -325
- package/dist/src/quiverai-By99-YmJ.js +0 -325
- package/dist/src/quiverai-CmmByDqo.js +0 -325
- package/dist/src/quiverai-HZkoJJqw.js +0 -326
- package/dist/src/registry-BLTnTfjT.cjs +0 -131
- package/dist/src/registry-BMC-COHT.js +0 -132
- package/dist/src/registry-C8UZtmBp.js +0 -131
- package/dist/src/registry-CfwEUYXG.js +0 -131
- package/dist/src/remoteGeneration-Bgg6kC5V.js +0 -370
- package/dist/src/remoteGeneration-CKJFE960.cjs +0 -482
- package/dist/src/remoteGeneration-DaxwJDKv.js +0 -370
- package/dist/src/remoteGeneration-vHMGVKr1.js +0 -371
- package/dist/src/responses-BvnyIHrq.js +0 -1099
- package/dist/src/responses-CERAgvf-.js +0 -1098
- package/dist/src/responses-CwgjeuOg.cjs +0 -1109
- package/dist/src/runtimeTransform-3RF9Avyg.cjs +0 -161
- package/dist/src/runtimeTransform-C51Z5j4H.js +0 -156
- package/dist/src/runtimeTransform-CKE_Iyv8.js +0 -157
- package/dist/src/runtimeTransform-Cs11xJpj.js +0 -156
- package/dist/src/sagemaker-BJ4dOCxE.js +0 -713
- package/dist/src/sagemaker-Bt3JUAWq.js +0 -714
- package/dist/src/sagemaker-QVKyLgLF.cjs +0 -716
- package/dist/src/sagemaker-l3IB8iTs.js +0 -713
- package/dist/src/scanner-DGjIiTZ1.js +0 -1971
- package/dist/src/server-BNaLZH6u.js +0 -63
- package/dist/src/server-CBMuQul3.js +0 -189
- package/dist/src/server-CMKKIzKv.cjs +0 -74
- package/dist/src/server-CN2IS9Cs.js +0 -155
- package/dist/src/server-ua4cqbjC.js +0 -2
- package/dist/src/session-CQIjq_HZ.cjs +0 -69
- package/dist/src/session-FTlg8sEu.js +0 -62
- package/dist/src/session-GBQXtPWp.js +0 -63
- package/dist/src/session-_0-rTdwY.js +0 -62
- package/dist/src/shared-BtuO-OAM.js +0 -1927
- package/dist/src/shared-Ci78wTZX.js +0 -1928
- package/dist/src/shared-Dd3rimdM.js +0 -1929
- package/dist/src/shared-KAjFxRre.cjs +0 -2185
- package/dist/src/simulatedUser--OjW6xCx.js +0 -247
- package/dist/src/simulatedUser-D0-slRye.cjs +0 -252
- package/dist/src/simulatedUser-D1Kh_cwA.js +0 -248
- package/dist/src/slack-BX0FUevO.js +0 -144
- package/dist/src/slack-CcwXFiJE.cjs +0 -144
- package/dist/src/slack-CnfqKfXp.js +0 -145
- package/dist/src/strategies-2ntcK4tN.js +0 -2248
- package/dist/src/strategies-DZIW7Zcs.js +0 -2385
- package/dist/src/strategies-YRDF2j-N.cjs +0 -2420
- package/dist/src/telemetry-CL8CVA4p.js +0 -205
- package/dist/src/telemetry-Cix90qqz.js +0 -201
- package/dist/src/telemetry-CkmlqTjV.js +0 -205
- package/dist/src/telemetry-DQH7l5bb.js +0 -2
- package/dist/src/telemetry-DUCXc1-r.cjs +0 -216
- package/dist/src/togetherai-3yUt5Ck7.js +0 -49
- package/dist/src/togetherai-BJUByLwt.cjs +0 -49
- package/dist/src/togetherai-Bh6KZkmd.js +0 -50
- package/dist/src/togetherai-DDl9yk3b.js +0 -48
- package/dist/src/traceContext-BiJVppjT.cjs +0 -1032
- package/dist/src/traceContext-CKKluULP.js +0 -1016
- package/dist/src/traceContext-D3Sk8fO-.js +0 -1015
- package/dist/src/transcription-BoVQKIVz.js +0 -175
- package/dist/src/transcription-Bs5u8780.js +0 -175
- package/dist/src/transcription-Dl654d1p.cjs +0 -178
- package/dist/src/transcription-VEvhM1Fu.js +0 -176
- package/dist/src/transform-BAbkGpvl.js +0 -125
- package/dist/src/transform-C_j4hUH8.js +0 -126
- package/dist/src/transform-Da86hs4M.cjs +0 -154
- package/dist/src/transform-_i1raQNo.js +0 -125
- package/dist/src/typesafe-CKXBeh82.cjs +0 -253
- package/dist/src/typesafe-D3VaGeNm.js +0 -253
- package/dist/src/typesafe-DYM-SFNH.js +0 -253
- package/dist/src/typesafe-LXmSbw8F.js +0 -254
- package/dist/src/util-41rb0XHX.js +0 -743
- package/dist/src/util-B0WlHYFM.js +0 -2049
- package/dist/src/util-BD1R_PsR.js +0 -1770
- package/dist/src/util-BLbM_ItC.js +0 -395
- package/dist/src/util-C72P0iIa.js +0 -352
- package/dist/src/util-C7MpGlJ6.cjs +0 -2305
- package/dist/src/util-CCtqagKc.js +0 -286
- package/dist/src/util-CM2Ec_uY.js +0 -2051
- package/dist/src/util-CSSAWO8v.js +0 -351
- package/dist/src/util-CkQc-fx3.cjs +0 -934
- package/dist/src/util-DcOlFTFa.cjs +0 -478
- package/dist/src/util-DluGTGVB.js +0 -395
- package/dist/src/util-PfQ60chz.js +0 -743
- package/dist/src/util-f14-CPij.js +0 -396
- package/dist/src/util-l9pXX3Eu.cjs +0 -357
- package/dist/src/util-o_BnlYqS.js +0 -2050
- package/dist/src/vertex-B_-gQgzc.js +0 -2
- package/dist/src/vertex-CU4gqoYa.js +0 -854
- package/dist/src/vertex-DZ42UHb3.js +0 -848
- package/dist/src/vertex-DsYQJA0T.cjs +0 -871
- package/dist/src/vertexLive-BvIaHKGB.js +0 -55
- package/dist/src/vertexLive-CTULqNx7.js +0 -56
- package/dist/src/vertexLive-DjJ_YQBe.cjs +0 -55
- package/dist/src/vertexLive-STUGcteB.js +0 -55
- package/dist/src/video-CAQGmtEV.js +0 -703
- package/dist/src/video-_FSTWlwX.js +0 -702
- package/dist/src/video-aBPJPWdt.js +0 -702
- package/dist/src/video-gDjkWv5m.cjs +0 -706
|
@@ -1,1109 +0,0 @@
|
|
|
1
|
-
const require_logger = require("./logger-DXUHJBHJ.cjs");
|
|
2
|
-
require("./dataUrl-CGsBT7UZ.cjs");
|
|
3
|
-
const require_fetch = require("./fetch-DYte6oQX.cjs");
|
|
4
|
-
const require_shared = require("./shared-D9Bf3UgD.cjs");
|
|
5
|
-
const require_time = require("./time-CY7bOv6D.cjs");
|
|
6
|
-
const require_render = require("./render-j-UNQw7s.cjs");
|
|
7
|
-
const require_genaiTracer = require("./genaiTracer-C32xFIB8.cjs");
|
|
8
|
-
const require_cache = require("./cache-DpuIzPxh.cjs");
|
|
9
|
-
const require_createHash = require("./createHash-sm6Q6LWg.cjs");
|
|
10
|
-
const require_gpt6 = require("./gpt6-mD0YWDzt.cjs");
|
|
11
|
-
const require_util = require("./util-CbYgIWBp.cjs");
|
|
12
|
-
const require_billing = require("./billing-ZA1NkqAK.cjs");
|
|
13
|
-
require("./tracing-DL4_JDxy.cjs");
|
|
14
|
-
const require_functionCallbackUtils = require("./functionCallbackUtils-ByWkmVud.cjs");
|
|
15
|
-
const require_openrouterBilling = require("./openrouterBilling-_forjO-_.cjs");
|
|
16
|
-
const require_openai = require("./openai-BwwgDeER.cjs");
|
|
17
|
-
const require_input = require("./input-CY0CGCwl.cjs");
|
|
18
|
-
//#region src/providers/responses/stream.ts
|
|
19
|
-
function getResponsesOutputText(response) {
|
|
20
|
-
if (typeof response.output_text === "string" && response.output_text.trim()) return response.output_text;
|
|
21
|
-
if (!Array.isArray(response.output)) return;
|
|
22
|
-
return response.output.flatMap((item) => {
|
|
23
|
-
if (!["message", "output_message"].includes(item?.type) || item.role && item.role !== "assistant") return [];
|
|
24
|
-
const text = Array.isArray(item.content) ? item.content.filter((part) => ["output_text", "text"].includes(part?.type) && typeof part.text === "string").map((part) => part.text).join("") : "";
|
|
25
|
-
return text.trim() ? [text] : [];
|
|
26
|
-
}).join("\n") || void 0;
|
|
27
|
-
}
|
|
28
|
-
function parseSseEvent(chunk, providerName, logger) {
|
|
29
|
-
const data = chunk.split(/\r?\n/).filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trimStart()).join("\n").trim();
|
|
30
|
-
if (!data || data === "[DONE]") return;
|
|
31
|
-
try {
|
|
32
|
-
return JSON.parse(data);
|
|
33
|
-
} catch {
|
|
34
|
-
logger.debug(`[${providerName} Responses] Ignoring malformed SSE payload`, { dataLength: data.length });
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
async function readResponsesStream(response, providerName, logger, onResponse, options) {
|
|
39
|
-
if (!response.body) throw new Error(`${providerName} streaming response has no body`);
|
|
40
|
-
const reader = response.body.getReader();
|
|
41
|
-
const decoder = new TextDecoder();
|
|
42
|
-
let buffer = "";
|
|
43
|
-
let latestResponse;
|
|
44
|
-
let outputText = "";
|
|
45
|
-
const textByOutputIndex = /* @__PURE__ */ new Map();
|
|
46
|
-
let pendingError;
|
|
47
|
-
const processChunk = (chunk) => {
|
|
48
|
-
const event = parseSseEvent(chunk, providerName, logger);
|
|
49
|
-
if (!event) return;
|
|
50
|
-
if (event.type === "error") {
|
|
51
|
-
const code = event.error?.code ?? event.code;
|
|
52
|
-
const message = event.error?.message ?? event.message ?? "unknown stream error";
|
|
53
|
-
const error = /* @__PURE__ */ new Error(`${providerName} streaming response error${code ? ` (${code})` : ""}: ${message}`);
|
|
54
|
-
const errorResponse = {
|
|
55
|
-
status: "failed",
|
|
56
|
-
error: event.error ?? {
|
|
57
|
-
code,
|
|
58
|
-
message
|
|
59
|
-
},
|
|
60
|
-
...event.error_type ? { error_type: event.error_type } : {}
|
|
61
|
-
};
|
|
62
|
-
const classification = options?.preserveFailedOutput ? options.classifyError?.(errorResponse) : void 0;
|
|
63
|
-
if (!classification || classification === "technical") throw error;
|
|
64
|
-
pendingError = {
|
|
65
|
-
error,
|
|
66
|
-
response: errorResponse,
|
|
67
|
-
classification
|
|
68
|
-
};
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (event.response && typeof event.response === "object") {
|
|
72
|
-
latestResponse = event.response;
|
|
73
|
-
onResponse?.(latestResponse);
|
|
74
|
-
} else if (Array.isArray(event.output)) latestResponse = event;
|
|
75
|
-
if (event.type === "response.output_text.delta") {
|
|
76
|
-
const delta = typeof event.delta === "string" ? event.delta : event.output_text?.delta;
|
|
77
|
-
if (typeof delta === "string") {
|
|
78
|
-
outputText += delta;
|
|
79
|
-
if (options?.preserveFailedOutput) {
|
|
80
|
-
const index = typeof event.output_index === "number" ? event.output_index : 0;
|
|
81
|
-
const partIndex = typeof event.content_index === "number" ? event.content_index : 0;
|
|
82
|
-
const content = textByOutputIndex.get(index) ?? /* @__PURE__ */ new Map();
|
|
83
|
-
content.set(partIndex, (content.get(partIndex) ?? "") + delta);
|
|
84
|
-
textByOutputIndex.set(index, content);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
while (true) {
|
|
90
|
-
const { done, value } = await reader.read();
|
|
91
|
-
if (done) break;
|
|
92
|
-
buffer += decoder.decode(value, { stream: true });
|
|
93
|
-
const chunks = buffer.split(/\r?\n\r?\n/);
|
|
94
|
-
buffer = chunks.pop() || "";
|
|
95
|
-
for (const chunk of chunks) processChunk(chunk);
|
|
96
|
-
}
|
|
97
|
-
buffer += decoder.decode();
|
|
98
|
-
if (buffer.trim()) processChunk(buffer);
|
|
99
|
-
if (pendingError) {
|
|
100
|
-
const terminal = latestResponse?.status === "failed" ? options?.classifyError?.(latestResponse) : void 0;
|
|
101
|
-
if (terminal === "technical" || terminal !== "refusal" && terminal !== "content_policy_violation" && pendingError.classification === "potential") throw pendingError.error;
|
|
102
|
-
if (terminal !== "refusal" && terminal !== "content_policy_violation") latestResponse = {
|
|
103
|
-
...latestResponse,
|
|
104
|
-
...pendingError.response,
|
|
105
|
-
error_type: pendingError.classification
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
if (latestResponse) {
|
|
109
|
-
if (options?.preserveFailedOutput && latestResponse.status === "failed" && outputText) {
|
|
110
|
-
const streamedText = Array.from(textByOutputIndex).sort(([left], [right]) => left - right).map(([, content]) => Array.from(content).sort(([left], [right]) => left - right).map(([, text]) => text).join("")).filter((text) => text.trim()).join("\n");
|
|
111
|
-
const reportedText = getResponsesOutputText(latestResponse);
|
|
112
|
-
if (streamedText && (!reportedText || streamedText.length > reportedText.length && streamedText.startsWith(reportedText))) return {
|
|
113
|
-
...latestResponse,
|
|
114
|
-
output_text: streamedText
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
return latestResponse;
|
|
118
|
-
}
|
|
119
|
-
if (outputText) return { output: [{
|
|
120
|
-
type: "message",
|
|
121
|
-
role: "assistant",
|
|
122
|
-
content: [{
|
|
123
|
-
type: "output_text",
|
|
124
|
-
text: outputText
|
|
125
|
-
}]
|
|
126
|
-
}] };
|
|
127
|
-
throw new Error(`${providerName} streaming response did not include output content`);
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region src/providers/openai/responses.ts
|
|
131
|
-
function hasUnpricedAzureResponsesToolUsage(data) {
|
|
132
|
-
const output = Array.isArray(data?.output) ? data.output : [];
|
|
133
|
-
if (output.some((item) => [
|
|
134
|
-
"file_search_call",
|
|
135
|
-
"code_interpreter_call",
|
|
136
|
-
"image_generation_call"
|
|
137
|
-
].includes(item?.type))) return true;
|
|
138
|
-
const webSearch = data?.tool_usage?.web_search;
|
|
139
|
-
const requests = webSearch?.num_requests;
|
|
140
|
-
if (typeof requests === "number" && Number.isFinite(requests) && requests >= 0) return requests > 0;
|
|
141
|
-
return webSearch != null || output.some((item) => item?.type === "web_search_call");
|
|
142
|
-
}
|
|
143
|
-
const BACKGROUND_RESPONSE_CANCEL_TIMEOUT_MS = 1e4;
|
|
144
|
-
const BACKGROUND_STREAM_CREATION_GRACE_MIN_MS = 1e3;
|
|
145
|
-
const BACKGROUND_STREAM_CREATION_GRACE_MAX_MS = 3e4;
|
|
146
|
-
let nextBackgroundProviderScope = 0;
|
|
147
|
-
const inFlightBackgroundCreations = /* @__PURE__ */ new Map();
|
|
148
|
-
const inFlightBackgroundResponses = /* @__PURE__ */ new Map();
|
|
149
|
-
function isSensitiveBackgroundCacheHeader(key) {
|
|
150
|
-
return require_logger.isSecretField(key) || /(?:^|[-_])(?:authorization|api[-_]?key|token|secret|signature|credential|cookie|password)(?:[-_]|$)/i.test(key);
|
|
151
|
-
}
|
|
152
|
-
function hasSensitiveBackgroundCacheValue(value, fieldName) {
|
|
153
|
-
if (fieldName && isSensitiveBackgroundCacheHeader(fieldName)) return value !== void 0 && value !== null && value !== "";
|
|
154
|
-
if (typeof value === "string") return require_util.hasSensitiveOpenAiCacheString(value);
|
|
155
|
-
if (Array.isArray(value)) return value.some((item) => hasSensitiveBackgroundCacheValue(item, fieldName));
|
|
156
|
-
if (value && typeof value === "object") return Object.entries(value).some(([key, nestedValue]) => hasSensitiveBackgroundCacheValue(nestedValue, key));
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
function canonicalizeBackgroundCacheValue(value, fieldName) {
|
|
160
|
-
if (Array.isArray(value)) return value.map((item) => canonicalizeBackgroundCacheValue(item, fieldName));
|
|
161
|
-
if (value && typeof value === "object") return Object.fromEntries((fieldName === "properties" ? Object.entries(value) : Object.entries(value).sort(([left], [right]) => left.localeCompare(right))).map(([key, nestedValue]) => [key, canonicalizeBackgroundCacheValue(nestedValue, key)]));
|
|
162
|
-
return value;
|
|
163
|
-
}
|
|
164
|
-
function getBackgroundCacheIdentity(url, request, responseId) {
|
|
165
|
-
const headerEntries = Object.entries(request.headers);
|
|
166
|
-
const cacheHeaders = headerEntries.filter(([key, value]) => !isSensitiveBackgroundCacheHeader(key) && !hasSensitiveBackgroundCacheValue(value)).map(([key, value]) => [key.toLowerCase(), value]).sort(([left], [right]) => left.localeCompare(right));
|
|
167
|
-
const hasSensitiveHeader = headerEntries.some(([key, value]) => isSensitiveBackgroundCacheHeader(key) && value.trim().length > 0);
|
|
168
|
-
const hasSensitiveHeaderValue = headerEntries.some(([key, value]) => !isSensitiveBackgroundCacheHeader(key) && hasSensitiveBackgroundCacheValue(value));
|
|
169
|
-
const hasTenantDiscriminator = cacheHeaders.some(([key, value]) => /(?:^|[-_])(?:project|tenant|account)(?:[-_]|$)/i.test(key) && value.trim().length > 0);
|
|
170
|
-
const sanitizedUrl = require_logger.sanitizeUrl(url);
|
|
171
|
-
const hasSensitiveUrlCredentials = sanitizedUrl !== url;
|
|
172
|
-
let sendsToOpenAiApi = false;
|
|
173
|
-
let hasSensitiveUrlPath = false;
|
|
174
|
-
try {
|
|
175
|
-
const parsedUrl = new URL(url);
|
|
176
|
-
hasSensitiveUrlPath = require_util.hasSensitiveOpenAiCachePath(decodeURIComponent(parsedUrl.pathname));
|
|
177
|
-
sendsToOpenAiApi = parsedUrl.hostname.toLowerCase() === "api.openai.com";
|
|
178
|
-
} catch {
|
|
179
|
-
hasSensitiveUrlPath = true;
|
|
180
|
-
}
|
|
181
|
-
let parsedBody;
|
|
182
|
-
try {
|
|
183
|
-
parsedBody = JSON.parse(request.body);
|
|
184
|
-
} catch {
|
|
185
|
-
parsedBody = request.body;
|
|
186
|
-
}
|
|
187
|
-
const hasSensitiveBody = hasSensitiveBackgroundCacheValue(parsedBody);
|
|
188
|
-
return {
|
|
189
|
-
key: require_createHash.sha256(JSON.stringify({
|
|
190
|
-
url: hasSensitiveUrlPath ? "[sensitive]" : sanitizedUrl,
|
|
191
|
-
method: request.method,
|
|
192
|
-
headers: cacheHeaders,
|
|
193
|
-
...responseId ? { id: responseId } : { body: hasSensitiveBody ? "[sensitive]" : canonicalizeBackgroundCacheValue(parsedBody) },
|
|
194
|
-
...hasSensitiveHeader && !hasTenantDiscriminator ? { scope: request.cacheScope } : {}
|
|
195
|
-
})),
|
|
196
|
-
cacheable: !hasSensitiveBody && !hasSensitiveUrlCredentials && !hasSensitiveUrlPath && !hasSensitiveHeaderValue && (!hasSensitiveHeader || sendsToOpenAiApi && hasTenantDiscriminator),
|
|
197
|
-
coalescable: !hasSensitiveBody && !hasSensitiveUrlCredentials && !hasSensitiveUrlPath && !hasSensitiveHeaderValue && (sendsToOpenAiApi ? !request.hasPerPromptAuthorization || hasTenantDiscriminator : !hasSensitiveHeader)
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
async function cancelBackgroundResponse(responseId, url, { headers, getAuthHeaders }) {
|
|
201
|
-
try {
|
|
202
|
-
await require_cache.fetchWithCache(require_util.appendOpenAiApiPath(url, `${encodeURIComponent(responseId)}/cancel`), {
|
|
203
|
-
method: "POST",
|
|
204
|
-
headers,
|
|
205
|
-
...getAuthHeaders ? { getAuthHeaders } : {}
|
|
206
|
-
}, BACKGROUND_RESPONSE_CANCEL_TIMEOUT_MS, "json", true, 0);
|
|
207
|
-
} catch (error) {
|
|
208
|
-
require_logger.logger.warn(`Failed to cancel background response ${responseId}: ${String(error)}`);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
async function pollBackgroundResponse(initial, url, authentication, timeout, maxRetries, signal, deadline = Date.now() + timeout, cancelOnStop = true) {
|
|
212
|
-
if (!initial.id) return {
|
|
213
|
-
data: initial,
|
|
214
|
-
status: 0,
|
|
215
|
-
statusText: "Error",
|
|
216
|
-
error: "Background response is missing its response ID."
|
|
217
|
-
};
|
|
218
|
-
let data = initial;
|
|
219
|
-
let status = 200;
|
|
220
|
-
let statusText = "OK";
|
|
221
|
-
let responseHeaders;
|
|
222
|
-
let firstPoll = true;
|
|
223
|
-
let deadlineSignal;
|
|
224
|
-
try {
|
|
225
|
-
while (data.status === "queued" || data.status === "in_progress") {
|
|
226
|
-
signal?.throwIfAborted();
|
|
227
|
-
if (!firstPoll) {
|
|
228
|
-
await require_time.sleep(Math.min(1e3, Math.max(0, deadline - Date.now())));
|
|
229
|
-
signal?.throwIfAborted();
|
|
230
|
-
}
|
|
231
|
-
firstPoll = false;
|
|
232
|
-
const remainingMs = deadline - Date.now();
|
|
233
|
-
if (remainingMs <= 0) {
|
|
234
|
-
if (cancelOnStop) await cancelBackgroundResponse(initial.id, url, authentication);
|
|
235
|
-
return {
|
|
236
|
-
data,
|
|
237
|
-
status: 0,
|
|
238
|
-
statusText: "Error",
|
|
239
|
-
error: `Background response ${initial.id} timed out after ${timeout}ms.`,
|
|
240
|
-
timedOut: true
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
deadlineSignal = AbortSignal.timeout(remainingMs);
|
|
244
|
-
const pollSignal = signal ? AbortSignal.any([signal, deadlineSignal]) : deadlineSignal;
|
|
245
|
-
const polled = await require_cache.fetchWithCache(require_util.appendOpenAiApiPath(url, encodeURIComponent(initial.id)), {
|
|
246
|
-
method: "GET",
|
|
247
|
-
headers: authentication.headers,
|
|
248
|
-
...authentication.getAuthHeaders ? { getAuthHeaders: authentication.getAuthHeaders } : {},
|
|
249
|
-
signal: pollSignal
|
|
250
|
-
}, remainingMs, "json", true, maxRetries);
|
|
251
|
-
data = polled.data;
|
|
252
|
-
status = polled.status;
|
|
253
|
-
statusText = polled.statusText;
|
|
254
|
-
responseHeaders = polled.headers;
|
|
255
|
-
if (status < 200 || status >= 300) {
|
|
256
|
-
const shouldCancel = status >= 400 && status < 500 && ![
|
|
257
|
-
404,
|
|
258
|
-
408,
|
|
259
|
-
409,
|
|
260
|
-
410,
|
|
261
|
-
425,
|
|
262
|
-
429
|
|
263
|
-
].includes(status);
|
|
264
|
-
if (shouldCancel) await cancelBackgroundResponse(initial.id, url, authentication);
|
|
265
|
-
return {
|
|
266
|
-
data,
|
|
267
|
-
status,
|
|
268
|
-
statusText,
|
|
269
|
-
headers: responseHeaders,
|
|
270
|
-
error: `API error: ${status} ${statusText}\n${JSON.stringify(data)}`,
|
|
271
|
-
cancelled: shouldCancel
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
} catch (error) {
|
|
276
|
-
if (signal?.aborted) {
|
|
277
|
-
if (cancelOnStop) await cancelBackgroundResponse(initial.id, url, authentication);
|
|
278
|
-
throw error;
|
|
279
|
-
}
|
|
280
|
-
if (deadlineSignal?.aborted || Date.now() >= deadline) {
|
|
281
|
-
if (cancelOnStop) await cancelBackgroundResponse(initial.id, url, authentication);
|
|
282
|
-
return {
|
|
283
|
-
data,
|
|
284
|
-
status: 0,
|
|
285
|
-
statusText: "Error",
|
|
286
|
-
error: `Background response ${initial.id} timed out after ${timeout}ms.`,
|
|
287
|
-
timedOut: true
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
throw error;
|
|
291
|
-
}
|
|
292
|
-
return {
|
|
293
|
-
data,
|
|
294
|
-
status,
|
|
295
|
-
statusText,
|
|
296
|
-
headers: responseHeaders
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
async function createBackgroundResponseWithCancellation(url, request, timeout, bustCache, maxRetries) {
|
|
300
|
-
const signal = request.signal;
|
|
301
|
-
const cacheIdentity = getBackgroundCacheIdentity(url, request);
|
|
302
|
-
const canCoalesce = require_cache.isCacheEnabled() && !bustCache && cacheIdentity.coalescable;
|
|
303
|
-
const effectiveCacheOptions = cacheIdentity.cacheable ? {
|
|
304
|
-
bust: bustCache,
|
|
305
|
-
cacheKey: cacheIdentity.key
|
|
306
|
-
} : true;
|
|
307
|
-
const cacheKey = require_cache.getScopedCacheKey(cacheIdentity.key);
|
|
308
|
-
let inFlight = canCoalesce ? inFlightBackgroundCreations.get(cacheKey) : void 0;
|
|
309
|
-
if (!inFlight) {
|
|
310
|
-
const promise = require_cache.fetchWithCache(url, {
|
|
311
|
-
method: request.method,
|
|
312
|
-
headers: request.headers,
|
|
313
|
-
body: request.body,
|
|
314
|
-
...request.getAuthHeaders ? { getAuthHeaders: request.getAuthHeaders } : {}
|
|
315
|
-
}, timeout, "json", effectiveCacheOptions, maxRetries);
|
|
316
|
-
inFlight = {
|
|
317
|
-
promise,
|
|
318
|
-
subscribers: 0,
|
|
319
|
-
billed: false
|
|
320
|
-
};
|
|
321
|
-
if (canCoalesce) {
|
|
322
|
-
inFlightBackgroundCreations.set(cacheKey, inFlight);
|
|
323
|
-
promise.finally(() => {
|
|
324
|
-
if (inFlightBackgroundCreations.get(cacheKey) === inFlight) inFlightBackgroundCreations.delete(cacheKey);
|
|
325
|
-
}).catch(() => {});
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
inFlight.subscribers++;
|
|
329
|
-
let released = false;
|
|
330
|
-
let onAbort;
|
|
331
|
-
const release = (aborted = false) => {
|
|
332
|
-
if (released) return;
|
|
333
|
-
released = true;
|
|
334
|
-
inFlight.subscribers--;
|
|
335
|
-
if (!aborted || inFlight.subscribers > 0) return;
|
|
336
|
-
inFlight.promise.then(async (created) => {
|
|
337
|
-
if (inFlight.subscribers > 0) return;
|
|
338
|
-
if (!canCoalesce && created.data.id && (created.data.status === "queued" || created.data.status === "in_progress")) await cancelBackgroundResponse(created.data.id, url, request);
|
|
339
|
-
await created.deleteFromCache?.();
|
|
340
|
-
}).catch((error) => {
|
|
341
|
-
require_logger.logger.warn(`Failed to clean up an aborted background response: ${String(error)}`);
|
|
342
|
-
});
|
|
343
|
-
};
|
|
344
|
-
const cancellation = new Promise((_resolve, reject) => {
|
|
345
|
-
if (!signal) return;
|
|
346
|
-
onAbort = () => {
|
|
347
|
-
release(true);
|
|
348
|
-
reject(require_fetch.getAbortError(signal));
|
|
349
|
-
};
|
|
350
|
-
if (signal.aborted) {
|
|
351
|
-
onAbort();
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
355
|
-
});
|
|
356
|
-
try {
|
|
357
|
-
const created = await Promise.race([inFlight.promise, cancellation]);
|
|
358
|
-
if (created.cached || created.status < 200 || created.status >= 300 || created.data.status !== "completed" && created.data.status !== "incomplete") return created;
|
|
359
|
-
const shared = inFlight.billed;
|
|
360
|
-
inFlight.billed = true;
|
|
361
|
-
return shared ? {
|
|
362
|
-
...created,
|
|
363
|
-
cached: true
|
|
364
|
-
} : created;
|
|
365
|
-
} finally {
|
|
366
|
-
if (onAbort) signal?.removeEventListener("abort", onAbort);
|
|
367
|
-
release();
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
async function resolveBackgroundResponse(initial, url, request, timeout, maxRetries, cached, deleteFromCache, cancelOnStop, deadline = Date.now() + timeout) {
|
|
371
|
-
const polled = await pollBackgroundResponse(initial, url, request, timeout, maxRetries, request.signal, deadline, cancelOnStop);
|
|
372
|
-
if (!cached || !polled.error || polled.status !== 404 && polled.status !== 410) return polled;
|
|
373
|
-
await deleteFromCache?.();
|
|
374
|
-
const retried = await createBackgroundResponseWithCancellation(url, request, Math.max(1, deadline - Date.now()), cancelOnStop, maxRetries);
|
|
375
|
-
if (retried.status < 200 || retried.status >= 300) return {
|
|
376
|
-
data: retried.data,
|
|
377
|
-
status: retried.status,
|
|
378
|
-
statusText: retried.statusText,
|
|
379
|
-
headers: retried.headers,
|
|
380
|
-
error: `API error: ${retried.status} ${retried.statusText}\n${JSON.stringify(retried.data)}`,
|
|
381
|
-
retried: true
|
|
382
|
-
};
|
|
383
|
-
if (retried.data.status === "queued" || retried.data.status === "in_progress") return {
|
|
384
|
-
...await pollBackgroundResponse(retried.data, url, request, timeout, maxRetries, request.signal, deadline, cancelOnStop),
|
|
385
|
-
retried: true
|
|
386
|
-
};
|
|
387
|
-
return {
|
|
388
|
-
data: retried.data,
|
|
389
|
-
status: retried.status,
|
|
390
|
-
statusText: retried.statusText,
|
|
391
|
-
headers: retried.headers,
|
|
392
|
-
retried: true
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
async function coalesceBackgroundResponse(initial, url, request, timeout, maxRetries, cached, deleteFromCache, cancelOnStop, deadline) {
|
|
396
|
-
const cacheIdentity = getBackgroundCacheIdentity(url, request, initial.id);
|
|
397
|
-
if (!cacheIdentity.coalescable) return resolveBackgroundResponse(initial, url, request, timeout, maxRetries, cached, deleteFromCache, cancelOnStop, deadline);
|
|
398
|
-
const cacheKey = require_cache.getScopedCacheKey(cacheIdentity.key);
|
|
399
|
-
let inFlight = inFlightBackgroundResponses.get(cacheKey);
|
|
400
|
-
if (!inFlight) {
|
|
401
|
-
const controller = new AbortController();
|
|
402
|
-
const promise = resolveBackgroundResponse(initial, url, {
|
|
403
|
-
...request,
|
|
404
|
-
signal: controller.signal
|
|
405
|
-
}, timeout, maxRetries, cached, deleteFromCache, cancelOnStop, deadline);
|
|
406
|
-
inFlight = {
|
|
407
|
-
promise,
|
|
408
|
-
controller,
|
|
409
|
-
subscribers: 0,
|
|
410
|
-
billed: false
|
|
411
|
-
};
|
|
412
|
-
inFlightBackgroundResponses.set(cacheKey, inFlight);
|
|
413
|
-
promise.finally(() => {
|
|
414
|
-
if (inFlightBackgroundResponses.get(cacheKey) === inFlight) inFlightBackgroundResponses.delete(cacheKey);
|
|
415
|
-
}).catch(() => {});
|
|
416
|
-
}
|
|
417
|
-
inFlight.subscribers++;
|
|
418
|
-
const callerSignal = request.signal;
|
|
419
|
-
let released = false;
|
|
420
|
-
let onAbort;
|
|
421
|
-
const release = () => {
|
|
422
|
-
if (released) return false;
|
|
423
|
-
released = true;
|
|
424
|
-
inFlight.subscribers--;
|
|
425
|
-
if (inFlight.subscribers === 0 && callerSignal?.aborted) {
|
|
426
|
-
inFlight.controller.abort(callerSignal.reason);
|
|
427
|
-
return true;
|
|
428
|
-
}
|
|
429
|
-
return false;
|
|
430
|
-
};
|
|
431
|
-
const cancellation = new Promise((_resolve, reject) => {
|
|
432
|
-
if (!callerSignal) return;
|
|
433
|
-
onAbort = () => {
|
|
434
|
-
if (release() && cancelOnStop) deleteFromCache?.();
|
|
435
|
-
reject(require_fetch.getAbortError(callerSignal));
|
|
436
|
-
};
|
|
437
|
-
if (callerSignal.aborted) {
|
|
438
|
-
onAbort();
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
callerSignal.addEventListener("abort", onAbort, { once: true });
|
|
442
|
-
});
|
|
443
|
-
try {
|
|
444
|
-
const result = await Promise.race([inFlight.promise, cancellation]);
|
|
445
|
-
if (result.timedOut && deadline !== void 0 && Date.now() < deadline) {
|
|
446
|
-
if (inFlightBackgroundResponses.get(cacheKey) === inFlight) inFlightBackgroundResponses.delete(cacheKey);
|
|
447
|
-
release();
|
|
448
|
-
return await coalesceBackgroundResponse(result.data, url, request, timeout, maxRetries, cached, deleteFromCache, cancelOnStop, deadline);
|
|
449
|
-
}
|
|
450
|
-
if (result.error) return result;
|
|
451
|
-
const shared = inFlight.billed;
|
|
452
|
-
inFlight.billed = true;
|
|
453
|
-
return shared ? {
|
|
454
|
-
...result,
|
|
455
|
-
shared: true
|
|
456
|
-
} : result;
|
|
457
|
-
} finally {
|
|
458
|
-
if (onAbort) callerSignal?.removeEventListener("abort", onAbort);
|
|
459
|
-
release();
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
var OpenAiResponsesProvider = class extends require_openai.OpenAiGenericProvider {
|
|
463
|
-
functionCallbackHandler = new require_functionCallbackUtils.FunctionCallbackHandler();
|
|
464
|
-
processor;
|
|
465
|
-
backgroundCacheScope = `provider:${++nextBackgroundProviderScope}`;
|
|
466
|
-
static OPENAI_RESPONSES_MODEL_NAMES = [
|
|
467
|
-
"gpt-4o",
|
|
468
|
-
"gpt-4o-2024-08-06",
|
|
469
|
-
"gpt-4o-2024-11-20",
|
|
470
|
-
"gpt-4o-2024-05-13",
|
|
471
|
-
"gpt-4o-mini",
|
|
472
|
-
"gpt-4o-mini-2024-07-18",
|
|
473
|
-
"gpt-4.1",
|
|
474
|
-
"gpt-4.1-2025-04-14",
|
|
475
|
-
"gpt-4.1-mini",
|
|
476
|
-
"gpt-4.1-mini-2025-04-14",
|
|
477
|
-
"gpt-4.1-nano",
|
|
478
|
-
"gpt-4.1-nano-2025-04-14",
|
|
479
|
-
"gpt-5",
|
|
480
|
-
"gpt-5-2025-08-07",
|
|
481
|
-
"gpt-5-nano",
|
|
482
|
-
"gpt-5-nano-2025-08-07",
|
|
483
|
-
"gpt-5-mini",
|
|
484
|
-
"gpt-5-mini-2025-08-07",
|
|
485
|
-
"gpt-5-pro",
|
|
486
|
-
"gpt-5-pro-2025-10-06",
|
|
487
|
-
"gpt-5.1",
|
|
488
|
-
"gpt-5.1-2025-11-13",
|
|
489
|
-
"gpt-5.2",
|
|
490
|
-
"gpt-5.2-2025-12-11",
|
|
491
|
-
"gpt-5.2-pro",
|
|
492
|
-
"gpt-5.2-pro-2025-12-11",
|
|
493
|
-
"gpt-5.3-codex",
|
|
494
|
-
"gpt-6-astra",
|
|
495
|
-
"gpt-6-sol",
|
|
496
|
-
"gpt-6-luna",
|
|
497
|
-
"gpt-6.1-sol",
|
|
498
|
-
"gpt-5.6",
|
|
499
|
-
"gpt-5.6-sol",
|
|
500
|
-
"gpt-5.6-terra",
|
|
501
|
-
"gpt-5.6-luna",
|
|
502
|
-
"gpt-5.5",
|
|
503
|
-
"gpt-5.5-2026-04-23",
|
|
504
|
-
"gpt-5.5-pro",
|
|
505
|
-
"gpt-5.5-pro-2026-04-23",
|
|
506
|
-
"gpt-5.4",
|
|
507
|
-
"gpt-5.4-2026-03-05",
|
|
508
|
-
"gpt-5.4-mini",
|
|
509
|
-
"gpt-5.4-mini-2026-03-17",
|
|
510
|
-
"gpt-5.4-nano",
|
|
511
|
-
"gpt-5.4-nano-2026-03-17",
|
|
512
|
-
"gpt-5.4-pro",
|
|
513
|
-
"gpt-5.4-pro-2026-03-05",
|
|
514
|
-
"o1",
|
|
515
|
-
"o1-2024-12-17",
|
|
516
|
-
"o1-pro",
|
|
517
|
-
"o1-pro-2025-03-19",
|
|
518
|
-
"o3-pro",
|
|
519
|
-
"o3-pro-2025-06-10",
|
|
520
|
-
"o3",
|
|
521
|
-
"o3-2025-04-16",
|
|
522
|
-
"o4-mini",
|
|
523
|
-
"o4-mini-2025-04-16",
|
|
524
|
-
"o3-mini",
|
|
525
|
-
"o3-mini-2025-01-31",
|
|
526
|
-
"gpt-5-codex-mini"
|
|
527
|
-
].filter((model) => !require_util.RETIRED_OPENAI_MODEL_IDS.has(model));
|
|
528
|
-
config;
|
|
529
|
-
constructor(modelName, options = {}) {
|
|
530
|
-
super(modelName, options);
|
|
531
|
-
this.config = options.config ? { ...options.config } : {};
|
|
532
|
-
this.processor = new require_input.ResponsesProcessor({
|
|
533
|
-
modelName: this.modelName,
|
|
534
|
-
providerType: "openai",
|
|
535
|
-
functionCallbackHandler: this.functionCallbackHandler,
|
|
536
|
-
costCalculator: () => void 0
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
isReasoningModel(modelName = this.getCapabilityModelName()) {
|
|
540
|
-
return modelName === "codex-mini-latest" || super.isReasoningModel(modelName);
|
|
541
|
-
}
|
|
542
|
-
isReasoningCapabilityModel(modelName) {
|
|
543
|
-
if (modelName === this.getCapabilityModelName().replace(/(^|\/)ft:/, "$1")) return this.isReasoningModel();
|
|
544
|
-
return modelName === "codex-mini-latest" || super.isReasoningModel(modelName);
|
|
545
|
-
}
|
|
546
|
-
supportsTemperatureForCapabilityModel(modelName) {
|
|
547
|
-
return modelName === this.getCapabilityModelName().replace(/(^|\/)ft:/, "$1") ? this.supportsTemperature() : !this.isReasoningCapabilityModel(modelName);
|
|
548
|
-
}
|
|
549
|
-
getEffectiveModelName(config) {
|
|
550
|
-
const passthroughModel = config.passthrough?.model;
|
|
551
|
-
return typeof passthroughModel === "string" ? this.normalizeCapabilityModelName(passthroughModel) : this.getCapabilityModelName();
|
|
552
|
-
}
|
|
553
|
-
getBillingModelName(config) {
|
|
554
|
-
return this.getEffectiveModelName(config);
|
|
555
|
-
}
|
|
556
|
-
usesGatewayErrorFormat() {
|
|
557
|
-
return this.getGenAISystem() === "openai" && require_util.isCustomOpenAiEndpoint(this.getApiUrl());
|
|
558
|
-
}
|
|
559
|
-
getBillingUsage(data, _config) {
|
|
560
|
-
return data.usage;
|
|
561
|
-
}
|
|
562
|
-
getBillingRegion() {}
|
|
563
|
-
applyBilling(result, data, config, cached) {
|
|
564
|
-
if (this.getGenAISystem() === "openai" && require_openrouterBilling.isOpenRouterEndpoint(this.getApiUrl())) {
|
|
565
|
-
const { cost: _existingCost, ...unbilled } = result;
|
|
566
|
-
const cost = require_openrouterBilling.calculateOpenRouterResponseCost(data, config, "responses");
|
|
567
|
-
const billingMetadata = require_openrouterBilling.getOpenRouterBillingMetadata(data);
|
|
568
|
-
return {
|
|
569
|
-
...unbilled,
|
|
570
|
-
...cost === void 0 ? {} : { cost },
|
|
571
|
-
...billingMetadata ? { metadata: {
|
|
572
|
-
...result.metadata,
|
|
573
|
-
...billingMetadata
|
|
574
|
-
} } : {}
|
|
575
|
-
};
|
|
576
|
-
}
|
|
577
|
-
const serviceTier = data.service_tier ?? config.service_tier;
|
|
578
|
-
const modelName = this.getBillingModelName(config);
|
|
579
|
-
const unprefixedModelName = require_util.normalizeOpenAiBillingModelName(modelName);
|
|
580
|
-
const bedrockEndpoint = this.getBedrockEndpoint();
|
|
581
|
-
const isBedrock = this.getGenAISystem() === "bedrock" || bedrockEndpoint !== void 0;
|
|
582
|
-
const runtimeProfile = bedrockEndpoint === "runtime" ? /^(global|us)\.openai\.(.+)$/.exec(unprefixedModelName) : null;
|
|
583
|
-
const billingModelName = runtimeProfile?.[2] ?? (isBedrock && bedrockEndpoint !== "runtime" ? unprefixedModelName.replace(/^openai\./, "") : unprefixedModelName);
|
|
584
|
-
const regionalProcessing = bedrockEndpoint === "runtime" ? Boolean(runtimeProfile && runtimeProfile[1] !== "global") : isBedrock || this.modelName.startsWith("openai.");
|
|
585
|
-
const billingLookupModel = require_util.normalizeOpenAiBillingModelName(billingModelName);
|
|
586
|
-
const responseCost = require_billing.calculateOpenAIUsageCost(billingLookupModel, config, this.getBillingUsage(data, config), {
|
|
587
|
-
apiUrl: this.getApiUrl(),
|
|
588
|
-
cachedResponse: cached,
|
|
589
|
-
provider: isBedrock ? "bedrock" : this.getGenAISystem(),
|
|
590
|
-
region: this.getBillingRegion(),
|
|
591
|
-
regionalProcessing,
|
|
592
|
-
serviceTier
|
|
593
|
-
});
|
|
594
|
-
const variant = require_gpt6.getGpt6Variant(billingModelName);
|
|
595
|
-
if ((variant === "sol" || variant === "luna" || variant === "6.1-sol") && require_billing.usesAzureOpenAiBilling(config, this.getApiUrl(), this.getGenAISystem())) {
|
|
596
|
-
const { cost: _existingCost, ...unbilled } = result;
|
|
597
|
-
return responseCost === void 0 || !cached && hasUnpricedAzureResponsesToolUsage(data) ? unbilled : {
|
|
598
|
-
...unbilled,
|
|
599
|
-
cost: responseCost
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
const observableToolCost = cached ? 0 : require_billing.calculateObservableOpenAIToolCost(data, billingLookupModel, config);
|
|
603
|
-
return {
|
|
604
|
-
...result,
|
|
605
|
-
...responseCost === void 0 ? {} : { cost: responseCost + observableToolCost }
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
getBedrockEndpoint() {
|
|
609
|
-
try {
|
|
610
|
-
const hostname = new URL(this.getApiUrl()).hostname;
|
|
611
|
-
if (/^bedrock-mantle\.[a-z0-9-]+\.api\.aws$/.test(hostname)) return "mantle";
|
|
612
|
-
if (/^bedrock-runtime(?:-fips)?\.[a-z0-9-]+\.(?:amazonaws\.com|api\.aws)$/.test(hostname)) return "runtime";
|
|
613
|
-
} catch {}
|
|
614
|
-
}
|
|
615
|
-
supportsPersistedGpt6EffortUpdates() {
|
|
616
|
-
return this.getGenAISystem() !== "bedrock" && this.getBedrockEndpoint() === void 0;
|
|
617
|
-
}
|
|
618
|
-
getPolicyResponse(data, config, cached, status, statusText, headers) {
|
|
619
|
-
const policy = require_util.getOpenAiPolicyRefusal(data, this.usesGatewayErrorFormat());
|
|
620
|
-
if (!policy) return;
|
|
621
|
-
const response = data.response ?? data;
|
|
622
|
-
const billingData = {
|
|
623
|
-
...response,
|
|
624
|
-
usage: response.usage ?? data.usage
|
|
625
|
-
};
|
|
626
|
-
const partialOutput = getResponsesOutputText(response);
|
|
627
|
-
return this.applyBilling({
|
|
628
|
-
output: partialOutput === void 0 ? policy.message : require_util.getOpenAiPartialOutput(partialOutput, config.response_format?.type === "json_schema"),
|
|
629
|
-
...billingData.usage ? { tokenUsage: require_input.getResponsesTokenUsage(billingData, cached) } : {},
|
|
630
|
-
cached,
|
|
631
|
-
isRefusal: true,
|
|
632
|
-
guardrails: {
|
|
633
|
-
flagged: true,
|
|
634
|
-
...!partialOutput && policy.flaggedInput ? { flaggedInput: true } : {},
|
|
635
|
-
reason: policy.message
|
|
636
|
-
},
|
|
637
|
-
raw: response,
|
|
638
|
-
metadata: {
|
|
639
|
-
...response.id ? { responseId: response.id } : {},
|
|
640
|
-
...response.model ? { model: response.model } : {},
|
|
641
|
-
...policy.code ? { providerPolicy: { code: policy.code } } : {},
|
|
642
|
-
http: {
|
|
643
|
-
status,
|
|
644
|
-
statusText,
|
|
645
|
-
headers: headers ?? {}
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
}, billingData, config, cached);
|
|
649
|
-
}
|
|
650
|
-
getDeploymentCapabilities(config) {
|
|
651
|
-
const effectiveModelName = this.getEffectiveModelName(config);
|
|
652
|
-
const capabilityModelName = effectiveModelName.replace(/(^|\/)ft:/, "$1");
|
|
653
|
-
const isEffectiveGpt5Model = capabilityModelName.startsWith("gpt-5") || capabilityModelName.includes("/gpt-5");
|
|
654
|
-
const isEffectiveReasoningModel = this.isReasoningCapabilityModel(capabilityModelName);
|
|
655
|
-
const supportsTemperature = this.supportsTemperatureForCapabilityModel(capabilityModelName);
|
|
656
|
-
const passthroughModel = config.passthrough?.model;
|
|
657
|
-
const normalizedModelName = require_util.normalizeOpenAiBillingModelName(effectiveModelName);
|
|
658
|
-
const modelLookupName = normalizedModelName.startsWith("ft:") ? normalizedModelName.split(":")[1] : normalizedModelName;
|
|
659
|
-
const hasAzureCustomDeploymentHost = !(typeof passthroughModel === "string" && require_util.OPENAI_BILLING_MODELS.some(({ id }) => id === modelLookupName)) && [
|
|
660
|
-
config.apiHost,
|
|
661
|
-
config.apiBaseUrl,
|
|
662
|
-
this.getApiUrl()
|
|
663
|
-
].some((endpoint) => require_util.isAzureOpenAiEndpoint(endpoint));
|
|
664
|
-
const isGPT6Model = require_gpt6.isGpt6Model(capabilityModelName);
|
|
665
|
-
const isAzureResponsesDeploymentWithReasoningConfig = hasAzureCustomDeploymentHost && (config.reasoning !== void 0 || config.reasoning_effort !== void 0);
|
|
666
|
-
const isAzureResponsesDeploymentWithVerbosityConfig = hasAzureCustomDeploymentHost && config.verbosity !== void 0;
|
|
667
|
-
return {
|
|
668
|
-
isGPT6Model,
|
|
669
|
-
isAzureResponsesDeploymentWithReasoningConfig,
|
|
670
|
-
isReasoningModel: isGPT6Model || isEffectiveReasoningModel || isAzureResponsesDeploymentWithReasoningConfig,
|
|
671
|
-
supportsVerbosity: isGPT6Model || isEffectiveGpt5Model || isAzureResponsesDeploymentWithVerbosityConfig,
|
|
672
|
-
supportsTemperature: isGPT6Model || supportsTemperature
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
async getOpenAiBody(prompt, context, callApiOptions) {
|
|
676
|
-
const promptConfig = context?.prompt?.config;
|
|
677
|
-
const mergedConfig = {
|
|
678
|
-
...this.config,
|
|
679
|
-
...promptConfig
|
|
680
|
-
};
|
|
681
|
-
const passthrough = mergedConfig.passthrough ? { ...mergedConfig.passthrough } : void 0;
|
|
682
|
-
const config = {
|
|
683
|
-
...mergedConfig,
|
|
684
|
-
passthrough
|
|
685
|
-
};
|
|
686
|
-
const effectiveServiceTier = require_util.getOpenAiEffectiveServiceTier(this.config, promptConfig);
|
|
687
|
-
let input;
|
|
688
|
-
try {
|
|
689
|
-
const parsedJson = JSON.parse(prompt);
|
|
690
|
-
if (Array.isArray(parsedJson)) input = require_input.normalizeResponsesInput(parsedJson);
|
|
691
|
-
else input = prompt;
|
|
692
|
-
} catch {
|
|
693
|
-
input = prompt;
|
|
694
|
-
}
|
|
695
|
-
const { isGPT6Model, isAzureResponsesDeploymentWithReasoningConfig, isReasoningModel, supportsVerbosity, supportsTemperature } = this.getDeploymentCapabilities(config);
|
|
696
|
-
const maxOutputTokensDefault = config.omitDefaults ? require_logger.getEnvString("OPENAI_MAX_TOKENS") === void 0 ? void 0 : require_logger.getEnvInt("OPENAI_MAX_TOKENS") : require_logger.getEnvInt("OPENAI_MAX_TOKENS", 1024);
|
|
697
|
-
const reasoningMaxOutputTokensDefault = require_logger.getEnvInt("OPENAI_MAX_COMPLETION_TOKENS") ?? require_logger.getEnvInt("OPENAI_MAX_TOKENS");
|
|
698
|
-
const maxOutputTokens = config.max_output_tokens ?? (isReasoningModel ? reasoningMaxOutputTokensDefault : maxOutputTokensDefault);
|
|
699
|
-
const gpt6Reasoning = isGPT6Model ? require_gpt6.getGpt6ResponsesReasoning(this.config, context?.prompt?.config, (value) => require_render.renderVarsInObject(value, context?.vars ?? {})) : void 0;
|
|
700
|
-
const renderedReasoning = isGPT6Model ? gpt6Reasoning : require_util.prepareOpenAiReasoning(config.reasoning, context?.vars);
|
|
701
|
-
const renderedReasoningEffort = isReasoningModel && !isGPT6Model ? require_render.renderVarsInObject(config.reasoning_effort, context?.vars ?? {}) : void 0;
|
|
702
|
-
const effectiveReasoningEffort = renderedReasoning?.effort ?? renderedReasoningEffort;
|
|
703
|
-
const hasAzureReasoningEffort = isAzureResponsesDeploymentWithReasoningConfig && effectiveReasoningEffort !== void 0 && effectiveReasoningEffort !== "none";
|
|
704
|
-
const temperatureDefault = config.omitDefaults || isGPT6Model ? require_logger.getEnvString("OPENAI_TEMPERATURE") === void 0 ? void 0 : require_logger.getEnvFloat("OPENAI_TEMPERATURE") : require_logger.getEnvFloat("OPENAI_TEMPERATURE", 0);
|
|
705
|
-
const temperature = supportsTemperature && (isGPT6Model || !hasAzureReasoningEffort) ? config.temperature ?? temperatureDefault : void 0;
|
|
706
|
-
const reasoningEffort = isReasoningModel ? effectiveReasoningEffort : void 0;
|
|
707
|
-
const instructions = config.instructions;
|
|
708
|
-
const responseFormat = require_util.prepareOpenAiResponseFormat(config.response_format, context?.vars);
|
|
709
|
-
let textFormat;
|
|
710
|
-
if (responseFormat) {
|
|
711
|
-
if (responseFormat.type === "json_object") textFormat = { format: { type: "json_object" } };
|
|
712
|
-
else if (responseFormat.type === "json_schema") {
|
|
713
|
-
const schema = responseFormat.schema || responseFormat.json_schema?.schema;
|
|
714
|
-
textFormat = { format: {
|
|
715
|
-
type: "json_schema",
|
|
716
|
-
name: responseFormat.json_schema?.name || responseFormat.name || "response_schema",
|
|
717
|
-
schema,
|
|
718
|
-
strict: true
|
|
719
|
-
} };
|
|
720
|
-
} else textFormat = { format: { type: "text" } };
|
|
721
|
-
} else textFormat = { format: { type: "text" } };
|
|
722
|
-
if (supportsVerbosity && config.verbosity) textFormat = {
|
|
723
|
-
...textFormat,
|
|
724
|
-
verbosity: config.verbosity
|
|
725
|
-
};
|
|
726
|
-
const loadedTools = await require_util.prepareOpenAiTools(config.tools, context?.vars, callApiOptions?.abortSignal);
|
|
727
|
-
const responsesTools = Array.isArray(loadedTools) ? loadedTools.map(require_util.flattenResponseTool) : loadedTools;
|
|
728
|
-
const toolChoice = require_util.flattenResponseTool(config.tool_choice);
|
|
729
|
-
const body = {
|
|
730
|
-
model: this.modelName,
|
|
731
|
-
input,
|
|
732
|
-
...config.access_programs === void 0 ? {} : { access_programs: config.access_programs },
|
|
733
|
-
...maxOutputTokens === void 0 ? {} : { max_output_tokens: maxOutputTokens },
|
|
734
|
-
...reasoningEffort ? { reasoning: { effort: reasoningEffort } } : {},
|
|
735
|
-
...temperature === void 0 ? {} : { temperature },
|
|
736
|
-
...instructions ? { instructions } : {},
|
|
737
|
-
...(isGPT6Model || !reasoningEffort || reasoningEffort === "none") && (config.top_p !== void 0 || require_logger.getEnvString("OPENAI_TOP_P")) ? { top_p: config.top_p ?? require_logger.getEnvFloat("OPENAI_TOP_P", 1) } : {},
|
|
738
|
-
...responsesTools ? { tools: responsesTools } : {},
|
|
739
|
-
...toolChoice ? { tool_choice: toolChoice } : {},
|
|
740
|
-
...config.max_tool_calls ? { max_tool_calls: config.max_tool_calls } : {},
|
|
741
|
-
...config.include === void 0 ? {} : { include: config.include },
|
|
742
|
-
...config.previous_response_id ? { previous_response_id: config.previous_response_id } : {},
|
|
743
|
-
text: textFormat,
|
|
744
|
-
...config.truncation ? { truncation: config.truncation } : {},
|
|
745
|
-
...config.metadata ? { metadata: config.metadata } : {},
|
|
746
|
-
..."parallel_tool_calls" in config ? { parallel_tool_calls: Boolean(config.parallel_tool_calls) } : {},
|
|
747
|
-
...config.stream ? { stream: config.stream } : {},
|
|
748
|
-
..."store" in config ? { store: Boolean(config.store) } : {},
|
|
749
|
-
...config.background ? { background: config.background } : {},
|
|
750
|
-
...config.webhook_url ? { webhook_url: config.webhook_url } : {},
|
|
751
|
-
...config.user ? { user: config.user } : {},
|
|
752
|
-
...config.safety_identifier === void 0 ? {} : { safety_identifier: config.safety_identifier },
|
|
753
|
-
...config.service_tier ? { service_tier: config.service_tier } : {},
|
|
754
|
-
...config.prompt_cache_key === void 0 ? {} : { prompt_cache_key: config.prompt_cache_key },
|
|
755
|
-
...config.prompt_cache_options === void 0 ? {} : { prompt_cache_options: config.prompt_cache_options },
|
|
756
|
-
...config.prompt_cache_retention === void 0 ? {} : { prompt_cache_retention: config.prompt_cache_retention },
|
|
757
|
-
...config.passthrough || {},
|
|
758
|
-
...effectiveServiceTier === void 0 || effectiveServiceTier === null ? {} : { service_tier: require_util.normalizeOpenAiServiceTierForWire(effectiveServiceTier, this.getApiUrl()) }
|
|
759
|
-
};
|
|
760
|
-
if (effectiveServiceTier === null && config.passthrough?.service_tier !== null) delete body.service_tier;
|
|
761
|
-
require_util.assertOpenAiApiModel(body.model, this.getApiUrl());
|
|
762
|
-
if (isGPT6Model) {
|
|
763
|
-
if (gpt6Reasoning) body.reasoning = gpt6Reasoning;
|
|
764
|
-
else delete body.reasoning;
|
|
765
|
-
} else if (renderedReasoning && isReasoningModel) body.reasoning = {
|
|
766
|
-
...body.reasoning,
|
|
767
|
-
...renderedReasoning
|
|
768
|
-
};
|
|
769
|
-
if ("max_tokens" in body) delete body.max_tokens;
|
|
770
|
-
require_gpt6.applyGpt6RequestRules(body, config.passthrough?.model ?? this.getCapabilityModelName(), "responses", {
|
|
771
|
-
defaultResponsesTemperature: config.omitDefaults ? void 0 : 0,
|
|
772
|
-
supportsPersistedEffortUpdates: this.supportsPersistedGpt6EffortUpdates()
|
|
773
|
-
});
|
|
774
|
-
return {
|
|
775
|
-
body,
|
|
776
|
-
config: {
|
|
777
|
-
...config,
|
|
778
|
-
service_tier: effectiveServiceTier,
|
|
779
|
-
tools: Array.isArray(body.tools) ? body.tools : loadedTools,
|
|
780
|
-
response_format: responseFormat
|
|
781
|
-
}
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
async callApi(prompt, context, callApiOptions) {
|
|
785
|
-
if (callApiOptions?.abortSignal?.aborted) throw require_fetch.getAbortError(callApiOptions.abortSignal);
|
|
786
|
-
const apiKey = this.getApiKey();
|
|
787
|
-
if (this.requiresApiKey() && !apiKey) throw new Error(this.getMissingApiKeyErrorMessage());
|
|
788
|
-
const resolved = await this.getOpenAiBody(prompt, context, callApiOptions);
|
|
789
|
-
if (callApiOptions?.abortSignal?.aborted) throw require_fetch.getAbortError(callApiOptions.abortSignal);
|
|
790
|
-
const effectiveBody = resolved.body;
|
|
791
|
-
const asNumber = (v) => typeof v === "number" ? v : void 0;
|
|
792
|
-
const spanContext = require_genaiTracer.buildChatSpanContext({
|
|
793
|
-
system: this.getGenAISystem(),
|
|
794
|
-
model: String(effectiveBody.model),
|
|
795
|
-
providerId: this.id(),
|
|
796
|
-
prompt,
|
|
797
|
-
context,
|
|
798
|
-
request: {
|
|
799
|
-
maxTokens: asNumber(effectiveBody.max_output_tokens),
|
|
800
|
-
temperature: asNumber(effectiveBody.temperature),
|
|
801
|
-
topP: asNumber(effectiveBody.top_p),
|
|
802
|
-
stopSequences: Array.isArray(effectiveBody.stop) ? effectiveBody.stop : void 0
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
return require_genaiTracer.withGenAISpan({
|
|
806
|
-
...spanContext,
|
|
807
|
-
openaiApiType: "responses"
|
|
808
|
-
}, () => this.callApiInternal(context, {
|
|
809
|
-
...resolved,
|
|
810
|
-
abortSignal: callApiOptions?.abortSignal
|
|
811
|
-
}, apiKey), require_genaiTracer.extractProviderResponseAttributes);
|
|
812
|
-
}
|
|
813
|
-
async callApiInternal(context, prepared, apiKey) {
|
|
814
|
-
const { body, config, abortSignal } = prepared;
|
|
815
|
-
const effectiveModelName = this.getEffectiveModelName(config);
|
|
816
|
-
const isDeepResearchModel = effectiveModelName.includes("deep-research");
|
|
817
|
-
if (isDeepResearchModel) {
|
|
818
|
-
if (!config.tools?.some((tool) => tool.type === "web_search" || tool.type === "web_search_preview" || tool.type === "file_search" && Array.isArray(tool.vector_store_ids) && tool.vector_store_ids.length > 0 || tool.type === "mcp")) return { error: `Deep research model ${effectiveModelName} requires at least one data source. Configure web_search, web_search_preview, file_search with vector_store_ids, or an MCP tool.` };
|
|
819
|
-
const mcpTools = config.tools?.filter((tool) => tool.type === "mcp") || [];
|
|
820
|
-
for (const mcpTool of mcpTools) if (mcpTool.require_approval !== "never") return { error: `Deep research model ${effectiveModelName} requires MCP tools to have require_approval: 'never'. Update your MCP tool configuration:\ntools:\n - type: mcp\n require_approval: never` };
|
|
821
|
-
}
|
|
822
|
-
let timeout = require_shared.getRequestTimeoutMs();
|
|
823
|
-
const isGpt5ProModel = /(^|\/)gpt-5(?:\.\d+)?-pro(?:-|$)/.test(effectiveModelName);
|
|
824
|
-
if (isDeepResearchModel || isGpt5ProModel || body.background === true) {
|
|
825
|
-
const evalTimeout = require_logger.getEnvInt("PROMPTFOO_EVAL_TIMEOUT_MS", 0);
|
|
826
|
-
timeout = evalTimeout > 0 ? evalTimeout : require_shared.LONG_RUNNING_MODEL_TIMEOUT_MS;
|
|
827
|
-
require_logger.logger.debug(`Using timeout of ${timeout}ms for long-running model ${effectiveModelName}`);
|
|
828
|
-
}
|
|
829
|
-
let data;
|
|
830
|
-
let status;
|
|
831
|
-
let statusText;
|
|
832
|
-
let cached = false;
|
|
833
|
-
let deleteFromCache;
|
|
834
|
-
let updateCache;
|
|
835
|
-
let responseHeaders;
|
|
836
|
-
let pollingBackground = false;
|
|
837
|
-
try {
|
|
838
|
-
const url = require_util.appendOpenAiApiPath(this.getApiUrl(), "responses");
|
|
839
|
-
const backgroundDeadline = body.background && !body.stream ? Date.now() + timeout : void 0;
|
|
840
|
-
const customHeaders = this.getOpenAiRequestHeaders(config.headers);
|
|
841
|
-
const hasCustomHeader = (name) => Object.keys(customHeaders).some((header) => header.toLowerCase() === name);
|
|
842
|
-
const buildHeaders = (key) => ({
|
|
843
|
-
...hasCustomHeader("content-type") ? {} : { "Content-Type": "application/json" },
|
|
844
|
-
...key && !hasCustomHeader("authorization") ? { Authorization: `Bearer ${key}` } : {},
|
|
845
|
-
...customHeaders
|
|
846
|
-
});
|
|
847
|
-
const getAuthHeaders = this.getRequestAuthentication();
|
|
848
|
-
const request = {
|
|
849
|
-
method: "POST",
|
|
850
|
-
headers: buildHeaders(getAuthHeaders ? void 0 : apiKey),
|
|
851
|
-
...getAuthHeaders ? { getAuthHeaders } : {},
|
|
852
|
-
body: JSON.stringify(body),
|
|
853
|
-
cacheScope: this.backgroundCacheScope,
|
|
854
|
-
hasPerPromptAuthorization: Object.keys(context?.prompt?.config?.headers ?? {}).some((header) => header.toLowerCase() === "authorization"),
|
|
855
|
-
...abortSignal ? { signal: abortSignal } : {}
|
|
856
|
-
};
|
|
857
|
-
if (body.stream && body.background) {
|
|
858
|
-
let backgroundResponseId;
|
|
859
|
-
let streamAccepted = false;
|
|
860
|
-
let streamTimedOut = false;
|
|
861
|
-
let streamCreationGraceHandle;
|
|
862
|
-
const controller = new AbortController();
|
|
863
|
-
let rejectPendingCreation;
|
|
864
|
-
const pendingCreationCancellation = new Promise((_resolve, reject) => {
|
|
865
|
-
rejectPendingCreation = reject;
|
|
866
|
-
});
|
|
867
|
-
const startStreamCreationGrace = () => {
|
|
868
|
-
if (streamCreationGraceHandle) return;
|
|
869
|
-
streamCreationGraceHandle = setTimeout(() => controller.abort(), Math.min(Math.max(timeout, BACKGROUND_STREAM_CREATION_GRACE_MIN_MS), BACKGROUND_STREAM_CREATION_GRACE_MAX_MS));
|
|
870
|
-
};
|
|
871
|
-
const timeoutHandle = setTimeout(() => {
|
|
872
|
-
streamTimedOut = true;
|
|
873
|
-
if (streamAccepted && !backgroundResponseId) {
|
|
874
|
-
rejectPendingCreation?.(/* @__PURE__ */ new Error(`OpenAI streaming response timed out after ${timeout}ms`));
|
|
875
|
-
startStreamCreationGrace();
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
|
-
controller.abort();
|
|
879
|
-
}, timeout);
|
|
880
|
-
const abortStream = () => {
|
|
881
|
-
if (backgroundResponseId) {
|
|
882
|
-
controller.abort(abortSignal?.reason);
|
|
883
|
-
return;
|
|
884
|
-
}
|
|
885
|
-
const stopStreamCreation = () => {
|
|
886
|
-
if (backgroundResponseId || !streamAccepted) {
|
|
887
|
-
controller.abort(abortSignal?.reason);
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
if (abortSignal) {
|
|
891
|
-
startStreamCreationGrace();
|
|
892
|
-
rejectPendingCreation?.(require_fetch.getAbortError(abortSignal));
|
|
893
|
-
}
|
|
894
|
-
};
|
|
895
|
-
if (streamAccepted) stopStreamCreation();
|
|
896
|
-
else queueMicrotask(stopStreamCreation);
|
|
897
|
-
};
|
|
898
|
-
abortSignal?.addEventListener("abort", abortStream, { once: true });
|
|
899
|
-
const streamCompletion = (async () => {
|
|
900
|
-
try {
|
|
901
|
-
const response = await require_fetch.fetchWithRetries(url, {
|
|
902
|
-
method: request.method,
|
|
903
|
-
headers: request.headers,
|
|
904
|
-
body: request.body,
|
|
905
|
-
...request.getAuthHeaders ? { getAuthHeaders: request.getAuthHeaders } : {},
|
|
906
|
-
signal: controller.signal
|
|
907
|
-
}, timeout, config.maxRetries);
|
|
908
|
-
let responseData;
|
|
909
|
-
if (response.status >= 200 && response.status < 300) {
|
|
910
|
-
streamAccepted = true;
|
|
911
|
-
responseData = await readResponsesStream(response, "OpenAI", require_logger.logger, (streamedResponse) => {
|
|
912
|
-
if (typeof streamedResponse.id === "string") {
|
|
913
|
-
backgroundResponseId = streamedResponse.id;
|
|
914
|
-
if (abortSignal?.aborted || streamTimedOut) controller.abort(abortSignal?.reason);
|
|
915
|
-
}
|
|
916
|
-
}, {
|
|
917
|
-
preserveFailedOutput: this.usesGatewayErrorFormat(),
|
|
918
|
-
classifyError: require_util.classifyOpenAiGatewayStreamError
|
|
919
|
-
});
|
|
920
|
-
} else {
|
|
921
|
-
const text = await response.text();
|
|
922
|
-
try {
|
|
923
|
-
responseData = JSON.parse(text);
|
|
924
|
-
} catch {
|
|
925
|
-
responseData = text;
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
return {
|
|
929
|
-
data: responseData,
|
|
930
|
-
status: response.status,
|
|
931
|
-
statusText: response.statusText,
|
|
932
|
-
headers: Object.fromEntries(response.headers.entries())
|
|
933
|
-
};
|
|
934
|
-
} catch (err) {
|
|
935
|
-
if (backgroundResponseId) await cancelBackgroundResponse(backgroundResponseId, url, request);
|
|
936
|
-
if (controller.signal.aborted && !abortSignal?.aborted) throw new Error(`OpenAI streaming response timed out after ${timeout}ms`);
|
|
937
|
-
throw err;
|
|
938
|
-
} finally {
|
|
939
|
-
clearTimeout(timeoutHandle);
|
|
940
|
-
clearTimeout(streamCreationGraceHandle);
|
|
941
|
-
abortSignal?.removeEventListener("abort", abortStream);
|
|
942
|
-
}
|
|
943
|
-
})();
|
|
944
|
-
({data, status, statusText, headers: responseHeaders} = await Promise.race([streamCompletion, pendingCreationCancellation]));
|
|
945
|
-
} else if (body.stream) {
|
|
946
|
-
const controller = new AbortController();
|
|
947
|
-
const timeoutHandle = setTimeout(() => controller.abort(), timeout);
|
|
948
|
-
const signal = abortSignal ? AbortSignal.any([controller.signal, abortSignal]) : controller.signal;
|
|
949
|
-
try {
|
|
950
|
-
const response = await require_cache.fetchWithCache(url, {
|
|
951
|
-
...request,
|
|
952
|
-
signal
|
|
953
|
-
}, timeout, "text", true, config.maxRetries);
|
|
954
|
-
status = response.status;
|
|
955
|
-
statusText = response.statusText;
|
|
956
|
-
responseHeaders = response.headers;
|
|
957
|
-
if (status >= 200 && status < 300) data = await readResponsesStream(new Response(response.data), "OpenAI", require_logger.logger, void 0, {
|
|
958
|
-
preserveFailedOutput: this.usesGatewayErrorFormat(),
|
|
959
|
-
classifyError: require_util.classifyOpenAiGatewayStreamError
|
|
960
|
-
});
|
|
961
|
-
else try {
|
|
962
|
-
data = JSON.parse(response.data);
|
|
963
|
-
} catch {
|
|
964
|
-
data = response.data;
|
|
965
|
-
}
|
|
966
|
-
} catch (err) {
|
|
967
|
-
if (controller.signal.aborted) throw new Error(`OpenAI streaming response timed out after ${timeout}ms`);
|
|
968
|
-
throw err;
|
|
969
|
-
} finally {
|
|
970
|
-
clearTimeout(timeoutHandle);
|
|
971
|
-
}
|
|
972
|
-
} else ({data, cached, status, statusText, deleteFromCache, updateCache, headers: responseHeaders} = body.background ? await createBackgroundResponseWithCancellation(url, request, timeout, this.shouldBustCache(context), config.maxRetries) : await require_cache.fetchWithCache(url, {
|
|
973
|
-
method: request.method,
|
|
974
|
-
headers: request.headers,
|
|
975
|
-
body: request.body,
|
|
976
|
-
...request.getAuthHeaders ? { getAuthHeaders: request.getAuthHeaders } : {},
|
|
977
|
-
...request.signal ? { signal: request.signal } : {}
|
|
978
|
-
}, timeout, "json", this.shouldBustCache(context), config.maxRetries));
|
|
979
|
-
const policyResponse = this.getPolicyResponse(data, config, cached, status, statusText, responseHeaders);
|
|
980
|
-
if (policyResponse) return policyResponse;
|
|
981
|
-
if (status < 200 || status >= 300) {
|
|
982
|
-
const errorMessage = `API error: ${status} ${statusText}\n${typeof data === "string" ? data : JSON.stringify(data)}`;
|
|
983
|
-
if (typeof data === "object" && data?.error?.code === "invalid_prompt" && !require_openrouterBilling.isOpenRouterEndpoint(this.getApiUrl()) && (!this.usesGatewayErrorFormat() || require_util.getOpenAiGatewayErrorType(data) === void 0)) return {
|
|
984
|
-
output: errorMessage,
|
|
985
|
-
tokenUsage: data?.usage ? require_input.getResponsesTokenUsage(data, cached) : void 0,
|
|
986
|
-
isRefusal: true,
|
|
987
|
-
metadata: { http: {
|
|
988
|
-
status,
|
|
989
|
-
statusText,
|
|
990
|
-
headers: responseHeaders ?? {}
|
|
991
|
-
} }
|
|
992
|
-
};
|
|
993
|
-
return {
|
|
994
|
-
error: errorMessage,
|
|
995
|
-
metadata: { http: {
|
|
996
|
-
status,
|
|
997
|
-
statusText,
|
|
998
|
-
headers: responseHeaders ?? {}
|
|
999
|
-
} }
|
|
1000
|
-
};
|
|
1001
|
-
}
|
|
1002
|
-
if (body.background && (data.status === "queued" || data.status === "in_progress")) {
|
|
1003
|
-
pollingBackground = true;
|
|
1004
|
-
const cancelOnStop = !require_cache.isCacheEnabled() || Boolean(this.shouldBustCache(context)) || !getBackgroundCacheIdentity(url, request, data.id).cacheable;
|
|
1005
|
-
const polled = await coalesceBackgroundResponse(data, url, request, timeout, config.maxRetries, cached, deleteFromCache, cancelOnStop, backgroundDeadline);
|
|
1006
|
-
if (polled.shared) cached = true;
|
|
1007
|
-
else if (!polled.error && (polled.data.status === "completed" || polled.data.status === "incomplete")) {
|
|
1008
|
-
const billingIdentity = getBackgroundCacheIdentity(url, request, polled.data.id);
|
|
1009
|
-
cached = billingIdentity.cacheable && require_cache.isCacheEnabled() && !this.shouldBustCache(context) && !require_cache.claimCacheKeyOnce(`openai:background-billing:${billingIdentity.key}`);
|
|
1010
|
-
}
|
|
1011
|
-
data = polled.data;
|
|
1012
|
-
status = polled.status;
|
|
1013
|
-
statusText = polled.statusText;
|
|
1014
|
-
responseHeaders = polled.headers;
|
|
1015
|
-
const polledPolicy = this.getPolicyResponse(data, config, cached, status, statusText, responseHeaders);
|
|
1016
|
-
if (polledPolicy) {
|
|
1017
|
-
await deleteFromCache?.();
|
|
1018
|
-
return polledPolicy;
|
|
1019
|
-
}
|
|
1020
|
-
if (!polled.error && (data.status === "completed" || data.status === "incomplete")) await updateCache?.(data, status, statusText, responseHeaders);
|
|
1021
|
-
if (polled.error) {
|
|
1022
|
-
if (polled.status === 0 && cancelOnStop || polled.cancelled) await deleteFromCache?.();
|
|
1023
|
-
return {
|
|
1024
|
-
error: polled.error,
|
|
1025
|
-
metadata: { http: {
|
|
1026
|
-
status,
|
|
1027
|
-
statusText,
|
|
1028
|
-
headers: responseHeaders ?? {}
|
|
1029
|
-
} }
|
|
1030
|
-
};
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
if (body.background && (data.status === "cancelled" || data.status === "failed")) {
|
|
1034
|
-
await deleteFromCache?.();
|
|
1035
|
-
const upstreamError = data.error?.message;
|
|
1036
|
-
return {
|
|
1037
|
-
error: upstreamError ? `Background response ${data.id} ${data.status}: ${upstreamError}` : `Background response ${data.id} was ${data.status}.`,
|
|
1038
|
-
metadata: { http: {
|
|
1039
|
-
status,
|
|
1040
|
-
statusText,
|
|
1041
|
-
headers: responseHeaders ?? {}
|
|
1042
|
-
} }
|
|
1043
|
-
};
|
|
1044
|
-
}
|
|
1045
|
-
} catch (err) {
|
|
1046
|
-
if (require_fetch.isAbortError(err) || abortSignal?.aborted) throw abortSignal?.aborted ? require_fetch.getAbortError(abortSignal) : err;
|
|
1047
|
-
if (err instanceof require_fetch.HttpRateLimitError) return {
|
|
1048
|
-
error: require_fetch.formatRateLimitErrorMessage(err),
|
|
1049
|
-
metadata: {
|
|
1050
|
-
rateLimitKind: err.kind,
|
|
1051
|
-
http: {
|
|
1052
|
-
status: err.status,
|
|
1053
|
-
statusText: err.statusText,
|
|
1054
|
-
headers: err.headers ?? {}
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
};
|
|
1058
|
-
require_logger.logger.error(`API call error: ${String(err)}`);
|
|
1059
|
-
if (!pollingBackground) await deleteFromCache?.();
|
|
1060
|
-
return {
|
|
1061
|
-
error: `API call error: ${String(err)}`,
|
|
1062
|
-
metadata: { http: {
|
|
1063
|
-
status: 0,
|
|
1064
|
-
statusText: "Error",
|
|
1065
|
-
headers: responseHeaders ?? {}
|
|
1066
|
-
} }
|
|
1067
|
-
};
|
|
1068
|
-
}
|
|
1069
|
-
if (data.error?.message) {
|
|
1070
|
-
await deleteFromCache?.();
|
|
1071
|
-
return {
|
|
1072
|
-
error: require_util.formatOpenAiError(data),
|
|
1073
|
-
metadata: { http: {
|
|
1074
|
-
status,
|
|
1075
|
-
statusText,
|
|
1076
|
-
headers: responseHeaders ?? {}
|
|
1077
|
-
} }
|
|
1078
|
-
};
|
|
1079
|
-
}
|
|
1080
|
-
const result = await this.processor.processResponseOutput(data, config, cached, { suppressReasoningOutput: Boolean(body.stream) });
|
|
1081
|
-
const billedResult = this.applyBilling(result, data, config, cached);
|
|
1082
|
-
return {
|
|
1083
|
-
...billedResult,
|
|
1084
|
-
metadata: {
|
|
1085
|
-
...billedResult.metadata,
|
|
1086
|
-
http: {
|
|
1087
|
-
status,
|
|
1088
|
-
statusText,
|
|
1089
|
-
headers: responseHeaders ?? {}
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
};
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
//#endregion
|
|
1096
|
-
Object.defineProperty(exports, "OpenAiResponsesProvider", {
|
|
1097
|
-
enumerable: true,
|
|
1098
|
-
get: function() {
|
|
1099
|
-
return OpenAiResponsesProvider;
|
|
1100
|
-
}
|
|
1101
|
-
});
|
|
1102
|
-
Object.defineProperty(exports, "readResponsesStream", {
|
|
1103
|
-
enumerable: true,
|
|
1104
|
-
get: function() {
|
|
1105
|
-
return readResponsesStream;
|
|
1106
|
-
}
|
|
1107
|
-
});
|
|
1108
|
-
|
|
1109
|
-
//# sourceMappingURL=responses-CwgjeuOg.cjs.map
|