promptfoo 0.120.24 → 0.120.26
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 +35 -22
- package/dist/src/{ListApp-55OAHww3.js → ListApp-D3DG0F8h.js} +1 -1
- package/dist/src/{accounts-BwVGYllP.cjs → accounts-BzEY8H3v.cjs} +5 -5
- package/dist/src/{accounts-BOlMHrvn.js → accounts-DHHiXsy6.js} +6 -6
- package/dist/src/{accounts-DxR9x_En.js → accounts-R3gfCR_g.js} +5 -5
- package/dist/src/{agentic-utils-t9-1raty.js → agentic-utils-D6_gzOUF.js} +3 -3
- package/dist/src/{agents-DMpQ860j.cjs → agents-C7BiinFI.cjs} +7 -7
- package/dist/src/{agents-9Z7pO8yx.js → agents-Cao4i7AX.js} +8 -8
- package/dist/src/{agents-DjExVR3v.js → agents-Cnph5GLD.js} +2 -2
- package/dist/src/{agents-CI0Ad69d.cjs → agents-CwM7re15.cjs} +5 -5
- package/dist/src/{agents-BwI-Tm5m.js → agents-DETIQHqF.js} +7 -7
- package/dist/src/{agents-CRAmwjo-.js → agents-DYIT-hQy.js} +6 -6
- package/dist/src/{agents-BbIpDhgp.js → agents-GiUianme.js} +5 -5
- package/dist/src/{agents-yL5DzIKY.js → agents-v4cW_ZgC.js} +2 -2
- package/dist/src/{aimlapi-xHHqwNg8.js → aimlapi-CMJpKK-B.js} +13 -13
- package/dist/src/{aimlapi-BM9P45Bp.js → aimlapi-DMF6v_vb.js} +15 -15
- package/dist/src/{aimlapi-DKo7IxJg.cjs → aimlapi-DoGLcQW_.cjs} +14 -14
- package/dist/src/{aimlapi-ivzDkqbs.js → aimlapi-DtSf1ykJ.js} +2 -2
- package/dist/src/app/assets/index-BOgkICuY.css +1 -0
- package/dist/src/app/assets/index-CSgqn_Vd.js +428 -0
- package/dist/src/app/assets/{vendor-charts-DnwydkkY.js → vendor-charts-CYyo8R8v.js} +1 -1
- package/dist/src/app/assets/{vendor-markdown-DjKAU15k.js → vendor-markdown-DSmzq4Jh.js} +1 -1
- package/dist/src/app/assets/vendor-react-AtKqiNEf.js +4 -0
- package/dist/src/app/assets/{vendor-syntax-Dc86c4Bu.js → vendor-syntax-D06x6TQF.js} +1 -1
- package/dist/src/app/index.html +6 -6
- package/dist/src/app/tsconfig.app.tsbuildinfo +1 -1
- package/dist/src/{audio-B3QGL6Nl.cjs → audio-BWjyvHn9.cjs} +4 -4
- package/dist/src/{audio-C-1oBiVZ.js → audio-BrJBFN2b.js} +4 -4
- package/dist/src/{audio-DnfDVjhL.js → audio-DUH4q0Xq.js} +5 -5
- package/dist/src/{audio-DQWHfAr8.js → audio-U580w8jM.js} +2 -2
- package/dist/src/{base-DHam07ip.js → base-BaXmtXYp.js} +3 -3
- package/dist/src/{base-BjsgxJp9.js → base-Dtp8b4_N.js} +3 -3
- package/dist/src/{base-Bso8ccGu.cjs → base-f71xxWai.cjs} +3 -3
- package/dist/src/{blobs-DOdc-E8L.cjs → blobs-673H0jCl.cjs} +3 -3
- package/dist/src/{blobs-Dcm272OH.js → blobs-C9J2mVgo.js} +3 -3
- package/dist/src/{blobs-MlVQyoSc.js → blobs-kt8v3UyH.js} +3 -3
- package/dist/src/{cache-KNsTJLKP.cjs → cache-7xULbvt3.cjs} +35 -8
- package/dist/src/{cache-BMl3AIo5.js → cache-BLLayYEN.js} +24 -9
- package/dist/src/{cache-B0ptF7sO.js → cache-BUPcq0Ad.js} +3 -3
- package/dist/src/cache-CVfRb-HD.cjs +6 -0
- package/dist/src/{cache-DPztwHxt.js → cache-O4EuX2JV.js} +4 -4
- package/dist/src/{cache-DHm8Pc8l.js → cache-mIszOnuz.js} +5 -22
- package/dist/src/{chat-DOQIJx7O.cjs → chat-C4zqjObh.cjs} +10 -10
- package/dist/src/{chat-DDGU7Tik.js → chat-C8Ei4f87.js} +9 -9
- package/dist/src/{chat-BnzIuoTQ.js → chat-CgyGj2hC.js} +12 -12
- package/dist/src/{chat-BRMJOuCv.js → chat-Cpz3O-Xl.js} +14 -14
- package/dist/src/{chat-CVOyOBYk.js → chat-DIywASPG.js} +11 -11
- package/dist/src/{chat-CrnXMbvh.cjs → chat-Fl6TZJRS.cjs} +13 -13
- package/dist/src/{chat-D8GcWK9l.js → chat-XPN9YHhr.js} +2 -2
- package/dist/src/{chatkit-IWIuhxFE.js → chatkit-DEls11hE.js} +4 -4
- package/dist/src/{chatkit-DlOZ-eNb.js → chatkit-DIrJX8xk.js} +4 -4
- package/dist/src/{chatkit-CcktkleS.js → chatkit-Dpxrq4eD.js} +2 -2
- package/dist/src/{chatkit-yeVtURUi.cjs → chatkit-e25Ziu17.cjs} +4 -4
- package/dist/src/{claude-agent-sdk-BiMgSH9g.js → claude-agent-sdk-6-xTaLwM.js} +48 -19
- package/dist/src/{claude-agent-sdk-Yj9Hq0cH.cjs → claude-agent-sdk-BzxF6NIJ.cjs} +48 -19
- package/dist/src/{claude-agent-sdk-rVqlUIJl.js → claude-agent-sdk-CmkTnKGH.js} +49 -20
- package/dist/src/{claude-agent-sdk-yid1kGsL.js → claude-agent-sdk-rXCBLK_o.js} +40 -11
- package/dist/src/{cloud-ByJVRSQI.js → cloud-BMbRVJFw.js} +3 -3
- package/dist/src/cloud-CZ4hytdm.js +5 -0
- package/dist/src/{cloudflare-ai-DmJZcvVx.cjs → cloudflare-ai-BAQ0u_dg.cjs} +14 -14
- package/dist/src/{cloudflare-ai-CWKYPCCF.js → cloudflare-ai-CUg4BTcj.js} +13 -13
- package/dist/src/{cloudflare-ai-goDJ5bwr.js → cloudflare-ai-CobxMTR4.js} +15 -15
- package/dist/src/{cloudflare-ai-CdKv38f6.js → cloudflare-ai-Z9X219gp.js} +2 -2
- package/dist/src/{cloudflare-gateway-BW8hcdB0.cjs → cloudflare-gateway-C0sgfr_z.cjs} +15 -15
- package/dist/src/{cloudflare-gateway-CDCOS1Os.js → cloudflare-gateway-D2_yi-Fh.js} +16 -16
- package/dist/src/{cloudflare-gateway-Dz_HCMGY.js → cloudflare-gateway-Djf3F3_H.js} +2 -2
- package/dist/src/{cloudflare-gateway-gzmTsXcd.js → cloudflare-gateway-_itGuXry.js} +14 -14
- package/dist/src/{codex-sdk-BlvhxMr0.js → codex-sdk-BASDNkIl.js} +90 -34
- package/dist/src/{codex-sdk-BC5qbCjh.js → codex-sdk-dSnGdgIp.js} +92 -36
- package/dist/src/{codex-sdk-CBpm53B8.js → codex-sdk-ibXwdglL.js} +91 -35
- package/dist/src/{codex-sdk-Cf5_CQch.cjs → codex-sdk-wTEpMM_X.cjs} +92 -36
- package/dist/src/{cometapi-DoaO5SLq.js → cometapi-B01btbfb.js} +16 -16
- package/dist/src/{cometapi-BUKGSUCw.js → cometapi-ChAaRjg5.js} +14 -14
- package/dist/src/{cometapi-C6BSw9k3.js → cometapi-DHUAH6nK.js} +2 -2
- package/dist/src/{cometapi-B3TzpkNI.cjs → cometapi-JbvOJSCO.cjs} +15 -15
- package/dist/src/{completion-BLe7SUA4.js → completion-BBJ6zmG3.js} +6 -6
- package/dist/src/{completion-1RAiLcwi.js → completion-D9_MDlnd.js} +6 -6
- package/dist/src/{completion-D6BTVt6e.cjs → completion-DDyL3Cb2.cjs} +6 -6
- package/dist/src/{docker-CkOzlD1W.js → docker-BuButc4D.js} +15 -15
- package/dist/src/{docker-BWsSX8Pn.cjs → docker-Ckw-j7Rr.cjs} +14 -14
- package/dist/src/{docker-CMf5SGLq.js → docker-JAAubMw3.js} +13 -13
- package/dist/src/{docker-C0AzMsuf.js → docker-vnOg96gi.js} +2 -2
- package/dist/src/errors-DnGCbnx8.js +36 -0
- package/dist/src/{esm-gWVPXn3r.cjs → esm-BQkx5roy.cjs} +2 -2
- package/dist/src/{esm-Lh6czAFT.js → esm-CYhseqj4.js} +2 -2
- package/dist/src/{esm-D40XsWlR.js → esm-rDtG_2rg.js} +2 -2
- package/dist/src/eval-CKHWqG9f.js +16 -0
- package/dist/src/{eval-WaSg64w3.js → eval-CYrbG57o.js} +106 -29
- package/dist/src/{evalResult-CGrGU_cG.js → evalResult-6JaUIStC.js} +7 -7
- package/dist/src/{evalResult-C_UM63nn.js → evalResult-COsVttMA.js} +7 -7
- package/dist/src/evalResult-CxTP-LMm.cjs +11 -0
- package/dist/src/evalResult-CzLURDcP.js +13 -0
- package/dist/src/{evalResult-BU4huold.cjs → evalResult-DlRfu_Rq.cjs} +7 -7
- package/dist/src/evalResult-DyttNQ_G.js +11 -0
- package/dist/src/evaluator-0PvfeBYh.js +38 -0
- package/dist/src/{evaluator-gmF3Vddp.js → evaluator-3EJCMTs0.js} +75 -49
- package/dist/src/{extractor-D-RM2m6A.cjs → extractor-DbhlYEeo.cjs} +23 -6
- package/dist/src/{extractor-Da8IxCeS.js → extractor-Hs7la_19.js} +23 -6
- package/dist/src/{extractor-BA90EtLq.js → extractor-LSYjrhK0.js} +23 -6
- package/dist/src/{fetch-BIfcW-Fd.js → fetch-18MuNu9i.js} +21 -7
- package/dist/src/{fetch-CW9GabAi.js → fetch-Bi0o-fdp.js} +2 -2
- package/dist/src/fetch-CMptBDVg.cjs +4 -0
- package/dist/src/fetch-DAZkv3gV.js +6 -0
- package/dist/src/{fetch-Mb7SbeM-.js → fetch-SRsE6Ctl.js} +21 -7
- package/dist/src/{fetch-MvWxCS5U.cjs → fetch-ZMn_oemb.cjs} +21 -7
- package/dist/src/{fileExtensions-CzcPkiKZ.js → fileExtensions-BpuMmaFL.js} +1 -1
- package/dist/src/{formatDuration-CCiZ-wBY.js → formatDuration-Doo0xq-z.js} +1 -1
- package/dist/src/{genaiTracer-BQ8AmajD.cjs → genaiTracer-CQlpZkrp.cjs} +2 -2
- package/dist/src/{genaiTracer-foKtbVa2.js → genaiTracer-CqNnnXrE.js} +1 -1
- package/dist/src/graders-BCytzXrb.js +34 -0
- package/dist/src/{graders-CwtelA9k.js → graders-BaMCwIKp.js} +212 -91
- package/dist/src/graders-CGZQShfJ.cjs +33 -0
- package/dist/src/{graders-2dabIkXs.cjs → graders-DzUUnUjC.cjs} +212 -91
- package/dist/src/{graders-BscQ6O1Q.js → graders-QsALpIdy.js} +211 -90
- package/dist/src/graders-spkuVC-E.js +36 -0
- package/dist/src/{image-Dv0o-Ab7.js → image-BXt_7u0v.js} +4 -4
- package/dist/src/{image-B6TV9l0v.js → image-BiEVdpdP.js} +7 -7
- package/dist/src/{image-DS9hlgSc.cjs → image-C3BjJUAU.cjs} +7 -7
- package/dist/src/{image-_jKUeeh9.js → image-COCWy5dX.js} +2 -2
- package/dist/src/{image-DqElR73O.cjs → image-D10zEe1f.cjs} +4 -4
- package/dist/src/{image-BVEVjrwl.js → image-DB4sHxdJ.js} +5 -5
- package/dist/src/{image-C1i3NoZo.js → image-mhAGP07h.js} +7 -7
- package/dist/src/index.cjs +305 -112
- package/dist/src/index.d.cts +137 -3
- package/dist/src/index.d.ts +137 -3
- package/dist/src/index.js +304 -111
- package/dist/src/{interactiveCheck-CjK2R4rB.js → interactiveCheck-DU-MAhp5.js} +2 -2
- package/dist/src/{knowledgeBase-K5fJN2kC.cjs → knowledgeBase-Bnb00xKs.cjs} +8 -8
- package/dist/src/{knowledgeBase-D-xthvn0.js → knowledgeBase-CMvMlLZR.js} +9 -9
- package/dist/src/{knowledgeBase-DJZHeJqg.js → knowledgeBase-DotRBzUE.js} +2 -2
- package/dist/src/{knowledgeBase-BSs2ldSR.js → knowledgeBase-XJQ0Qyez.js} +8 -8
- package/dist/src/{litellm-kPhaZkzz.js → litellm-BECdjOTx.js} +3 -3
- package/dist/src/{litellm-uRLukY7s.cjs → litellm-BrnZhMcL.cjs} +15 -15
- package/dist/src/{litellm-DH_rVIOd.js → litellm-CHrRmPAe.js} +16 -16
- package/dist/src/{litellm-DoXGHlpD.js → litellm-CrLJrPIm.js} +14 -14
- package/dist/src/{logger-CMp-NS-e.cjs → logger-BdZ-IqBc.cjs} +5 -2
- package/dist/src/{logger-Bzi5o47S.js → logger-BotXmWKW.js} +5 -2
- package/dist/src/{logger-q5I8CByj.js → logger-w8Ozp0Td.js} +5 -2
- package/dist/src/{luma-ray-B3GiVpuq.js → luma-ray-BOeX-h0M.js} +10 -10
- package/dist/src/{luma-ray-CPISsLu-.js → luma-ray-C-w6EsJm.js} +2 -2
- package/dist/src/{luma-ray-BrWrKIIB.cjs → luma-ray-C0RkI3lt.cjs} +10 -10
- package/dist/src/{luma-ray-gyI_GEy2.js → luma-ray-DgKLS0BF.js} +11 -11
- package/dist/src/main.js +3260 -2537
- package/dist/src/{messages-CJgEjRQF.js → messages-CDZYGNlS.js} +13 -10
- package/dist/src/{messages-BMkwrfmt.js → messages-D61tPFQo.js} +14 -11
- package/dist/src/{messages-B5HsO_dM.cjs → messages-DXV3Qh8_.cjs} +14 -11
- package/dist/src/{meteor-CBciquOS.js → meteor-Dj8cTkU_.js} +1 -1
- package/dist/src/{meteor-0cLf9TIn.js → meteor-P2rUE-Uz.js} +1 -1
- package/dist/src/{meteor-BQ6Ws9k2.js → meteor-SLNTgmXm.js} +2 -2
- package/dist/src/{meteor-DRuEfzuQ.cjs → meteor-odmwVbyG.cjs} +1 -1
- package/dist/src/{nova-reel-B5SOonY2.js → nova-reel-Bk5npr2q.js} +11 -11
- package/dist/src/{nova-reel-CT9ZuhJ3.js → nova-reel-C2LFfVTf.js} +2 -2
- package/dist/src/{nova-reel-ByTx85ed.cjs → nova-reel-D9FXq3Mt.cjs} +10 -10
- package/dist/src/{nova-reel-ChM7WaHR.js → nova-reel-DtCjbD5O.js} +10 -10
- package/dist/src/{nova-sonic-D4M3kKYu.js → nova-sonic-BXRfQyF-.js} +8 -8
- package/dist/src/{nova-sonic-C-H3eDvL.cjs → nova-sonic-BoRSY_U6.cjs} +7 -7
- package/dist/src/{nova-sonic-DgifpOKF.js → nova-sonic-CgaWLDM1.js} +7 -7
- package/dist/src/{nova-sonic-BqP59oOu.js → nova-sonic-D_qERM-K.js} +2 -2
- package/dist/src/{openai-BjpdxIOG.cjs → openai-Bigwjgo1.cjs} +2 -2
- package/dist/src/{openai-Cv9pEKxp.js → openai-CT5fwbve.js} +2 -2
- package/dist/src/{openai-CitF-gEN.js → openai-Dz3surb_.js} +2 -2
- package/dist/src/openclaw-B6XY2kUf.js +526 -0
- package/dist/src/openclaw-CpPrXwf6.js +524 -0
- package/dist/src/openclaw-DDSfq5fp.cjs +528 -0
- package/dist/src/openclaw-dHLcXUWZ.js +511 -0
- package/dist/src/{opencode-sdk-Dakn4QMp.js → opencode-sdk-CImWVqy9.js} +7 -7
- package/dist/src/{opencode-sdk-BcLvVMV-.js → opencode-sdk-CuCztr4P.js} +6 -6
- package/dist/src/{opencode-sdk-z7KKOCdB.js → opencode-sdk-DhcfRbBH.js} +3 -3
- package/dist/src/{opencode-sdk-Cqszt4br.cjs → opencode-sdk-mqF-Oj3f.cjs} +6 -6
- package/dist/src/{otlpReceiver-BvmMgacx.cjs → otlpReceiver-B6Xo4KZM.cjs} +6 -6
- package/dist/src/{otlpReceiver-DRNetlJH.js → otlpReceiver-BO0rbDzh.js} +6 -6
- package/dist/src/{otlpReceiver-Bhj_vnzl.js → otlpReceiver-Dg817agV.js} +6 -6
- package/dist/src/{otlpReceiver-Cpnk-Hjf.js → otlpReceiver-DmRb0NBj.js} +2 -2
- package/dist/src/{providerRegistry-D32Lt9vp.js → providerRegistry-Xf0qdqGQ.js} +2 -2
- package/dist/src/{providerRegistry-HGQd2MF6.cjs → providerRegistry-lc7a7utN.cjs} +2 -2
- package/dist/src/{providerRegistry-BdKWcUa8.js → providerRegistry-wCWd7sKQ.js} +2 -2
- package/dist/src/providers-BMZZmPBJ.cjs +32 -0
- package/dist/src/{providers-BWoVY_Wz.cjs → providers-BNKVY53V.cjs} +294 -782
- package/dist/src/{providers-Co_FGgH8.js → providers-BiNq_Iyc.js} +281 -769
- package/dist/src/{providers-CUCHJCHD.js → providers-BlEhY5mi.js} +286 -779
- package/dist/src/providers-CQQrNaJk.js +32 -0
- package/dist/src/providers-Ck8HyrC-.js +34 -0
- package/dist/src/{pythonUtils-rOCm9w_5.cjs → pythonUtils-DZ6EbdY4.cjs} +3 -3
- package/dist/src/{pythonUtils-B9JA-gsC.js → pythonUtils-r1uBuA0n.js} +3 -3
- package/dist/src/{pythonUtils-eNq6Wsfr.js → pythonUtils-vMlk9Qp5.js} +3 -3
- package/dist/src/{quiverai-BpWtOEQZ.cjs → quiverai-BNfIwKCO.cjs} +13 -13
- package/dist/src/{quiverai-Cj-PUa3p.js → quiverai-BQigKdIH.js} +14 -14
- package/dist/src/{quiverai-BN8OVvDE.js → quiverai-Bfy2WnE2.js} +12 -12
- package/dist/src/{quiverai-D5MSsd2c.js → quiverai-CedIP0PJ.js} +2 -2
- package/dist/src/{render-D2710HbA.js → render-CAZvKKkB.js} +4 -4
- package/dist/src/responses-DLLjADw5.js +653 -0
- package/dist/src/responses-TsdODUpm.js +654 -0
- package/dist/src/responses-zOtKtnY_.cjs +671 -0
- package/dist/src/{rubyUtils-Dn6MGcsk.js → rubyUtils-BtjlqyXt.js} +3 -3
- package/dist/src/{rubyUtils-LBsk3zIm.js → rubyUtils-Cs35SDYa.js} +3 -3
- package/dist/src/rubyUtils-D7--T12C.js +6 -0
- package/dist/src/{rubyUtils-rnCVDgH-.cjs → rubyUtils-DCVaJ3mc.cjs} +3 -3
- package/dist/src/rubyUtils-DRRiMFV2.js +5 -0
- package/dist/src/rubyUtils-vb8OYFC-.cjs +5 -0
- package/dist/src/{sagemaker-C8MeZIkH.js → sagemaker-BcgLu0U4.js} +18 -18
- package/dist/src/{sagemaker-4ukMNSN0.js → sagemaker-CLdUAv5z.js} +17 -17
- package/dist/src/{sagemaker-DyVHy2BW.js → sagemaker-Du4LIR97.js} +2 -2
- package/dist/src/{sagemaker-DB3Eojau.cjs → sagemaker-DwNnEVYt.cjs} +17 -17
- package/dist/src/{scanner-C28XVEq2.js → scanner-Dyw21Wg_.js} +12 -12
- package/dist/src/server/index.js +1818 -605
- package/dist/src/server-BUbS0Qfh.js +6 -0
- package/dist/src/{server-BF3HkMhe.js → server-CbMTRQkg.js} +8 -6
- package/dist/src/{server-CSbLW-UI.cjs → server-CgUQ25qW.cjs} +8 -6
- package/dist/src/{server-mycZbUH8.js → server-DWmZLfCy.js} +10 -7
- package/dist/src/server-XpGXFHkS.cjs +6 -0
- package/dist/src/server-gfOx5Zrk.js +8 -0
- package/dist/src/{signal-DM_SPNmi.js → signal-Bl32q42d.js} +3 -3
- package/dist/src/{slack-Ed1yyt_j.js → slack-BfdBx2tO.js} +2 -2
- package/dist/src/{slack-D1F9Y7CH.cjs → slack-BtMkB6xP.cjs} +2 -2
- package/dist/src/{slack-DkAF58Tr.js → slack-DPqj42Ts.js} +2 -2
- package/dist/src/{slack-BK312SXM.js → slack-OZYxoVON.js} +2 -2
- package/dist/src/{store-CT_e5OZX.js → store-2ocbYY9D.js} +3 -3
- package/dist/src/store-5u2yriTV.js +7 -0
- package/dist/src/{store-BpumNYCl.cjs → store-BqwfFEyF.cjs} +3 -3
- package/dist/src/{store-BFLqwuc_.js → store-D4gdn9ih.js} +3 -3
- package/dist/src/store-D_lq_8oQ.js +6 -0
- package/dist/src/store-m5KT6Ly7.cjs +6 -0
- package/dist/src/{tables-Dansasnu.cjs → tables-B9E1kRp-.cjs} +3 -3
- package/dist/src/{tables-BjaApSAB.js → tables-C7TT2XVn.js} +3 -3
- package/dist/src/{tables-Dwexr5Z6.js → tables-D-NSwNIb.js} +3 -3
- package/dist/src/telemetry-5RHFoCJh.js +6 -0
- package/dist/src/{telemetry-MVkZQxt9.js → telemetry-BXyVqyAg.js} +5 -4
- package/dist/src/{telemetry-DFDFKdnr.cjs → telemetry-D0_yFdtU.cjs} +5 -4
- package/dist/src/{telemetry-Ds5Nn81l.js → telemetry-DZ_7PaVq.js} +5 -4
- package/dist/src/telemetry-Do8wMnA-.js +8 -0
- package/dist/src/telemetry-LojxPoFq.cjs +6 -0
- package/dist/src/{text-PYISqVm1.cjs → text-DF2hMKdg.cjs} +1 -1
- package/dist/src/{text-DuYSUYPB.js → text-DgMr_tiM.js} +1 -1
- package/dist/src/{text-Dx0GJOCN.js → text-Dm78AVGG.js} +1 -1
- package/dist/src/{tokenUsageUtils-BtZd3sP7.cjs → tokenUsageUtils-CXhxVj72.cjs} +9 -4
- package/dist/src/{tokenUsageUtils-DoinwgKF.js → tokenUsageUtils-DmZSD2eU.js} +9 -4
- package/dist/src/{tokenUsageUtils-cFdLMERB.js → tokenUsageUtils-FZd5O_4A.js} +9 -4
- package/dist/src/{transcription-Cp19m_Mt.js → transcription-C-M81iDA.js} +2 -2
- package/dist/src/{transcription-CLRpAg07.js → transcription-CYuY5sFO.js} +10 -10
- package/dist/src/{transcription-D8ifIKOv.js → transcription-Ch7S-LWw.js} +11 -11
- package/dist/src/{transcription-CXXFEVM_.cjs → transcription-FNIz3YOe.cjs} +10 -10
- package/dist/src/transform-8eGmaH-7.js +7 -0
- package/dist/src/transform-BRVvWaG4.cjs +6 -0
- package/dist/src/{transform-Bn-lgBE2.js → transform-CoP2bJ7P.js} +44 -5
- package/dist/src/{transform-BFPYuBaW.js → transform-CqTFr7KR.js} +5 -5
- package/dist/src/{transform-DvQWeBSR.js → transform-D8dILpfZ.js} +4 -4
- package/dist/src/{transform-BUrxadlA.js → transform-DMaxQwDx.js} +44 -5
- package/dist/src/transform-GybT0X0u.js +8 -0
- package/dist/src/{transform-DshYLyBq.cjs → transform-Kd6u-oNm.cjs} +4 -4
- package/dist/src/{transform-Bw1IstDE.cjs → transform-ivxEY4f7.cjs} +55 -4
- package/dist/src/{transformersAvailability-BaoWHpu1.cjs → transformersAvailability-Bkep3ka7.cjs} +1 -1
- package/dist/src/{transformersAvailability-Dhh45n5P.js → transformersAvailability-DEU2naS1.js} +1 -1
- package/dist/src/{transformersAvailability-DtpwoeFC.js → transformersAvailability-DkAWaK5B.js} +1 -1
- package/dist/src/{transformersAvailability-O2YaCv9Z.js → transformersAvailability-DwmezkVe.js} +1 -1
- package/dist/src/{types-B-XUqfNs.cjs → types-BIfttHrT.cjs} +22 -2
- package/dist/src/{types-BsU_PxR3.js → types-DMVjYLpx.js} +16 -2
- package/dist/src/{types-CgrxBFgm.js → types-t52w-XsS.js} +19 -3
- package/dist/src/{util-M2MoNCUR.js → util-BSh4a_Q8.js} +7 -7
- package/dist/src/{util-DTJWKLkl.cjs → util-C08Kns6-.cjs} +18 -4
- package/dist/src/{util-DHBpsbZE.js → util-CUEt0Vum.js} +18 -4
- package/dist/src/{util-Bnw6EyZN.js → util-Cl0zfT3V.js} +18 -4
- package/dist/src/{util-C7A-PlKK.cjs → util-DUYOvxAy.cjs} +6 -6
- package/dist/src/{util-WYC3rB_p.js → util-DiCePfDu.js} +6 -6
- package/dist/src/{util-CV99ps44.cjs → util-DkFTvieG.cjs} +17 -5
- package/dist/src/{util-CfepsNVK.js → util-mJ58qbbw.js} +17 -5
- package/dist/src/{util-BZaMVBMq.js → util-vjscpUzy.js} +17 -5
- package/dist/src/{utils-BryuD3vq.js → utils-CVzb4YiI.js} +3 -3
- package/dist/src/{utils-Dezi3MBH.cjs → utils-DFaZa6Rf.cjs} +3 -3
- package/dist/src/{utils-GiyI2K4P.js → utils-JaY9veb5.js} +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +75 -77
- package/dist/src/app/assets/index-07dbAcWK.js +0 -427
- package/dist/src/app/assets/index-DnEcCQgk.css +0 -1
- package/dist/src/app/assets/vendor-react-DHoaNLma.js +0 -4
- package/dist/src/cache-BujOdYlc.cjs +0 -6
- package/dist/src/cloud-BHYz0XkH.js +0 -5
- package/dist/src/eval-0IFf8hON.js +0 -16
- package/dist/src/evalResult-BCCv6FXj.js +0 -13
- package/dist/src/evalResult-C8iVgVvr.js +0 -11
- package/dist/src/evalResult-CqFeWKYx.cjs +0 -11
- package/dist/src/evaluator-DwS5NAEj.js +0 -37
- package/dist/src/fetch-BH9KSaUC.cjs +0 -4
- package/dist/src/fetch-BL6kqunF.js +0 -6
- package/dist/src/graders-BK3LuhJ8.cjs +0 -32
- package/dist/src/graders-Bpjtip-E.js +0 -35
- package/dist/src/graders-KIf6Uej3.js +0 -33
- package/dist/src/providers-41mSodR_.js +0 -31
- package/dist/src/providers-CiZCpIxz.cjs +0 -31
- package/dist/src/providers-G531909f.js +0 -33
- package/dist/src/rubyUtils-BLd6EE1u.cjs +0 -5
- package/dist/src/rubyUtils-CVELPvUH.js +0 -6
- package/dist/src/rubyUtils-_t9Gmf7U.js +0 -5
- package/dist/src/server-Bc4T4XDt.cjs +0 -6
- package/dist/src/server-CMyxJ7ct.js +0 -6
- package/dist/src/server-D9FuxNYE.js +0 -8
- package/dist/src/store-CrMinjmN.cjs +0 -6
- package/dist/src/store-EaWZOoxz.js +0 -7
- package/dist/src/store-KXWnHB15.js +0 -6
- package/dist/src/telemetry-BXD2mCyr.cjs +0 -6
- package/dist/src/telemetry-CYiBm56v.js +0 -8
- package/dist/src/telemetry-lICYKIMB.js +0 -6
- package/dist/src/transform-DZI2t8-9.js +0 -8
- package/dist/src/transform-DZUV3qpO.js +0 -7
- package/dist/src/transform-XcotjzZX.cjs +0 -6
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as getEnvString, O as cliState_default, S as getEnvInt, b as getEnvBool, d as extractFirstJsonObject, g as safeJsonStringify, l as sanitizeObject, m as isValidJson, o as logger_default, u as sanitizeUrl, v as getConfigDirectoryPath, x as getEnvFloat } from "./logger-
|
|
3
|
-
import { P as VERSION, S as CLOUD_PROVIDER_PREFIX, _ as openaiToolsToBedrock, b as transformToolChoice, d as REQUEST_TIMEOUT_MS, f as calculateCost, g as openaiToolChoiceToBedrock, i as fetchWithTimeout, l as sleep, m as isOpenAIToolChoice, n as fetchWithProxy, p as isOpenAIToolArray, r as fetchWithRetries, u as LONG_RUNNING_MODEL_TIMEOUT_MS, v as parseChatPrompt, x as transformTools, y as toTitleCase } from "./fetch-
|
|
2
|
+
import { C as getEnvString, O as cliState_default, S as getEnvInt, b as getEnvBool, d as extractFirstJsonObject, g as safeJsonStringify, l as sanitizeObject, m as isValidJson, o as logger_default, u as sanitizeUrl, v as getConfigDirectoryPath, x as getEnvFloat } from "./logger-BotXmWKW.js";
|
|
3
|
+
import { P as VERSION, S as CLOUD_PROVIDER_PREFIX, _ as openaiToolsToBedrock, b as transformToolChoice, d as REQUEST_TIMEOUT_MS, f as calculateCost, g as openaiToolChoiceToBedrock, i as fetchWithTimeout, l as sleep, m as isOpenAIToolChoice, n as fetchWithProxy, p as isOpenAIToolArray, r as fetchWithRetries, u as LONG_RUNNING_MODEL_TIMEOUT_MS, v as parseChatPrompt, x as transformTools, y as toTitleCase } from "./fetch-SRsE6Ctl.js";
|
|
4
4
|
import { t as invariant } from "./invariant-DT20jrBd.js";
|
|
5
|
-
import { o as getUserEmail } from "./accounts-
|
|
6
|
-
import { i as cloudConfig } from "./cloud-
|
|
7
|
-
import { r as telemetry_default } from "./telemetry-
|
|
8
|
-
import { A as DATASET_PLUGINS, H as pluginDescriptions, L as isCustomStrategy, N as MULTI_TURN_STRATEGIES, O as AGENTIC_STRATEGIES, ft as STRATEGY_EXEMPT_PLUGINS, m as isProviderOptions, p as isApiProvider, v as ProviderOptionsSchema } from "./types-
|
|
9
|
-
import { f as neverGenerateRemote, l as getRemoteGenerationUrl, m as shouldGenerateRemote, p as neverGenerateRemoteForRegularEvals, r as checkServerFeatureSupport, u as getRemoteGenerationUrlForUnaligned } from "./server-
|
|
10
|
-
import { a as fetchWithCache,
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { i as
|
|
15
|
-
import { n as
|
|
16
|
-
import {
|
|
17
|
-
import { n as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { t as
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { t as
|
|
31
|
-
import { n as
|
|
32
|
-
import { t as
|
|
33
|
-
import { n as
|
|
5
|
+
import { o as getUserEmail } from "./accounts-DHHiXsy6.js";
|
|
6
|
+
import { i as cloudConfig } from "./cloud-BMbRVJFw.js";
|
|
7
|
+
import { r as telemetry_default } from "./telemetry-BXyVqyAg.js";
|
|
8
|
+
import { A as DATASET_PLUGINS, E as isUuid, H as pluginDescriptions, L as isCustomStrategy, N as MULTI_TURN_STRATEGIES, O as AGENTIC_STRATEGIES, ft as STRATEGY_EXEMPT_PLUGINS, m as isProviderOptions, p as isApiProvider, v as ProviderOptionsSchema } from "./types-t52w-XsS.js";
|
|
9
|
+
import { f as neverGenerateRemote, l as getRemoteGenerationUrl, m as shouldGenerateRemote, p as neverGenerateRemoteForRegularEvals, r as checkServerFeatureSupport, u as getRemoteGenerationUrlForUnaligned } from "./server-DWmZLfCy.js";
|
|
10
|
+
import { a as fetchWithCache, o as getCache, s as isCacheEnabled } from "./cache-mIszOnuz.js";
|
|
11
|
+
import { r as isTransientConnectionError } from "./errors-DnGCbnx8.js";
|
|
12
|
+
import { a as isVideoFile, i as isJavascriptFile, n as isAudioFile, r as isImageFile } from "./fileExtensions-BpuMmaFL.js";
|
|
13
|
+
import { C as extractVariablesFromTemplates, E as parseFileUrl, _ as parsePathOrGlob, b as renderEnvOnlyInObject, d as getResolvedRelativePath, f as maybeLoadConfigFromExternalFile, g as maybeLoadToolsFromExternalFile, h as maybeLoadResponseFormatFromExternalFile, m as maybeLoadFromExternalFileWithVars, p as maybeLoadFromExternalFile, w as getNunjucksEngine, x as renderVarsInObject } from "./util-BSh4a_Q8.js";
|
|
14
|
+
import { a as safeJoin, i as resolvePackageEntryPoint, n as getWrapperDir, o as safeResolve, r as importModule } from "./esm-CYhseqj4.js";
|
|
15
|
+
import { i as validatePythonPath, n as getEnvInt$1, r as runPython, t as getConfiguredPythonPath } from "./pythonUtils-r1uBuA0n.js";
|
|
16
|
+
import { n as transform, r as getProcessShim, t as TransformInputType } from "./transform-CqTFr7KR.js";
|
|
17
|
+
import { a as sha256, n as isBlobStorageEnabled, r as shouldAttemptRemoteBlobUpload, t as extractAndStoreBinaryData } from "./extractor-LSYjrhK0.js";
|
|
18
|
+
import { n as withGenAISpan } from "./genaiTracer-CqNnnXrE.js";
|
|
19
|
+
import { i as normalizeFinishReason, n as MCPClient, r as FINISH_REASON_MAP, t as OpenAiChatCompletionProvider } from "./chat-DIywASPG.js";
|
|
20
|
+
import { a as createEmptyTokenUsage, n as accumulateResponseTokenUsage, r as accumulateTokenUsage } from "./tokenUsageUtils-DmZSD2eU.js";
|
|
21
|
+
import { O as TOKEN_REFRESH_BUFFER_MS, S as toDataUri, _ as getGoogleClient, a as calculateGoogleCost, b as resolveProjectId, c as geminiFormatAndSystemInstructions, d as mergeParts, f as normalizeSafetySettings, g as GoogleAuthManager, h as CHAT_MODELS, i as transformMCPToolsToOpenAi, l as getCandidate, o as createAuthCacheDiscriminator, p as normalizeTools, r as transformMCPToolsToGoogle, s as formatCandidateContents, u as getGoogleAccessToken, y as loadCredentials } from "./transform-CoP2bJ7P.js";
|
|
22
|
+
import { n as AnthropicGenericProvider, t as AnthropicMessagesProvider } from "./messages-D61tPFQo.js";
|
|
23
|
+
import { a as parseMessages, i as outputFromMessage, t as ANTHROPIC_MODELS } from "./util-vjscpUzy.js";
|
|
24
|
+
import { n as ResponsesProcessor, r as FunctionCallbackHandler, t as OpenAiResponsesProvider } from "./responses-TsdODUpm.js";
|
|
25
|
+
import { t as OpenAiGenericProvider } from "./openai-CT5fwbve.js";
|
|
26
|
+
import { a as calculateOpenAICost, c as getTokenUsage$2, o as failApiCall, r as OPENAI_REALTIME_MODELS, s as formatOpenAiError } from "./util-CUEt0Vum.js";
|
|
27
|
+
import { n as OpenAiEmbeddingProvider, t as OpenAiCompletionProvider } from "./completion-BBJ6zmG3.js";
|
|
28
|
+
import { i as storeBlob } from "./blobs-kt8v3UyH.js";
|
|
29
|
+
import { a as evalResultsTable, g as getDb } from "./tables-C7TT2XVn.js";
|
|
30
|
+
import { n as escapeRegExp, t as ellipsize } from "./text-DgMr_tiM.js";
|
|
31
|
+
import { n as getTraceStore } from "./store-D4gdn9ih.js";
|
|
32
|
+
import { t as AwsBedrockGenericProvider } from "./base-BaXmtXYp.js";
|
|
33
|
+
import { n as callOpenAiImageApi, r as formatOutput, t as OpenAiImageProvider } from "./image-mhAGP07h.js";
|
|
34
|
+
import { t as providerRegistry } from "./providerRegistry-Xf0qdqGQ.js";
|
|
35
|
+
import { n as runRuby } from "./rubyUtils-BtjlqyXt.js";
|
|
34
36
|
import { Agent } from "undici";
|
|
35
37
|
import { z } from "zod";
|
|
36
38
|
import input from "@inquirer/input";
|
|
@@ -55,6 +57,7 @@ import { createHash as createHash$1, randomUUID as randomUUID$1 } from "node:cry
|
|
|
55
57
|
import { and, desc, eq, sql } from "drizzle-orm";
|
|
56
58
|
import { EventEmitter } from "events";
|
|
57
59
|
import { Presets, SingleBar } from "cli-progress";
|
|
60
|
+
import { execa } from "execa";
|
|
58
61
|
import WebSocket from "ws";
|
|
59
62
|
import http from "http";
|
|
60
63
|
import httpZ from "http-z";
|
|
@@ -119,6 +122,78 @@ async function getProviderFromCloud(id) {
|
|
|
119
122
|
throw new Error(`Failed to fetch provider from cloud: ${id}.`);
|
|
120
123
|
}
|
|
121
124
|
}
|
|
125
|
+
function isRecord(value) {
|
|
126
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
127
|
+
}
|
|
128
|
+
async function fetchCloudConfig(path) {
|
|
129
|
+
const response = await makeRequest(path, "GET");
|
|
130
|
+
if (!response.ok) {
|
|
131
|
+
const errorMessage = typeof response.text === "function" ? await response.text() : "";
|
|
132
|
+
logger_default.error(`[Cloud] Failed to fetch config from cloud: ${errorMessage}. HTTP Status: ${response.status} -- ${response.statusText}.`);
|
|
133
|
+
throw new Error(`Failed to fetch config from cloud: ${response.statusText}`);
|
|
134
|
+
}
|
|
135
|
+
return response.json();
|
|
136
|
+
}
|
|
137
|
+
function looksLikeEvalConfig(config) {
|
|
138
|
+
return "providers" in config || "providerIds" in config || "prompts" in config || "tests" in config || "testCases" in config;
|
|
139
|
+
}
|
|
140
|
+
function extractEvalConfigPayload(body) {
|
|
141
|
+
if (!isRecord(body)) throw new Error("Invalid cloud eval config response: expected a JSON object.");
|
|
142
|
+
const bodyConfig = isRecord(body.config) ? body.config : void 0;
|
|
143
|
+
if (!bodyConfig) {
|
|
144
|
+
if (looksLikeEvalConfig(body)) return body;
|
|
145
|
+
throw new Error("Invalid cloud eval config response: missing \"config\" object.");
|
|
146
|
+
}
|
|
147
|
+
const nestedConfig = isRecord(bodyConfig.config) ? bodyConfig.config : void 0;
|
|
148
|
+
if (!nestedConfig) return {
|
|
149
|
+
...bodyConfig,
|
|
150
|
+
...typeof bodyConfig.name !== "string" && typeof body.name === "string" ? { name: body.name } : {}
|
|
151
|
+
};
|
|
152
|
+
return {
|
|
153
|
+
...nestedConfig,
|
|
154
|
+
...typeof nestedConfig.name !== "string" && typeof bodyConfig.name === "string" ? { name: bodyConfig.name } : {}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function normalizeCloudEvalProvider(provider) {
|
|
158
|
+
if (typeof provider !== "string") return provider;
|
|
159
|
+
if (provider.startsWith(CLOUD_PROVIDER_PREFIX) || !isUuid(provider)) return provider;
|
|
160
|
+
return `${CLOUD_PROVIDER_PREFIX}${provider}`;
|
|
161
|
+
}
|
|
162
|
+
function normalizeCloudEvalPrompt(prompt) {
|
|
163
|
+
if (typeof prompt === "string") return prompt;
|
|
164
|
+
if (isRecord(prompt)) {
|
|
165
|
+
if (typeof prompt.content === "string") return prompt.content;
|
|
166
|
+
if (typeof prompt.raw === "string") return prompt.raw;
|
|
167
|
+
}
|
|
168
|
+
return String(prompt ?? "");
|
|
169
|
+
}
|
|
170
|
+
function normalizeEvalConfig(config) {
|
|
171
|
+
const providers = Array.isArray(config.providers) ? config.providers : Array.isArray(config.providerIds) ? config.providerIds : [];
|
|
172
|
+
const prompts = Array.isArray(config.prompts) ? config.prompts : [];
|
|
173
|
+
const tests = Array.isArray(config.tests) ? config.tests : Array.isArray(config.testCases) ? config.testCases : [];
|
|
174
|
+
const commandLineOptions = {
|
|
175
|
+
...isRecord(config.commandLineOptions) ? config.commandLineOptions : {},
|
|
176
|
+
...config.maxConcurrency != null ? { maxConcurrency: config.maxConcurrency } : {},
|
|
177
|
+
...config.delay != null ? { delay: config.delay } : {},
|
|
178
|
+
...config.verbose != null ? { verbose: config.verbose } : {}
|
|
179
|
+
};
|
|
180
|
+
const normalizedConfig = {
|
|
181
|
+
...config,
|
|
182
|
+
providers: providers.map(normalizeCloudEvalProvider),
|
|
183
|
+
prompts: prompts.map(normalizeCloudEvalPrompt),
|
|
184
|
+
tests
|
|
185
|
+
};
|
|
186
|
+
if (Object.keys(commandLineOptions).length > 0) normalizedConfig.commandLineOptions = commandLineOptions;
|
|
187
|
+
else delete normalizedConfig.commandLineOptions;
|
|
188
|
+
if (typeof config.description === "string" && config.description.trim().length > 0) normalizedConfig.description = config.description;
|
|
189
|
+
else if (typeof config.name === "string" && config.name.trim().length > 0) normalizedConfig.description = config.name;
|
|
190
|
+
delete normalizedConfig.providerIds;
|
|
191
|
+
delete normalizedConfig.testCases;
|
|
192
|
+
delete normalizedConfig.maxConcurrency;
|
|
193
|
+
delete normalizedConfig.delay;
|
|
194
|
+
delete normalizedConfig.verbose;
|
|
195
|
+
return normalizedConfig;
|
|
196
|
+
}
|
|
122
197
|
/**
|
|
123
198
|
* Fetches a unified configuration from PromptFoo Cloud for red team operations.
|
|
124
199
|
* @param id - The unique identifier of the cloud configuration
|
|
@@ -129,13 +204,7 @@ async function getProviderFromCloud(id) {
|
|
|
129
204
|
async function getConfigFromCloud(id, providerId) {
|
|
130
205
|
if (!cloudConfig.isEnabled()) throw new Error(`Could not fetch Config ${id} from cloud. Cloud config is not enabled. Please run \`promptfoo auth login\` to login.`);
|
|
131
206
|
try {
|
|
132
|
-
const
|
|
133
|
-
if (!response.ok) {
|
|
134
|
-
const errorMessage = await response.text();
|
|
135
|
-
logger_default.error(`[Cloud] Failed to fetch config from cloud: ${errorMessage}. HTTP Status: ${response.status} -- ${response.statusText}.`);
|
|
136
|
-
throw new Error(`Failed to fetch config from cloud: ${response.statusText}`);
|
|
137
|
-
}
|
|
138
|
-
const body = await response.json();
|
|
207
|
+
const body = await fetchCloudConfig(`redteam/configs/${id}/unified${providerId ? `?providerId=${providerId}` : ""}`);
|
|
139
208
|
logger_default.info(`Config fetched from cloud: ${id}`);
|
|
140
209
|
return body;
|
|
141
210
|
} catch (e) {
|
|
@@ -145,6 +214,26 @@ async function getConfigFromCloud(id, providerId) {
|
|
|
145
214
|
}
|
|
146
215
|
}
|
|
147
216
|
/**
|
|
217
|
+
* Fetches an eval configuration from PromptFoo Cloud by ID.
|
|
218
|
+
* The response may contain legacy eval fields, which are normalized into UnifiedConfig.
|
|
219
|
+
* @param id - The unique identifier of the cloud eval configuration
|
|
220
|
+
* @returns Promise resolving to a normalized unified configuration object
|
|
221
|
+
* @throws Error if cloud is not enabled, config not found, or response shape is invalid
|
|
222
|
+
*/
|
|
223
|
+
async function getEvalConfigFromCloud(id) {
|
|
224
|
+
if (!cloudConfig.isEnabled()) throw new Error(`Could not fetch Config ${id} from cloud. Cloud config is not enabled. Please run \`promptfoo auth login\` to login.`);
|
|
225
|
+
try {
|
|
226
|
+
const config = normalizeEvalConfig(extractEvalConfigPayload(await fetchCloudConfig(`configs/${id}`)));
|
|
227
|
+
logger_default.info(`Eval config fetched from cloud: ${id}`);
|
|
228
|
+
return config;
|
|
229
|
+
} catch (e) {
|
|
230
|
+
logger_default.error(`Failed to fetch eval config from cloud: ${id}.`);
|
|
231
|
+
logger_default.error(String(e));
|
|
232
|
+
if (e instanceof Error) throw e;
|
|
233
|
+
throw new Error(String(e));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
148
237
|
* Checks if a provider path represents a cloud-based provider.
|
|
149
238
|
* @param providerPath - The provider path to check
|
|
150
239
|
* @returns True if the path starts with the cloud provider prefix, false otherwise
|
|
@@ -613,179 +702,6 @@ var ScriptCompletionProvider = class {
|
|
|
613
702
|
}
|
|
614
703
|
};
|
|
615
704
|
|
|
616
|
-
//#endregion
|
|
617
|
-
//#region src/providers/functionCallbackUtils.ts
|
|
618
|
-
/**
|
|
619
|
-
* Handles function callback execution for AI providers.
|
|
620
|
-
* Provides a unified way to execute function callbacks across different provider formats.
|
|
621
|
-
*/
|
|
622
|
-
var FunctionCallbackHandler = class {
|
|
623
|
-
loadedCallbacks = {};
|
|
624
|
-
mcpToolNames = null;
|
|
625
|
-
constructor(mcpClient) {
|
|
626
|
-
this.mcpClient = mcpClient;
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
* Processes a function call by executing its callback or returning the original call
|
|
630
|
-
* @param call The function call to process (can be various formats)
|
|
631
|
-
* @param callbacks Configuration mapping function names to callbacks
|
|
632
|
-
* @param context Optional context to pass to the callback
|
|
633
|
-
* @returns The result of processing
|
|
634
|
-
*/
|
|
635
|
-
async processCall(call, callbacks, context) {
|
|
636
|
-
const functionInfo = this.extractFunctionInfo(call);
|
|
637
|
-
if (this.mcpClient && functionInfo) {
|
|
638
|
-
if (this.mcpToolNames === null) {
|
|
639
|
-
const mcpTools = this.mcpClient.getAllTools();
|
|
640
|
-
this.mcpToolNames = new Set(mcpTools.map((tool) => tool.name));
|
|
641
|
-
}
|
|
642
|
-
if (this.mcpToolNames.has(functionInfo.name)) return await this.executeMcpTool(functionInfo.name, functionInfo.arguments);
|
|
643
|
-
}
|
|
644
|
-
if (!functionInfo || !callbacks || !callbacks[functionInfo.name]) return {
|
|
645
|
-
output: typeof call === "string" ? call : JSON.stringify(call),
|
|
646
|
-
isError: false
|
|
647
|
-
};
|
|
648
|
-
try {
|
|
649
|
-
return {
|
|
650
|
-
output: await this.executeCallback(functionInfo.name, functionInfo.arguments || "{}", callbacks, context),
|
|
651
|
-
isError: false
|
|
652
|
-
};
|
|
653
|
-
} catch (error) {
|
|
654
|
-
logger_default.debug(`Function callback failed for ${functionInfo.name}: ${error}`);
|
|
655
|
-
return {
|
|
656
|
-
output: typeof call === "string" ? call : JSON.stringify(call),
|
|
657
|
-
isError: true
|
|
658
|
-
};
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* Processes multiple function calls
|
|
663
|
-
* @param calls Array of calls or a single call
|
|
664
|
-
* @param callbacks Configuration mapping function names to callbacks
|
|
665
|
-
* @param context Optional context to pass to callbacks
|
|
666
|
-
* @param options Processing options
|
|
667
|
-
* @returns Processed output in appropriate format
|
|
668
|
-
*/
|
|
669
|
-
async processCalls(calls, callbacks, context, _options) {
|
|
670
|
-
if (!calls) return calls;
|
|
671
|
-
const isArray = Array.isArray(calls);
|
|
672
|
-
const callsArray = isArray ? calls : [calls];
|
|
673
|
-
const results = await Promise.all(callsArray.map((call) => this.processCall(call, callbacks, context)));
|
|
674
|
-
if (results.some((r, index) => !r.isError && r.output !== JSON.stringify(callsArray[index]))) {
|
|
675
|
-
const outputs = results.map((r) => r.output);
|
|
676
|
-
if (!isArray && outputs.length === 1) return outputs[0];
|
|
677
|
-
return outputs.every((o) => typeof o === "string") ? outputs.join("\n") : outputs;
|
|
678
|
-
}
|
|
679
|
-
if (!isArray && results.length === 1) return results[0].output;
|
|
680
|
-
return calls;
|
|
681
|
-
}
|
|
682
|
-
/**
|
|
683
|
-
* Extracts function name and arguments from various call formats
|
|
684
|
-
*/
|
|
685
|
-
extractFunctionInfo(call) {
|
|
686
|
-
if (!call || typeof call !== "object") return null;
|
|
687
|
-
if (call.name && typeof call.name === "string") return {
|
|
688
|
-
name: call.name,
|
|
689
|
-
arguments: call.arguments
|
|
690
|
-
};
|
|
691
|
-
if (call.type === "function" && call.function?.name) return {
|
|
692
|
-
name: call.function.name,
|
|
693
|
-
arguments: call.function.arguments
|
|
694
|
-
};
|
|
695
|
-
return null;
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* Executes a function callback
|
|
699
|
-
*/
|
|
700
|
-
async executeCallback(functionName, args, callbacks, context) {
|
|
701
|
-
let callback = this.loadedCallbacks[functionName];
|
|
702
|
-
if (!callback) {
|
|
703
|
-
const callbackConfig = callbacks[functionName];
|
|
704
|
-
if (typeof callbackConfig === "string") if (callbackConfig.startsWith("file://")) callback = await this.loadExternalFunction(callbackConfig);
|
|
705
|
-
else callback = new Function("return " + callbackConfig)();
|
|
706
|
-
else if (typeof callbackConfig === "function") callback = callbackConfig;
|
|
707
|
-
else throw new Error(`Invalid callback configuration for ${functionName}`);
|
|
708
|
-
this.loadedCallbacks[functionName] = callback;
|
|
709
|
-
}
|
|
710
|
-
const result = await callback(args, context);
|
|
711
|
-
return typeof result === "string" ? result : JSON.stringify(result);
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Loads a function from an external file
|
|
715
|
-
*/
|
|
716
|
-
async loadExternalFunction(fileRef) {
|
|
717
|
-
let filePath = fileRef.slice(7);
|
|
718
|
-
let functionName;
|
|
719
|
-
if (filePath.includes(":")) {
|
|
720
|
-
const splits = filePath.split(":");
|
|
721
|
-
if (splits[0] && isJavascriptFile(splits[0])) [filePath, functionName] = splits;
|
|
722
|
-
}
|
|
723
|
-
try {
|
|
724
|
-
const resolvedPath = path.resolve(cliState_default.basePath || "", filePath);
|
|
725
|
-
logger_default.debug(`Loading function from ${resolvedPath}${functionName ? `:${functionName}` : ""}`);
|
|
726
|
-
const mod = await importModule(resolvedPath);
|
|
727
|
-
const func = functionName && mod[functionName] ? mod[functionName] : mod.default || mod;
|
|
728
|
-
if (typeof func !== "function") throw new Error(`Expected ${resolvedPath}${functionName ? `:${functionName}` : ""} to export a function, got ${typeof func}`);
|
|
729
|
-
return func;
|
|
730
|
-
} catch (error) {
|
|
731
|
-
throw new Error(`Failed to load function from ${fileRef}: ${error}`);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Executes an MCP tool
|
|
736
|
-
*/
|
|
737
|
-
async executeMcpTool(toolName, args) {
|
|
738
|
-
try {
|
|
739
|
-
if (!this.mcpClient) throw new Error("MCP client not available");
|
|
740
|
-
const parsedArgs = args == null || args === "" ? {} : typeof args === "string" ? JSON.parse(args) : args;
|
|
741
|
-
const result = await this.mcpClient.callTool(toolName, parsedArgs);
|
|
742
|
-
if (result?.error) return {
|
|
743
|
-
output: `MCP Tool Error (${toolName}): ${result.error}`,
|
|
744
|
-
isError: true
|
|
745
|
-
};
|
|
746
|
-
const normalizeContent = (content) => {
|
|
747
|
-
if (content == null) return "";
|
|
748
|
-
if (typeof content === "string") return content;
|
|
749
|
-
if (Array.isArray(content)) return content.map((part) => {
|
|
750
|
-
if (typeof part === "string") return part;
|
|
751
|
-
if (part && typeof part === "object") {
|
|
752
|
-
if ("text" in part && part.text != null) return String(part.text);
|
|
753
|
-
if ("json" in part) return JSON.stringify(part.json);
|
|
754
|
-
if ("data" in part) return JSON.stringify(part.data);
|
|
755
|
-
return JSON.stringify(part);
|
|
756
|
-
}
|
|
757
|
-
return String(part);
|
|
758
|
-
}).join("\n");
|
|
759
|
-
return JSON.stringify(content);
|
|
760
|
-
};
|
|
761
|
-
return {
|
|
762
|
-
output: `MCP Tool Result (${toolName}): ${normalizeContent(result?.content)}`,
|
|
763
|
-
isError: false
|
|
764
|
-
};
|
|
765
|
-
} catch (error) {
|
|
766
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
767
|
-
logger_default.debug(`MCP tool execution failed for ${toolName}: ${errorMessage}`);
|
|
768
|
-
return {
|
|
769
|
-
output: `MCP Tool Error (${toolName}): ${errorMessage}`,
|
|
770
|
-
isError: true
|
|
771
|
-
};
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
* Sets the MCP client, preserving any loaded callbacks
|
|
776
|
-
*/
|
|
777
|
-
setMcpClient(client) {
|
|
778
|
-
this.mcpClient = client;
|
|
779
|
-
this.mcpToolNames = null;
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Clears the cached callbacks
|
|
783
|
-
*/
|
|
784
|
-
clearCache() {
|
|
785
|
-
this.loadedCallbacks = {};
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
|
|
789
705
|
//#endregion
|
|
790
706
|
//#region src/providers/azure/defaults.ts
|
|
791
707
|
const DEFAULT_AZURE_API_VERSION = "2024-12-01-preview";
|
|
@@ -1564,6 +1480,13 @@ const AZURE_MODELS = [
|
|
|
1564
1480
|
output: 6 / 1e6
|
|
1565
1481
|
}
|
|
1566
1482
|
},
|
|
1483
|
+
{
|
|
1484
|
+
id: "claude-sonnet-4-6",
|
|
1485
|
+
cost: {
|
|
1486
|
+
input: 3 / 1e6,
|
|
1487
|
+
output: 15 / 1e6
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1567
1490
|
{
|
|
1568
1491
|
id: "claude-opus-4-6",
|
|
1569
1492
|
cost: {
|
|
@@ -1858,6 +1781,13 @@ const AZURE_MODELS = [
|
|
|
1858
1781
|
output: .026 / 1e6
|
|
1859
1782
|
}
|
|
1860
1783
|
},
|
|
1784
|
+
{
|
|
1785
|
+
id: "Mistral-Large-3",
|
|
1786
|
+
cost: {
|
|
1787
|
+
input: .5 / 1e6,
|
|
1788
|
+
output: 1.5 / 1e6
|
|
1789
|
+
}
|
|
1790
|
+
},
|
|
1861
1791
|
{
|
|
1862
1792
|
id: "Mistral-Large-2411",
|
|
1863
1793
|
cost: {
|
|
@@ -2916,7 +2846,7 @@ var AIStudioChatProvider = class extends GoogleGenericProvider {
|
|
|
2916
2846
|
temperature: config.temperature,
|
|
2917
2847
|
topP: config.topP,
|
|
2918
2848
|
topK: config.topK,
|
|
2919
|
-
safetySettings: config.safetySettings,
|
|
2849
|
+
safetySettings: normalizeSafetySettings(config.safetySettings),
|
|
2920
2850
|
stopSequences: config.stopSequences,
|
|
2921
2851
|
maxOutputTokens: config.maxOutputTokens
|
|
2922
2852
|
};
|
|
@@ -2990,7 +2920,7 @@ var AIStudioChatProvider = class extends GoogleGenericProvider {
|
|
|
2990
2920
|
...config.maxOutputTokens !== void 0 && { maxOutputTokens: config.maxOutputTokens },
|
|
2991
2921
|
...config.generationConfig
|
|
2992
2922
|
},
|
|
2993
|
-
safetySettings: config.safetySettings,
|
|
2923
|
+
safetySettings: normalizeSafetySettings(config.safetySettings),
|
|
2994
2924
|
...config.toolConfig ? { toolConfig: config.toolConfig } : {},
|
|
2995
2925
|
...allTools.length > 0 ? { tools: allTools } : {},
|
|
2996
2926
|
...systemInstruction ? { system_instruction: systemInstruction } : {}
|
|
@@ -3309,7 +3239,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
3309
3239
|
topK: config.topK,
|
|
3310
3240
|
...config.generationConfig
|
|
3311
3241
|
},
|
|
3312
|
-
...config.safetySettings ? { safetySettings: config.safetySettings } : {},
|
|
3242
|
+
...config.safetySettings ? { safetySettings: normalizeSafetySettings(config.safetySettings) } : {},
|
|
3313
3243
|
...config.toolConfig ? { toolConfig: config.toolConfig } : {},
|
|
3314
3244
|
...allTools.length > 0 ? { tools: allTools } : {},
|
|
3315
3245
|
...systemInstruction ? { systemInstruction } : {},
|
|
@@ -3523,7 +3453,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
3523
3453
|
parameters: {
|
|
3524
3454
|
context: this.config.context,
|
|
3525
3455
|
examples: this.config.examples,
|
|
3526
|
-
safetySettings: this.config.safetySettings,
|
|
3456
|
+
safetySettings: normalizeSafetySettings(this.config.safetySettings),
|
|
3527
3457
|
stopSequences: this.config.stopSequences,
|
|
3528
3458
|
temperature: this.config.temperature,
|
|
3529
3459
|
maxOutputTokens: this.config.maxOutputTokens,
|
|
@@ -3874,7 +3804,7 @@ const MISTRAL_EMBEDDING_MODELS = [{
|
|
|
3874
3804
|
output: .1 / 1e6
|
|
3875
3805
|
}
|
|
3876
3806
|
}];
|
|
3877
|
-
function getTokenUsage$
|
|
3807
|
+
function getTokenUsage$1(data, cached) {
|
|
3878
3808
|
if (data.usage) if (cached) return {
|
|
3879
3809
|
cached: data.usage.total_tokens,
|
|
3880
3810
|
total: data.usage.total_tokens,
|
|
@@ -4008,7 +3938,7 @@ var MistralChatCompletionProvider = class MistralChatCompletionProvider {
|
|
|
4008
3938
|
if (!data.choices || !data.choices[0] || !data.choices[0].message.content) return { error: `Malformed response data: ${JSON.stringify(data)}` };
|
|
4009
3939
|
const result = {
|
|
4010
3940
|
output: data.choices[0].message.content,
|
|
4011
|
-
tokenUsage: getTokenUsage$
|
|
3941
|
+
tokenUsage: getTokenUsage$1(data, cached),
|
|
4012
3942
|
cached,
|
|
4013
3943
|
cost: calculateMistralCost(this.modelName, config, data.usage?.prompt_tokens, data.usage?.completion_tokens)
|
|
4014
3944
|
};
|
|
@@ -4085,7 +4015,7 @@ var MistralEmbeddingProvider = class {
|
|
|
4085
4015
|
try {
|
|
4086
4016
|
const embedding = data?.data?.[0]?.embedding;
|
|
4087
4017
|
if (!embedding) throw new Error("No embedding found in Mistral Embedding API response");
|
|
4088
|
-
const tokenUsage = getTokenUsage$
|
|
4018
|
+
const tokenUsage = getTokenUsage$1(data, cached);
|
|
4089
4019
|
const promptTokens = tokenUsage.prompt || 0;
|
|
4090
4020
|
const completionTokens = 0;
|
|
4091
4021
|
return {
|
|
@@ -4226,472 +4156,6 @@ var OpenAiModerationProvider = class OpenAiModerationProvider extends OpenAiGene
|
|
|
4226
4156
|
}
|
|
4227
4157
|
};
|
|
4228
4158
|
|
|
4229
|
-
//#endregion
|
|
4230
|
-
//#region src/providers/responses/processor.ts
|
|
4231
|
-
/**
|
|
4232
|
-
* Extract user-facing metadata from response data.
|
|
4233
|
-
* Only includes fields that are useful for users viewing eval results.
|
|
4234
|
-
*/
|
|
4235
|
-
function extractMetadata(data, processedOutput) {
|
|
4236
|
-
const metadata = {};
|
|
4237
|
-
if (typeof data.id === "string" && data.id) metadata.responseId = data.id;
|
|
4238
|
-
if (typeof data.model === "string" && data.model) metadata.model = data.model;
|
|
4239
|
-
if (Array.isArray(processedOutput.annotations) && processedOutput.annotations.length > 0) metadata.annotations = processedOutput.annotations;
|
|
4240
|
-
return metadata;
|
|
4241
|
-
}
|
|
4242
|
-
/**
|
|
4243
|
-
* Extract token usage from response data, handling both OpenAI Chat Completions format
|
|
4244
|
-
* (prompt_tokens, completion_tokens) and Azure Responses format (input_tokens, output_tokens)
|
|
4245
|
-
*/
|
|
4246
|
-
function getTokenUsage$1(data, cached) {
|
|
4247
|
-
if (data.usage) if (cached) {
|
|
4248
|
-
const totalTokens = data.usage.total_tokens || (data.usage.input_tokens || 0) + (data.usage.output_tokens || 0);
|
|
4249
|
-
return {
|
|
4250
|
-
cached: totalTokens,
|
|
4251
|
-
total: totalTokens,
|
|
4252
|
-
numRequests: 1
|
|
4253
|
-
};
|
|
4254
|
-
} else {
|
|
4255
|
-
const promptTokens = data.usage.prompt_tokens || data.usage.input_tokens || 0;
|
|
4256
|
-
const completionTokens = data.usage.completion_tokens || data.usage.output_tokens || 0;
|
|
4257
|
-
return {
|
|
4258
|
-
total: data.usage.total_tokens || promptTokens + completionTokens,
|
|
4259
|
-
prompt: promptTokens,
|
|
4260
|
-
completion: completionTokens,
|
|
4261
|
-
numRequests: 1,
|
|
4262
|
-
...data.usage.completion_tokens_details ? { completionDetails: {
|
|
4263
|
-
reasoning: data.usage.completion_tokens_details.reasoning_tokens,
|
|
4264
|
-
acceptedPrediction: data.usage.completion_tokens_details.accepted_prediction_tokens,
|
|
4265
|
-
rejectedPrediction: data.usage.completion_tokens_details.rejected_prediction_tokens
|
|
4266
|
-
} } : {}
|
|
4267
|
-
};
|
|
4268
|
-
}
|
|
4269
|
-
return {};
|
|
4270
|
-
}
|
|
4271
|
-
/**
|
|
4272
|
-
* Shared response processor for OpenAI and Azure Responses APIs.
|
|
4273
|
-
* Handles all response types with identical logic to ensure feature parity.
|
|
4274
|
-
*/
|
|
4275
|
-
var ResponsesProcessor = class {
|
|
4276
|
-
constructor(config) {
|
|
4277
|
-
this.config = config;
|
|
4278
|
-
}
|
|
4279
|
-
async processResponseOutput(data, requestConfig, cached) {
|
|
4280
|
-
logger_default.debug(`Processing ${this.config.providerType} responses output`, {
|
|
4281
|
-
responseId: data.id,
|
|
4282
|
-
model: data.model
|
|
4283
|
-
});
|
|
4284
|
-
if (data.error) return { error: formatOpenAiError(data) };
|
|
4285
|
-
try {
|
|
4286
|
-
const context = {
|
|
4287
|
-
config: requestConfig,
|
|
4288
|
-
cached,
|
|
4289
|
-
data
|
|
4290
|
-
};
|
|
4291
|
-
const processedOutput = await this.processOutput(data.output, context);
|
|
4292
|
-
if (processedOutput.isRefusal) return {
|
|
4293
|
-
output: processedOutput.refusal,
|
|
4294
|
-
tokenUsage: getTokenUsage$1(data, cached),
|
|
4295
|
-
isRefusal: true,
|
|
4296
|
-
cached,
|
|
4297
|
-
cost: this.config.costCalculator(this.config.modelName, data.usage, requestConfig),
|
|
4298
|
-
raw: data,
|
|
4299
|
-
metadata: extractMetadata(data, processedOutput)
|
|
4300
|
-
};
|
|
4301
|
-
let finalOutput = processedOutput.result;
|
|
4302
|
-
if (requestConfig.response_format?.type === "json_schema" && typeof finalOutput === "string") try {
|
|
4303
|
-
finalOutput = JSON.parse(finalOutput);
|
|
4304
|
-
} catch (error) {
|
|
4305
|
-
logger_default.error(`Failed to parse JSON output: ${error}`);
|
|
4306
|
-
}
|
|
4307
|
-
const result = {
|
|
4308
|
-
output: finalOutput,
|
|
4309
|
-
tokenUsage: getTokenUsage$1(data, cached),
|
|
4310
|
-
cached,
|
|
4311
|
-
cost: this.config.costCalculator(this.config.modelName, data.usage, requestConfig),
|
|
4312
|
-
raw: data,
|
|
4313
|
-
metadata: extractMetadata(data, processedOutput)
|
|
4314
|
-
};
|
|
4315
|
-
if (processedOutput.annotations && processedOutput.annotations.length > 0) result.raw = {
|
|
4316
|
-
...data,
|
|
4317
|
-
annotations: processedOutput.annotations
|
|
4318
|
-
};
|
|
4319
|
-
return result;
|
|
4320
|
-
} catch (err) {
|
|
4321
|
-
return { error: `Error parsing response: ${String(err)}\nResponse: ${JSON.stringify(data)}` };
|
|
4322
|
-
}
|
|
4323
|
-
}
|
|
4324
|
-
async processOutput(output, context) {
|
|
4325
|
-
if (this.config.modelName.includes("deep-research")) logger_default.debug(`Deep research response structure: ${JSON.stringify(context.data, null, 2)}`);
|
|
4326
|
-
if (!output || !Array.isArray(output) || output.length === 0) throw new Error("Invalid response format: Missing output array");
|
|
4327
|
-
let result = "";
|
|
4328
|
-
let refusal = "";
|
|
4329
|
-
let isRefusal = false;
|
|
4330
|
-
const annotations = [];
|
|
4331
|
-
for (const item of output) {
|
|
4332
|
-
if (!item || typeof item !== "object") {
|
|
4333
|
-
logger_default.warn(`Skipping invalid output item: ${JSON.stringify(item)}`);
|
|
4334
|
-
continue;
|
|
4335
|
-
}
|
|
4336
|
-
const processed = await this.processOutputItem(item, context);
|
|
4337
|
-
if (processed.isRefusal) {
|
|
4338
|
-
refusal = processed.content || "";
|
|
4339
|
-
isRefusal = true;
|
|
4340
|
-
} else if (processed.content) if (result) result += "\n" + processed.content;
|
|
4341
|
-
else result = processed.content;
|
|
4342
|
-
if (processed.annotations) annotations.push(...processed.annotations);
|
|
4343
|
-
}
|
|
4344
|
-
return {
|
|
4345
|
-
result,
|
|
4346
|
-
refusal,
|
|
4347
|
-
isRefusal,
|
|
4348
|
-
annotations: annotations.length > 0 ? annotations : void 0
|
|
4349
|
-
};
|
|
4350
|
-
}
|
|
4351
|
-
async processOutputItem(item, context) {
|
|
4352
|
-
switch (item.type) {
|
|
4353
|
-
case "function_call": return await this.processFunctionCall(item, context);
|
|
4354
|
-
case "message": return await this.processMessage(item, context);
|
|
4355
|
-
case "tool_result": return this.processToolResult(item);
|
|
4356
|
-
case "reasoning": return this.processReasoning(item);
|
|
4357
|
-
case "web_search_call": return this.processWebSearch(item);
|
|
4358
|
-
case "code_interpreter_call": return this.processCodeInterpreter(item);
|
|
4359
|
-
case "mcp_list_tools": return this.processMcpListTools(item);
|
|
4360
|
-
case "mcp_call": return this.processMcpCall(item);
|
|
4361
|
-
case "mcp_approval_request": return this.processMcpApprovalRequest(item);
|
|
4362
|
-
default:
|
|
4363
|
-
logger_default.debug(`Unknown output item type: ${item.type}`);
|
|
4364
|
-
return {};
|
|
4365
|
-
}
|
|
4366
|
-
}
|
|
4367
|
-
async processFunctionCall(item, context) {
|
|
4368
|
-
let functionResult;
|
|
4369
|
-
if (item.arguments === "{}" && item.status === "completed") functionResult = JSON.stringify({
|
|
4370
|
-
type: "function_call",
|
|
4371
|
-
name: item.name,
|
|
4372
|
-
status: "no_arguments_provided",
|
|
4373
|
-
note: "Function called but no arguments were extracted. Consider using the correct Responses API tool format."
|
|
4374
|
-
});
|
|
4375
|
-
else functionResult = await this.config.functionCallbackHandler.processCalls(item, context.config.functionToolCallbacks);
|
|
4376
|
-
return { content: functionResult };
|
|
4377
|
-
}
|
|
4378
|
-
async processMessage(item, context) {
|
|
4379
|
-
if (item.role !== "assistant") return {};
|
|
4380
|
-
let content = "";
|
|
4381
|
-
let isRefusal = false;
|
|
4382
|
-
let refusal = "";
|
|
4383
|
-
const annotations = [];
|
|
4384
|
-
if (item.content) for (const contentItem of item.content) {
|
|
4385
|
-
if (!contentItem || typeof contentItem !== "object") {
|
|
4386
|
-
logger_default.warn(`Skipping invalid content item: ${JSON.stringify(contentItem)}`);
|
|
4387
|
-
continue;
|
|
4388
|
-
}
|
|
4389
|
-
if (contentItem.type === "output_text") {
|
|
4390
|
-
content += contentItem.text;
|
|
4391
|
-
if (Array.isArray(contentItem.annotations) && contentItem.annotations.length > 0) annotations.push(...contentItem.annotations);
|
|
4392
|
-
} else if (contentItem.type === "tool_use" || contentItem.type === "function_call") content = await this.config.functionCallbackHandler.processCalls(contentItem, context.config.functionToolCallbacks);
|
|
4393
|
-
else if (contentItem.type === "refusal") {
|
|
4394
|
-
refusal = contentItem.refusal;
|
|
4395
|
-
isRefusal = true;
|
|
4396
|
-
}
|
|
4397
|
-
}
|
|
4398
|
-
else if (item.refusal) {
|
|
4399
|
-
refusal = item.refusal;
|
|
4400
|
-
isRefusal = true;
|
|
4401
|
-
}
|
|
4402
|
-
return {
|
|
4403
|
-
content: isRefusal ? refusal : content,
|
|
4404
|
-
isRefusal,
|
|
4405
|
-
annotations: annotations.length > 0 ? annotations : void 0
|
|
4406
|
-
};
|
|
4407
|
-
}
|
|
4408
|
-
processToolResult(item) {
|
|
4409
|
-
return Promise.resolve({ content: JSON.stringify(item) });
|
|
4410
|
-
}
|
|
4411
|
-
processReasoning(item) {
|
|
4412
|
-
if (!item.summary || !item.summary.length) return Promise.resolve({});
|
|
4413
|
-
const reasoningText = `Reasoning: ${item.summary.map((s) => s.text).join("\n")}`;
|
|
4414
|
-
return Promise.resolve({ content: reasoningText });
|
|
4415
|
-
}
|
|
4416
|
-
processWebSearch(item) {
|
|
4417
|
-
let content = "";
|
|
4418
|
-
const action = item.action;
|
|
4419
|
-
if (action) if (action.type === "search") content = `Web Search: "${action.query}"`;
|
|
4420
|
-
else if (action.type === "open_page") content = `Opening page: ${action.url}`;
|
|
4421
|
-
else if (action.type === "find_in_page") content = `Finding in page: "${action.query}"`;
|
|
4422
|
-
else content = `Web action: ${action.type}`;
|
|
4423
|
-
else content = `Web Search Call (status: ${item.status || "unknown"})`;
|
|
4424
|
-
if (item.status === "failed" && item.error) content += ` (Error: ${item.error})`;
|
|
4425
|
-
return Promise.resolve({ content });
|
|
4426
|
-
}
|
|
4427
|
-
processCodeInterpreter(item) {
|
|
4428
|
-
let content = `Code Interpreter: ${item.code || "Running code..."}`;
|
|
4429
|
-
if (item.status === "failed" && item.error) content += ` (Error: ${item.error})`;
|
|
4430
|
-
return Promise.resolve({ content });
|
|
4431
|
-
}
|
|
4432
|
-
processMcpListTools(item) {
|
|
4433
|
-
const content = `MCP Tools from ${item.server_label}: ${JSON.stringify(item.tools, null, 2)}`;
|
|
4434
|
-
return Promise.resolve({ content });
|
|
4435
|
-
}
|
|
4436
|
-
processMcpCall(item) {
|
|
4437
|
-
let content;
|
|
4438
|
-
if (item.error) content = `MCP Tool Error (${item.name}): ${item.error}`;
|
|
4439
|
-
else content = `MCP Tool Result (${item.name}): ${item.output}`;
|
|
4440
|
-
return Promise.resolve({ content });
|
|
4441
|
-
}
|
|
4442
|
-
processMcpApprovalRequest(item) {
|
|
4443
|
-
const content = `MCP Approval Required for ${item.server_label}.${item.name}: ${item.arguments}`;
|
|
4444
|
-
return Promise.resolve({ content });
|
|
4445
|
-
}
|
|
4446
|
-
};
|
|
4447
|
-
|
|
4448
|
-
//#endregion
|
|
4449
|
-
//#region src/providers/openai/responses.ts
|
|
4450
|
-
var OpenAiResponsesProvider = class extends OpenAiGenericProvider {
|
|
4451
|
-
functionCallbackHandler = new FunctionCallbackHandler();
|
|
4452
|
-
processor;
|
|
4453
|
-
static OPENAI_RESPONSES_MODEL_NAMES = [
|
|
4454
|
-
"gpt-4o",
|
|
4455
|
-
"gpt-4o-2024-08-06",
|
|
4456
|
-
"gpt-4o-2024-11-20",
|
|
4457
|
-
"gpt-4o-2024-05-13",
|
|
4458
|
-
"gpt-4o-2024-07-18",
|
|
4459
|
-
"gpt-4o-mini",
|
|
4460
|
-
"gpt-4o-mini-2024-07-18",
|
|
4461
|
-
"gpt-4.1",
|
|
4462
|
-
"gpt-4.1-2025-04-14",
|
|
4463
|
-
"gpt-4.1-mini",
|
|
4464
|
-
"gpt-4.1-mini-2025-04-14",
|
|
4465
|
-
"gpt-4.1-nano",
|
|
4466
|
-
"gpt-4.1-nano-2025-04-14",
|
|
4467
|
-
"gpt-5",
|
|
4468
|
-
"gpt-5-2025-08-07",
|
|
4469
|
-
"gpt-5-chat",
|
|
4470
|
-
"gpt-5-chat-latest",
|
|
4471
|
-
"gpt-5-nano",
|
|
4472
|
-
"gpt-5-nano-2025-08-07",
|
|
4473
|
-
"gpt-5-mini",
|
|
4474
|
-
"gpt-5-mini-2025-08-07",
|
|
4475
|
-
"gpt-5-pro",
|
|
4476
|
-
"gpt-5-pro-2025-10-06",
|
|
4477
|
-
"gpt-5.1",
|
|
4478
|
-
"gpt-5.1-2025-11-13",
|
|
4479
|
-
"gpt-5.1-mini",
|
|
4480
|
-
"gpt-5.1-nano",
|
|
4481
|
-
"gpt-5.1-codex",
|
|
4482
|
-
"gpt-5.1-codex-max",
|
|
4483
|
-
"gpt-5.1-chat-latest",
|
|
4484
|
-
"gpt-5.2",
|
|
4485
|
-
"gpt-5.2-2025-12-11",
|
|
4486
|
-
"gpt-audio",
|
|
4487
|
-
"gpt-audio-2025-08-28",
|
|
4488
|
-
"gpt-audio-mini",
|
|
4489
|
-
"gpt-audio-mini-2025-10-06",
|
|
4490
|
-
"computer-use-preview",
|
|
4491
|
-
"computer-use-preview-2025-03-11",
|
|
4492
|
-
"o1",
|
|
4493
|
-
"o1-2024-12-17",
|
|
4494
|
-
"o1-preview",
|
|
4495
|
-
"o1-preview-2024-09-12",
|
|
4496
|
-
"o1-mini",
|
|
4497
|
-
"o1-mini-2024-09-12",
|
|
4498
|
-
"o1-pro",
|
|
4499
|
-
"o1-pro-2025-03-19",
|
|
4500
|
-
"o3-pro",
|
|
4501
|
-
"o3-pro-2025-06-10",
|
|
4502
|
-
"o3",
|
|
4503
|
-
"o3-2025-04-16",
|
|
4504
|
-
"o4-mini",
|
|
4505
|
-
"o4-mini-2025-04-16",
|
|
4506
|
-
"o3-mini",
|
|
4507
|
-
"o3-mini-2025-01-31",
|
|
4508
|
-
"codex-mini-latest",
|
|
4509
|
-
"gpt-5-codex",
|
|
4510
|
-
"o3-deep-research",
|
|
4511
|
-
"o3-deep-research-2025-06-26",
|
|
4512
|
-
"o4-mini-deep-research",
|
|
4513
|
-
"o4-mini-deep-research-2025-06-26"
|
|
4514
|
-
];
|
|
4515
|
-
config;
|
|
4516
|
-
constructor(modelName, options = {}) {
|
|
4517
|
-
super(modelName, options);
|
|
4518
|
-
this.config = options.config || {};
|
|
4519
|
-
this.processor = new ResponsesProcessor({
|
|
4520
|
-
modelName: this.modelName,
|
|
4521
|
-
providerType: "openai",
|
|
4522
|
-
functionCallbackHandler: this.functionCallbackHandler,
|
|
4523
|
-
costCalculator: (modelName, usage, config) => calculateOpenAICost(modelName, config, usage?.input_tokens, usage?.output_tokens, 0, 0) ?? 0
|
|
4524
|
-
});
|
|
4525
|
-
}
|
|
4526
|
-
isGPT5Model() {
|
|
4527
|
-
return this.modelName.startsWith("gpt-5") || this.modelName.includes("/gpt-5");
|
|
4528
|
-
}
|
|
4529
|
-
isReasoningModel() {
|
|
4530
|
-
return this.modelName.startsWith("o1") || this.modelName.startsWith("o3") || this.modelName.startsWith("o4") || this.modelName.includes("/o1") || this.modelName.includes("/o3") || this.modelName.includes("/o4") || this.modelName === "codex-mini-latest" || this.isGPT5Model();
|
|
4531
|
-
}
|
|
4532
|
-
supportsTemperature() {
|
|
4533
|
-
return !this.isReasoningModel();
|
|
4534
|
-
}
|
|
4535
|
-
async getOpenAiBody(prompt, context, _callApiOptions) {
|
|
4536
|
-
const config = {
|
|
4537
|
-
...this.config,
|
|
4538
|
-
...context?.prompt?.config
|
|
4539
|
-
};
|
|
4540
|
-
let input;
|
|
4541
|
-
try {
|
|
4542
|
-
const parsedJson = JSON.parse(prompt);
|
|
4543
|
-
if (Array.isArray(parsedJson)) input = parsedJson;
|
|
4544
|
-
else input = prompt;
|
|
4545
|
-
} catch {
|
|
4546
|
-
input = prompt;
|
|
4547
|
-
}
|
|
4548
|
-
const isReasoningModel = this.isReasoningModel();
|
|
4549
|
-
const maxOutputTokens = config.max_output_tokens ?? (isReasoningModel ? getEnvInt("OPENAI_MAX_COMPLETION_TOKENS") : getEnvInt("OPENAI_MAX_TOKENS", 1024));
|
|
4550
|
-
const temperature = this.supportsTemperature() ? config.temperature ?? getEnvFloat("OPENAI_TEMPERATURE", 0) : void 0;
|
|
4551
|
-
const reasoningEffort = isReasoningModel ? renderVarsInObject(config.reasoning_effort, context?.vars) : void 0;
|
|
4552
|
-
const instructions = config.instructions;
|
|
4553
|
-
const responseFormat = maybeLoadResponseFormatFromExternalFile(config.response_format, context?.vars);
|
|
4554
|
-
let textFormat;
|
|
4555
|
-
if (responseFormat) if (responseFormat.type === "json_object") textFormat = { format: { type: "json_object" } };
|
|
4556
|
-
else if (responseFormat.type === "json_schema") {
|
|
4557
|
-
const schema = responseFormat.schema || responseFormat.json_schema?.schema;
|
|
4558
|
-
textFormat = { format: {
|
|
4559
|
-
type: "json_schema",
|
|
4560
|
-
name: responseFormat.json_schema?.name || responseFormat.name || "response_schema",
|
|
4561
|
-
schema,
|
|
4562
|
-
strict: true
|
|
4563
|
-
} };
|
|
4564
|
-
} else textFormat = { format: { type: "text" } };
|
|
4565
|
-
else textFormat = { format: { type: "text" } };
|
|
4566
|
-
if (this.isGPT5Model() && config.verbosity) textFormat = {
|
|
4567
|
-
...textFormat,
|
|
4568
|
-
verbosity: config.verbosity
|
|
4569
|
-
};
|
|
4570
|
-
const loadedTools = config.tools ? await maybeLoadToolsFromExternalFile(config.tools, context?.vars) : void 0;
|
|
4571
|
-
const body = {
|
|
4572
|
-
model: this.modelName,
|
|
4573
|
-
input,
|
|
4574
|
-
...maxOutputTokens !== void 0 ? { max_output_tokens: maxOutputTokens } : {},
|
|
4575
|
-
...reasoningEffort ? { reasoning: { effort: reasoningEffort } } : {},
|
|
4576
|
-
...temperature !== void 0 ? { temperature } : {},
|
|
4577
|
-
...instructions ? { instructions } : {},
|
|
4578
|
-
...config.top_p !== void 0 || getEnvString("OPENAI_TOP_P") ? { top_p: config.top_p ?? getEnvFloat("OPENAI_TOP_P", 1) } : {},
|
|
4579
|
-
...loadedTools ? { tools: loadedTools } : {},
|
|
4580
|
-
...config.tool_choice ? { tool_choice: config.tool_choice } : {},
|
|
4581
|
-
...config.max_tool_calls ? { max_tool_calls: config.max_tool_calls } : {},
|
|
4582
|
-
...config.previous_response_id ? { previous_response_id: config.previous_response_id } : {},
|
|
4583
|
-
text: textFormat,
|
|
4584
|
-
...config.truncation ? { truncation: config.truncation } : {},
|
|
4585
|
-
...config.metadata ? { metadata: config.metadata } : {},
|
|
4586
|
-
..."parallel_tool_calls" in config ? { parallel_tool_calls: Boolean(config.parallel_tool_calls) } : {},
|
|
4587
|
-
...config.stream ? { stream: config.stream } : {},
|
|
4588
|
-
..."store" in config ? { store: Boolean(config.store) } : {},
|
|
4589
|
-
...config.background ? { background: config.background } : {},
|
|
4590
|
-
...config.webhook_url ? { webhook_url: config.webhook_url } : {},
|
|
4591
|
-
...config.user ? { user: config.user } : {},
|
|
4592
|
-
...config.passthrough || {}
|
|
4593
|
-
};
|
|
4594
|
-
if (config.reasoning && this.isReasoningModel()) body.reasoning = config.reasoning;
|
|
4595
|
-
return {
|
|
4596
|
-
body,
|
|
4597
|
-
config: {
|
|
4598
|
-
...config,
|
|
4599
|
-
tools: loadedTools,
|
|
4600
|
-
response_format: responseFormat
|
|
4601
|
-
}
|
|
4602
|
-
};
|
|
4603
|
-
}
|
|
4604
|
-
async callApi(prompt, context, callApiOptions) {
|
|
4605
|
-
if (!this.getApiKey()) throw new Error("OpenAI API key is not set. Set the OPENAI_API_KEY environment variable or add `apiKey` to the provider config.");
|
|
4606
|
-
const { body, config } = await this.getOpenAiBody(prompt, context, callApiOptions);
|
|
4607
|
-
const isDeepResearchModel = this.modelName.includes("deep-research");
|
|
4608
|
-
if (isDeepResearchModel) {
|
|
4609
|
-
if (!config.tools?.some((tool) => tool.type === "web_search_preview")) return { error: `Deep research model ${this.modelName} requires the web_search_preview tool to be configured. Add it to your provider config:\ntools:\n - type: web_search_preview` };
|
|
4610
|
-
const mcpTools = config.tools?.filter((tool) => tool.type === "mcp") || [];
|
|
4611
|
-
for (const mcpTool of mcpTools) if (mcpTool.require_approval !== "never") return { error: `Deep research model ${this.modelName} requires MCP tools to have require_approval: 'never'. Update your MCP tool configuration:\ntools:\n - type: mcp\n require_approval: never` };
|
|
4612
|
-
}
|
|
4613
|
-
let timeout = REQUEST_TIMEOUT_MS;
|
|
4614
|
-
if (isDeepResearchModel || this.modelName.includes("gpt-5-pro")) {
|
|
4615
|
-
const evalTimeout = getEnvInt("PROMPTFOO_EVAL_TIMEOUT_MS", 0);
|
|
4616
|
-
timeout = evalTimeout > 0 ? evalTimeout : LONG_RUNNING_MODEL_TIMEOUT_MS;
|
|
4617
|
-
logger_default.debug(`Using timeout of ${timeout}ms for long-running model ${this.modelName}`);
|
|
4618
|
-
}
|
|
4619
|
-
let data;
|
|
4620
|
-
let status;
|
|
4621
|
-
let statusText;
|
|
4622
|
-
let cached = false;
|
|
4623
|
-
let deleteFromCache;
|
|
4624
|
-
let responseHeaders;
|
|
4625
|
-
try {
|
|
4626
|
-
({data, cached, status, statusText, deleteFromCache, headers: responseHeaders} = await fetchWithCache(`${this.getApiUrl()}/responses`, {
|
|
4627
|
-
method: "POST",
|
|
4628
|
-
headers: {
|
|
4629
|
-
"Content-Type": "application/json",
|
|
4630
|
-
Authorization: `Bearer ${this.getApiKey()}`,
|
|
4631
|
-
...this.getOrganization() ? { "OpenAI-Organization": this.getOrganization() } : {},
|
|
4632
|
-
...config.headers
|
|
4633
|
-
},
|
|
4634
|
-
body: JSON.stringify(body)
|
|
4635
|
-
}, timeout, "json", context?.bustCache ?? context?.debug, this.config.maxRetries));
|
|
4636
|
-
if (status < 200 || status >= 300) {
|
|
4637
|
-
const errorMessage = `API error: ${status} ${statusText}\n${typeof data === "string" ? data : JSON.stringify(data)}`;
|
|
4638
|
-
if (typeof data === "object" && data?.error?.code === "invalid_prompt") return {
|
|
4639
|
-
output: errorMessage,
|
|
4640
|
-
tokenUsage: data?.usage ? getTokenUsage$3(data, cached) : void 0,
|
|
4641
|
-
isRefusal: true,
|
|
4642
|
-
metadata: { http: {
|
|
4643
|
-
status,
|
|
4644
|
-
statusText,
|
|
4645
|
-
headers: responseHeaders ?? {}
|
|
4646
|
-
} }
|
|
4647
|
-
};
|
|
4648
|
-
return {
|
|
4649
|
-
error: errorMessage,
|
|
4650
|
-
metadata: { http: {
|
|
4651
|
-
status,
|
|
4652
|
-
statusText,
|
|
4653
|
-
headers: responseHeaders ?? {}
|
|
4654
|
-
} }
|
|
4655
|
-
};
|
|
4656
|
-
}
|
|
4657
|
-
} catch (err) {
|
|
4658
|
-
logger_default.error(`API call error: ${String(err)}`);
|
|
4659
|
-
await deleteFromCache?.();
|
|
4660
|
-
return {
|
|
4661
|
-
error: `API call error: ${String(err)}`,
|
|
4662
|
-
metadata: { http: {
|
|
4663
|
-
status: 0,
|
|
4664
|
-
statusText: "Error",
|
|
4665
|
-
headers: responseHeaders ?? {}
|
|
4666
|
-
} }
|
|
4667
|
-
};
|
|
4668
|
-
}
|
|
4669
|
-
if (data.error?.message) {
|
|
4670
|
-
await deleteFromCache?.();
|
|
4671
|
-
return {
|
|
4672
|
-
error: formatOpenAiError(data),
|
|
4673
|
-
metadata: { http: {
|
|
4674
|
-
status,
|
|
4675
|
-
statusText,
|
|
4676
|
-
headers: responseHeaders ?? {}
|
|
4677
|
-
} }
|
|
4678
|
-
};
|
|
4679
|
-
}
|
|
4680
|
-
const result = await this.processor.processResponseOutput(data, config, cached);
|
|
4681
|
-
return {
|
|
4682
|
-
...result,
|
|
4683
|
-
metadata: {
|
|
4684
|
-
...result.metadata,
|
|
4685
|
-
http: {
|
|
4686
|
-
status,
|
|
4687
|
-
statusText,
|
|
4688
|
-
headers: responseHeaders ?? {}
|
|
4689
|
-
}
|
|
4690
|
-
}
|
|
4691
|
-
};
|
|
4692
|
-
}
|
|
4693
|
-
};
|
|
4694
|
-
|
|
4695
4159
|
//#endregion
|
|
4696
4160
|
//#region src/redteam/plugins/agentic/constants.ts
|
|
4697
4161
|
const REDTEAM_MEMORY_POISONING_PLUGIN_ID = "promptfoo:redteam:agentic:memory-poisoning";
|
|
@@ -5933,7 +5397,7 @@ async function loadRedteamProvider({ provider, jsonOnly = false, preferSmallMode
|
|
|
5933
5397
|
ret = redteamProvider;
|
|
5934
5398
|
} else if (typeof redteamProvider === "string" || isProviderOptions(redteamProvider)) {
|
|
5935
5399
|
logger_default.debug(`Loading ${purpose} provider`, { provider: redteamProvider });
|
|
5936
|
-
ret = (await (await import("./providers-
|
|
5400
|
+
ret = (await (await import("./providers-Ck8HyrC-.js")).loadApiProviders([redteamProvider]))[0];
|
|
5937
5401
|
} else {
|
|
5938
5402
|
const defaultModel = preferSmallModel ? ATTACKER_MODEL_SMALL : ATTACKER_MODEL;
|
|
5939
5403
|
logger_default.debug(`Using default ${purpose} provider: ${defaultModel}`);
|
|
@@ -6212,7 +5676,7 @@ async function externalizeResponseForRedteamHistory(response, context) {
|
|
|
6212
5676
|
*/
|
|
6213
5677
|
async function tryUnblocking({ messages, lastResponse, goal, purpose }) {
|
|
6214
5678
|
try {
|
|
6215
|
-
const { checkServerFeatureSupport } = await import("./server-
|
|
5679
|
+
const { checkServerFeatureSupport } = await import("./server-gfOx5Zrk.js");
|
|
6216
5680
|
const supportsUnblocking = await checkServerFeatureSupport("blocking-question-analysis", "2025-06-16T14:49:11-07:00");
|
|
6217
5681
|
if (!getEnvBool("PROMPTFOO_ENABLE_UNBLOCKING")) {
|
|
6218
5682
|
logger_default.debug("[Unblocking] Disabled by default (set PROMPTFOO_ENABLE_UNBLOCKING=true to enable)");
|
|
@@ -9993,7 +9457,6 @@ async function addImageToBase64(testCases, injectVar, config = {}) {
|
|
|
9993
9457
|
|
|
9994
9458
|
//#endregion
|
|
9995
9459
|
//#region src/redteam/strategies/simpleVideo.ts
|
|
9996
|
-
let ffmpegCache = null;
|
|
9997
9460
|
function shouldShowProgressBar() {
|
|
9998
9461
|
return !cliState_default.webUI && logger_default.level !== "debug";
|
|
9999
9462
|
}
|
|
@@ -10010,25 +9473,29 @@ function getSystemFont() {
|
|
|
10010
9473
|
return "DejaVu-Sans";
|
|
10011
9474
|
}
|
|
10012
9475
|
}
|
|
10013
|
-
|
|
10014
|
-
|
|
9476
|
+
let ffmpegAvailable = false;
|
|
9477
|
+
async function checkFfmpegAvailable() {
|
|
9478
|
+
if (ffmpegAvailable) return;
|
|
10015
9479
|
try {
|
|
10016
|
-
|
|
10017
|
-
|
|
9480
|
+
await execa("ffmpeg", ["-version"]);
|
|
9481
|
+
ffmpegAvailable = true;
|
|
10018
9482
|
} catch (error) {
|
|
10019
|
-
|
|
10020
|
-
|
|
9483
|
+
throw new Error(`To use the video strategy, FFmpeg must be installed on your system:
|
|
9484
|
+
- macOS: brew install ffmpeg
|
|
9485
|
+
- Ubuntu/Debian: apt-get install ffmpeg
|
|
9486
|
+
- Windows: Download from ffmpeg.org
|
|
9487
|
+
Error: ${error}`);
|
|
10021
9488
|
}
|
|
10022
9489
|
}
|
|
10023
|
-
|
|
9490
|
+
function escapeDrawtextString(text) {
|
|
9491
|
+
return text.replace(/\\/g, "\\\\").replace(/'/g, "'\\''").replace(/:/g, "\\:").replace(/\n/g, "\\n").replace(/%/g, "%%");
|
|
9492
|
+
}
|
|
9493
|
+
async function createTempVideoEnvironment() {
|
|
10024
9494
|
const tempDir = path.join(os.tmpdir(), "promptfoo-video");
|
|
10025
9495
|
if (!fs.existsSync(tempDir)) fs.mkdirSync(tempDir, { recursive: true });
|
|
10026
|
-
const
|
|
10027
|
-
const outputPath = path.join(tempDir, "output-video.mp4");
|
|
10028
|
-
fs.writeFileSync(textFilePath, text);
|
|
9496
|
+
const outputPath = path.join(tempDir, `output-video-${randomUUID()}.mp4`);
|
|
10029
9497
|
const cleanup = () => {
|
|
10030
9498
|
try {
|
|
10031
|
-
if (fs.existsSync(textFilePath)) fs.unlinkSync(textFilePath);
|
|
10032
9499
|
if (fs.existsSync(outputPath)) fs.unlinkSync(outputPath);
|
|
10033
9500
|
} catch (error) {
|
|
10034
9501
|
logger_default.warn(`Failed to clean up temporary files: ${error}`);
|
|
@@ -10036,7 +9503,6 @@ async function createTempVideoEnvironment(text) {
|
|
|
10036
9503
|
};
|
|
10037
9504
|
return {
|
|
10038
9505
|
tempDir,
|
|
10039
|
-
textFilePath,
|
|
10040
9506
|
outputPath,
|
|
10041
9507
|
cleanup
|
|
10042
9508
|
};
|
|
@@ -10047,26 +9513,29 @@ function getFallbackBase64(text) {
|
|
|
10047
9513
|
async function textToVideo(text) {
|
|
10048
9514
|
try {
|
|
10049
9515
|
if (neverGenerateRemote()) {
|
|
10050
|
-
|
|
10051
|
-
const {
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
9516
|
+
await checkFfmpegAvailable();
|
|
9517
|
+
const { outputPath, cleanup } = await createTempVideoEnvironment();
|
|
9518
|
+
try {
|
|
9519
|
+
const escapedText = escapeDrawtextString(text);
|
|
9520
|
+
await execa("ffmpeg", [
|
|
9521
|
+
"-f",
|
|
9522
|
+
"lavfi",
|
|
9523
|
+
"-i",
|
|
9524
|
+
"color=white:s=640x480:d=5",
|
|
9525
|
+
"-vf",
|
|
9526
|
+
`drawtext=fontfile=${getSystemFont()}:text='${escapedText}':fontcolor=black:fontsize=24:x=(w-text_w)/2:y=(h-text_h)/2`,
|
|
9527
|
+
"-y",
|
|
9528
|
+
outputPath
|
|
9529
|
+
]);
|
|
9530
|
+
const base64Video = fs.readFileSync(outputPath).toString("base64");
|
|
9531
|
+
cleanup();
|
|
9532
|
+
return base64Video;
|
|
9533
|
+
} catch (error) {
|
|
9534
|
+
logger_default.error(`Error creating video with ffmpeg: ${error}`);
|
|
9535
|
+
cleanup();
|
|
9536
|
+
throw error;
|
|
9537
|
+
}
|
|
9538
|
+
} else throw new Error("Local video generation requires FFmpeg to be installed. Future versions may support remote generation.");
|
|
10070
9539
|
} catch (error) {
|
|
10071
9540
|
logger_default.error(`Error generating video from text: ${error}`);
|
|
10072
9541
|
return getFallbackBase64(text);
|
|
@@ -10277,6 +9746,7 @@ const Strategies = [
|
|
|
10277
9746
|
},
|
|
10278
9747
|
{
|
|
10279
9748
|
id: "crescendo",
|
|
9749
|
+
requiresGoalExtraction: true,
|
|
10280
9750
|
action: async (testCases, injectVar, config) => {
|
|
10281
9751
|
logger_default.debug(`Adding Crescendo to ${testCases.length} test cases`);
|
|
10282
9752
|
const newTestCases = addCrescendo(testCases, injectVar, config);
|
|
@@ -10286,6 +9756,7 @@ const Strategies = [
|
|
|
10286
9756
|
},
|
|
10287
9757
|
{
|
|
10288
9758
|
id: "custom",
|
|
9759
|
+
requiresGoalExtraction: true,
|
|
10289
9760
|
action: async (testCases, injectVar, config, strategyId = "custom") => {
|
|
10290
9761
|
logger_default.debug(`Adding Custom to ${testCases.length} test cases`);
|
|
10291
9762
|
const newTestCases = addCustom(testCases, injectVar, config, strategyId);
|
|
@@ -10304,6 +9775,7 @@ const Strategies = [
|
|
|
10304
9775
|
},
|
|
10305
9776
|
{
|
|
10306
9777
|
id: "goat",
|
|
9778
|
+
requiresGoalExtraction: true,
|
|
10307
9779
|
action: async (testCases, injectVar, config) => {
|
|
10308
9780
|
logger_default.debug(`Adding GOAT to ${testCases.length} test cases`);
|
|
10309
9781
|
const newTestCases = await addGoatTestCases(testCases, injectVar, config);
|
|
@@ -10313,6 +9785,7 @@ const Strategies = [
|
|
|
10313
9785
|
},
|
|
10314
9786
|
{
|
|
10315
9787
|
id: "indirect-web-pwn",
|
|
9788
|
+
requiresGoalExtraction: true,
|
|
10316
9789
|
action: async (testCases, injectVar, config) => {
|
|
10317
9790
|
logger_default.debug(`Adding Indirect Web Pwn to ${testCases.length} test cases`);
|
|
10318
9791
|
const newTestCases = await addIndirectWebPwnTestCases(testCases, injectVar, config);
|
|
@@ -10349,10 +9822,12 @@ const Strategies = [
|
|
|
10349
9822
|
},
|
|
10350
9823
|
{
|
|
10351
9824
|
id: "jailbreak",
|
|
9825
|
+
requiresGoalExtraction: true,
|
|
10352
9826
|
action: async (testCases, injectVar, config) => {
|
|
10353
|
-
logger_default.
|
|
10354
|
-
|
|
10355
|
-
|
|
9827
|
+
logger_default.warn("Strategy \"jailbreak\" is deprecated. Use \"jailbreak:meta\" instead. The \"jailbreak\" strategy used outdated single-shot optimization techniques.");
|
|
9828
|
+
logger_default.debug(`Adding meta-agent jailbreaks to ${testCases.length} test cases`);
|
|
9829
|
+
const newTestCases = addIterativeJailbreaks(testCases, injectVar, "iterative:meta", config);
|
|
9830
|
+
logger_default.debug(`Added ${newTestCases.length} meta-agent jailbreak test cases`);
|
|
10356
9831
|
return newTestCases;
|
|
10357
9832
|
}
|
|
10358
9833
|
},
|
|
@@ -10376,6 +9851,7 @@ const Strategies = [
|
|
|
10376
9851
|
},
|
|
10377
9852
|
{
|
|
10378
9853
|
id: "jailbreak:tree",
|
|
9854
|
+
requiresGoalExtraction: true,
|
|
10379
9855
|
action: async (testCases, injectVar, config) => {
|
|
10380
9856
|
logger_default.debug(`Adding experimental tree jailbreaks to ${testCases.length} test cases`);
|
|
10381
9857
|
const newTestCases = addIterativeJailbreaks(testCases, injectVar, "iterative:tree", config);
|
|
@@ -10385,6 +9861,7 @@ const Strategies = [
|
|
|
10385
9861
|
},
|
|
10386
9862
|
{
|
|
10387
9863
|
id: "jailbreak:meta",
|
|
9864
|
+
requiresGoalExtraction: true,
|
|
10388
9865
|
action: async (testCases, injectVar, config) => {
|
|
10389
9866
|
logger_default.debug(`Adding meta-agent jailbreaks to ${testCases.length} test cases`);
|
|
10390
9867
|
const newTestCases = addIterativeJailbreaks(testCases, injectVar, "iterative:meta", config);
|
|
@@ -10394,6 +9871,7 @@ const Strategies = [
|
|
|
10394
9871
|
},
|
|
10395
9872
|
{
|
|
10396
9873
|
id: "jailbreak:hydra",
|
|
9874
|
+
requiresGoalExtraction: true,
|
|
10397
9875
|
action: async (testCases, injectVar, config) => {
|
|
10398
9876
|
logger_default.debug(`Adding hydra multi-turn jailbreaks to ${testCases.length} test cases`);
|
|
10399
9877
|
const newTestCases = addHydra(testCases, injectVar, config);
|
|
@@ -11297,7 +10775,7 @@ var CrescendoProvider = class {
|
|
|
11297
10775
|
});
|
|
11298
10776
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
11299
10777
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
11300
|
-
const { getGraderById } = await import("./graders-
|
|
10778
|
+
const { getGraderById } = await import("./graders-spkuVC-E.js");
|
|
11301
10779
|
let graderPassed;
|
|
11302
10780
|
const additionalRubric = getGoalRubric(this.userGoal);
|
|
11303
10781
|
while (roundNum < this.maxTurns) try {
|
|
@@ -11972,7 +11450,7 @@ var CustomProvider = class {
|
|
|
11972
11450
|
let lastTransformResult;
|
|
11973
11451
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
11974
11452
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
11975
|
-
const { getGraderById } = await import("./graders-
|
|
11453
|
+
const { getGraderById } = await import("./graders-spkuVC-E.js");
|
|
11976
11454
|
let graderPassed;
|
|
11977
11455
|
let storedGraderResult;
|
|
11978
11456
|
const additionalRubric = getGoalRubric(this.userGoal);
|
|
@@ -12454,7 +11932,7 @@ var GoatProvider = class {
|
|
|
12454
11932
|
let assertToUse;
|
|
12455
11933
|
let graderPassed;
|
|
12456
11934
|
let storedGraderResult;
|
|
12457
|
-
const { getGraderById } = await import("./graders-
|
|
11935
|
+
const { getGraderById } = await import("./graders-spkuVC-E.js");
|
|
12458
11936
|
let test;
|
|
12459
11937
|
if (context?.test) {
|
|
12460
11938
|
test = context?.test;
|
|
@@ -12895,7 +12373,7 @@ var HydraProvider = class {
|
|
|
12895
12373
|
let lastTransformResult;
|
|
12896
12374
|
let lastTransformDisplayVars;
|
|
12897
12375
|
let lastFinalAttackPrompt;
|
|
12898
|
-
const { getGraderById } = await import("./graders-
|
|
12376
|
+
const { getGraderById } = await import("./graders-spkuVC-E.js");
|
|
12899
12377
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
12900
12378
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
12901
12379
|
let previousTraceSummary;
|
|
@@ -12931,7 +12409,7 @@ var HydraProvider = class {
|
|
|
12931
12409
|
},
|
|
12932
12410
|
vars: {}
|
|
12933
12411
|
}, options);
|
|
12934
|
-
accumulateResponseTokenUsage(totalTokenUsage, agentResp);
|
|
12412
|
+
accumulateResponseTokenUsage(totalTokenUsage, agentResp, { countAsRequest: false });
|
|
12935
12413
|
if (this.agentProvider.delay) await sleep(this.agentProvider.delay);
|
|
12936
12414
|
if (agentResp.error) {
|
|
12937
12415
|
logger_default.debug("[Hydra] Agent provider error", {
|
|
@@ -13254,7 +12732,7 @@ var HydraProvider = class {
|
|
|
13254
12732
|
label: "hydra-learning-update"
|
|
13255
12733
|
},
|
|
13256
12734
|
vars: {}
|
|
13257
|
-
}, options));
|
|
12735
|
+
}, options), { countAsRequest: false });
|
|
13258
12736
|
logger_default.debug("[Hydra] Scan learnings updated", {
|
|
13259
12737
|
scanId,
|
|
13260
12738
|
testRunId
|
|
@@ -13464,7 +12942,8 @@ var IndirectWebPwnProvider = class {
|
|
|
13464
12942
|
fetchPrompt,
|
|
13465
12943
|
attempt: attempt + 1
|
|
13466
12944
|
});
|
|
13467
|
-
const targetResponse = await targetProvider
|
|
12945
|
+
const targetResponse = await getTargetResponse(targetProvider, fetchPrompt, context, options);
|
|
12946
|
+
accumulateResponseTokenUsage(totalTokenUsage, targetResponse);
|
|
13468
12947
|
if (targetResponse.metadata?.webFetchUsed) webFetchActuallyUsed = true;
|
|
13469
12948
|
if (targetResponse.error) {
|
|
13470
12949
|
logger_default.error("[IndirectWebPwn] Target error", { error: targetResponse.error });
|
|
@@ -13490,11 +12969,6 @@ var IndirectWebPwnProvider = class {
|
|
|
13490
12969
|
output: responseOutput
|
|
13491
12970
|
});
|
|
13492
12971
|
lastOutput = responseOutput;
|
|
13493
|
-
if (targetResponse.tokenUsage) {
|
|
13494
|
-
totalTokenUsage.total = (totalTokenUsage.total || 0) + (targetResponse.tokenUsage.total || 0);
|
|
13495
|
-
totalTokenUsage.prompt = (totalTokenUsage.prompt || 0) + (targetResponse.tokenUsage.prompt || 0);
|
|
13496
|
-
totalTokenUsage.completion = (totalTokenUsage.completion || 0) + (targetResponse.tokenUsage.completion || 0);
|
|
13497
|
-
}
|
|
13498
12972
|
const tracking = await this.checkPageFetched(webPage.uuid, evalId);
|
|
13499
12973
|
logger_default.debug("[IndirectWebPwn] Tracking check", {
|
|
13500
12974
|
uuid: webPage.uuid,
|
|
@@ -13738,7 +13212,7 @@ async function runRedteamConversation$2({ context, filters, injectVar, numIterat
|
|
|
13738
13212
|
if (sessionId) sessionIds.push(sessionId);
|
|
13739
13213
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
13740
13214
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
13741
|
-
const { getGraderById } = await import("./graders-
|
|
13215
|
+
const { getGraderById } = await import("./graders-spkuVC-E.js");
|
|
13742
13216
|
if (test && assertToUse) {
|
|
13743
13217
|
const grader = getGraderById(assertToUse.type);
|
|
13744
13218
|
if (grader) {
|
|
@@ -14204,11 +13678,11 @@ async function runRedteamConversation$1({ prompt, filters, vars, redteamProvider
|
|
|
14204
13678
|
promptIdx: context?.promptIdx
|
|
14205
13679
|
});
|
|
14206
13680
|
lastResponse = targetResponse;
|
|
13681
|
+
accumulateResponseTokenUsage(totalTokenUsage, targetResponse);
|
|
14207
13682
|
if (targetResponse.error) {
|
|
14208
13683
|
logger_default.debug(`Iteration ${i + 1}: Target provider error: ${targetResponse.error}`);
|
|
14209
13684
|
continue;
|
|
14210
13685
|
}
|
|
14211
|
-
accumulateResponseTokenUsage(totalTokenUsage, targetResponse);
|
|
14212
13686
|
const url = targetResponse.output.match(/(https?:\/\/[^\s)]+)/g);
|
|
14213
13687
|
let imageDescription;
|
|
14214
13688
|
if (url && url.length > 0) try {
|
|
@@ -14228,7 +13702,7 @@ async function runRedteamConversation$1({ prompt, filters, vars, redteamProvider
|
|
|
14228
13702
|
}
|
|
14229
13703
|
}]
|
|
14230
13704
|
}]), void 0, options);
|
|
14231
|
-
accumulateResponseTokenUsage(totalTokenUsage, visionResponse);
|
|
13705
|
+
accumulateResponseTokenUsage(totalTokenUsage, visionResponse, { countAsRequest: false });
|
|
14232
13706
|
if (visionProvider.delay) await sleep(visionProvider.delay);
|
|
14233
13707
|
if (visionResponse.error) {
|
|
14234
13708
|
logger_default.warn(`Iteration ${i + 1}: Vision API error: ${visionResponse.error}`);
|
|
@@ -14455,7 +13929,7 @@ async function runMetaAgentRedteam({ context, filters, injectVar, numIterations,
|
|
|
14455
13929
|
},
|
|
14456
13930
|
vars: {}
|
|
14457
13931
|
}, options);
|
|
14458
|
-
accumulateResponseTokenUsage(totalTokenUsage, agentResp);
|
|
13932
|
+
accumulateResponseTokenUsage(totalTokenUsage, agentResp, { countAsRequest: false });
|
|
14459
13933
|
if (agentProvider.delay) {
|
|
14460
13934
|
logger_default.debug(`[IterativeMeta] Sleeping for ${agentProvider.delay}ms`);
|
|
14461
13935
|
await sleep(agentProvider.delay);
|
|
@@ -14568,7 +14042,7 @@ async function runMetaAgentRedteam({ context, filters, injectVar, numIterations,
|
|
|
14568
14042
|
previousTraceSummary = attackTraceSummary;
|
|
14569
14043
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
14570
14044
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
14571
|
-
const { getGraderById } = await import("./graders-
|
|
14045
|
+
const { getGraderById } = await import("./graders-spkuVC-E.js");
|
|
14572
14046
|
if (test && assertToUse) {
|
|
14573
14047
|
const grader = getGraderById(assertToUse.type);
|
|
14574
14048
|
if (grader) {
|
|
@@ -15101,6 +14575,7 @@ async function runRedteamConversation({ context, filters, injectVar, options, pr
|
|
|
15101
14575
|
promptIdx: context?.promptIdx
|
|
15102
14576
|
});
|
|
15103
14577
|
lastResponse = targetResponse;
|
|
14578
|
+
accumulateResponseTokenUsage(totalTokenUsage, targetResponse);
|
|
15104
14579
|
if (targetResponse.error) {
|
|
15105
14580
|
logger_default.info(`[IterativeTree] Target error at depth ${depth}, attempt ${attempts}: ${targetResponse.error}`, { targetResponse });
|
|
15106
14581
|
treeOutputs.push({
|
|
@@ -15125,7 +14600,6 @@ async function runRedteamConversation({ context, filters, injectVar, options, pr
|
|
|
15125
14600
|
continue;
|
|
15126
14601
|
}
|
|
15127
14602
|
invariant(Object.prototype.hasOwnProperty.call(targetResponse, "output"), "[IterativeTree] Target did not return an output property");
|
|
15128
|
-
accumulateResponseTokenUsage(totalTokenUsage, targetResponse);
|
|
15129
14603
|
const containsPenalizedPhrase = checkPenalizedPhrases(targetResponse.output);
|
|
15130
14604
|
const { score, explanation } = await evaluateResponse(gradingProvider, judgeSystemPrompt, targetResponse.output, bestResponse, containsPenalizedPhrase);
|
|
15131
14605
|
logger_default.debug(`[Depth ${depth}, Attempt ${attempts}] Evaluation: score=${score}, penalized=${containsPenalizedPhrase}. Max score so far: ${maxScore}`);
|
|
@@ -15145,7 +14619,7 @@ async function runRedteamConversation({ context, filters, injectVar, options, pr
|
|
|
15145
14619
|
noImprovementCount++;
|
|
15146
14620
|
if (noImprovementCount % 5 === 0) logger_default.debug(`[Depth ${depth}, Attempt ${attempts}] No improvement for ${noImprovementCount} consecutive iterations. Max score: ${maxScore}`);
|
|
15147
14621
|
}
|
|
15148
|
-
const { getGraderById } = await import("./graders-
|
|
14622
|
+
const { getGraderById } = await import("./graders-spkuVC-E.js");
|
|
15149
14623
|
let graderPassed;
|
|
15150
14624
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
15151
14625
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
@@ -19334,6 +18808,7 @@ const AWS_BEDROCK_MODELS = {
|
|
|
19334
18808
|
"anthropic.claude-opus-4-1-20250805-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19335
18809
|
"anthropic.claude-opus-4-6-v1": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19336
18810
|
"anthropic.claude-opus-4-5-20251101-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
18811
|
+
"anthropic.claude-sonnet-4-6": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19337
18812
|
"anthropic.claude-sonnet-4-5-20250929-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19338
18813
|
"anthropic.claude-haiku-4-5-20251001-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19339
18814
|
"anthropic.claude-sonnet-4-20250514-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
@@ -19371,6 +18846,7 @@ const AWS_BEDROCK_MODELS = {
|
|
|
19371
18846
|
"apac.anthropic.claude-opus-4-1-20250805-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19372
18847
|
"apac.anthropic.claude-opus-4-6-v1": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19373
18848
|
"apac.anthropic.claude-opus-4-5-20251101-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
18849
|
+
"apac.anthropic.claude-sonnet-4-6": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19374
18850
|
"apac.anthropic.claude-sonnet-4-5-20250929-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19375
18851
|
"apac.anthropic.claude-haiku-4-5-20251001-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19376
18852
|
"apac.anthropic.claude-sonnet-4-20250514-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
@@ -19387,6 +18863,7 @@ const AWS_BEDROCK_MODELS = {
|
|
|
19387
18863
|
"eu.anthropic.claude-opus-4-1-20250805-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19388
18864
|
"eu.anthropic.claude-opus-4-6-v1": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19389
18865
|
"eu.anthropic.claude-opus-4-5-20251101-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
18866
|
+
"eu.anthropic.claude-sonnet-4-6": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19390
18867
|
"eu.anthropic.claude-sonnet-4-5-20250929-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19391
18868
|
"eu.anthropic.claude-haiku-4-5-20251001-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19392
18869
|
"eu.anthropic.claude-sonnet-4-20250514-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
@@ -19412,6 +18889,7 @@ const AWS_BEDROCK_MODELS = {
|
|
|
19412
18889
|
"us.anthropic.claude-opus-4-1-20250805-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19413
18890
|
"us.anthropic.claude-opus-4-6-v1": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19414
18891
|
"us.anthropic.claude-opus-4-5-20251101-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
18892
|
+
"us.anthropic.claude-sonnet-4-6": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19415
18893
|
"us.anthropic.claude-sonnet-4-5-20250929-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19416
18894
|
"us.anthropic.claude-haiku-4-5-20251001-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
19417
18895
|
"us.anthropic.claude-sonnet-4-20250514-v1:0": BEDROCK_MODEL.CLAUDE_MESSAGES,
|
|
@@ -23126,7 +22604,7 @@ var GeminiImageProvider = class {
|
|
|
23126
22604
|
...this.config.imageAspectRatio && { aspectRatio: this.config.imageAspectRatio },
|
|
23127
22605
|
...this.config.imageSize && isGemini3 && { imageSize: this.config.imageSize }
|
|
23128
22606
|
};
|
|
23129
|
-
if (this.config.safetySettings) body.safetySettings = this.config.safetySettings;
|
|
22607
|
+
if (this.config.safetySettings) body.safetySettings = normalizeSafetySettings(this.config.safetySettings);
|
|
23130
22608
|
return body;
|
|
23131
22609
|
}
|
|
23132
22610
|
processResponse(data, cached, latencyMs) {
|
|
@@ -23147,16 +22625,20 @@ var GeminiImageProvider = class {
|
|
|
23147
22625
|
"SPII"
|
|
23148
22626
|
].includes(candidate.finishReason)) return { error: `Response was blocked with finish reason: ${candidate.finishReason}` };
|
|
23149
22627
|
if (!candidate.content?.parts) return { error: "No content parts in response" };
|
|
23150
|
-
const
|
|
22628
|
+
const textParts = [];
|
|
22629
|
+
const imageParts = [];
|
|
23151
22630
|
let totalCost = 0;
|
|
23152
|
-
for (const part of candidate.content.parts) if (part.text)
|
|
22631
|
+
for (const part of candidate.content.parts) if (part.text) textParts.push(part.text);
|
|
23153
22632
|
else if (part.inlineData) {
|
|
23154
22633
|
const mimeType = part.inlineData.mimeType || "image/png";
|
|
23155
22634
|
const base64Data = part.inlineData.data;
|
|
23156
|
-
|
|
22635
|
+
imageParts.push({
|
|
22636
|
+
mimeType,
|
|
22637
|
+
base64Data
|
|
22638
|
+
});
|
|
23157
22639
|
totalCost += this.getCostPerImage();
|
|
23158
22640
|
}
|
|
23159
|
-
if (
|
|
22641
|
+
if (imageParts.length === 0 && textParts.length === 0) return { error: "No valid content generated" };
|
|
23160
22642
|
const tokenUsage = cached ? {
|
|
23161
22643
|
cached: data.usageMetadata?.totalTokenCount,
|
|
23162
22644
|
total: data.usageMetadata?.totalTokenCount,
|
|
@@ -23167,8 +22649,13 @@ var GeminiImageProvider = class {
|
|
|
23167
22649
|
total: data.usageMetadata?.totalTokenCount,
|
|
23168
22650
|
numRequests: 1
|
|
23169
22651
|
};
|
|
22652
|
+
const images = imageParts.length > 0 ? imageParts.map((img) => ({
|
|
22653
|
+
data: toDataUri(img.mimeType, img.base64Data),
|
|
22654
|
+
mimeType: img.mimeType
|
|
22655
|
+
})) : void 0;
|
|
23170
22656
|
return {
|
|
23171
|
-
output:
|
|
22657
|
+
output: imageParts.length > 0 && textParts.length === 0 ? images[0].data : textParts.join("\n\n"),
|
|
22658
|
+
images,
|
|
23172
22659
|
cached,
|
|
23173
22660
|
latencyMs,
|
|
23174
22661
|
cost: totalCost > 0 ? totalCost : void 0,
|
|
@@ -23306,13 +22793,17 @@ var GoogleImageProvider = class {
|
|
|
23306
22793
|
const base64Image = imageData.bytesBase64Encoded;
|
|
23307
22794
|
const mimeType = imageData.mimeType || "image/png";
|
|
23308
22795
|
if (base64Image) {
|
|
23309
|
-
imageOutputs.push(
|
|
22796
|
+
imageOutputs.push({
|
|
22797
|
+
data: toDataUri(mimeType, base64Image),
|
|
22798
|
+
mimeType
|
|
22799
|
+
});
|
|
23310
22800
|
totalCost += costPerImage;
|
|
23311
22801
|
}
|
|
23312
22802
|
}
|
|
23313
22803
|
if (imageOutputs.length === 0) return { error: "No valid images generated" };
|
|
23314
22804
|
return {
|
|
23315
|
-
output: imageOutputs.
|
|
22805
|
+
output: imageOutputs[0].data,
|
|
22806
|
+
images: imageOutputs,
|
|
23316
22807
|
cached,
|
|
23317
22808
|
latencyMs,
|
|
23318
22809
|
cost: totalCost
|
|
@@ -25468,6 +24959,7 @@ var HttpProvider = class {
|
|
|
25468
24959
|
const vars = {
|
|
25469
24960
|
...context?.vars || {},
|
|
25470
24961
|
prompt,
|
|
24962
|
+
...context?.evaluationId ? { evaluationId: context.evaluationId } : {},
|
|
25471
24963
|
...transformedTools !== void 0 ? { tools: serializeForTemplate(transformedTools) } : {},
|
|
25472
24964
|
...transformedToolChoice !== void 0 ? { tool_choice: serializeForTemplate(transformedToolChoice) } : {}
|
|
25473
24965
|
};
|
|
@@ -25691,9 +25183,17 @@ var HttpProvider = class {
|
|
|
25691
25183
|
logger_default.error(`Error parsing session ID: ${String(err)}. Got headers: ${safeJsonStringify(sanitizeObject(responseHeaders, { context: "response headers" }))} and parsed body: ${safeJsonStringify(sanitizeObject(parsedData, { context: "response body" }))}`);
|
|
25692
25184
|
throw err;
|
|
25693
25185
|
}
|
|
25186
|
+
ret.metadata = {
|
|
25187
|
+
...ret.metadata,
|
|
25188
|
+
http: {
|
|
25189
|
+
status,
|
|
25190
|
+
statusText
|
|
25191
|
+
}
|
|
25192
|
+
};
|
|
25694
25193
|
if (context?.debug) {
|
|
25695
25194
|
ret.raw = data;
|
|
25696
25195
|
ret.metadata = {
|
|
25196
|
+
...ret.metadata,
|
|
25697
25197
|
headers: sanitizeObject(responseHeaders, { context: "response headers" }),
|
|
25698
25198
|
transformedRequest: this.config.transformRequest ? transformedPrompt : parsedRequest.body?.text || renderedRequest.trim(),
|
|
25699
25199
|
finalRequestBody: parsedRequest.body?.text,
|
|
@@ -27232,7 +26732,7 @@ var OpenAiAssistantProvider = class extends OpenAiGenericProvider {
|
|
|
27232
26732
|
else outputBlocks.push(`[Unknown step type: ${step.step_details.type}]`);
|
|
27233
26733
|
return {
|
|
27234
26734
|
output: outputBlocks.join("\n\n").trim(),
|
|
27235
|
-
tokenUsage: getTokenUsage$
|
|
26735
|
+
tokenUsage: getTokenUsage$2(run, false)
|
|
27236
26736
|
};
|
|
27237
26737
|
}
|
|
27238
26738
|
};
|
|
@@ -28676,7 +28176,7 @@ var OpenRouterProvider = class extends OpenAiChatCompletionProvider {
|
|
|
28676
28176
|
}
|
|
28677
28177
|
return {
|
|
28678
28178
|
output,
|
|
28679
|
-
tokenUsage: getTokenUsage$
|
|
28179
|
+
tokenUsage: getTokenUsage$2(data, cached),
|
|
28680
28180
|
cached,
|
|
28681
28181
|
cost: calculateOpenAICost(this.modelName, config, data.usage?.prompt_tokens, data.usage?.completion_tokens),
|
|
28682
28182
|
...finishReason && { finishReason }
|
|
@@ -30027,7 +29527,7 @@ var SnowflakeCortexProvider = class extends OpenAiChatCompletionProvider {
|
|
|
30027
29527
|
}
|
|
30028
29528
|
return {
|
|
30029
29529
|
output,
|
|
30030
|
-
tokenUsage: getTokenUsage$
|
|
29530
|
+
tokenUsage: getTokenUsage$2(data, cached),
|
|
30031
29531
|
cached,
|
|
30032
29532
|
latencyMs,
|
|
30033
29533
|
cost: calculateOpenAICost(this.modelName, config, data.usage?.prompt_tokens, data.usage?.completion_tokens),
|
|
@@ -32728,7 +32228,7 @@ const providerMap = [
|
|
|
32728
32228
|
{
|
|
32729
32229
|
test: (providerPath) => providerPath.startsWith("opencode:") || providerPath === "opencode",
|
|
32730
32230
|
create: async (providerPath, providerOptions, context) => {
|
|
32731
|
-
const { OpenCodeSDKProvider } = await import("./opencode-sdk-
|
|
32231
|
+
const { OpenCodeSDKProvider } = await import("./opencode-sdk-CImWVqy9.js");
|
|
32732
32232
|
return new OpenCodeSDKProvider({
|
|
32733
32233
|
...providerOptions,
|
|
32734
32234
|
id: providerPath,
|
|
@@ -32737,10 +32237,17 @@ const providerMap = [
|
|
|
32737
32237
|
});
|
|
32738
32238
|
}
|
|
32739
32239
|
},
|
|
32240
|
+
{
|
|
32241
|
+
test: (providerPath) => providerPath.startsWith("openclaw:") || providerPath === "openclaw",
|
|
32242
|
+
create: async (providerPath, providerOptions, context) => {
|
|
32243
|
+
const { createOpenClawProvider } = await import("./openclaw-B6XY2kUf.js");
|
|
32244
|
+
return createOpenClawProvider(providerPath, providerOptions, context.env);
|
|
32245
|
+
}
|
|
32246
|
+
},
|
|
32740
32247
|
{
|
|
32741
32248
|
test: (providerPath) => providerPath.startsWith("anthropic:claude-agent-sdk") || providerPath.startsWith("anthropic:claude-code"),
|
|
32742
32249
|
create: async (_providerPath, providerOptions, context) => {
|
|
32743
|
-
const { ClaudeCodeSDKProvider } = await import("./claude-agent-sdk-
|
|
32250
|
+
const { ClaudeCodeSDKProvider } = await import("./claude-agent-sdk-CmkTnKGH.js");
|
|
32744
32251
|
return new ClaudeCodeSDKProvider({
|
|
32745
32252
|
...providerOptions,
|
|
32746
32253
|
env: context.env
|
|
@@ -32797,25 +32304,25 @@ const providerMap = [
|
|
|
32797
32304
|
const modelName = splits.slice(2).join(":");
|
|
32798
32305
|
if (modelType === "converse") return new AwsBedrockConverseProvider(modelName, providerOptions);
|
|
32799
32306
|
if (modelType === "nova-sonic" || modelType.includes("amazon.nova-sonic")) {
|
|
32800
|
-
const { NovaSonicProvider } = await import("./nova-sonic-
|
|
32307
|
+
const { NovaSonicProvider } = await import("./nova-sonic-BXRfQyF-.js");
|
|
32801
32308
|
return new NovaSonicProvider("amazon.nova-sonic-v1:0", providerOptions);
|
|
32802
32309
|
}
|
|
32803
32310
|
if (modelType.includes("luma.ray") || modelName.includes("luma.ray")) {
|
|
32804
|
-
const { LumaRayVideoProvider } = await import("./luma-ray-
|
|
32311
|
+
const { LumaRayVideoProvider } = await import("./luma-ray-DgKLS0BF.js");
|
|
32805
32312
|
return new LumaRayVideoProvider(modelName.includes("luma.ray") ? modelName : splits.slice(1).join(":") || "luma.ray-v2:0", providerOptions);
|
|
32806
32313
|
}
|
|
32807
32314
|
if (modelType.includes("amazon.nova-reel") || modelType === "video" && (modelName.includes("amazon.nova-reel") || modelName === "")) {
|
|
32808
|
-
const { NovaReelVideoProvider } = await import("./nova-reel-
|
|
32315
|
+
const { NovaReelVideoProvider } = await import("./nova-reel-Bk5npr2q.js");
|
|
32809
32316
|
return new NovaReelVideoProvider(modelName || "amazon.nova-reel-v1:1", providerOptions);
|
|
32810
32317
|
}
|
|
32811
32318
|
if (modelType === "agents") {
|
|
32812
|
-
const { AwsBedrockAgentsProvider } = await import("./agents-
|
|
32319
|
+
const { AwsBedrockAgentsProvider } = await import("./agents-Cao4i7AX.js");
|
|
32813
32320
|
return new AwsBedrockAgentsProvider(modelName, providerOptions);
|
|
32814
32321
|
}
|
|
32815
32322
|
if (modelType === "completion") return new AwsBedrockCompletionProvider(modelName, providerOptions);
|
|
32816
32323
|
if (modelType === "embeddings" || modelType === "embedding") return new AwsBedrockEmbeddingProvider(modelName, providerOptions);
|
|
32817
32324
|
if (modelType === "kb" || modelType === "knowledge-base") {
|
|
32818
|
-
const { AwsBedrockKnowledgeBaseProvider } = await import("./knowledgeBase-
|
|
32325
|
+
const { AwsBedrockKnowledgeBaseProvider } = await import("./knowledgeBase-CMvMlLZR.js");
|
|
32819
32326
|
return new AwsBedrockKnowledgeBaseProvider(modelName, providerOptions);
|
|
32820
32327
|
}
|
|
32821
32328
|
return new AwsBedrockCompletionProvider(splits.slice(1).join(":"), providerOptions);
|
|
@@ -32825,7 +32332,7 @@ const providerMap = [
|
|
|
32825
32332
|
test: (providerPath) => providerPath.startsWith("bedrock-agent:"),
|
|
32826
32333
|
create: async (providerPath, providerOptions, _context) => {
|
|
32827
32334
|
const agentId = providerPath.substring(14);
|
|
32828
|
-
const { AwsBedrockAgentsProvider } = await import("./agents-
|
|
32335
|
+
const { AwsBedrockAgentsProvider } = await import("./agents-Cao4i7AX.js");
|
|
32829
32336
|
return new AwsBedrockAgentsProvider(agentId, providerOptions);
|
|
32830
32337
|
}
|
|
32831
32338
|
},
|
|
@@ -32835,7 +32342,7 @@ const providerMap = [
|
|
|
32835
32342
|
const splits = providerPath.split(":");
|
|
32836
32343
|
const modelType = splits[1];
|
|
32837
32344
|
const endpointName = splits.slice(2).join(":");
|
|
32838
|
-
const { SageMakerCompletionProvider, SageMakerEmbeddingProvider } = await import("./sagemaker-
|
|
32345
|
+
const { SageMakerCompletionProvider, SageMakerEmbeddingProvider } = await import("./sagemaker-BcgLu0U4.js");
|
|
32839
32346
|
if (modelType === "embedding" || modelType === "embeddings") return new SageMakerEmbeddingProvider(endpointName || modelType, providerOptions);
|
|
32840
32347
|
if (splits.length === 2) return new SageMakerCompletionProvider(modelType, providerOptions);
|
|
32841
32348
|
if (endpointName.includes("jumpstart") || modelType === "jumpstart") return new SageMakerCompletionProvider(endpointName, {
|
|
@@ -32876,7 +32383,7 @@ const providerMap = [
|
|
|
32876
32383
|
{
|
|
32877
32384
|
test: (providerPath) => providerPath.startsWith("cloudflare-ai:"),
|
|
32878
32385
|
create: async (providerPath, providerOptions, context) => {
|
|
32879
|
-
const { createCloudflareAiProvider } = await import("./cloudflare-ai-
|
|
32386
|
+
const { createCloudflareAiProvider } = await import("./cloudflare-ai-CobxMTR4.js");
|
|
32880
32387
|
return createCloudflareAiProvider(providerPath, {
|
|
32881
32388
|
...providerOptions,
|
|
32882
32389
|
env: context.env
|
|
@@ -32886,7 +32393,7 @@ const providerMap = [
|
|
|
32886
32393
|
{
|
|
32887
32394
|
test: (providerPath) => providerPath.startsWith("cloudflare-gateway:"),
|
|
32888
32395
|
create: async (providerPath, providerOptions, context) => {
|
|
32889
|
-
const { createCloudflareGatewayProvider } = await import("./cloudflare-gateway-
|
|
32396
|
+
const { createCloudflareGatewayProvider } = await import("./cloudflare-gateway-D2_yi-Fh.js");
|
|
32890
32397
|
return createCloudflareGatewayProvider(providerPath, {
|
|
32891
32398
|
...providerOptions,
|
|
32892
32399
|
env: context.env
|
|
@@ -33038,27 +32545,27 @@ const providerMap = [
|
|
|
33038
32545
|
create: async (providerPath, providerOptions, context) => {
|
|
33039
32546
|
const modelType = providerPath.split(":")[1];
|
|
33040
32547
|
if (modelType === "image") {
|
|
33041
|
-
const { createHyperbolicImageProvider } = await import("./image-
|
|
32548
|
+
const { createHyperbolicImageProvider } = await import("./image-DB4sHxdJ.js");
|
|
33042
32549
|
return createHyperbolicImageProvider(providerPath, {
|
|
33043
32550
|
...providerOptions,
|
|
33044
32551
|
env: context.env
|
|
33045
32552
|
});
|
|
33046
32553
|
}
|
|
33047
32554
|
if (modelType === "audio") {
|
|
33048
|
-
const { createHyperbolicAudioProvider } = await import("./audio-
|
|
32555
|
+
const { createHyperbolicAudioProvider } = await import("./audio-DUH4q0Xq.js");
|
|
33049
32556
|
return createHyperbolicAudioProvider(providerPath, {
|
|
33050
32557
|
...providerOptions,
|
|
33051
32558
|
env: context.env
|
|
33052
32559
|
});
|
|
33053
32560
|
}
|
|
33054
|
-
const { createHyperbolicProvider } = await import("./chat-
|
|
32561
|
+
const { createHyperbolicProvider } = await import("./chat-Cpz3O-Xl.js");
|
|
33055
32562
|
return createHyperbolicProvider(providerPath, providerOptions);
|
|
33056
32563
|
}
|
|
33057
32564
|
},
|
|
33058
32565
|
{
|
|
33059
32566
|
test: (providerPath) => providerPath.startsWith("litellm:"),
|
|
33060
32567
|
create: async (providerPath, providerOptions, context) => {
|
|
33061
|
-
const { createLiteLLMProvider } = await import("./litellm-
|
|
32568
|
+
const { createLiteLLMProvider } = await import("./litellm-CHrRmPAe.js");
|
|
33062
32569
|
return createLiteLLMProvider(providerPath, {
|
|
33063
32570
|
config: providerOptions,
|
|
33064
32571
|
env: context.env
|
|
@@ -33114,7 +32621,7 @@ const providerMap = [
|
|
|
33114
32621
|
const modelType = splits[1];
|
|
33115
32622
|
const modelName = splits.slice(2).join(":");
|
|
33116
32623
|
if (modelType === "codex-sdk" || modelType === "codex") {
|
|
33117
|
-
const { OpenAICodexSDKProvider } = await import("./codex-sdk-
|
|
32624
|
+
const { OpenAICodexSDKProvider } = await import("./codex-sdk-dSnGdgIp.js");
|
|
33118
32625
|
return new OpenAICodexSDKProvider({
|
|
33119
32626
|
...providerOptions,
|
|
33120
32627
|
env: context.env
|
|
@@ -33127,7 +32634,7 @@ const providerMap = [
|
|
|
33127
32634
|
if (modelType === "realtime") return new OpenAiRealtimeProvider(modelName || "gpt-4o-realtime-preview-2024-12-17", providerOptions);
|
|
33128
32635
|
if (modelType === "responses") return new OpenAiResponsesProvider(modelName || "gpt-4.1-2025-04-14", providerOptions);
|
|
33129
32636
|
if (modelType === "transcription") {
|
|
33130
|
-
const { OpenAiTranscriptionProvider } = await import("./transcription-
|
|
32637
|
+
const { OpenAiTranscriptionProvider } = await import("./transcription-Ch7S-LWw.js");
|
|
33131
32638
|
return new OpenAiTranscriptionProvider(modelName || "gpt-4o-transcribe-diarize", providerOptions);
|
|
33132
32639
|
}
|
|
33133
32640
|
if (OpenAiChatCompletionProvider.OPENAI_CHAT_MODEL_NAMES.includes(modelType)) return new OpenAiChatCompletionProvider(modelType, providerOptions);
|
|
@@ -33135,11 +32642,11 @@ const providerMap = [
|
|
|
33135
32642
|
if (OpenAiRealtimeProvider.OPENAI_REALTIME_MODEL_NAMES.includes(modelType)) return new OpenAiRealtimeProvider(modelType, providerOptions);
|
|
33136
32643
|
if (OpenAiResponsesProvider.OPENAI_RESPONSES_MODEL_NAMES.includes(modelType)) return new OpenAiResponsesProvider(modelType, providerOptions);
|
|
33137
32644
|
if (modelType === "agents") {
|
|
33138
|
-
const { OpenAiAgentsProvider } = await import("./agents-
|
|
32645
|
+
const { OpenAiAgentsProvider } = await import("./agents-DYIT-hQy.js");
|
|
33139
32646
|
return new OpenAiAgentsProvider(modelName || "default-agent", providerOptions);
|
|
33140
32647
|
}
|
|
33141
32648
|
if (modelType === "chatkit") {
|
|
33142
|
-
const { OpenAiChatKitProvider } = await import("./chatkit-
|
|
32649
|
+
const { OpenAiChatKitProvider } = await import("./chatkit-DEls11hE.js");
|
|
33143
32650
|
return new OpenAiChatKitProvider(modelName || "", providerOptions);
|
|
33144
32651
|
}
|
|
33145
32652
|
if (modelType === "assistant") return new OpenAiAssistantProvider(modelName, providerOptions);
|
|
@@ -33182,7 +32689,7 @@ const providerMap = [
|
|
|
33182
32689
|
{
|
|
33183
32690
|
test: (providerPath) => providerPath.startsWith("quiverai:"),
|
|
33184
32691
|
create: async (providerPath, providerOptions, context) => {
|
|
33185
|
-
const { createQuiverAiProvider } = await import("./quiverai-
|
|
32692
|
+
const { createQuiverAiProvider } = await import("./quiverai-BQigKdIH.js");
|
|
33186
32693
|
return createQuiverAiProvider(providerPath, providerOptions, context.env);
|
|
33187
32694
|
}
|
|
33188
32695
|
},
|
|
@@ -33227,7 +32734,7 @@ const providerMap = [
|
|
|
33227
32734
|
{
|
|
33228
32735
|
test: (providerPath) => providerPath.startsWith("aimlapi:"),
|
|
33229
32736
|
create: async (providerPath, providerOptions, context) => {
|
|
33230
|
-
const { createAimlApiProvider } = await import("./aimlapi-
|
|
32737
|
+
const { createAimlApiProvider } = await import("./aimlapi-DMF6v_vb.js");
|
|
33231
32738
|
return createAimlApiProvider(providerPath, {
|
|
33232
32739
|
...providerOptions,
|
|
33233
32740
|
env: context.env
|
|
@@ -33237,7 +32744,7 @@ const providerMap = [
|
|
|
33237
32744
|
{
|
|
33238
32745
|
test: (providerPath) => providerPath.startsWith("cometapi:"),
|
|
33239
32746
|
create: async (providerPath, providerOptions, context) => {
|
|
33240
|
-
const { createCometApiProvider } = await import("./cometapi-
|
|
32747
|
+
const { createCometApiProvider } = await import("./cometapi-B01btbfb.js");
|
|
33241
32748
|
return createCometApiProvider(providerPath, {
|
|
33242
32749
|
...providerOptions,
|
|
33243
32750
|
env: context.env
|
|
@@ -33247,7 +32754,7 @@ const providerMap = [
|
|
|
33247
32754
|
{
|
|
33248
32755
|
test: (providerPath) => providerPath.startsWith("docker:"),
|
|
33249
32756
|
create: async (providerPath, providerOptions, context) => {
|
|
33250
|
-
const { createDockerProvider } = await import("./docker-
|
|
32757
|
+
const { createDockerProvider } = await import("./docker-BuButc4D.js");
|
|
33251
32758
|
return createDockerProvider(providerPath, {
|
|
33252
32759
|
...providerOptions,
|
|
33253
32760
|
env: context.env
|
|
@@ -33513,7 +33020,7 @@ const providerMap = [
|
|
|
33513
33020
|
{
|
|
33514
33021
|
test: (providerPath) => providerPath.startsWith("transformers:") || providerPath.startsWith("transformers.js:"),
|
|
33515
33022
|
create: async (providerPath, providerOptions, _context) => {
|
|
33516
|
-
const { validateTransformersDependency } = await import("./transformersAvailability-
|
|
33023
|
+
const { validateTransformersDependency } = await import("./transformersAvailability-DwmezkVe.js");
|
|
33517
33024
|
await validateTransformersDependency();
|
|
33518
33025
|
const splits = providerPath.split(":");
|
|
33519
33026
|
if (splits.length < 3) throw new Error(`Invalid Transformers.js provider path: ${providerPath}. Format: transformers:<task>:<model>
|
|
@@ -33533,7 +33040,7 @@ Example: transformers:feature-extraction:Xenova/all-MiniLM-L6-v2`);
|
|
|
33533
33040
|
test: (providerPath) => providerPath === "slack" || providerPath.startsWith("slack:"),
|
|
33534
33041
|
create: async (providerPath, providerOptions, _context) => {
|
|
33535
33042
|
try {
|
|
33536
|
-
const { SlackProvider } = await import("./slack-
|
|
33043
|
+
const { SlackProvider } = await import("./slack-BfdBx2tO.js");
|
|
33537
33044
|
if (providerPath === "slack") return new SlackProvider(providerOptions);
|
|
33538
33045
|
const splits = providerPath.split(":");
|
|
33539
33046
|
if (splits.length < 2) throw new Error("Invalid Slack provider path. Use slack:<channel_id> or slack:channel:<channel_id>");
|
|
@@ -33829,5 +33336,5 @@ function getProviderIds(providerPaths) {
|
|
|
33829
33336
|
}
|
|
33830
33337
|
|
|
33831
33338
|
//#endregion
|
|
33832
|
-
export {
|
|
33833
|
-
//# sourceMappingURL=providers-
|
|
33339
|
+
export { AzureEmbeddingProvider as $, renderPrompt as A, OpenAiModerationProvider as B, extractVariablesFromJson as C, isEmptyResponse as D, isBasicRefusal as E, TokenUsageTracker as F, VertexChatProvider as G, MistralEmbeddingProvider as H, createRateLimitRegistry as I, DefaultGradingProvider$1 as J, AIStudioChatProvider as K, createProviderRateLimitOptions as L, isPackagePath as M, loadFromPackage as N, removePrefix as O, redteamProviderManager as P, AzureModerationProvider as Q, PromptfooHarmfulCompletionProvider as R, extractPromptFromTags as S, getShortPluginId as T, DefaultEmbeddingProvider as U, MistralChatCompletionProvider as V, DefaultGradingProvider as W, DefaultSuggestionsProvider as X, DefaultLlmRubricProvider as Y, DefaultSynthesizeProvider as Z, pluginMatchesStrategyTargets as _, resolveTeamId as _t, resolveProviderConfigs as a, getCloudDatabaseId as at, extractGoalFromPrompt as b, createTransformRequest as c, getEvalConfigFromCloud as ct, Strategies as d, getPoliciesFromCloud as dt, AzureChatCompletionProvider as et, loadStrategy as f, getProviderFromCloud as ft, retrieveMedia as g, resolveTeamFromIdentifier as gt, mediaExists as h, makeRequest as ht, resolveProvider as i, checkCloudPermissions as it, runExtensionHook as j, collectFileMetadata as k, createTransformResponse$1 as l, getOrgContext as lt, getMediaStorage as m, isCloudProvider as mt, loadApiProvider as n, parseScriptParts as nt, MCPProvider as o, getConfigFromCloud as ot, validateStrategies as p, getUserTeams as pt, DefaultGradingJsonProvider as q, loadApiProviders as r, canCreateTargets as rt, HttpProvider as s, getDefaultTeam as st, getProviderIds as t, getFileHashes as tt, GoogleLiveProvider as u, getPluginSeverityOverridesFromCloud as ut, checkExfilTracking as v, getSessionId as w, extractInputVarsFromPrompt as x, extractAllPromptsFromTags as y, REDTEAM_MEMORY_POISONING_PLUGIN_ID as z };
|
|
33340
|
+
//# sourceMappingURL=providers-BlEhY5mi.js.map
|