promptfoo 0.121.2 → 0.121.3
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 +2 -0
- package/dist/src/{accounts-CiBLOnA7.js → accounts-B2XmGjty.js} +5 -5
- package/dist/src/{accounts-gtkH-5KX.cjs → accounts-BPyfpSeU.cjs} +5 -5
- package/dist/src/{accounts-Bm2D8Db9.js → accounts-CFLK3mnD.js} +6 -6
- package/dist/src/{accounts-B0pgC1oV.js → accounts-Xatc0RYb.js} +5 -5
- package/dist/src/{agentic-utils-DS1g3GLF.js → agentic-utils-36epdqwB.js} +3 -3
- package/dist/src/{cometapi-CUQq3H_a.js → agentic-utils-D8yXo5Lm.js} +4 -61
- package/dist/src/{cometapi-C4xSqeID.cjs → agentic-utils-DAVsChuB.cjs} +24 -62
- package/dist/src/agentic-utils-DIYAAYE7.js +153 -0
- package/dist/src/{agents-CBr9A01V.js → agents-BBVJCIYr.js} +226 -13
- package/dist/src/{agents-Di9DKPzn.cjs → agents-BBWxKSM0.cjs} +7 -7
- package/dist/src/{agents-DgF2zDag.js → agents-Bqgfdokm.js} +228 -13
- package/dist/src/{agents-DbRtpYxR.cjs → agents-CAYbM7qD.cjs} +226 -13
- package/dist/src/{agents-9qiOy0ho.js → agents-CLQ-P15P.js} +7 -7
- package/dist/src/{agents-cLXA8a_8.js → agents-CgBniSlI.js} +8 -8
- package/dist/src/{agents-D__IdAlg.js → agents-DSSTV4bv.js} +226 -15
- package/dist/src/{agents-CmvBq8LV.js → agents-wg3ohknq.js} +7 -7
- package/dist/src/{aimlapi-BvlNH0gr.cjs → aimlapi-Bv8Fmc-b.cjs} +14 -14
- package/dist/src/{aimlapi-DHJU_kcV.js → aimlapi-BwGC1TtS.js} +13 -13
- package/dist/src/{aimlapi-CnkC2HqE.js → aimlapi-DaC3qZ-o.js} +14 -14
- package/dist/src/{aimlapi-B4rcnZgv.js → aimlapi-MgSLdvy7.js} +13 -13
- package/dist/src/app/assets/index-B6l9CVVb.js +439 -0
- package/dist/src/app/assets/index-DyZ0Ep37.css +1 -0
- package/dist/src/app/assets/sync-CStkzc6u.js +4 -0
- package/dist/src/app/assets/vendor-markdown-Bz7N-ca6.js +29 -0
- package/dist/src/app/index.html +3 -3
- package/dist/src/{audio-Bkv46et0.js → audio-Bn44pQxv.js} +4 -4
- package/dist/src/{audio-ClI_AFre.js → audio-DDA5WHdx.js} +4 -4
- package/dist/src/{audio-CGMyULza.cjs → audio-DVFjQ67_.cjs} +4 -4
- package/dist/src/{audio-Dz3z7s3J.js → audio-DjU9GswO.js} +5 -5
- package/dist/src/{base-CGrhspbK.cjs → base-BboXIF_0.cjs} +3 -3
- package/dist/src/{base-Dy1V8--Z.js → base-CKjwebIH.js} +3 -3
- package/dist/src/{base-DLKtKMFh.js → base-CqzQ4K8j.js} +3 -3
- package/dist/src/{base-CpjcHe4e.js → base-Cz2ZC_iA.js} +3 -3
- package/dist/src/{blobs-CMHN0Qcz.js → blobs-B1JriOyi.js} +3 -3
- package/dist/src/{blobs-BDbfYdrJ.js → blobs-BUWmKWzo.js} +3 -3
- package/dist/src/{blobs-D23XLin-.cjs → blobs-C6j0bvFz.cjs} +3 -3
- package/dist/src/{blobs-CBO20krR.js → blobs-DXTl6J3H.js} +3 -3
- package/dist/src/{cache-Dh5WtQps.cjs → cache-C5yFZ4gC.cjs} +3 -3
- package/dist/src/{cache-C4Nxf52C.js → cache-CaT5tPgo.js} +3 -3
- package/dist/src/cache-CyCanoMu.js +6 -0
- package/dist/src/{cache-BVeDlD87.js → cache-DSqR6ezl.js} +3 -3
- package/dist/src/cache-Df_QFDNu.cjs +5 -0
- package/dist/src/{cache-i1P6crbO.js → cache-HP0NP4k3.js} +3 -3
- package/dist/src/{chat-CzkrVDfz.js → chat-B-52XYI1.js} +12 -12
- package/dist/src/{chat-DJIw17u0.js → chat-B0iaWhoh.js} +14 -14
- package/dist/src/{chat-qmatte1u.js → chat-BE0qTA8e.js} +13 -13
- package/dist/src/{chat-BiKyneZl.js → chat-BEwdgGEg.js} +14 -14
- package/dist/src/{chat-C1Qst7jL.cjs → chat-BtIKkLKx.cjs} +13 -13
- package/dist/src/{chat-CgF-J-Jj.cjs → chat-CM8qWR3_.cjs} +15 -15
- package/dist/src/{chat-C2jrdPMx.js → chat-DK1U-eZ-.js} +12 -12
- package/dist/src/{chat-DqxYYtWA.js → chat-pxmiVpWe.js} +14 -14
- package/dist/src/{chatkit-65VXf5SR.js → chatkit-BYGQlHlV.js} +4 -4
- package/dist/src/{chatkit-DKyPi1Gs.cjs → chatkit-Cx174XI3.cjs} +4 -4
- package/dist/src/{chatkit-BxFvW8KY.js → chatkit-_8eJqKcD.js} +4 -4
- package/dist/src/{chatkit-Be-Q-a9F.js → chatkit-a2D6mY6s.js} +4 -4
- package/dist/src/{claude-agent-sdk-D9Z5Pr9X.cjs → claude-agent-sdk-8ddRp1L2.cjs} +35 -17
- package/dist/src/{claude-agent-sdk-DfCoW0E6.js → claude-agent-sdk-Bq5EArsX.js} +33 -15
- package/dist/src/{claude-agent-sdk-Apiy0iaz.js → claude-agent-sdk-CMjh4LFH.js} +33 -15
- package/dist/src/{claude-agent-sdk-D2bJee9S.js → claude-agent-sdk-HgbFioFw.js} +33 -15
- package/dist/src/cloud-DE3t1-ZI.js +4 -0
- package/dist/src/{cloud-C0dlstV_.js → cloud-z8KZpUoa.js} +3 -3
- package/dist/src/{cloudflare-ai-g7PB6VHR.js → cloudflare-ai-BGyXlpXJ.js} +13 -13
- package/dist/src/{cloudflare-ai-8TDxHR0x.js → cloudflare-ai-Bbp26N0L.js} +13 -13
- package/dist/src/{cloudflare-ai-CknbZ5LJ.cjs → cloudflare-ai-C62x6MQG.cjs} +14 -14
- package/dist/src/{cloudflare-ai-BxAGvfju.js → cloudflare-ai-DdKP9TKT.js} +14 -14
- package/dist/src/{cloudflare-gateway-CP9QEWYS.js → cloudflare-gateway-BwAaUgeW.js} +14 -14
- package/dist/src/{cloudflare-gateway-B9HWA5wf.js → cloudflare-gateway-D-e9i1Sn.js} +15 -15
- package/dist/src/{cloudflare-gateway-CKDb4dJ8.js → cloudflare-gateway-DXhtXDRb.js} +15 -163
- package/dist/src/{cloudflare-gateway-BSnDmHYo.cjs → cloudflare-gateway-Dx36ftqF.cjs} +15 -15
- package/dist/src/{codex-sdk-DUwKWezN.js → codex-sdk-BQEw16R_.js} +180 -11
- package/dist/src/{codex-sdk-C6UMlxwV.js → codex-sdk-C_07GuVS.js} +180 -11
- package/dist/src/{codex-sdk-GGAw0qbD.js → codex-sdk-DE5G18dx.js} +180 -11
- package/dist/src/{codex-sdk-fAO0c3yA.cjs → codex-sdk-ZLKfDjqP.cjs} +181 -12
- package/dist/src/cometapi-BDyV-NNm.js +62 -0
- package/dist/src/cometapi-C3hOlM7-.cjs +62 -0
- package/dist/src/{cometapi-BL9yvj_f.js → cometapi-hhL4TAh3.js} +14 -14
- package/dist/src/{cometapi-DFNiKmSz.js → cometapi-sp7sJpBD.js} +15 -15
- package/dist/src/{completion-5MzrpJxT.js → completion-BCimtq-h.js} +6 -6
- package/dist/src/{completion-qRoZAYRB.js → completion-DCjv7RZ3.js} +6 -6
- package/dist/src/{completion-CM6oK8PS.cjs → completion-DlXUhj5c.cjs} +6 -6
- package/dist/src/{completion-DZ083F31.js → completion-DoYy49ti.js} +6 -6
- package/dist/src/{createHash-CfZSc0b4.cjs → createHash-BYwImsYv.cjs} +2 -2
- package/dist/src/{docker-DcF2pRrj.cjs → docker-Cqj2-QVi.cjs} +14 -14
- package/dist/src/{docker-Bb5dcxr8.js → docker-CxCkwMzc.js} +13 -13
- package/dist/src/{docker-BvfL2BrW.js → docker-DpguQj-w.js} +14 -14
- package/dist/src/{docker-ExVyLp0S.js → docker-FeBni2dw.js} +13 -13
- package/dist/src/{esm-C03C-mv3.js → esm-7UIl0pPM.js} +2 -2
- package/dist/src/{esm-Cd1AjG1D.js → esm-CKWP3u_P.js} +3 -3
- package/dist/src/{esm-CnNt7sI4.cjs → esm-CipptfDu.cjs} +2 -2
- package/dist/src/{esm-CaIwzWR5.js → esm-SUNIX1x3.js} +3 -3
- package/dist/src/eval-7aEqoMs3.js +15 -0
- package/dist/src/{eval-Dg2nG4v2.js → eval-BTqTn7lb.js} +10 -10
- package/dist/src/{evalResult-BDMqrapS.js → evalResult-BkIhRdTe.js} +7 -7
- package/dist/src/evalResult-CYNHkk5A.js +12 -0
- package/dist/src/evalResult-CuvJeNiM.js +10 -0
- package/dist/src/{evalResult-BBRNtX4I.js → evalResult-DUDShQrm.js} +7 -7
- package/dist/src/{evalResult-fuaI8HkH.cjs → evalResult-DpARzUCb.cjs} +7 -7
- package/dist/src/evalResult-tGdilrWt.cjs +10 -0
- package/dist/src/evaluator-BBUqRhz1.js +36 -0
- package/dist/src/{evaluator-BhoWwp5b.js → evaluator-BcvOGaam.js} +823 -73
- package/dist/src/{extractor-D25qpmGX.js → extractor-C8XwivI9.js} +6 -6
- package/dist/src/{extractor-DReVID0K.js → extractor-CAZ2G3Kh.js} +6 -6
- package/dist/src/{extractor-pYLLi3wS.cjs → extractor-DG3sSfXE.cjs} +6 -6
- package/dist/src/{extractor-C0EVHewb.js → extractor-D_wd8jxt.js} +6 -6
- package/dist/src/{fetch-HaqdX7U1.js → fetch-BiYv2BZc.js} +3 -3
- package/dist/src/{fetch-BPkYtG8K.cjs → fetch-BnR9wSnm.cjs} +3 -3
- package/dist/src/{fetch-Cwxnd8zz.js → fetch-CVAtKnI3.js} +3 -3
- package/dist/src/{fetch-Dxpd4_sr.js → fetch-DoVRJZhJ.js} +4 -4
- package/dist/src/fetch-UWU706qb.js +5 -0
- package/dist/src/{genaiTracer-DN4dQywX.cjs → genaiTracer-BfxrvSUb.cjs} +2 -2
- package/dist/src/{graders-DU49_J8Y.cjs → graders-BElhu9ZY.cjs} +126 -55
- package/dist/src/{graders-DP7KFFo-.js → graders-BXAJ0sbS.js} +120 -55
- package/dist/src/graders-BxfEguVY.js +32 -0
- package/dist/src/graders-CzVMbEnv.js +34 -0
- package/dist/src/{graders-BTeBGqjJ.js → graders-DG7mhg-b.js} +120 -55
- package/dist/src/graders-DjCXfj0l.cjs +32 -0
- package/dist/src/{graders-Bj_Odv7c.js → graders-RjHF8VfG.js} +120 -55
- package/dist/src/graders-kHzIWOKu.js +32 -0
- package/dist/src/{image-BLmROtN3.cjs → image--F58eEIn.cjs} +6 -6
- package/dist/src/{image-B0h9VEMc.js → image-6WQXK8m8.js} +4 -4
- package/dist/src/{image-Dpxa1Jt6.js → image-B8b6f36E.js} +6 -6
- package/dist/src/{image-CHfWvljl.js → image-CoxZp9PZ.js} +6 -6
- package/dist/src/{image-B02ogr_b.js → image-DO0RYnjH.js} +5 -5
- package/dist/src/{image-DS-o-0ph.js → image-PoF6DN3x.js} +6 -6
- package/dist/src/{image-C1madmKh.cjs → image-fza3zuKs.cjs} +4 -4
- package/dist/src/{image-Bb4vWQLM.js → image-xNbw5ph2.js} +4 -4
- package/dist/src/index.cjs +853 -104
- package/dist/src/index.d.cts +573 -60
- package/dist/src/index.d.ts +573 -60
- package/dist/src/index.js +850 -102
- package/dist/src/{interactiveCheck-BgLZUIt3.js → interactiveCheck-BnMYOjMu.js} +2 -2
- package/dist/src/{knowledgeBase-B3OoKIej.js → knowledgeBase-Bi7CmDbx.js} +7 -7
- package/dist/src/{knowledgeBase-CYTLHOt1.js → knowledgeBase-Ce3ofVan.js} +8 -8
- package/dist/src/{knowledgeBase-D33Ty2l6.js → knowledgeBase-DFRXPZl_.js} +7 -7
- package/dist/src/{knowledgeBase-DOO_BM9b.cjs → knowledgeBase-DqrLX8fy.cjs} +7 -7
- package/dist/src/{litellm-AaeZcZQF.js → litellm-Bo2gQXpo.js} +14 -14
- package/dist/src/{litellm-NbjknEh6.js → litellm-CKiAxnoM.js} +13 -13
- package/dist/src/{litellm-I_hbp_dc.cjs → litellm-CnHI69aj.cjs} +14 -14
- package/dist/src/{litellm-TrljxD9G.js → litellm-Tc294Jhj.js} +13 -13
- package/dist/src/{logger-KkObSCzq.js → logger-BcJBzSSA.js} +10 -14
- package/dist/src/{logger-DLcq4dWf.js → logger-BnkjG2jt.js} +10 -14
- package/dist/src/{logger-Cp1GPUjj.cjs → logger-D5iKBpu_.cjs} +27 -13
- package/dist/src/{logger-CT3IKMKA.js → logger-DO8_zM18.js} +10 -14
- package/dist/src/{luma-ray-BS2_tY8L.js → luma-ray-0ehMPt5N.js} +10 -10
- package/dist/src/{luma-ray-DDsjcgZZ.js → luma-ray-C9q8rdQe.js} +9 -9
- package/dist/src/{luma-ray-f6I2fft-.js → luma-ray-DP0QA9qn.js} +9 -9
- package/dist/src/{luma-ray-Due0n7di.cjs → luma-ray-m9Ku2meV.cjs} +9 -9
- package/dist/src/main.js +69 -71
- package/dist/src/{messages-D0lx5qK7.js → messages-DJNo37Ko.js} +14 -9
- package/dist/src/{messages-BS17jdMx.js → messages-Dy9QecMs.js} +14 -9
- package/dist/src/{messages-Bs1kC7P4.cjs → messages-HJsyEh4o.cjs} +15 -10
- package/dist/src/{messages-ZJk778GH.js → messages-biC_ex-p.js} +14 -9
- package/dist/src/{modelslab-DRb74SP4.js → modelslab-B5J-ZM5c.js} +9 -9
- package/dist/src/{modelslab-Bx9IrZfS.js → modelslab-BI458moT.js} +10 -10
- package/dist/src/{modelslab-Bmni6skY.js → modelslab-BTOT8FUO.js} +9 -9
- package/dist/src/{modelslab-CoUX6Jc_.cjs → modelslab-IQbNg-r7.cjs} +9 -9
- package/dist/src/{nova-reel-bgjxilYW.js → nova-reel-BZ9y-Y5s.js} +9 -9
- package/dist/src/{nova-reel-C_QM18Xn.cjs → nova-reel-CE5etkv9.cjs} +9 -9
- package/dist/src/{nova-reel-D_W1tjMH.js → nova-reel-DEeQlnOJ.js} +10 -10
- package/dist/src/{nova-reel-BfPq-0Yk.js → nova-reel-Xw1SXLpg.js} +9 -9
- package/dist/src/{nova-sonic-De1HW5fD.js → nova-sonic-DWswpN1E.js} +7 -7
- package/dist/src/{nova-sonic-CFb5GYhg.js → nova-sonic-DXTLpi-r.js} +6 -6
- package/dist/src/{nova-sonic-zfcljeRp.cjs → nova-sonic-N0yCm0vb.cjs} +6 -6
- package/dist/src/{nova-sonic-DIGQNR07.js → nova-sonic-Ogqf-csn.js} +6 -6
- package/dist/src/{openai-DhbB7eWK.js → openai-BMcwgD5C.js} +2 -2
- package/dist/src/{openai-j-sE2O7r.js → openai-BcB5KlTk.js} +2 -2
- package/dist/src/{openai-Cuif0GEt.cjs → openai-CoxGAQwn.cjs} +2 -2
- package/dist/src/{openai-DElQ-fPX.js → openai-D6wITiVn.js} +2 -2
- package/dist/src/{openclaw-tiVYRtr-.js → openclaw-0Sv7AK3O.js} +13 -13
- package/dist/src/{openclaw-CSugPYAr.cjs → openclaw-CXxbKgDH.cjs} +14 -14
- package/dist/src/{openclaw-DuvJKEW5.js → openclaw-D1FSCps-.js} +13 -13
- package/dist/src/{openclaw-DiSz3I5L.js → openclaw-D2ENvu7a.js} +14 -14
- package/dist/src/{opencode-sdk-0j6rTWNb.js → opencode-sdk-C71Z0ehR.js} +13 -13
- package/dist/src/{opencode-sdk-B3CWY9h_.js → opencode-sdk-CHCs7dEb.js} +12 -12
- package/dist/src/{opencode-sdk-C2y6UkP2.js → opencode-sdk-DDxj4QqH.js} +12 -12
- package/dist/src/{opencode-sdk-BL764Jdi.cjs → opencode-sdk-WWJhnbKr.cjs} +16 -16
- package/dist/src/{otlpReceiver-C99PPb48.js → otlpReceiver-C9KlUtxh.js} +6 -6
- package/dist/src/{otlpReceiver-CdNBdbsk.js → otlpReceiver-CZL48YfC.js} +6 -6
- package/dist/src/{otlpReceiver-D89fR-rC.js → otlpReceiver-CavGAA6k.js} +6 -6
- package/dist/src/{otlpReceiver-CGq6LspY.cjs → otlpReceiver-DHKqJlsz.cjs} +6 -6
- package/dist/src/{providerRegistry-B0RUOLI_.js → providerRegistry-B9lh-_tx.js} +2 -2
- package/dist/src/{providerRegistry-Civky8Ar.cjs → providerRegistry-BTDgfV5h.cjs} +2 -2
- package/dist/src/{providerRegistry-CD8MEar9.js → providerRegistry-BkzVH5Ba.js} +2 -2
- package/dist/src/{providerRegistry-DM8rZYol.js → providerRegistry-CUWki5mQ.js} +2 -2
- package/dist/src/providers-BSLEaIQG.js +32 -0
- package/dist/src/{providers-CgKOSgTR.cjs → providers-CScd1wN6.cjs} +733 -464
- package/dist/src/{providers-BlqUifFg.js → providers-Ch6Mr0gn.js} +795 -526
- package/dist/src/{providers-Dk_6ocUX.js → providers-Cn73d5sr.js} +795 -526
- package/dist/src/providers-D-FnDg8k.cjs +31 -0
- package/dist/src/providers-DEYiFVAo.js +30 -0
- package/dist/src/{providers-D8lF1sqW.js → providers-DvddrgxL.js} +795 -526
- package/dist/src/providers-sS2WI8YD.js +30 -0
- package/dist/src/{pythonUtils-D6fwaDSg.js → pythonUtils-Bzwbgpbg.js} +3 -3
- package/dist/src/{pythonUtils-D5nxkQ0P.js → pythonUtils-Cpo0Ez1p.js} +3 -3
- package/dist/src/{pythonUtils-CTU3Y3lw.cjs → pythonUtils-dAVigVK-.cjs} +3 -3
- package/dist/src/{pythonUtils-C3py6GC1.js → pythonUtils-wIqk7zAf.js} +3 -3
- package/dist/src/{quiverai-CIaELU_m.js → quiverai-BeofbLVc.js} +4 -4
- package/dist/src/{quiverai-uH-dcTIr.js → quiverai-CCQn73lq.js} +5 -5
- package/dist/src/{quiverai-PdShCPox.cjs → quiverai-CcUhPIBg.cjs} +4 -4
- package/dist/src/{quiverai-BbOUOn2L.js → quiverai-DVSEqJiq.js} +4 -4
- package/dist/src/{render-Drod8m7K.js → render-BHl6QVq9.js} +3 -3
- package/dist/src/{responses-WNGNYe3K.js → responses-BKP_WYis.js} +14 -10
- package/dist/src/{responses-DIR9Ud3j.js → responses-CQb1Tj69.js} +14 -10
- package/dist/src/{responses-CB2jwoAr.js → responses-CgNyTPsY.js} +14 -10
- package/dist/src/{responses-D8SBTL64.cjs → responses-mo0KQDbu.cjs} +14 -10
- package/dist/src/rubyUtils-B1HXG4ej.cjs +4 -0
- package/dist/src/{rubyUtils-DhCAlxZr.cjs → rubyUtils-CGeUtCfW.cjs} +3 -3
- package/dist/src/{rubyUtils-Boc4HZzX.js → rubyUtils-CiVfln3g.js} +3 -3
- package/dist/src/{rubyUtils-BcuGX77l.js → rubyUtils-DECSbsfY.js} +3 -3
- package/dist/src/{rubyUtils-BUVePouc.js → rubyUtils-PgU-gHmx.js} +3 -3
- package/dist/src/rubyUtils-Rt6pKA96.js +5 -0
- package/dist/src/{sagemaker-CNBxx5CJ.js → sagemaker-CVv8W7so.js} +17 -17
- package/dist/src/{sagemaker-CemTFp2h.js → sagemaker-CqeASYE5.js} +17 -17
- package/dist/src/{sagemaker-YSyBXQQh.js → sagemaker-MUbD5V3v.js} +18 -18
- package/dist/src/{sagemaker-Cl28mZU2.cjs → sagemaker-jiw1wQa-.cjs} +17 -17
- package/dist/src/{scanner-BsBlNXNn.js → scanner-DVDeUz1r.js} +10 -10
- package/dist/src/server/index.js +854 -106
- package/dist/src/server-B0Xh1Gx-.js +7 -0
- package/dist/src/{server-C_7Ax-hA.cjs → server-BtoCXeXI.cjs} +4 -4
- package/dist/src/{server-VWgWb00X.js → server-CP9qKM40.js} +4 -4
- package/dist/src/{server-CuxBbeSY.js → server-Cns05F1j.js} +5 -5
- package/dist/src/server-DJTKu9IR.cjs +5 -0
- package/dist/src/{server-CqzrVGpF.js → server-DZ9MtCn0.js} +6 -6
- package/dist/src/{signal-4U3mfRvL.js → signal-C3ZTsUgi.js} +3 -3
- package/dist/src/{slack-DOdy_kyv.js → slack-2sdpGzbt.js} +2 -2
- package/dist/src/{slack-BmVAVGaK.cjs → slack-94iG3T0s.cjs} +2 -2
- package/dist/src/{slack-DCUPTzS2.js → slack-BR0HtO3K.js} +2 -2
- package/dist/src/{slack-DXMKtA-f.js → slack-DCEV-vWP.js} +2 -2
- package/dist/src/store-C5u6MgC8.js +6 -0
- package/dist/src/{store-DLlFCC4h.cjs → store-CLyU7AtI.cjs} +17 -5
- package/dist/src/store-CNHk-De4.cjs +5 -0
- package/dist/src/{store-DXilxTl-.js → store-Cj258DgL.js} +17 -5
- package/dist/src/{store-Dim__MDd.js → store-P8OKm19S.js} +17 -5
- package/dist/src/{store-CXGFv4aR.js → store-VB0GP46K.js} +17 -5
- package/dist/src/{tables-DLJPUdUE.js → tables-BEIFz2tM.js} +3 -3
- package/dist/src/{tables-DPi7wKeM.cjs → tables-BdZQEpRz.cjs} +3 -3
- package/dist/src/{tables-gftXzE9I.js → tables-DmzvLbeZ.js} +3 -3
- package/dist/src/{tables-6YKwjN9-.js → tables-kC7R5kiK.js} +3 -3
- package/dist/src/{telemetry-CMrFgtPB.js → telemetry-BnH5VJAU.js} +4 -4
- package/dist/src/{telemetry-Dthj_BbD.js → telemetry-BugWqKiu.js} +4 -4
- package/dist/src/{telemetry-Cps3mIU-.js → telemetry-DPXLd7UE.js} +4 -4
- package/dist/src/telemetry-Yig0Tino.js +7 -0
- package/dist/src/telemetry-p8Pwqm1i.cjs +5 -0
- package/dist/src/{telemetry-DaX14Chu.cjs → telemetry-re627Lre.cjs} +4 -4
- package/dist/src/{transcription-NLVG9MT1.cjs → transcription-BvtsrzRG.cjs} +13 -13
- package/dist/src/{transcription-BNYURcXg.js → transcription-CaMivnjG.js} +13 -13
- package/dist/src/{transcription-s6A-bNrZ.js → transcription-DOMMTu01.js} +14 -14
- package/dist/src/{transcription-B_OdaHp7.js → transcription-Hb3VnC4M.js} +13 -13
- package/dist/src/{transform-DuHvhZpj.cjs → transform-0BwoBsvO.cjs} +19 -5
- package/dist/src/{transform-uAytVuyX.js → transform-B2-jIv68.js} +8 -6
- package/dist/src/{transform-DECvGmzp.js → transform-BqPkNPYm.js} +4 -4
- package/dist/src/{transform-aa6tmVpZ.js → transform-BzK09Q_9.js} +4 -4
- package/dist/src/transform-ChNIpHz7.js +6 -0
- package/dist/src/{transform-D5HsjduX.js → transform-DrleutM3.js} +8 -6
- package/dist/src/{transform-vNucnNr0.js → transform-DyDAwEpE.js} +8 -6
- package/dist/src/transform-PtQ6rAE3.cjs +5 -0
- package/dist/src/{transform-CzK1Q0zl.cjs → transform-ZrG2dvlo.cjs} +4 -4
- package/dist/src/{transform-DilY9wbS.js → transform-ljLYHEPh.js} +4 -4
- package/dist/src/{transformersAvailability-CEVM2GNQ.js → transformersAvailability-BGkzavwb.js} +1 -1
- package/dist/src/{transformersAvailability-CwayUSlh.cjs → transformersAvailability-DKoRtQLy.cjs} +1 -1
- package/dist/src/{types-Cbd8uOMq.js → types-CIhFeUC4.js} +7 -1
- package/dist/src/{types-CzW2QFyi.js → types-Cd3ygw8W.js} +7 -1
- package/dist/src/{types-C_7nyzr1.cjs → types-D8cGDZbL.cjs} +8 -2
- package/dist/src/{types-DmyIJ-sR.js → types-q8GXGF65.js} +7 -1
- package/dist/src/{util-DGNOS1db.cjs → util--9u9UVCt.cjs} +3 -3
- package/dist/src/{util-ZzmqNPlg.js → util-BLvy9qfE.js} +7 -7
- package/dist/src/{util-C1CeHl-P.js → util-Bm3E9jpK.js} +7 -7
- package/dist/src/{util-BV4XUC0n.js → util-BtoGs5Cb.js} +18 -4
- package/dist/src/{util-BzMcevZc.cjs → util-CFj4YKIn.cjs} +18 -4
- package/dist/src/{util-BRYkYPTd.js → util-CMMkIxfU.js} +7 -7
- package/dist/src/{util-Dnmk2mBQ.js → util-CgDCK4KI.js} +18 -4
- package/dist/src/{util-B9vlHIIh.cjs → util-CuLo2pMR.cjs} +7 -7
- package/dist/src/{util-CMy69ZgQ.js → util-DM2rTn_6.js} +18 -4
- package/dist/src/{util-B3xGByQh.js → util-DMFeUvLz.js} +3 -3
- package/dist/src/{util-BHGHw5G1.js → util-DbVG-yZU.js} +3 -3
- package/dist/src/{util-Bv6uGDfH.js → util-vNmDL5DT.js} +3 -3
- package/dist/src/{utils-XiOAgly5.js → utils-CFxO9KGo.js} +2 -2
- package/dist/src/{utils-f2-Moju7.js → utils-DEuL4VNB.js} +2 -2
- package/dist/src/{utils-Cz9qXqII.cjs → utils-DKw8mrgr.cjs} +3 -3
- package/dist/src/{utils-dLokC-eR.js → utils-DOjD4dTC.js} +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -32
- package/dist/src/app/assets/index-4LKxG2CG.js +0 -439
- package/dist/src/app/assets/index-C3zcsZFQ.css +0 -1
- package/dist/src/app/assets/sync-9qqYcY-B.js +0 -4
- package/dist/src/app/assets/vendor-markdown-0tekx3KX.js +0 -29
- package/dist/src/app/tsconfig.app.tsbuildinfo +0 -1
- package/dist/src/cache-CeUpFm3M.cjs +0 -5
- package/dist/src/cache-n-RCJ-hL.js +0 -6
- package/dist/src/cloud-BBh91EUK.js +0 -4
- package/dist/src/eval-B3r2CVXr.js +0 -15
- package/dist/src/evalResult-5xwYnECe.js +0 -12
- package/dist/src/evalResult-71lY93Kj.cjs +0 -10
- package/dist/src/evalResult-Dx5P5cIv.js +0 -10
- package/dist/src/evaluator-Jx6bRZV6.js +0 -36
- package/dist/src/fetch-BxNb_Lp3.js +0 -5
- package/dist/src/graders-B_pgMLS2.js +0 -34
- package/dist/src/graders-DErokPDO.cjs +0 -32
- package/dist/src/graders-DR_uNe54.js +0 -32
- package/dist/src/graders-w3176Wz-.js +0 -32
- package/dist/src/providers-B7V0njNs.js +0 -32
- package/dist/src/providers-BEwbhv0X.js +0 -30
- package/dist/src/providers-CH3C7zf7.js +0 -30
- package/dist/src/providers-zyB6k_38.cjs +0 -31
- package/dist/src/rubyUtils-BUHu6PhO.js +0 -5
- package/dist/src/rubyUtils-CP42kMvq.cjs +0 -4
- package/dist/src/server-DA4Cyrrq.js +0 -7
- package/dist/src/server-Dulb-4-K.cjs +0 -5
- package/dist/src/store-CXS-Q_91.js +0 -6
- package/dist/src/store-eYkaKMwq.cjs +0 -5
- package/dist/src/telemetry-BpMfhthR.cjs +0 -5
- package/dist/src/telemetry-Dw38hanS.js +0 -7
- package/dist/src/transform-DTGDnAzW.js +0 -6
- package/dist/src/transform-m3qNw4KP.cjs +0 -5
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as transformTools, P as VERSION, S as transformToolChoice, b as parseChatPrompt, d as sleep, f as LONG_RUNNING_MODEL_TIMEOUT_MS, g as isOpenAIToolChoice, h as isOpenAIToolArray, m as calculateCost, n as fetchWithRetries, o as cloudConfig, p as REQUEST_TIMEOUT_MS, r as fetchWithTimeout, t as fetchWithProxy, v as openaiToolChoiceToBedrock, w as CLOUD_PROVIDER_PREFIX, x as toTitleCase, y as openaiToolsToBedrock } from "./fetch-
|
|
1
|
+
import { C as getEnvString, D as state, S as getEnvInt, _ as safeJsonStringify, a as logger, b as getEnvBool, d as sanitizeUrl, f as extractFirstJsonObject, h as isValidJson, u as sanitizeObject, x as getEnvFloat, y as getConfigDirectoryPath } from "./logger-BnkjG2jt.js";
|
|
2
|
+
import { C as transformTools, P as VERSION, S as transformToolChoice, b as parseChatPrompt, d as sleep, f as LONG_RUNNING_MODEL_TIMEOUT_MS, g as isOpenAIToolChoice, h as isOpenAIToolArray, m as calculateCost, n as fetchWithRetries, o as cloudConfig, p as REQUEST_TIMEOUT_MS$1, r as fetchWithTimeout, t as fetchWithProxy, v as openaiToolChoiceToBedrock, w as CLOUD_PROVIDER_PREFIX, x as toTitleCase, y as openaiToolsToBedrock } from "./fetch-BiYv2BZc.js";
|
|
3
3
|
import { t as invariant } from "./invariant-vgHWClmd.js";
|
|
4
|
-
import { c as isLoggedIntoCloud, o as getUserEmail } from "./accounts-
|
|
5
|
-
import { c as getRemoteGenerationUrl, d as neverGenerateRemote, f as neverGenerateRemoteForRegularEvals, l as getRemoteGenerationUrlForUnaligned, p as shouldGenerateRemote, r as checkServerFeatureSupport } from "./server-
|
|
6
|
-
import { a as evalResultsTable, h as getDb } from "./tables-
|
|
7
|
-
import { a as safeJoin, i as resolvePackageEntryPoint, n as getWrapperDir, o as safeResolve, r as importModule } from "./esm-
|
|
8
|
-
import { D as DATASET_PLUGINS, N as isCustomStrategy, R as pluginDescriptions, T as AGENTIC_STRATEGIES, g as ProviderOptionsSchema, k as MULTI_TURN_STRATEGIES, m as isProviderOptions, ot as STRATEGY_EXEMPT_PLUGINS, p as isApiProvider, w as isUuid } from "./types-
|
|
4
|
+
import { c as isLoggedIntoCloud, o as getUserEmail } from "./accounts-Xatc0RYb.js";
|
|
5
|
+
import { c as getRemoteGenerationUrl, d as neverGenerateRemote, f as neverGenerateRemoteForRegularEvals, l as getRemoteGenerationUrlForUnaligned, p as shouldGenerateRemote, r as checkServerFeatureSupport } from "./server-Cns05F1j.js";
|
|
6
|
+
import { a as evalResultsTable, h as getDb } from "./tables-BEIFz2tM.js";
|
|
7
|
+
import { a as safeJoin, i as resolvePackageEntryPoint, n as getWrapperDir, o as safeResolve, r as importModule } from "./esm-CKWP3u_P.js";
|
|
8
|
+
import { D as DATASET_PLUGINS, N as isCustomStrategy, R as pluginDescriptions, T as AGENTIC_STRATEGIES, g as ProviderOptionsSchema, k as MULTI_TURN_STRATEGIES, m as isProviderOptions, ot as STRATEGY_EXEMPT_PLUGINS, p as isApiProvider, w as isUuid } from "./types-Cd3ygw8W.js";
|
|
9
9
|
import { a as isVideoFile, i as isJavascriptFile, n as isAudioFile, r as isImageFile } from "./fileExtensions-LcDYkU4v.js";
|
|
10
10
|
import { n as sha256 } from "./createHash-CTQmL3G2.js";
|
|
11
|
-
import { t as getTraceStore } from "./store-
|
|
12
|
-
import { a as isCacheEnabled, c as isTransientConnectionError, i as getCache, r as fetchWithCache } from "./cache-
|
|
11
|
+
import { t as getTraceStore } from "./store-VB0GP46K.js";
|
|
12
|
+
import { a as isCacheEnabled, c as isTransientConnectionError, i as getCache, r as fetchWithCache } from "./cache-HP0NP4k3.js";
|
|
13
13
|
import { a as createEmptyTokenUsage, n as accumulateResponseTokenUsage, r as accumulateTokenUsage } from "./tokenUsageUtils-BDGe-iyI.js";
|
|
14
|
-
import { i as storeBlob } from "./blobs-
|
|
15
|
-
import { n as isBlobStorageEnabled, r as shouldAttemptRemoteBlobUpload, t as extractAndStoreBinaryData } from "./extractor-
|
|
16
|
-
import { n as telemetry } from "./telemetry-
|
|
14
|
+
import { i as storeBlob } from "./blobs-BUWmKWzo.js";
|
|
15
|
+
import { n as isBlobStorageEnabled, r as shouldAttemptRemoteBlobUpload, t as extractAndStoreBinaryData } from "./extractor-C8XwivI9.js";
|
|
16
|
+
import { n as telemetry } from "./telemetry-DPXLd7UE.js";
|
|
17
17
|
import { n as withGenAISpan } from "./genaiTracer-70Z8BIuV.js";
|
|
18
|
-
import { i as validatePythonPath, n as getEnvInt$1, r as runPython, t as getConfiguredPythonPath } from "./pythonUtils-
|
|
19
|
-
import { C as getResolvedRelativePath, D as maybeLoadResponseFormatFromExternalFile, E as maybeLoadFromExternalFileWithVars, F as extractVariablesFromTemplates, I as getNunjucksEngine, M as renderEnvOnlyInObject, N as renderVarsInObject, O as maybeLoadToolsFromExternalFile, R as parseFileUrl, T as maybeLoadFromExternalFile, k as parsePathOrGlob, w as maybeLoadConfigFromExternalFile } from "./util-
|
|
20
|
-
import { i as normalizeFinishReason, n as MCPClient, r as FINISH_REASON_MAP, t as OpenAiChatCompletionProvider } from "./chat-
|
|
21
|
-
import {
|
|
22
|
-
import { n as AnthropicGenericProvider, t as AnthropicMessagesProvider } from "./messages-
|
|
23
|
-
import { a as parseMessages, i as outputFromMessage, n as calculateAnthropicCost, r as getTokenUsage$2, t as ANTHROPIC_MODELS } from "./util-
|
|
24
|
-
import { n as ResponsesProcessor, r as FunctionCallbackHandler, t as OpenAiResponsesProvider } from "./responses-
|
|
25
|
-
import { t as OpenAiGenericProvider } from "./openai-
|
|
26
|
-
import { a as calculateOpenAICost, c as getTokenUsage$3, o as failApiCall, r as OPENAI_REALTIME_MODELS, s as formatOpenAiError } from "./util-
|
|
27
|
-
import { n as OpenAiEmbeddingProvider, t as OpenAiCompletionProvider } from "./completion-
|
|
28
|
-
import { i as getProcessShim, n as transform, t as TransformInputType } from "./transform-
|
|
18
|
+
import { i as validatePythonPath, n as getEnvInt$1, r as runPython, t as getConfiguredPythonPath } from "./pythonUtils-Bzwbgpbg.js";
|
|
19
|
+
import { C as getResolvedRelativePath, D as maybeLoadResponseFormatFromExternalFile, E as maybeLoadFromExternalFileWithVars, F as extractVariablesFromTemplates, I as getNunjucksEngine, L as loadFunction, M as renderEnvOnlyInObject, N as renderVarsInObject, O as maybeLoadToolsFromExternalFile, R as parseFileUrl, T as maybeLoadFromExternalFile, k as parsePathOrGlob, w as maybeLoadConfigFromExternalFile } from "./util-BLvy9qfE.js";
|
|
20
|
+
import { i as normalizeFinishReason, n as MCPClient, r as FINISH_REASON_MAP, t as OpenAiChatCompletionProvider } from "./chat-B0iaWhoh.js";
|
|
21
|
+
import { A as TOKEN_REFRESH_BUFFER_MS, S as resolveProjectId, _ as determineGoogleVertexMode, a as calculateGoogleCost, 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, v as getGoogleApiKey, w as toDataUri, x as loadCredentials, y as getGoogleClient } from "./transform-B2-jIv68.js";
|
|
22
|
+
import { n as AnthropicGenericProvider, t as AnthropicMessagesProvider } from "./messages-biC_ex-p.js";
|
|
23
|
+
import { a as parseMessages, i as outputFromMessage, n as calculateAnthropicCost, r as getTokenUsage$2, t as ANTHROPIC_MODELS } from "./util-DbVG-yZU.js";
|
|
24
|
+
import { n as ResponsesProcessor, r as FunctionCallbackHandler, t as OpenAiResponsesProvider } from "./responses-CgNyTPsY.js";
|
|
25
|
+
import { t as OpenAiGenericProvider } from "./openai-D6wITiVn.js";
|
|
26
|
+
import { a as calculateOpenAICost, c as getTokenUsage$3, o as failApiCall, r as OPENAI_REALTIME_MODELS, s as formatOpenAiError } from "./util-BtoGs5Cb.js";
|
|
27
|
+
import { n as OpenAiEmbeddingProvider, t as OpenAiCompletionProvider } from "./completion-BCimtq-h.js";
|
|
28
|
+
import { i as getProcessShim, n as transform, t as TransformInputType } from "./transform-BzK09Q_9.js";
|
|
29
29
|
import { n as escapeRegExp, t as ellipsize } from "./text-TIv0QYnd.js";
|
|
30
|
-
import { a as novaParseMessages, i as novaOutputFromMessage, t as AwsBedrockGenericProvider } from "./base-
|
|
31
|
-
import { i as formatOutput, n as buildStructuredImageOutputs, r as callOpenAiImageApi, t as OpenAiImageProvider } from "./image-
|
|
32
|
-
import { t as providerRegistry } from "./providerRegistry-
|
|
33
|
-
import { n as runRuby } from "./rubyUtils-
|
|
30
|
+
import { a as novaParseMessages, i as novaOutputFromMessage, t as AwsBedrockGenericProvider } from "./base-Cz2ZC_iA.js";
|
|
31
|
+
import { i as formatOutput, n as buildStructuredImageOutputs, r as callOpenAiImageApi, t as OpenAiImageProvider } from "./image-B8b6f36E.js";
|
|
32
|
+
import { t as providerRegistry } from "./providerRegistry-BkzVH5Ba.js";
|
|
33
|
+
import { n as runRuby } from "./rubyUtils-DECSbsfY.js";
|
|
34
34
|
import * as fs$1 from "fs";
|
|
35
35
|
import fs, { promises } from "fs";
|
|
36
36
|
import * as path$1 from "path";
|
|
@@ -169,9 +169,9 @@ function normalizeEvalConfig(config) {
|
|
|
169
169
|
const tests = Array.isArray(config.tests) ? config.tests : Array.isArray(config.testCases) ? config.testCases : [];
|
|
170
170
|
const commandLineOptions = {
|
|
171
171
|
...isRecord(config.commandLineOptions) ? config.commandLineOptions : {},
|
|
172
|
-
...config.maxConcurrency
|
|
173
|
-
...config.delay
|
|
174
|
-
...config.verbose
|
|
172
|
+
...config.maxConcurrency == null ? {} : { maxConcurrency: config.maxConcurrency },
|
|
173
|
+
...config.delay == null ? {} : { delay: config.delay },
|
|
174
|
+
...config.verbose == null ? {} : { verbose: config.verbose }
|
|
175
175
|
};
|
|
176
176
|
const normalizedConfig = {
|
|
177
177
|
...config,
|
|
@@ -644,6 +644,62 @@ const AZURE_MODELS = [
|
|
|
644
644
|
output: 20 / 1e6
|
|
645
645
|
}
|
|
646
646
|
},
|
|
647
|
+
{
|
|
648
|
+
id: "gpt-5.4",
|
|
649
|
+
cost: {
|
|
650
|
+
input: 2.5 / 1e6,
|
|
651
|
+
output: 10 / 1e6
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
id: "gpt-5.4-2026-03-05",
|
|
656
|
+
cost: {
|
|
657
|
+
input: 2.5 / 1e6,
|
|
658
|
+
output: 10 / 1e6
|
|
659
|
+
}
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
id: "gpt-5.4-pro",
|
|
663
|
+
cost: {
|
|
664
|
+
input: 5 / 1e6,
|
|
665
|
+
output: 20 / 1e6
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
id: "gpt-5.4-pro-2026-03-05",
|
|
670
|
+
cost: {
|
|
671
|
+
input: 5 / 1e6,
|
|
672
|
+
output: 20 / 1e6
|
|
673
|
+
}
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
id: "gpt-5.4-mini",
|
|
677
|
+
cost: {
|
|
678
|
+
input: .4 / 1e6,
|
|
679
|
+
output: 1.6 / 1e6
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
id: "gpt-5.4-mini-2026-03-17",
|
|
684
|
+
cost: {
|
|
685
|
+
input: .4 / 1e6,
|
|
686
|
+
output: 1.6 / 1e6
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
id: "gpt-5.4-nano",
|
|
691
|
+
cost: {
|
|
692
|
+
input: .1 / 1e6,
|
|
693
|
+
output: .4 / 1e6
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
id: "gpt-5.4-nano-2026-03-17",
|
|
698
|
+
cost: {
|
|
699
|
+
input: .1 / 1e6,
|
|
700
|
+
output: .4 / 1e6
|
|
701
|
+
}
|
|
702
|
+
},
|
|
647
703
|
{
|
|
648
704
|
id: "gpt-5-mini",
|
|
649
705
|
cost: {
|
|
@@ -2070,7 +2126,7 @@ var AzureChatCompletionProvider = class extends AzureGenericProvider {
|
|
|
2070
2126
|
...this.config.headers
|
|
2071
2127
|
},
|
|
2072
2128
|
body: JSON.stringify(body)
|
|
2073
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug);
|
|
2129
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug);
|
|
2074
2130
|
cached = isCached;
|
|
2075
2131
|
latencyMs = fetchLatencyMs;
|
|
2076
2132
|
if (typeof responseData === "string") try {
|
|
@@ -2170,7 +2226,7 @@ var AzureEmbeddingProvider = class extends AzureGenericProvider {
|
|
|
2170
2226
|
...this.config.headers
|
|
2171
2227
|
},
|
|
2172
2228
|
body: JSON.stringify(body)
|
|
2173
|
-
}, REQUEST_TIMEOUT_MS));
|
|
2229
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
2174
2230
|
} catch (err) {
|
|
2175
2231
|
return {
|
|
2176
2232
|
error: `API call error: ${String(err)}`,
|
|
@@ -2331,7 +2387,7 @@ var AzureModerationProvider = class AzureModerationProvider extends AzureGeneric
|
|
|
2331
2387
|
...this.configWithHeaders.passthrough || {}
|
|
2332
2388
|
};
|
|
2333
2389
|
const controller = new AbortController();
|
|
2334
|
-
const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
2390
|
+
const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS$1);
|
|
2335
2391
|
const response = await fetchWithProxy(url, {
|
|
2336
2392
|
method: "POST",
|
|
2337
2393
|
headers,
|
|
@@ -2578,7 +2634,7 @@ var GoogleGenericProvider = class {
|
|
|
2578
2634
|
* Get the request timeout in milliseconds.
|
|
2579
2635
|
*/
|
|
2580
2636
|
getTimeout() {
|
|
2581
|
-
return this.config.timeoutMs || REQUEST_TIMEOUT_MS;
|
|
2637
|
+
return this.config.timeoutMs || REQUEST_TIMEOUT_MS$1;
|
|
2582
2638
|
}
|
|
2583
2639
|
};
|
|
2584
2640
|
//#endregion
|
|
@@ -2720,7 +2776,7 @@ var AIStudioChatProvider = class extends GoogleGenericProvider {
|
|
|
2720
2776
|
headers,
|
|
2721
2777
|
body: JSON.stringify(body),
|
|
2722
2778
|
...authDiscriminator && { _authHash: authDiscriminator }
|
|
2723
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug));
|
|
2779
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug));
|
|
2724
2780
|
} catch (err) {
|
|
2725
2781
|
return { error: `API call error: ${String(err)}` };
|
|
2726
2782
|
}
|
|
@@ -2747,7 +2803,7 @@ var AIStudioChatProvider = class extends GoogleGenericProvider {
|
|
|
2747
2803
|
rejectedPrediction: 0
|
|
2748
2804
|
} }
|
|
2749
2805
|
};
|
|
2750
|
-
const completionForCost = data.usageMetadata?.candidatesTokenCount
|
|
2806
|
+
const completionForCost = data.usageMetadata?.candidatesTokenCount == null ? void 0 : data.usageMetadata.candidatesTokenCount + (data.usageMetadata?.thoughtsTokenCount ?? 0);
|
|
2751
2807
|
return {
|
|
2752
2808
|
output,
|
|
2753
2809
|
tokenUsage,
|
|
@@ -2802,7 +2858,7 @@ var AIStudioChatProvider = class extends GoogleGenericProvider {
|
|
|
2802
2858
|
headers,
|
|
2803
2859
|
body: JSON.stringify(body),
|
|
2804
2860
|
...authDiscriminator && { _authHash: authDiscriminator }
|
|
2805
|
-
}, REQUEST_TIMEOUT_MS, "json", false));
|
|
2861
|
+
}, REQUEST_TIMEOUT_MS$1, "json", false));
|
|
2806
2862
|
} catch (err) {
|
|
2807
2863
|
return { error: `API call error: ${String(err)}` };
|
|
2808
2864
|
}
|
|
@@ -2844,7 +2900,7 @@ var AIStudioChatProvider = class extends GoogleGenericProvider {
|
|
|
2844
2900
|
rejectedPrediction: 0
|
|
2845
2901
|
} }
|
|
2846
2902
|
};
|
|
2847
|
-
const completionForCost = data.usageMetadata?.candidatesTokenCount
|
|
2903
|
+
const completionForCost = data.usageMetadata?.candidatesTokenCount == null ? void 0 : data.usageMetadata.candidatesTokenCount + (data.usageMetadata?.thoughtsTokenCount ?? 0);
|
|
2848
2904
|
const cost = cached ? void 0 : calculateGoogleCost(this.modelName, config, data.usageMetadata?.promptTokenCount, completionForCost);
|
|
2849
2905
|
return {
|
|
2850
2906
|
output,
|
|
@@ -3035,7 +3091,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
3035
3091
|
method: "POST",
|
|
3036
3092
|
headers: { "Content-Type": "application/json; charset=utf-8" },
|
|
3037
3093
|
data: body,
|
|
3038
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
3094
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
3039
3095
|
})).data;
|
|
3040
3096
|
} catch (err) {
|
|
3041
3097
|
const error = err;
|
|
@@ -3149,7 +3205,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
3149
3205
|
method: "POST",
|
|
3150
3206
|
headers: await this.getAuthHeaders(),
|
|
3151
3207
|
body: JSON.stringify(body),
|
|
3152
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
3208
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS$1)
|
|
3153
3209
|
});
|
|
3154
3210
|
if (!res.ok) {
|
|
3155
3211
|
const errorData = await res.json().catch(() => null);
|
|
@@ -3165,7 +3221,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
3165
3221
|
url,
|
|
3166
3222
|
method: "POST",
|
|
3167
3223
|
data: body,
|
|
3168
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
3224
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
3169
3225
|
})).data;
|
|
3170
3226
|
}
|
|
3171
3227
|
} catch (err) {
|
|
@@ -3268,7 +3324,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
3268
3324
|
rejectedPrediction: 0
|
|
3269
3325
|
} }
|
|
3270
3326
|
};
|
|
3271
|
-
const completionForCost = completionTokenCount
|
|
3327
|
+
const completionForCost = completionTokenCount == null ? void 0 : completionTokenCount + (thoughtsTokenCount ?? 0);
|
|
3272
3328
|
const cost = calculateGoogleCost(this.modelName, config, promptTokenCount, completionForCost, true);
|
|
3273
3329
|
response = {
|
|
3274
3330
|
cached: false,
|
|
@@ -3355,7 +3411,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
3355
3411
|
method: "POST",
|
|
3356
3412
|
headers: { "Content-Type": "application/json" },
|
|
3357
3413
|
data: body,
|
|
3358
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
3414
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
3359
3415
|
})).data;
|
|
3360
3416
|
} catch (err) {
|
|
3361
3417
|
return { error: `API call error: ${JSON.stringify(err)}` };
|
|
@@ -3424,7 +3480,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
3424
3480
|
method: "POST",
|
|
3425
3481
|
headers: { "Content-Type": "application/json; charset=utf-8" },
|
|
3426
3482
|
data: body,
|
|
3427
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
3483
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
3428
3484
|
})).data;
|
|
3429
3485
|
logger.debug(`Llama API response: ${JSON.stringify(data)}`);
|
|
3430
3486
|
} catch (err) {
|
|
@@ -3751,12 +3807,14 @@ var MistralChatCompletionProvider = class MistralChatCompletionProvider {
|
|
|
3751
3807
|
};
|
|
3752
3808
|
return withGenAISpan(spanContext, () => this.callApiInternal(prompt, context, config), resultExtractor);
|
|
3753
3809
|
}
|
|
3754
|
-
async callApiInternal(prompt,
|
|
3810
|
+
async callApiInternal(prompt, context, config = {}) {
|
|
3755
3811
|
if (!this.getApiKey()) throw new Error("Mistral API key is not set. Set the MISTRAL_API_KEY environment variable or add `apiKey` or `apiKeyEnvar` to the provider config.");
|
|
3756
3812
|
const messages = parseChatPrompt(prompt, [{
|
|
3757
3813
|
role: "user",
|
|
3758
3814
|
content: prompt
|
|
3759
3815
|
}]);
|
|
3816
|
+
const loadedTools = config.tools ? await maybeLoadToolsFromExternalFile(config.tools, context?.vars) : void 0;
|
|
3817
|
+
const hasTools = Array.isArray(loadedTools) ? loadedTools.length > 0 : loadedTools !== void 0;
|
|
3760
3818
|
const params = {
|
|
3761
3819
|
model: this.modelName,
|
|
3762
3820
|
messages,
|
|
@@ -3765,6 +3823,9 @@ var MistralChatCompletionProvider = class MistralChatCompletionProvider {
|
|
|
3765
3823
|
max_tokens: config?.max_tokens || 1024,
|
|
3766
3824
|
safe_prompt: config?.safe_prompt || false,
|
|
3767
3825
|
random_seed: config?.random_seed || null,
|
|
3826
|
+
...hasTools ? { tools: loadedTools } : {},
|
|
3827
|
+
...config?.tool_choice ? { tool_choice: config.tool_choice } : {},
|
|
3828
|
+
..."parallel_tool_calls" in config ? { parallel_tool_calls: Boolean(config.parallel_tool_calls) } : {},
|
|
3768
3829
|
...config?.response_format ? { response_format: config.response_format } : {}
|
|
3769
3830
|
};
|
|
3770
3831
|
const cacheKey = `mistral:${JSON.stringify(params)}`;
|
|
@@ -3799,15 +3860,20 @@ var MistralChatCompletionProvider = class MistralChatCompletionProvider {
|
|
|
3799
3860
|
Authorization: `Bearer ${this.getApiKey()}`
|
|
3800
3861
|
},
|
|
3801
3862
|
body: JSON.stringify(params)
|
|
3802
|
-
}, REQUEST_TIMEOUT_MS));
|
|
3863
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
3803
3864
|
} catch (err) {
|
|
3804
3865
|
return { error: `API call error: ${String(err)}` };
|
|
3805
3866
|
}
|
|
3806
3867
|
logger.debug("Mistral API response", { data });
|
|
3807
3868
|
if (data.error) return { error: `API call error: ${data.error}` };
|
|
3808
|
-
if (!data.choices || !data.choices[0] || !data.choices[0].message
|
|
3869
|
+
if (!data.choices || !data.choices[0] || !data.choices[0].message) return { error: `Malformed response data: ${JSON.stringify(data)}` };
|
|
3870
|
+
const message = data.choices[0].message;
|
|
3871
|
+
let output;
|
|
3872
|
+
if (message.content && message.tool_calls?.length) output = message;
|
|
3873
|
+
else if (message.tool_calls?.length) output = message.tool_calls;
|
|
3874
|
+
else output = message.content;
|
|
3809
3875
|
const result = {
|
|
3810
|
-
output
|
|
3876
|
+
output,
|
|
3811
3877
|
tokenUsage: getTokenUsage$1(data, cached),
|
|
3812
3878
|
cached,
|
|
3813
3879
|
cost: calculateMistralCost(this.modelName, config, data.usage?.prompt_tokens, data.usage?.completion_tokens)
|
|
@@ -3880,7 +3946,7 @@ var MistralEmbeddingProvider = class {
|
|
|
3880
3946
|
Authorization: `Bearer ${this.getApiKey()}`
|
|
3881
3947
|
},
|
|
3882
3948
|
body: JSON.stringify(body)
|
|
3883
|
-
}, REQUEST_TIMEOUT_MS));
|
|
3949
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
3884
3950
|
} catch (err) {
|
|
3885
3951
|
logger.error(`API call error: ${err}`);
|
|
3886
3952
|
throw err;
|
|
@@ -4016,7 +4082,7 @@ var OpenAiModerationProvider = class OpenAiModerationProvider extends OpenAiGene
|
|
|
4016
4082
|
method: "POST",
|
|
4017
4083
|
headers,
|
|
4018
4084
|
body: requestBody
|
|
4019
|
-
}, REQUEST_TIMEOUT_MS, "json", false, this.config.maxRetries);
|
|
4085
|
+
}, REQUEST_TIMEOUT_MS$1, "json", false, this.config.maxRetries);
|
|
4020
4086
|
if (status < 200 || status >= 300) return handleApiError$1(`${status} ${statusText}`, typeof data === "string" ? data : JSON.stringify(data));
|
|
4021
4087
|
logger.debug(`\tOpenAI moderation API response: ${JSON.stringify(data)}`);
|
|
4022
4088
|
const response = parseOpenAIModerationResponse(data);
|
|
@@ -4129,7 +4195,7 @@ var PromptfooChatCompletionProvider = class {
|
|
|
4129
4195
|
headers: { "Content-Type": "application/json" },
|
|
4130
4196
|
body: JSON.stringify(body),
|
|
4131
4197
|
...callApiOptions?.abortSignal && { signal: callApiOptions.abortSignal }
|
|
4132
|
-
}, REQUEST_TIMEOUT_MS);
|
|
4198
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
4133
4199
|
const data = await response.json();
|
|
4134
4200
|
if (!data.result) {
|
|
4135
4201
|
logger.debug(`Error from promptfoo completion provider. Status: ${response.status} ${response.statusText} ${JSON.stringify(data)} `);
|
|
@@ -4188,7 +4254,7 @@ var PromptfooSimulatedUserProvider = class {
|
|
|
4188
4254
|
headers: { "Content-Type": "application/json" },
|
|
4189
4255
|
body: JSON.stringify(body),
|
|
4190
4256
|
...callApiOptions?.abortSignal && { signal: callApiOptions.abortSignal }
|
|
4191
|
-
}, REQUEST_TIMEOUT_MS);
|
|
4257
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
4192
4258
|
if (!response.ok) throw new Error(`API call failed with status ${response.status}: ${await response.text()}`);
|
|
4193
4259
|
const data = await response.json();
|
|
4194
4260
|
return {
|
|
@@ -5255,7 +5321,7 @@ async function loadRedteamProvider({ provider, jsonOnly = false, preferSmallMode
|
|
|
5255
5321
|
ret = redteamProvider;
|
|
5256
5322
|
} else if (typeof redteamProvider === "string" || isProviderOptions(redteamProvider)) {
|
|
5257
5323
|
logger.debug(`Loading ${purpose} provider`, { provider: redteamProvider });
|
|
5258
|
-
ret = (await (await import("./providers-
|
|
5324
|
+
ret = (await (await import("./providers-DEYiFVAo.js")).loadApiProviders([redteamProvider]))[0];
|
|
5259
5325
|
} else {
|
|
5260
5326
|
const defaultModel = preferSmallModel ? ATTACKER_MODEL_SMALL : ATTACKER_MODEL;
|
|
5261
5327
|
logger.debug(`Using default ${purpose} provider: ${defaultModel}`);
|
|
@@ -5542,7 +5608,7 @@ async function externalizeResponseForRedteamHistory(response, context) {
|
|
|
5542
5608
|
*/
|
|
5543
5609
|
async function tryUnblocking({ messages, lastResponse, goal, purpose }) {
|
|
5544
5610
|
try {
|
|
5545
|
-
const { checkServerFeatureSupport } = await import("./server-
|
|
5611
|
+
const { checkServerFeatureSupport } = await import("./server-Cns05F1j.js").then((n) => n.o);
|
|
5546
5612
|
const supportsUnblocking = await checkServerFeatureSupport("blocking-question-analysis", "2025-06-16T14:49:11-07:00");
|
|
5547
5613
|
if (!getEnvBool("PROMPTFOO_ENABLE_UNBLOCKING")) {
|
|
5548
5614
|
logger.debug("[Unblocking] Disabled by default (set PROMPTFOO_ENABLE_UNBLOCKING=true to enable)");
|
|
@@ -6511,7 +6577,7 @@ async function extractGoalFromPrompt(prompt, purpose, pluginId, policy) {
|
|
|
6511
6577
|
method: "POST",
|
|
6512
6578
|
headers: { "Content-Type": "application/json" },
|
|
6513
6579
|
body: JSON.stringify(requestBody)
|
|
6514
|
-
}, REQUEST_TIMEOUT_MS);
|
|
6580
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
6515
6581
|
logger.debug(`Goal extraction response - Status: ${status} ${statusText || ""}, Data: ${JSON.stringify(data)}`);
|
|
6516
6582
|
if (status !== 200) {
|
|
6517
6583
|
logger.warn(`Failed to extract goal from prompt: HTTP ${status} ${statusText || ""}, Response Data: ${JSON.stringify(data)}`);
|
|
@@ -7010,7 +7076,7 @@ async function generateCitations(testCases, injectVar, config) {
|
|
|
7010
7076
|
method: "POST",
|
|
7011
7077
|
headers: { "Content-Type": "application/json" },
|
|
7012
7078
|
body: JSON.stringify(payload)
|
|
7013
|
-
}, REQUEST_TIMEOUT_MS);
|
|
7079
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
7014
7080
|
logger.debug(`Got remote citation generation result for case ${Number(index) + 1}: ${JSON.stringify(data)}`);
|
|
7015
7081
|
if (data.error) {
|
|
7016
7082
|
logger.error(`[Citation] Error in citation generation: ${data.error}`);
|
|
@@ -7147,7 +7213,7 @@ async function generateGcgPrompts(testCases, injectVar, config) {
|
|
|
7147
7213
|
method: "POST",
|
|
7148
7214
|
headers: { "Content-Type": "application/json" },
|
|
7149
7215
|
body: JSON.stringify(payload)
|
|
7150
|
-
}, REQUEST_TIMEOUT_MS);
|
|
7216
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
7151
7217
|
logger.debug(`Got GCG generation result for case ${Number(index) + 1}: ${JSON.stringify(data)}`);
|
|
7152
7218
|
if (data.error) {
|
|
7153
7219
|
logger.error(`[GCG] Error in GCG generation: ${data.error}`);
|
|
@@ -8072,7 +8138,7 @@ async function generateLikertPrompts(testCases, injectVar, config) {
|
|
|
8072
8138
|
method: "POST",
|
|
8073
8139
|
headers: { "Content-Type": "application/json" },
|
|
8074
8140
|
body: JSON.stringify(payload)
|
|
8075
|
-
}, REQUEST_TIMEOUT_MS);
|
|
8141
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
8076
8142
|
logger.debug(`Got Likert jailbreak generation result for case ${Number(index) + 1}: ${JSON.stringify(data)}`);
|
|
8077
8143
|
if (data.error || !data.modifiedPrompts) {
|
|
8078
8144
|
logger.error(`[jailbreak:likert] Error in Likert generation: ${data.error}}`);
|
|
@@ -8157,7 +8223,7 @@ async function generateMathPrompt(testCases, injectVar, config) {
|
|
|
8157
8223
|
method: "POST",
|
|
8158
8224
|
headers: { "Content-Type": "application/json" },
|
|
8159
8225
|
body: JSON.stringify(payload)
|
|
8160
|
-
}, REQUEST_TIMEOUT_MS);
|
|
8226
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
8161
8227
|
logger.debug(`Got remote MathPrompt generation result for batch ${Number(index) + 1}: ${JSON.stringify(data)}`);
|
|
8162
8228
|
allResults = allResults.concat(data.result);
|
|
8163
8229
|
processedBatches++;
|
|
@@ -9047,7 +9113,7 @@ async function textToAudio(text, language = "en", options) {
|
|
|
9047
9113
|
method: "POST",
|
|
9048
9114
|
headers: { "Content-Type": "application/json" },
|
|
9049
9115
|
body: JSON.stringify(payload)
|
|
9050
|
-
}, REQUEST_TIMEOUT_MS);
|
|
9116
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
9051
9117
|
if (data.error || !data.audioBase64) throw new Error(`Error in remote audio generation: ${data.error || "No audio data returned"}`);
|
|
9052
9118
|
logger.debug(`Received audio base64 from remote API (${data.audioBase64.length} chars)`);
|
|
9053
9119
|
const base64Audio = data.audioBase64;
|
|
@@ -9463,13 +9529,21 @@ async function generateCompositePrompts(testCases, injectVar, config) {
|
|
|
9463
9529
|
email: getUserEmail(),
|
|
9464
9530
|
...config.n && { n: config.n },
|
|
9465
9531
|
...config.modelFamily && { modelFamily: config.modelFamily },
|
|
9466
|
-
...inputs && { inputs }
|
|
9532
|
+
...inputs && { inputs },
|
|
9533
|
+
...config.techniques && { techniques: config.techniques },
|
|
9534
|
+
...config.evasions && { evasions: config.evasions },
|
|
9535
|
+
...config.alwaysIncludeTechniques && { alwaysIncludeTechniques: config.alwaysIncludeTechniques },
|
|
9536
|
+
...config.compositionOrder && { compositionOrder: config.compositionOrder },
|
|
9537
|
+
...config.combinationMode && { combinationMode: config.combinationMode },
|
|
9538
|
+
...config.includeEvasionGuidance != null && { includeEvasionGuidance: config.includeEvasionGuidance },
|
|
9539
|
+
...config.evasionGuidance && { evasionGuidance: config.evasionGuidance },
|
|
9540
|
+
...config.targetContext && { targetContext: config.targetContext }
|
|
9467
9541
|
};
|
|
9468
9542
|
const { data } = await fetchWithCache(getRemoteGenerationUrl(), {
|
|
9469
9543
|
method: "POST",
|
|
9470
9544
|
headers: { "Content-Type": "application/json" },
|
|
9471
9545
|
body: JSON.stringify(payload)
|
|
9472
|
-
}, REQUEST_TIMEOUT_MS);
|
|
9546
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
9473
9547
|
logger.debug(`Got composite jailbreak generation result for case ${Number(index) + 1}: ${JSON.stringify(data)}`);
|
|
9474
9548
|
if (data.error || !data.modifiedPrompts) {
|
|
9475
9549
|
logger.error(`[jailbreak:composite] Error in composite generation: ${data.error}}`);
|
|
@@ -10594,7 +10668,7 @@ var CrescendoProvider = class {
|
|
|
10594
10668
|
});
|
|
10595
10669
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
10596
10670
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
10597
|
-
const { getGraderById } = await import("./graders-
|
|
10671
|
+
const { getGraderById } = await import("./graders-BxfEguVY.js");
|
|
10598
10672
|
let graderPassed;
|
|
10599
10673
|
const additionalRubric = getGoalRubric(this.userGoal);
|
|
10600
10674
|
while (roundNum < this.maxTurns) try {
|
|
@@ -10700,18 +10774,7 @@ var CrescendoProvider = class {
|
|
|
10700
10774
|
if (grader) {
|
|
10701
10775
|
const gradingTraceSummary = tracingOptions.includeInGrading ? response.traceSummary ?? (response.traceContext ? formatTraceSummary(response.traceContext) : void 0) : void 0;
|
|
10702
10776
|
let gradingContext;
|
|
10703
|
-
if (lastResponse.metadata?.wasExfiltrated
|
|
10704
|
-
logger.debug("[Crescendo] Using exfil data from provider response metadata");
|
|
10705
|
-
gradingContext = {
|
|
10706
|
-
...tracingOptions.includeInGrading ? {
|
|
10707
|
-
traceContext: response.traceContext,
|
|
10708
|
-
traceSummary: gradingTraceSummary
|
|
10709
|
-
} : {},
|
|
10710
|
-
wasExfiltrated: Boolean(lastResponse.metadata.wasExfiltrated),
|
|
10711
|
-
exfilCount: Number(lastResponse.metadata.exfilCount) || 0,
|
|
10712
|
-
exfilRecords: []
|
|
10713
|
-
};
|
|
10714
|
-
} else {
|
|
10777
|
+
if (lastResponse.metadata?.wasExfiltrated === void 0) {
|
|
10715
10778
|
const webPageUuid = test.metadata?.webPageUuid;
|
|
10716
10779
|
if (webPageUuid) {
|
|
10717
10780
|
const evalId = context?.evaluationId ?? test.metadata?.evaluationId;
|
|
@@ -10730,6 +10793,17 @@ var CrescendoProvider = class {
|
|
|
10730
10793
|
exfilRecords: exfilData.exfilRecords
|
|
10731
10794
|
};
|
|
10732
10795
|
}
|
|
10796
|
+
} else {
|
|
10797
|
+
logger.debug("[Crescendo] Using exfil data from provider response metadata");
|
|
10798
|
+
gradingContext = {
|
|
10799
|
+
...tracingOptions.includeInGrading ? {
|
|
10800
|
+
traceContext: response.traceContext,
|
|
10801
|
+
traceSummary: gradingTraceSummary
|
|
10802
|
+
} : {},
|
|
10803
|
+
wasExfiltrated: Boolean(lastResponse.metadata.wasExfiltrated),
|
|
10804
|
+
exfilCount: Number(lastResponse.metadata.exfilCount) || 0,
|
|
10805
|
+
exfilRecords: []
|
|
10806
|
+
};
|
|
10733
10807
|
}
|
|
10734
10808
|
if (!gradingContext && tracingOptions.includeInGrading) gradingContext = {
|
|
10735
10809
|
traceContext: response.traceContext,
|
|
@@ -11285,7 +11359,7 @@ var CustomProvider = class {
|
|
|
11285
11359
|
let lastTransformResult;
|
|
11286
11360
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
11287
11361
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
11288
|
-
const { getGraderById } = await import("./graders-
|
|
11362
|
+
const { getGraderById } = await import("./graders-BxfEguVY.js");
|
|
11289
11363
|
let graderPassed;
|
|
11290
11364
|
let storedGraderResult;
|
|
11291
11365
|
const additionalRubric = getGoalRubric(this.userGoal);
|
|
@@ -11783,7 +11857,7 @@ var GoatProvider = class {
|
|
|
11783
11857
|
let assertToUse;
|
|
11784
11858
|
let graderPassed;
|
|
11785
11859
|
let storedGraderResult;
|
|
11786
|
-
const { getGraderById } = await import("./graders-
|
|
11860
|
+
const { getGraderById } = await import("./graders-BxfEguVY.js");
|
|
11787
11861
|
let test;
|
|
11788
11862
|
if (context?.test) {
|
|
11789
11863
|
test = context?.test;
|
|
@@ -12066,18 +12140,7 @@ var GoatProvider = class {
|
|
|
12066
12140
|
const grader = assertToUse ? getGraderById(assertToUse.type) : void 0;
|
|
12067
12141
|
if (test && grader && finalOutput) {
|
|
12068
12142
|
let gradingContext;
|
|
12069
|
-
if (finalResponse.metadata?.wasExfiltrated
|
|
12070
|
-
logger.debug("[GOAT] Using exfil data from provider response metadata");
|
|
12071
|
-
gradingContext = {
|
|
12072
|
-
...tracingOptions.includeInGrading ? {
|
|
12073
|
-
traceContext: targetResponse.traceContext,
|
|
12074
|
-
traceSummary: gradingTraceSummary
|
|
12075
|
-
} : {},
|
|
12076
|
-
wasExfiltrated: Boolean(finalResponse.metadata.wasExfiltrated),
|
|
12077
|
-
exfilCount: Number(finalResponse.metadata.exfilCount) || 0,
|
|
12078
|
-
exfilRecords: []
|
|
12079
|
-
};
|
|
12080
|
-
} else {
|
|
12143
|
+
if (finalResponse.metadata?.wasExfiltrated === void 0) {
|
|
12081
12144
|
const webPageUuid = test.metadata?.webPageUuid;
|
|
12082
12145
|
if (webPageUuid) {
|
|
12083
12146
|
const evalId = context?.evaluationId ?? test.metadata?.evaluationId;
|
|
@@ -12096,6 +12159,17 @@ var GoatProvider = class {
|
|
|
12096
12159
|
exfilRecords: exfilData.exfilRecords
|
|
12097
12160
|
};
|
|
12098
12161
|
}
|
|
12162
|
+
} else {
|
|
12163
|
+
logger.debug("[GOAT] Using exfil data from provider response metadata");
|
|
12164
|
+
gradingContext = {
|
|
12165
|
+
...tracingOptions.includeInGrading ? {
|
|
12166
|
+
traceContext: targetResponse.traceContext,
|
|
12167
|
+
traceSummary: gradingTraceSummary
|
|
12168
|
+
} : {},
|
|
12169
|
+
wasExfiltrated: Boolean(finalResponse.metadata.wasExfiltrated),
|
|
12170
|
+
exfilCount: Number(finalResponse.metadata.exfilCount) || 0,
|
|
12171
|
+
exfilRecords: []
|
|
12172
|
+
};
|
|
12099
12173
|
}
|
|
12100
12174
|
if (!gradingContext && tracingOptions.includeInGrading) gradingContext = {
|
|
12101
12175
|
traceContext: targetResponse.traceContext,
|
|
@@ -12256,7 +12330,7 @@ var HydraProvider = class {
|
|
|
12256
12330
|
let lastTransformResult;
|
|
12257
12331
|
let lastTransformDisplayVars;
|
|
12258
12332
|
let lastFinalAttackPrompt;
|
|
12259
|
-
const { getGraderById } = await import("./graders-
|
|
12333
|
+
const { getGraderById } = await import("./graders-BxfEguVY.js");
|
|
12260
12334
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
12261
12335
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
12262
12336
|
let previousTraceSummary;
|
|
@@ -13110,7 +13184,7 @@ async function runRedteamConversation$2({ context, filters, injectVar, numIterat
|
|
|
13110
13184
|
if (sessionId) sessionIds.push(sessionId);
|
|
13111
13185
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
13112
13186
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
13113
|
-
const { getGraderById } = await import("./graders-
|
|
13187
|
+
const { getGraderById } = await import("./graders-BxfEguVY.js");
|
|
13114
13188
|
if (test && assertToUse) {
|
|
13115
13189
|
const grader = getGraderById(assertToUse.type);
|
|
13116
13190
|
if (grader) {
|
|
@@ -13937,7 +14011,7 @@ async function runMetaAgentRedteam({ context, filters, injectVar, numIterations,
|
|
|
13937
14011
|
previousTraceSummary = attackTraceSummary;
|
|
13938
14012
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
13939
14013
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
13940
|
-
const { getGraderById } = await import("./graders-
|
|
14014
|
+
const { getGraderById } = await import("./graders-BxfEguVY.js");
|
|
13941
14015
|
if (test && assertToUse) {
|
|
13942
14016
|
const grader = getGraderById(assertToUse.type);
|
|
13943
14017
|
if (grader) {
|
|
@@ -14521,7 +14595,7 @@ async function runRedteamConversation({ context, filters, injectVar, options, pr
|
|
|
14521
14595
|
noImprovementCount++;
|
|
14522
14596
|
if (noImprovementCount % 5 === 0) logger.debug(`[Depth ${depth}, Attempt ${attempts}] No improvement for ${noImprovementCount} consecutive iterations. Max score: ${maxScore}`);
|
|
14523
14597
|
}
|
|
14524
|
-
const { getGraderById } = await import("./graders-
|
|
14598
|
+
const { getGraderById } = await import("./graders-BxfEguVY.js");
|
|
14525
14599
|
let graderPassed;
|
|
14526
14600
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
14527
14601
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
@@ -15195,7 +15269,7 @@ var AI21ChatCompletionProvider = class AI21ChatCompletionProvider {
|
|
|
15195
15269
|
messages,
|
|
15196
15270
|
temperature: config?.temperature ?? .1,
|
|
15197
15271
|
top_p: config?.top_p || 1,
|
|
15198
|
-
max_tokens: config?.max_tokens
|
|
15272
|
+
max_tokens: config?.max_tokens ?? 1024,
|
|
15199
15273
|
n: 1,
|
|
15200
15274
|
stop: [],
|
|
15201
15275
|
response_format: config.response_format || { type: "text" }
|
|
@@ -15210,7 +15284,7 @@ var AI21ChatCompletionProvider = class AI21ChatCompletionProvider {
|
|
|
15210
15284
|
Authorization: `Bearer ${this.getApiKey()}`
|
|
15211
15285
|
},
|
|
15212
15286
|
body: JSON.stringify(body)
|
|
15213
|
-
}, REQUEST_TIMEOUT_MS));
|
|
15287
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
15214
15288
|
} catch (err) {
|
|
15215
15289
|
return { error: `API call error: ${String(err)}` };
|
|
15216
15290
|
}
|
|
@@ -15376,7 +15450,7 @@ var AnthropicCompletionProvider = class extends AnthropicGenericProvider {
|
|
|
15376
15450
|
const params = {
|
|
15377
15451
|
model: this.modelName,
|
|
15378
15452
|
prompt: `${Anthropic.HUMAN_PROMPT} ${prompt} ${Anthropic.AI_PROMPT}`,
|
|
15379
|
-
max_tokens_to_sample: this.config?.max_tokens_to_sample
|
|
15453
|
+
max_tokens_to_sample: this.config?.max_tokens_to_sample ?? getEnvInt("ANTHROPIC_MAX_TOKENS", 1024),
|
|
15380
15454
|
temperature: this.config.temperature ?? getEnvFloat("ANTHROPIC_TEMPERATURE", 0),
|
|
15381
15455
|
stop_sequences: stop
|
|
15382
15456
|
};
|
|
@@ -15550,7 +15624,7 @@ var AzureAssistantProvider = class extends AzureGenericProvider {
|
|
|
15550
15624
|
* Helper method to make HTTP requests using fetchWithCache
|
|
15551
15625
|
*/
|
|
15552
15626
|
async makeRequest(url, options) {
|
|
15553
|
-
const timeoutMs = this.assistantConfig.timeoutMs || REQUEST_TIMEOUT_MS;
|
|
15627
|
+
const timeoutMs = this.assistantConfig.timeoutMs || REQUEST_TIMEOUT_MS$1;
|
|
15554
15628
|
const retries = this.assistantConfig.retryOptions?.maxRetries || 4;
|
|
15555
15629
|
const shouldBustCache = url.includes("/runs/") && options.method === "GET" || url.includes("/threads") && options.method === "POST" && !url.includes("/messages") && !url.includes("submit_tool_outputs");
|
|
15556
15630
|
try {
|
|
@@ -15848,7 +15922,7 @@ var AzureCompletionProvider = class extends AzureGenericProvider {
|
|
|
15848
15922
|
...this.config.headers
|
|
15849
15923
|
},
|
|
15850
15924
|
body: JSON.stringify(body)
|
|
15851
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug));
|
|
15925
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug));
|
|
15852
15926
|
} catch (err) {
|
|
15853
15927
|
return { error: `API call error: ${String(err)}` };
|
|
15854
15928
|
}
|
|
@@ -15915,61 +15989,65 @@ var AzureCompletionProvider = class extends AzureGenericProvider {
|
|
|
15915
15989
|
var AzureFoundryAgentProvider = class extends AzureGenericProvider {
|
|
15916
15990
|
assistantConfig;
|
|
15917
15991
|
loadedFunctionCallbacks = {};
|
|
15992
|
+
processor;
|
|
15918
15993
|
projectClient = null;
|
|
15919
15994
|
projectUrl;
|
|
15995
|
+
resolvedAgent = null;
|
|
15996
|
+
warnedUnsupportedFields = /* @__PURE__ */ new Set();
|
|
15920
15997
|
constructor(deploymentName, options = {}) {
|
|
15921
15998
|
super(deploymentName, options);
|
|
15922
15999
|
this.assistantConfig = options.config || {};
|
|
15923
16000
|
this.projectUrl = options.config?.projectUrl || process.env.AZURE_AI_PROJECT_URL || "";
|
|
15924
16001
|
if (!this.projectUrl) throw new Error("Azure AI Project URL must be provided via projectUrl option or AZURE_AI_PROJECT_URL environment variable");
|
|
16002
|
+
this.processor = new ResponsesProcessor({
|
|
16003
|
+
modelName: this.assistantConfig.modelName || deploymentName,
|
|
16004
|
+
providerType: "azure",
|
|
16005
|
+
functionCallbackHandler: new FunctionCallbackHandler(),
|
|
16006
|
+
costCalculator: (_modelName, usage, requestConfig) => calculateAzureCost(requestConfig?.model || this.assistantConfig.modelName || this.deploymentName, usage) ?? 0
|
|
16007
|
+
});
|
|
15925
16008
|
if (this.assistantConfig.functionToolCallbacks) this.preloadFunctionCallbacks();
|
|
15926
16009
|
}
|
|
15927
|
-
/**
|
|
15928
|
-
* Initialize the Azure AI Project client
|
|
15929
|
-
*/
|
|
15930
16010
|
async initializeClient() {
|
|
15931
16011
|
if (this.projectClient) return this.projectClient;
|
|
15932
16012
|
try {
|
|
15933
16013
|
const { AIProjectClient } = await import("@azure/ai-projects");
|
|
15934
16014
|
const { DefaultAzureCredential } = await import("@azure/identity");
|
|
15935
|
-
|
|
16015
|
+
const projectClient = new AIProjectClient(this.projectUrl, new DefaultAzureCredential());
|
|
16016
|
+
this.projectClient = projectClient;
|
|
15936
16017
|
logger.debug("Azure AI Project client initialized successfully");
|
|
15937
|
-
return
|
|
16018
|
+
return projectClient;
|
|
15938
16019
|
} catch (error) {
|
|
15939
|
-
|
|
15940
|
-
|
|
16020
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
16021
|
+
logger.error(`Failed to initialize Azure AI Project client: ${errorMessage}`);
|
|
16022
|
+
throw new Error(`Failed to initialize Azure AI Project client: ${errorMessage}`);
|
|
15941
16023
|
}
|
|
15942
16024
|
}
|
|
15943
|
-
|
|
15944
|
-
|
|
15945
|
-
|
|
16025
|
+
async resolveAgent(client) {
|
|
16026
|
+
if (this.resolvedAgent) return this.resolvedAgent;
|
|
16027
|
+
try {
|
|
16028
|
+
const agent = await client.agents.get(this.deploymentName);
|
|
16029
|
+
this.resolvedAgent = agent;
|
|
16030
|
+
return agent;
|
|
16031
|
+
} catch (error) {
|
|
16032
|
+
logger.debug(`[AzureFoundryAgentProvider] Direct agent lookup failed for '${this.deploymentName}', falling back to list lookup`, { error: error instanceof Error ? error.message : String(error) });
|
|
16033
|
+
}
|
|
16034
|
+
for await (const agent of client.agents.list()) if (agent.id === this.deploymentName || agent.name === this.deploymentName) {
|
|
16035
|
+
this.resolvedAgent = agent;
|
|
16036
|
+
return agent;
|
|
16037
|
+
}
|
|
16038
|
+
throw new Error(`Azure Foundry agent '${this.deploymentName}' was not found by name or legacy ID in project '${this.projectUrl}'. The Azure AI Projects v2 SDK resolves agents by name. Update the provider to use azure:foundry-agent:<agent-name>, or keep using the legacy ID format and ensure the agent still exists in this project.`);
|
|
16039
|
+
}
|
|
15946
16040
|
async preloadFunctionCallbacks() {
|
|
15947
16041
|
if (!this.assistantConfig.functionToolCallbacks) return;
|
|
15948
16042
|
const callbacks = this.assistantConfig.functionToolCallbacks;
|
|
15949
16043
|
for (const [name, callback] of Object.entries(callbacks)) try {
|
|
15950
|
-
if (typeof callback === "string")
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
const fn = await this.loadExternalFunction(callbackStr);
|
|
15954
|
-
this.loadedFunctionCallbacks[name] = fn;
|
|
15955
|
-
logger.debug(`Successfully preloaded function callback '${name}' from file`);
|
|
15956
|
-
} else {
|
|
15957
|
-
this.loadedFunctionCallbacks[name] = new Function("return " + callbackStr)();
|
|
15958
|
-
logger.debug(`Successfully preloaded inline function callback '${name}'`);
|
|
15959
|
-
}
|
|
15960
|
-
} else if (typeof callback === "function") {
|
|
15961
|
-
this.loadedFunctionCallbacks[name] = callback;
|
|
15962
|
-
logger.debug(`Successfully stored function callback '${name}'`);
|
|
15963
|
-
}
|
|
16044
|
+
if (typeof callback === "string") if (callback.startsWith("file://")) this.loadedFunctionCallbacks[name] = await this.loadExternalFunction(callback);
|
|
16045
|
+
else this.loadedFunctionCallbacks[name] = new Function("return " + callback)();
|
|
16046
|
+
else if (typeof callback === "function") this.loadedFunctionCallbacks[name] = callback;
|
|
15964
16047
|
} catch (error) {
|
|
15965
16048
|
logger.error(`Failed to preload function callback '${name}': ${error}`);
|
|
15966
16049
|
}
|
|
15967
16050
|
}
|
|
15968
|
-
/**
|
|
15969
|
-
* Loads a function from an external file
|
|
15970
|
-
* @param fileRef The file reference in the format 'file://path/to/file:functionName'
|
|
15971
|
-
* @returns The loaded function
|
|
15972
|
-
*/
|
|
15973
16051
|
async loadExternalFunction(fileRef) {
|
|
15974
16052
|
let filePath = fileRef.slice(7);
|
|
15975
16053
|
let functionName;
|
|
@@ -15978,11 +16056,9 @@ var AzureFoundryAgentProvider = class extends AzureGenericProvider {
|
|
|
15978
16056
|
if (splits[0] && isJavascriptFile(splits[0])) [filePath, functionName] = splits;
|
|
15979
16057
|
}
|
|
15980
16058
|
try {
|
|
15981
|
-
const
|
|
15982
|
-
logger.debug(`Loading function from ${resolvedPath}${functionName ? `:${functionName}` : ""}`);
|
|
15983
|
-
const requiredModule = await importModule(resolvedPath, functionName);
|
|
16059
|
+
const requiredModule = await importModule(path.resolve(state.basePath || "", filePath), functionName);
|
|
15984
16060
|
if (typeof requiredModule === "function") return requiredModule;
|
|
15985
|
-
|
|
16061
|
+
if (requiredModule && typeof requiredModule === "object" && functionName && functionName in requiredModule) {
|
|
15986
16062
|
const fn = requiredModule[functionName];
|
|
15987
16063
|
if (typeof fn === "function") return fn;
|
|
15988
16064
|
}
|
|
@@ -15991,139 +16067,197 @@ var AzureFoundryAgentProvider = class extends AzureGenericProvider {
|
|
|
15991
16067
|
throw new Error(`Error loading function from ${filePath}: ${error.message || String(error)}`);
|
|
15992
16068
|
}
|
|
15993
16069
|
}
|
|
15994
|
-
|
|
15995
|
-
* Executes a function callback with proper error handling
|
|
15996
|
-
*/
|
|
15997
|
-
async executeFunctionCallback(functionName, args, context) {
|
|
16070
|
+
async executeFunctionCallback(functionName, args, context, callbacks) {
|
|
15998
16071
|
try {
|
|
15999
16072
|
let callback = this.loadedFunctionCallbacks[functionName];
|
|
16073
|
+
const effectiveCallbacks = callbacks || this.assistantConfig.functionToolCallbacks;
|
|
16000
16074
|
if (!callback) {
|
|
16001
|
-
const callbackRef =
|
|
16002
|
-
if (callbackRef && typeof callbackRef === "string")
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
this.loadedFunctionCallbacks[functionName] = callback;
|
|
16007
|
-
} else if (typeof callbackRef === "function") {
|
|
16008
|
-
callback = callbackRef;
|
|
16009
|
-
this.loadedFunctionCallbacks[functionName] = callback;
|
|
16010
|
-
}
|
|
16075
|
+
const callbackRef = effectiveCallbacks?.[functionName];
|
|
16076
|
+
if (callbackRef && typeof callbackRef === "string") if (callbackRef.startsWith("file://")) callback = await this.loadExternalFunction(callbackRef);
|
|
16077
|
+
else callback = new Function("return " + callbackRef)();
|
|
16078
|
+
else if (typeof callbackRef === "function") callback = callbackRef;
|
|
16079
|
+
if (callback) this.loadedFunctionCallbacks[functionName] = callback;
|
|
16011
16080
|
}
|
|
16012
16081
|
if (!callback) throw new Error(`No callback found for function '${functionName}'`);
|
|
16013
|
-
logger.debug(`Executing function '${functionName}' with args: ${args}${context ? ` and context: ${JSON.stringify(context)}` : ""}`);
|
|
16014
16082
|
const result = await callback(args, context);
|
|
16015
16083
|
if (result === void 0 || result === null) return "";
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
} catch (error) {
|
|
16019
|
-
logger.warn(`Error stringifying result from function '${functionName}': ${error}`);
|
|
16020
|
-
return String(result);
|
|
16021
|
-
}
|
|
16022
|
-
else return String(result);
|
|
16084
|
+
if (typeof result === "object") return JSON.stringify(result);
|
|
16085
|
+
return String(result);
|
|
16023
16086
|
} catch (error) {
|
|
16024
16087
|
logger.error(`Error executing function '${functionName}': ${error.message || String(error)}`);
|
|
16025
16088
|
return JSON.stringify({ error: `Error in ${functionName}: ${error.message || String(error)}` });
|
|
16026
16089
|
}
|
|
16027
16090
|
}
|
|
16091
|
+
parsePromptInput(prompt) {
|
|
16092
|
+
try {
|
|
16093
|
+
const parsedJson = JSON.parse(prompt);
|
|
16094
|
+
if (Array.isArray(parsedJson)) return parsedJson;
|
|
16095
|
+
} catch {}
|
|
16096
|
+
return [{
|
|
16097
|
+
type: "message",
|
|
16098
|
+
role: "user",
|
|
16099
|
+
content: prompt
|
|
16100
|
+
}];
|
|
16101
|
+
}
|
|
16102
|
+
warnForUnsupportedConfig(config) {
|
|
16103
|
+
const unsupportedFields = [
|
|
16104
|
+
config.frequency_penalty === void 0 ? null : "frequency_penalty",
|
|
16105
|
+
config.presence_penalty === void 0 ? null : "presence_penalty",
|
|
16106
|
+
config.retryOptions ? "retryOptions" : null,
|
|
16107
|
+
config.seed === void 0 ? null : "seed",
|
|
16108
|
+
config.stop?.length ? "stop" : null,
|
|
16109
|
+
config.timeoutMs === void 0 ? null : "timeoutMs",
|
|
16110
|
+
config.tool_resources ? "tool_resources" : null
|
|
16111
|
+
].filter(Boolean);
|
|
16112
|
+
if (unsupportedFields.length === 0) return;
|
|
16113
|
+
const warningKey = unsupportedFields.sort().join(",");
|
|
16114
|
+
if (this.warnedUnsupportedFields.has(warningKey)) return;
|
|
16115
|
+
this.warnedUnsupportedFields.add(warningKey);
|
|
16116
|
+
logger.warn(`[AzureFoundryAgentProvider] The Azure AI Projects v2 agent runtime ignores these per-request settings: ${unsupportedFields.join(", ")}. Configure them on the agent itself, or pass supported Responses API fields instead.`);
|
|
16117
|
+
}
|
|
16118
|
+
async buildResponsesBody(prompt, context) {
|
|
16119
|
+
const config = {
|
|
16120
|
+
...this.assistantConfig,
|
|
16121
|
+
...context?.prompt?.config
|
|
16122
|
+
};
|
|
16123
|
+
this.warnForUnsupportedConfig(config);
|
|
16124
|
+
const responseFormat = maybeLoadResponseFormatFromExternalFile(config.response_format, context?.vars);
|
|
16125
|
+
const loadedTools = config.tools ? await maybeLoadToolsFromExternalFile(config.tools, context?.vars) : void 0;
|
|
16126
|
+
const reasoningEffort = config.reasoning_effort ? renderVarsInObject(config.reasoning_effort, context?.vars) : void 0;
|
|
16127
|
+
const maxOutputTokens = config.max_output_tokens ?? config.max_completion_tokens ?? config.max_tokens;
|
|
16128
|
+
let text;
|
|
16129
|
+
if (responseFormat?.type === "json_object") text = { format: { type: "json_object" } };
|
|
16130
|
+
else if (responseFormat?.type === "json_schema") {
|
|
16131
|
+
const schema = responseFormat.schema || responseFormat.json_schema?.schema;
|
|
16132
|
+
text = { format: {
|
|
16133
|
+
type: "json_schema",
|
|
16134
|
+
name: responseFormat.json_schema?.name || responseFormat.name || "response_schema",
|
|
16135
|
+
schema,
|
|
16136
|
+
strict: responseFormat.json_schema?.strict ?? responseFormat.strict ?? true
|
|
16137
|
+
} };
|
|
16138
|
+
}
|
|
16139
|
+
if (config.verbosity) text = {
|
|
16140
|
+
...text || {},
|
|
16141
|
+
verbosity: config.verbosity
|
|
16142
|
+
};
|
|
16143
|
+
return {
|
|
16144
|
+
body: {
|
|
16145
|
+
input: this.parsePromptInput(prompt),
|
|
16146
|
+
...config.instructions ? { instructions: config.instructions } : {},
|
|
16147
|
+
...config.metadata ? { metadata: config.metadata } : {},
|
|
16148
|
+
...config.modelName ? { model: config.modelName } : {},
|
|
16149
|
+
...maxOutputTokens === void 0 ? {} : { max_output_tokens: maxOutputTokens },
|
|
16150
|
+
...reasoningEffort ? { reasoning: { effort: reasoningEffort } } : {},
|
|
16151
|
+
...config.temperature === void 0 ? {} : { temperature: config.temperature },
|
|
16152
|
+
...config.top_p === void 0 ? {} : { top_p: config.top_p },
|
|
16153
|
+
...config.tool_choice ? { tool_choice: config.tool_choice } : {},
|
|
16154
|
+
...loadedTools ? { tools: loadedTools } : {},
|
|
16155
|
+
...text ? { text } : {},
|
|
16156
|
+
...config.passthrough || {}
|
|
16157
|
+
},
|
|
16158
|
+
effectiveConfig: {
|
|
16159
|
+
...config,
|
|
16160
|
+
response_format: responseFormat,
|
|
16161
|
+
tools: loadedTools
|
|
16162
|
+
}
|
|
16163
|
+
};
|
|
16164
|
+
}
|
|
16165
|
+
getFunctionCalls(response) {
|
|
16166
|
+
return (response.output || []).filter((item) => {
|
|
16167
|
+
return item?.type === "function_call" && typeof item.id === "string" && typeof item.call_id === "string" && typeof item.name === "string" && typeof item.arguments === "string";
|
|
16168
|
+
});
|
|
16169
|
+
}
|
|
16170
|
+
getCallableFunctionCalls(response, callbacks) {
|
|
16171
|
+
const functionCalls = this.getFunctionCalls(response);
|
|
16172
|
+
if (functionCalls.length === 0 || !callbacks || Object.keys(callbacks).length === 0) return [];
|
|
16173
|
+
const missingCallbacks = functionCalls.filter((call) => !(call.name in callbacks));
|
|
16174
|
+
if (missingCallbacks.length > 0) {
|
|
16175
|
+
logger.debug(`[AzureFoundryAgentProvider] Returning unresolved function calls because callbacks are missing for: ${missingCallbacks.map((call) => call.name).join(", ")}`);
|
|
16176
|
+
return [];
|
|
16177
|
+
}
|
|
16178
|
+
return functionCalls;
|
|
16179
|
+
}
|
|
16180
|
+
async buildFunctionCallOutputs(functionCalls, response, agent, callbacks) {
|
|
16181
|
+
const callbackContext = {
|
|
16182
|
+
threadId: response.conversation?.id || response.id,
|
|
16183
|
+
runId: response.id,
|
|
16184
|
+
assistantId: agent.id,
|
|
16185
|
+
provider: "azure-foundry"
|
|
16186
|
+
};
|
|
16187
|
+
return Promise.all(functionCalls.map(async (call) => ({
|
|
16188
|
+
type: "function_call_output",
|
|
16189
|
+
call_id: call.call_id,
|
|
16190
|
+
output: await this.executeFunctionCallback(call.name, call.arguments, callbackContext, callbacks)
|
|
16191
|
+
})));
|
|
16192
|
+
}
|
|
16193
|
+
getAgentReference(agent) {
|
|
16194
|
+
return { body: { agent: {
|
|
16195
|
+
name: agent.name,
|
|
16196
|
+
type: "agent_reference"
|
|
16197
|
+
} } };
|
|
16198
|
+
}
|
|
16199
|
+
async processResponse(response, effectiveConfig) {
|
|
16200
|
+
const result = await this.processor.processResponseOutput(response, effectiveConfig, false);
|
|
16201
|
+
if (!result.error) return result;
|
|
16202
|
+
if (response.output_text) {
|
|
16203
|
+
logger.debug(`[AzureFoundryAgentProvider] ResponsesProcessor returned an error, falling back to output_text`, { processorError: result.error });
|
|
16204
|
+
return {
|
|
16205
|
+
...result,
|
|
16206
|
+
error: void 0,
|
|
16207
|
+
output: response.output_text,
|
|
16208
|
+
raw: response
|
|
16209
|
+
};
|
|
16210
|
+
}
|
|
16211
|
+
return result;
|
|
16212
|
+
}
|
|
16028
16213
|
async callApi(prompt, context, _callApiOptions) {
|
|
16029
|
-
const
|
|
16030
|
-
|
|
16031
|
-
instructions: this.assistantConfig.instructions,
|
|
16032
|
-
max_completion_tokens: this.assistantConfig.max_completion_tokens,
|
|
16033
|
-
max_tokens: this.assistantConfig.max_tokens,
|
|
16034
|
-
model: this.assistantConfig.modelName,
|
|
16035
|
-
presence_penalty: this.assistantConfig.presence_penalty,
|
|
16036
|
-
prompt,
|
|
16037
|
-
response_format: this.assistantConfig.response_format,
|
|
16038
|
-
seed: this.assistantConfig.seed,
|
|
16039
|
-
stop: this.assistantConfig.stop,
|
|
16040
|
-
temperature: this.assistantConfig.temperature,
|
|
16041
|
-
tool_choice: this.assistantConfig.tool_choice,
|
|
16042
|
-
tool_resources: this.assistantConfig.tool_resources,
|
|
16043
|
-
tools: JSON.stringify(await maybeLoadToolsFromExternalFile(this.assistantConfig.tools, context?.vars)),
|
|
16044
|
-
top_p: this.assistantConfig.top_p
|
|
16045
|
-
})}`;
|
|
16214
|
+
const { body, effectiveConfig } = await this.buildResponsesBody(prompt, context);
|
|
16215
|
+
const cacheKey = `azure_foundry_agent:${this.deploymentName}:${JSON.stringify(body)}`;
|
|
16046
16216
|
if (isCacheEnabled()) try {
|
|
16047
16217
|
const cachedResult = await (await getCache()).get(cacheKey);
|
|
16048
16218
|
if (cachedResult) {
|
|
16049
|
-
logger.debug(`Cache hit for agent prompt: ${prompt.substring(0, 50)}...`);
|
|
16219
|
+
logger.debug(`Cache hit for Foundry agent prompt: ${prompt.substring(0, 50)}...`);
|
|
16050
16220
|
return {
|
|
16051
16221
|
...cachedResult,
|
|
16052
16222
|
cached: true
|
|
16053
16223
|
};
|
|
16054
16224
|
}
|
|
16055
|
-
} catch (
|
|
16056
|
-
logger.warn(`Error checking cache: ${
|
|
16225
|
+
} catch (error) {
|
|
16226
|
+
logger.warn(`Error checking cache for Azure Foundry agent response: ${error}`);
|
|
16057
16227
|
}
|
|
16058
16228
|
try {
|
|
16059
16229
|
const client = await this.initializeClient();
|
|
16060
|
-
|
|
16061
|
-
const
|
|
16062
|
-
|
|
16063
|
-
const
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
if (
|
|
16077
|
-
|
|
16078
|
-
if (this.assistantConfig.tool_choice) runOptions.tool_choice = this.assistantConfig.tool_choice;
|
|
16079
|
-
if (this.assistantConfig.tools) {
|
|
16080
|
-
const loadedTools = await maybeLoadToolsFromExternalFile(this.assistantConfig.tools, context?.vars);
|
|
16081
|
-
if (loadedTools !== void 0) runOptions.tools = loadedTools;
|
|
16082
|
-
}
|
|
16083
|
-
if (this.assistantConfig.modelName) runOptions.model = this.assistantConfig.modelName;
|
|
16084
|
-
if (this.assistantConfig.instructions) runOptions.instructions = this.assistantConfig.instructions;
|
|
16085
|
-
const run = await client.agents.runs.create(thread.id, agent.id, runOptions);
|
|
16086
|
-
logger.debug(`Created run: ${run.id}`);
|
|
16087
|
-
let result;
|
|
16088
|
-
if (this.assistantConfig.functionToolCallbacks && Object.keys(this.assistantConfig.functionToolCallbacks).length > 0) result = await this.pollRunWithToolCallHandling(client, thread.id, run);
|
|
16089
|
-
else {
|
|
16090
|
-
const completedRun = await this.pollRun(client, thread.id, run.id);
|
|
16091
|
-
if (completedRun.status === "completed") result = await this.processCompletedRun(client, thread.id, completedRun);
|
|
16092
|
-
else if (completedRun.lastError) {
|
|
16093
|
-
const errorCode = completedRun.lastError.code || "";
|
|
16094
|
-
const errorMessage = completedRun.lastError.message || "";
|
|
16095
|
-
if (errorCode === "content_filter" || this.isContentFilterError(errorMessage)) {
|
|
16096
|
-
const lowerErrorMessage = errorMessage.toLowerCase();
|
|
16097
|
-
const isInputFiltered = lowerErrorMessage.includes("prompt") || lowerErrorMessage.includes("input");
|
|
16098
|
-
const isOutputFiltered = lowerErrorMessage.includes("output") || lowerErrorMessage.includes("response");
|
|
16099
|
-
result = {
|
|
16100
|
-
output: "The generated content was filtered due to triggering Azure OpenAI Service's content filtering system.",
|
|
16101
|
-
guardrails: {
|
|
16102
|
-
flagged: true,
|
|
16103
|
-
flaggedInput: isInputFiltered,
|
|
16104
|
-
flaggedOutput: !isInputFiltered && (isOutputFiltered || !isOutputFiltered)
|
|
16105
|
-
}
|
|
16106
|
-
};
|
|
16107
|
-
} else result = { error: `Thread run failed: ${errorCode} - ${errorMessage}` };
|
|
16108
|
-
} else result = { error: `Thread run failed with status: ${completedRun.status}` };
|
|
16109
|
-
}
|
|
16230
|
+
const agent = await this.resolveAgent(client);
|
|
16231
|
+
const openAIClient = client.getOpenAIClient();
|
|
16232
|
+
const responseOptions = this.getAgentReference(agent);
|
|
16233
|
+
const maxLoopTimeMs = this.assistantConfig.maxPollTimeMs || 3e5;
|
|
16234
|
+
const startTime = Date.now();
|
|
16235
|
+
let response = await openAIClient.responses.create(body, responseOptions);
|
|
16236
|
+
while (Date.now() - startTime <= maxLoopTimeMs) {
|
|
16237
|
+
const functionCalls = this.getCallableFunctionCalls(response, effectiveConfig.functionToolCallbacks);
|
|
16238
|
+
if (functionCalls.length === 0) break;
|
|
16239
|
+
const outputs = await this.buildFunctionCallOutputs(functionCalls, response, agent, effectiveConfig.functionToolCallbacks);
|
|
16240
|
+
logger.debug(`[AzureFoundryAgentProvider] Submitting ${outputs.length} function_call_output item(s)`);
|
|
16241
|
+
response = await openAIClient.responses.create({
|
|
16242
|
+
input: outputs,
|
|
16243
|
+
previous_response_id: response.id
|
|
16244
|
+
}, responseOptions);
|
|
16245
|
+
}
|
|
16246
|
+
if (Date.now() - startTime > maxLoopTimeMs) return { error: `Azure Foundry agent tool-calling loop timed out after ${maxLoopTimeMs}ms.` };
|
|
16247
|
+
const result = await this.processResponse(response, effectiveConfig);
|
|
16110
16248
|
if (isCacheEnabled() && !result.error) try {
|
|
16111
16249
|
await (await getCache()).set(cacheKey, result);
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
logger.warn(`Error caching result: ${err}`);
|
|
16250
|
+
} catch (error) {
|
|
16251
|
+
logger.warn(`Error caching Azure Foundry agent response: ${error}`);
|
|
16115
16252
|
}
|
|
16116
16253
|
return result;
|
|
16117
|
-
} catch (
|
|
16118
|
-
logger.error(`Error in Azure Foundry Agent API call: ${
|
|
16119
|
-
return this.formatError(
|
|
16254
|
+
} catch (error) {
|
|
16255
|
+
logger.error(`Error in Azure Foundry Agent API call: ${error}`);
|
|
16256
|
+
return this.formatError(error);
|
|
16120
16257
|
}
|
|
16121
16258
|
}
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
*/
|
|
16125
|
-
formatError(err) {
|
|
16126
|
-
const errorMessage = err.message || String(err);
|
|
16259
|
+
formatError(error) {
|
|
16260
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
16127
16261
|
if (this.isContentFilterError(errorMessage)) {
|
|
16128
16262
|
const lowerErrorMessage = errorMessage.toLowerCase();
|
|
16129
16263
|
const isInputFiltered = lowerErrorMessage.includes("prompt") || lowerErrorMessage.includes("input");
|
|
@@ -16137,14 +16271,10 @@ var AzureFoundryAgentProvider = class extends AzureGenericProvider {
|
|
|
16137
16271
|
}
|
|
16138
16272
|
};
|
|
16139
16273
|
}
|
|
16140
|
-
if (errorMessage.includes("Can't add messages to thread") && errorMessage.includes("while a run")) return { error: `Error in Azure Foundry Agent API call: ${errorMessage}` };
|
|
16141
16274
|
if (this.isRateLimitError(errorMessage)) return { error: `Rate limit exceeded: ${errorMessage}` };
|
|
16142
16275
|
if (this.isServiceError(errorMessage)) return { error: `Service error: ${errorMessage}` };
|
|
16143
16276
|
return { error: `Error in Azure Foundry Agent API call: ${errorMessage}` };
|
|
16144
16277
|
}
|
|
16145
|
-
/**
|
|
16146
|
-
* Helper methods to check for specific error types
|
|
16147
|
-
*/
|
|
16148
16278
|
isContentFilterError(errorMessage) {
|
|
16149
16279
|
const lowerErrorMessage = errorMessage.toLowerCase();
|
|
16150
16280
|
return lowerErrorMessage.includes("content_filter") || lowerErrorMessage.includes("content filter") || lowerErrorMessage.includes("filtered due to") || lowerErrorMessage.includes("content filtering") || lowerErrorMessage.includes("inappropriate content") || lowerErrorMessage.includes("safety guidelines") || lowerErrorMessage.includes("guardrail");
|
|
@@ -16155,160 +16285,6 @@ var AzureFoundryAgentProvider = class extends AzureGenericProvider {
|
|
|
16155
16285
|
isServiceError(errorMessage) {
|
|
16156
16286
|
return errorMessage.includes("Service unavailable") || errorMessage.includes("Bad gateway") || errorMessage.includes("Gateway timeout") || errorMessage.includes("Server is busy") || errorMessage.includes("Sorry, something went wrong");
|
|
16157
16287
|
}
|
|
16158
|
-
isServerError(errorMessage) {
|
|
16159
|
-
return errorMessage.includes("500") || errorMessage.includes("502") || errorMessage.includes("503") || errorMessage.includes("504");
|
|
16160
|
-
}
|
|
16161
|
-
isRetryableError(code, message) {
|
|
16162
|
-
if (code === "rate_limit_exceeded") return true;
|
|
16163
|
-
if (!message) return false;
|
|
16164
|
-
return this.isRateLimitError(message) || this.isServiceError(message) || this.isServerError(message);
|
|
16165
|
-
}
|
|
16166
|
-
/**
|
|
16167
|
-
* Poll a run until it completes or fails
|
|
16168
|
-
*/
|
|
16169
|
-
async pollRun(client, threadId, runId, pollIntervalMs = 1e3) {
|
|
16170
|
-
const maxPollTime = this.assistantConfig.maxPollTimeMs || 3e5;
|
|
16171
|
-
const startTime = Date.now();
|
|
16172
|
-
let run = await client.agents.runs.get(threadId, runId);
|
|
16173
|
-
while (["queued", "in_progress"].includes(run.status)) {
|
|
16174
|
-
if (Date.now() - startTime > maxPollTime) throw new Error(`Run polling timed out after ${maxPollTime}ms. Last status: ${run.status}`);
|
|
16175
|
-
await sleep(pollIntervalMs);
|
|
16176
|
-
run = await client.agents.runs.get(threadId, runId);
|
|
16177
|
-
if (Date.now() - startTime > 3e4) pollIntervalMs = Math.min(pollIntervalMs * 1.5, 5e3);
|
|
16178
|
-
}
|
|
16179
|
-
return run;
|
|
16180
|
-
}
|
|
16181
|
-
/**
|
|
16182
|
-
* Handle tool calls during run polling
|
|
16183
|
-
*/
|
|
16184
|
-
async pollRunWithToolCallHandling(client, threadId, initialRun) {
|
|
16185
|
-
const maxPollTime = this.assistantConfig.maxPollTimeMs || 3e5;
|
|
16186
|
-
const startTime = Date.now();
|
|
16187
|
-
let pollIntervalMs = 1e3;
|
|
16188
|
-
let run = initialRun;
|
|
16189
|
-
while (true) {
|
|
16190
|
-
if (Date.now() - startTime > maxPollTime) return { error: `Run polling timed out after ${maxPollTime}ms. The operation may still be in progress.` };
|
|
16191
|
-
try {
|
|
16192
|
-
run = await client.agents.runs.get(threadId, run.id);
|
|
16193
|
-
logger.debug(`Run status: ${run.status}`);
|
|
16194
|
-
if (run.status === "requires_action") if (run.requiredAction?.type === "submit_tool_outputs" && run.requiredAction.submitToolOutputs?.toolCalls) {
|
|
16195
|
-
const toolCalls = run.requiredAction.submitToolOutputs.toolCalls;
|
|
16196
|
-
const functionCallsWithCallbacks = toolCalls.filter((toolCall) => {
|
|
16197
|
-
return toolCall.type === "function" && toolCall.function && toolCall.function.name in (this.assistantConfig.functionToolCallbacks ?? {});
|
|
16198
|
-
});
|
|
16199
|
-
if (functionCallsWithCallbacks.length === 0) {
|
|
16200
|
-
logger.debug(`No matching callbacks found for tool calls. Available functions: ${Object.keys(this.assistantConfig.functionToolCallbacks || {}).join(", ")}. Tool calls: ${JSON.stringify(toolCalls)}`);
|
|
16201
|
-
const emptyOutputs = toolCalls.map((toolCall) => ({
|
|
16202
|
-
toolCallId: toolCall.id,
|
|
16203
|
-
output: JSON.stringify({ message: `No callback registered for function ${toolCall.type === "function" ? toolCall.function?.name : toolCall.type}` })
|
|
16204
|
-
}));
|
|
16205
|
-
try {
|
|
16206
|
-
await client.agents.runs.submitToolOutputs(threadId, run.id, emptyOutputs);
|
|
16207
|
-
await sleep(pollIntervalMs);
|
|
16208
|
-
continue;
|
|
16209
|
-
} catch (error) {
|
|
16210
|
-
logger.error(`Error submitting empty tool outputs: ${error.message}`);
|
|
16211
|
-
return { error: `Error submitting empty tool outputs: ${error.message}` };
|
|
16212
|
-
}
|
|
16213
|
-
}
|
|
16214
|
-
const callbackContext = {
|
|
16215
|
-
threadId,
|
|
16216
|
-
runId: run.id,
|
|
16217
|
-
assistantId: this.deploymentName,
|
|
16218
|
-
provider: "azure-foundry"
|
|
16219
|
-
};
|
|
16220
|
-
const toolOutputs = await Promise.all(functionCallsWithCallbacks.map(async (toolCall) => {
|
|
16221
|
-
const functionName = toolCall.function.name;
|
|
16222
|
-
const functionArgs = toolCall.function.arguments;
|
|
16223
|
-
try {
|
|
16224
|
-
logger.debug(`Calling function ${functionName} with args: ${functionArgs}`);
|
|
16225
|
-
const outputResult = await this.executeFunctionCallback(functionName, functionArgs, callbackContext);
|
|
16226
|
-
logger.debug(`Function ${functionName} result: ${outputResult}`);
|
|
16227
|
-
return {
|
|
16228
|
-
toolCallId: toolCall.id,
|
|
16229
|
-
output: outputResult
|
|
16230
|
-
};
|
|
16231
|
-
} catch (error) {
|
|
16232
|
-
logger.error(`Error calling function ${functionName}: ${error}`);
|
|
16233
|
-
return {
|
|
16234
|
-
toolCallId: toolCall.id,
|
|
16235
|
-
output: JSON.stringify({ error: String(error) })
|
|
16236
|
-
};
|
|
16237
|
-
}
|
|
16238
|
-
}));
|
|
16239
|
-
if (toolOutputs.length === 0) {
|
|
16240
|
-
logger.error("No valid tool outputs to submit");
|
|
16241
|
-
break;
|
|
16242
|
-
}
|
|
16243
|
-
logger.debug(`Submitting tool outputs: ${JSON.stringify(toolOutputs)}`);
|
|
16244
|
-
try {
|
|
16245
|
-
await client.agents.runs.submitToolOutputs(threadId, run.id, toolOutputs);
|
|
16246
|
-
} catch (error) {
|
|
16247
|
-
logger.error(`Error submitting tool outputs: ${error.message}`);
|
|
16248
|
-
return { error: `Error submitting tool outputs: ${error.message}` };
|
|
16249
|
-
}
|
|
16250
|
-
} else {
|
|
16251
|
-
logger.error(`Unknown required action type: ${run.requiredAction?.type}`);
|
|
16252
|
-
break;
|
|
16253
|
-
}
|
|
16254
|
-
else if ([
|
|
16255
|
-
"completed",
|
|
16256
|
-
"failed",
|
|
16257
|
-
"cancelled",
|
|
16258
|
-
"expired"
|
|
16259
|
-
].includes(run.status)) {
|
|
16260
|
-
if (run.status !== "completed") {
|
|
16261
|
-
if (run.lastError) {
|
|
16262
|
-
const errorCode = run.lastError.code || "";
|
|
16263
|
-
const errorMessage = run.lastError.message || "";
|
|
16264
|
-
if (errorCode === "content_filter" || this.isContentFilterError(errorMessage)) {
|
|
16265
|
-
const lowerErrorMessage = errorMessage.toLowerCase();
|
|
16266
|
-
const isInputFiltered = lowerErrorMessage.includes("prompt") || lowerErrorMessage.includes("input");
|
|
16267
|
-
const isOutputFiltered = lowerErrorMessage.includes("output") || lowerErrorMessage.includes("response");
|
|
16268
|
-
return {
|
|
16269
|
-
output: "The generated content was filtered due to triggering Azure OpenAI Service's content filtering system.",
|
|
16270
|
-
guardrails: {
|
|
16271
|
-
flagged: true,
|
|
16272
|
-
flaggedInput: isInputFiltered,
|
|
16273
|
-
flaggedOutput: !isInputFiltered && (isOutputFiltered || !isOutputFiltered)
|
|
16274
|
-
}
|
|
16275
|
-
};
|
|
16276
|
-
}
|
|
16277
|
-
return { error: `Thread run failed: ${errorCode} - ${errorMessage}` };
|
|
16278
|
-
}
|
|
16279
|
-
return { error: `Thread run failed with status: ${run.status}` };
|
|
16280
|
-
}
|
|
16281
|
-
break;
|
|
16282
|
-
}
|
|
16283
|
-
await sleep(pollIntervalMs);
|
|
16284
|
-
if (Date.now() - startTime > 3e4) pollIntervalMs = Math.min(pollIntervalMs * 1.5, 5e3);
|
|
16285
|
-
} catch (error) {
|
|
16286
|
-
logger.error(`Error polling run status: ${error}`);
|
|
16287
|
-
const errorMessage = error.message || String(error);
|
|
16288
|
-
if (this.isRetryableError("", errorMessage)) return { error: `Error polling run status: ${errorMessage}` };
|
|
16289
|
-
return { error: `Error polling run status: ${errorMessage}` };
|
|
16290
|
-
}
|
|
16291
|
-
}
|
|
16292
|
-
return await this.processCompletedRun(client, threadId, run);
|
|
16293
|
-
}
|
|
16294
|
-
/**
|
|
16295
|
-
* Process a completed run to extract messages
|
|
16296
|
-
*/
|
|
16297
|
-
async processCompletedRun(client, threadId, _run) {
|
|
16298
|
-
try {
|
|
16299
|
-
const messages = [];
|
|
16300
|
-
for await (const message of client.agents.messages.list(threadId, { order: "asc" })) messages.push(message);
|
|
16301
|
-
const outputBlocks = [];
|
|
16302
|
-
messages.forEach((message) => {
|
|
16303
|
-
const contentBlocks = message.content.map((content) => content.type === "text" && content.text ? content.text.value : `<${content.type} output>`).join("\n");
|
|
16304
|
-
outputBlocks.push(`[${toTitleCase(message.role)}] ${contentBlocks}`);
|
|
16305
|
-
});
|
|
16306
|
-
return { output: outputBlocks.join("\n\n").trim() };
|
|
16307
|
-
} catch (err) {
|
|
16308
|
-
logger.error(`Error processing run results: ${err}`);
|
|
16309
|
-
return { error: `Error processing run results: ${err.message || String(err)}` };
|
|
16310
|
-
}
|
|
16311
|
-
}
|
|
16312
16288
|
};
|
|
16313
16289
|
//#endregion
|
|
16314
16290
|
//#region src/providers/azure/responses.ts
|
|
@@ -16378,9 +16354,9 @@ var AzureResponsesProvider = class extends AzureGenericProvider {
|
|
|
16378
16354
|
const body = {
|
|
16379
16355
|
model: this.deploymentName,
|
|
16380
16356
|
input,
|
|
16381
|
-
...maxOutputTokens
|
|
16357
|
+
...maxOutputTokens === void 0 ? {} : { max_output_tokens: maxOutputTokens },
|
|
16382
16358
|
...reasoningEffort ? { reasoning: { effort: reasoningEffort } } : {},
|
|
16383
|
-
...temperature
|
|
16359
|
+
...temperature === void 0 ? {} : { temperature },
|
|
16384
16360
|
...instructions ? { instructions } : {},
|
|
16385
16361
|
...config.top_p !== void 0 || getEnvString("OPENAI_TOP_P") ? { top_p: config.top_p ?? getEnvFloat("OPENAI_TOP_P", 1) } : {},
|
|
16386
16362
|
...config.tools ? { tools: await maybeLoadToolsFromExternalFile(config.tools, context?.vars) } : {},
|
|
@@ -16411,7 +16387,7 @@ var AzureResponsesProvider = class extends AzureGenericProvider {
|
|
|
16411
16387
|
}
|
|
16412
16388
|
const body = await this.getAzureResponsesBody(prompt, context, callApiOptions);
|
|
16413
16389
|
const isDeepResearchModel = this.deploymentName.includes("deep-research");
|
|
16414
|
-
let timeout = REQUEST_TIMEOUT_MS;
|
|
16390
|
+
let timeout = REQUEST_TIMEOUT_MS$1;
|
|
16415
16391
|
if (isDeepResearchModel) {
|
|
16416
16392
|
const evalTimeout = getEnvInt("PROMPTFOO_EVAL_TIMEOUT_MS", 0);
|
|
16417
16393
|
timeout = evalTimeout > 0 ? evalTimeout : LONG_RUNNING_MODEL_TIMEOUT_MS;
|
|
@@ -17415,9 +17391,9 @@ var AwsBedrockConverseProvider = class extends AwsBedrockGenericProvider {
|
|
|
17415
17391
|
const temperature = reasoningEnabled ? void 0 : temperatureValue;
|
|
17416
17392
|
const topP = reasoningEnabled ? void 0 : topPValue;
|
|
17417
17393
|
if (maxTokens !== void 0 || temperature !== void 0 || topP !== void 0 || stopSequences) return {
|
|
17418
|
-
...maxTokens
|
|
17419
|
-
...temperature
|
|
17420
|
-
...topP
|
|
17394
|
+
...maxTokens === void 0 ? {} : { maxTokens },
|
|
17395
|
+
...temperature === void 0 ? {} : { temperature },
|
|
17396
|
+
...topP === void 0 ? {} : { topP },
|
|
17421
17397
|
...stopSequences ? { stopSequences } : {}
|
|
17422
17398
|
};
|
|
17423
17399
|
}
|
|
@@ -17637,7 +17613,7 @@ var AwsBedrockConverseProvider = class extends AwsBedrockGenericProvider {
|
|
|
17637
17613
|
if (hasSuccessfulCallback && results.length > 0) return {
|
|
17638
17614
|
output: results.join("\n"),
|
|
17639
17615
|
tokenUsage,
|
|
17640
|
-
...cost
|
|
17616
|
+
...cost === void 0 ? {} : { cost },
|
|
17641
17617
|
...Object.keys(metadata).length > 0 ? { metadata } : {},
|
|
17642
17618
|
...guardrails ? { guardrails } : {},
|
|
17643
17619
|
...malformedError ? { error: malformedError } : {}
|
|
@@ -17647,7 +17623,7 @@ var AwsBedrockConverseProvider = class extends AwsBedrockGenericProvider {
|
|
|
17647
17623
|
return {
|
|
17648
17624
|
output: extractTextFromContentBlocks(content, showThinking),
|
|
17649
17625
|
tokenUsage,
|
|
17650
|
-
...cost
|
|
17626
|
+
...cost === void 0 ? {} : { cost },
|
|
17651
17627
|
...Object.keys(metadata).length > 0 ? { metadata } : {},
|
|
17652
17628
|
...guardrails ? { guardrails } : {},
|
|
17653
17629
|
...malformedError ? { error: malformedError } : {}
|
|
@@ -17761,7 +17737,7 @@ var AwsBedrockConverseProvider = class extends AwsBedrockGenericProvider {
|
|
|
17761
17737
|
return {
|
|
17762
17738
|
output: finalOutput,
|
|
17763
17739
|
tokenUsage,
|
|
17764
|
-
...cost
|
|
17740
|
+
...cost === void 0 ? {} : { cost },
|
|
17765
17741
|
...Object.keys(metadata).length > 0 ? { metadata } : {},
|
|
17766
17742
|
...malformedError ? { error: malformedError } : {}
|
|
17767
17743
|
};
|
|
@@ -19425,7 +19401,7 @@ var CohereChatCompletionProvider = class CohereChatCompletionProvider {
|
|
|
19425
19401
|
"X-Client-Name": getEnvString("COHERE_CLIENT_NAME") || "promptfoo"
|
|
19426
19402
|
},
|
|
19427
19403
|
body: JSON.stringify(body)
|
|
19428
|
-
}, REQUEST_TIMEOUT_MS));
|
|
19404
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
19429
19405
|
if (data.message) return { error: data.message };
|
|
19430
19406
|
const tokenUsage = {
|
|
19431
19407
|
cached: cached ? data.token_count?.total_tokens || 0 : 0,
|
|
@@ -19487,7 +19463,7 @@ var CohereEmbeddingProvider = class {
|
|
|
19487
19463
|
"X-Client-Name": getEnvString("COHERE_CLIENT_NAME") || "promptfoo"
|
|
19488
19464
|
},
|
|
19489
19465
|
body: JSON.stringify(body)
|
|
19490
|
-
}, REQUEST_TIMEOUT_MS));
|
|
19466
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
19491
19467
|
} catch (err) {
|
|
19492
19468
|
logger.error(`API call error: ${err}`);
|
|
19493
19469
|
throw err;
|
|
@@ -20396,7 +20372,7 @@ var ElevenLabsAgentsProvider = class {
|
|
|
20396
20372
|
promptLength: prompt.length
|
|
20397
20373
|
});
|
|
20398
20374
|
const simulationRequest = buildSimulationRequest(parseConversation(prompt, context), this.config.simulatedUser, this.config.evaluationCriteria, this.config.toolMockConfig);
|
|
20399
|
-
simulationRequest.new_turns_limit = this.config.maxTurns
|
|
20375
|
+
simulationRequest.new_turns_limit = this.config.maxTurns ?? 10;
|
|
20400
20376
|
logger.debug("[ElevenLabs Agents] Request payload", {
|
|
20401
20377
|
endpoint: `/convai/agents/${agentId}/simulate-conversation`,
|
|
20402
20378
|
payload: simulationRequest
|
|
@@ -20523,7 +20499,7 @@ var ElevenLabsAgentsProvider = class {
|
|
|
20523
20499
|
simulatedUser: config?.simulatedUser,
|
|
20524
20500
|
evaluationCriteria: config?.evaluationCriteria,
|
|
20525
20501
|
toolMockConfig: config?.toolMockConfig,
|
|
20526
|
-
maxTurns: config?.maxTurns
|
|
20502
|
+
maxTurns: config?.maxTurns ?? 10,
|
|
20527
20503
|
label: options.label || options.id
|
|
20528
20504
|
};
|
|
20529
20505
|
}
|
|
@@ -22394,7 +22370,7 @@ var GeminiImageProvider = class {
|
|
|
22394
22370
|
headers,
|
|
22395
22371
|
body: JSON.stringify(body),
|
|
22396
22372
|
...authDiscriminator && { _authHash: authDiscriminator }
|
|
22397
|
-
}, REQUEST_TIMEOUT_MS, "json", false);
|
|
22373
|
+
}, REQUEST_TIMEOUT_MS$1, "json", false);
|
|
22398
22374
|
const latencyMs = Date.now() - startTime;
|
|
22399
22375
|
return this.processResponse(data, cached, latencyMs);
|
|
22400
22376
|
} catch (err) {
|
|
@@ -22422,7 +22398,7 @@ var GeminiImageProvider = class {
|
|
|
22422
22398
|
...this.config.headers || {}
|
|
22423
22399
|
},
|
|
22424
22400
|
data: body,
|
|
22425
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
22401
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
22426
22402
|
});
|
|
22427
22403
|
const latencyMs = Date.now() - startTime;
|
|
22428
22404
|
return this.processResponse(response.data, false, latencyMs);
|
|
@@ -22583,7 +22559,7 @@ var GoogleImageProvider = class {
|
|
|
22583
22559
|
...this.config.headers || {}
|
|
22584
22560
|
},
|
|
22585
22561
|
data: body,
|
|
22586
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
22562
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
22587
22563
|
}), "Vertex AI API call");
|
|
22588
22564
|
const latencyMs = Date.now() - startTime;
|
|
22589
22565
|
return this.processResponse(response.data, false, latencyMs);
|
|
@@ -22620,7 +22596,7 @@ var GoogleImageProvider = class {
|
|
|
22620
22596
|
headers,
|
|
22621
22597
|
body: JSON.stringify(body),
|
|
22622
22598
|
...authDiscriminator && { _authHash: authDiscriminator }
|
|
22623
|
-
}, REQUEST_TIMEOUT_MS, "json"), "Google AI Studio API call");
|
|
22599
|
+
}, REQUEST_TIMEOUT_MS$1, "json"), "Google AI Studio API call");
|
|
22624
22600
|
return this.processResponse(response.data, response.cached, response.latencyMs);
|
|
22625
22601
|
} catch (err) {
|
|
22626
22602
|
return { error: `API call error: ${String(err)}` };
|
|
@@ -23168,6 +23144,8 @@ const DEFAULT_RESOLUTION$1 = "720p";
|
|
|
23168
23144
|
const DEFAULT_DURATION$1 = 8;
|
|
23169
23145
|
const DEFAULT_POLL_INTERVAL_MS$1 = 1e4;
|
|
23170
23146
|
const DEFAULT_MAX_POLL_TIME_MS$1 = 6e5;
|
|
23147
|
+
const REQUEST_TIMEOUT_MS = 3e5;
|
|
23148
|
+
const AI_STUDIO_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
23171
23149
|
function validateAspectRatio$1(ratio) {
|
|
23172
23150
|
if (!["16:9", "9:16"].includes(ratio)) return {
|
|
23173
23151
|
valid: false,
|
|
@@ -23219,6 +23197,13 @@ var GoogleVideoProvider = class {
|
|
|
23219
23197
|
async getProjectId() {
|
|
23220
23198
|
return await resolveProjectId(this.config, this.env);
|
|
23221
23199
|
}
|
|
23200
|
+
isVertexMode(config = this.config) {
|
|
23201
|
+
return determineGoogleVertexMode(config, this.env);
|
|
23202
|
+
}
|
|
23203
|
+
getApiKey(config = this.config) {
|
|
23204
|
+
const { apiKey } = getGoogleApiKey(config, this.env, this.isVertexMode(config));
|
|
23205
|
+
return apiKey;
|
|
23206
|
+
}
|
|
23222
23207
|
async getClientWithCredentials() {
|
|
23223
23208
|
const { client } = await getGoogleClient({ credentials: loadCredentials(this.config.credentials) });
|
|
23224
23209
|
return client;
|
|
@@ -23227,6 +23212,17 @@ var GoogleVideoProvider = class {
|
|
|
23227
23212
|
const location = this.getLocation();
|
|
23228
23213
|
return `https://${location}-aiplatform.googleapis.com/v1/projects/${await this.getProjectId()}/locations/${location}/publishers/google/models/${this.modelName}:${action}`;
|
|
23229
23214
|
}
|
|
23215
|
+
getAiStudioEndpoint(pathSuffix) {
|
|
23216
|
+
return `${AI_STUDIO_BASE_URL}/${pathSuffix}`;
|
|
23217
|
+
}
|
|
23218
|
+
async getAiStudioHeaders(config) {
|
|
23219
|
+
const apiKey = this.getApiKey(config);
|
|
23220
|
+
if (!apiKey) throw new Error("Google API key is not set. Set GOOGLE_API_KEY or GEMINI_API_KEY, or add `apiKey` to the provider config.");
|
|
23221
|
+
return {
|
|
23222
|
+
"Content-Type": "application/json",
|
|
23223
|
+
"x-goog-api-key": apiKey
|
|
23224
|
+
};
|
|
23225
|
+
}
|
|
23230
23226
|
/**
|
|
23231
23227
|
* Load image data from file:// path or return as-is if base64
|
|
23232
23228
|
*/
|
|
@@ -23239,10 +23235,24 @@ var GoogleVideoProvider = class {
|
|
|
23239
23235
|
return { data: imagePath };
|
|
23240
23236
|
}
|
|
23241
23237
|
/**
|
|
23238
|
+
* Load video data from file:// path or return as-is if base64
|
|
23239
|
+
*/
|
|
23240
|
+
loadVideoData(videoPath) {
|
|
23241
|
+
if (videoPath.startsWith("file://")) {
|
|
23242
|
+
const filePath = videoPath.slice(7);
|
|
23243
|
+
if (!fs.existsSync(filePath)) return { error: `Video file not found: ${filePath}` };
|
|
23244
|
+
return { data: fs.readFileSync(filePath).toString("base64") };
|
|
23245
|
+
}
|
|
23246
|
+
return { data: videoPath };
|
|
23247
|
+
}
|
|
23248
|
+
/**
|
|
23242
23249
|
* Create a new video generation job
|
|
23243
23250
|
*/
|
|
23244
23251
|
async createVideoJob(prompt, config) {
|
|
23245
|
-
|
|
23252
|
+
if (this.isVertexMode(config)) return this.createVertexVideoJob(prompt, config);
|
|
23253
|
+
return this.createAiStudioVideoJob(prompt, config);
|
|
23254
|
+
}
|
|
23255
|
+
buildVertexRequestBody(prompt, config) {
|
|
23246
23256
|
const instance = { prompt };
|
|
23247
23257
|
if (config.aspectRatio) instance.aspectRatio = config.aspectRatio;
|
|
23248
23258
|
if (config.resolution) instance.resolution = config.resolution;
|
|
@@ -23286,7 +23296,69 @@ var GoogleVideoProvider = class {
|
|
|
23286
23296
|
}
|
|
23287
23297
|
const extendVideoId = config.extendVideoId || config.sourceVideo;
|
|
23288
23298
|
if (extendVideoId) instance.video = { operationName: extendVideoId };
|
|
23299
|
+
return { body: { instances: [instance] } };
|
|
23300
|
+
}
|
|
23301
|
+
buildAiStudioRequestBody(prompt, config) {
|
|
23302
|
+
const instance = { prompt };
|
|
23303
|
+
const parameters = {};
|
|
23304
|
+
if (config.aspectRatio) parameters.aspectRatio = config.aspectRatio;
|
|
23305
|
+
if (config.resolution) parameters.resolution = config.resolution;
|
|
23306
|
+
if (config.durationSeconds) parameters.durationSeconds = config.durationSeconds;
|
|
23307
|
+
if (config.negativePrompt) parameters.negativePrompt = config.negativePrompt;
|
|
23308
|
+
if (config.personGeneration) parameters.personGeneration = config.personGeneration;
|
|
23309
|
+
if (config.seed !== void 0) parameters.seed = config.seed;
|
|
23310
|
+
if (config.image) {
|
|
23311
|
+
const { data: imageData, error } = this.loadImageData(config.image);
|
|
23312
|
+
if (error) return { error };
|
|
23313
|
+
instance.image = { inlineData: {
|
|
23314
|
+
mimeType: "image/png",
|
|
23315
|
+
data: imageData
|
|
23316
|
+
} };
|
|
23317
|
+
}
|
|
23318
|
+
const lastFrame = config.lastFrame || config.lastImage;
|
|
23319
|
+
if (lastFrame) {
|
|
23320
|
+
const { data: lastFrameData, error } = this.loadImageData(lastFrame);
|
|
23321
|
+
if (error) return { error };
|
|
23322
|
+
instance.lastFrame = { inlineData: {
|
|
23323
|
+
mimeType: "image/png",
|
|
23324
|
+
data: lastFrameData
|
|
23325
|
+
} };
|
|
23326
|
+
}
|
|
23327
|
+
if (config.referenceImages && config.referenceImages.length > 0) {
|
|
23328
|
+
const refs = [];
|
|
23329
|
+
for (const ref of config.referenceImages.slice(0, 3)) {
|
|
23330
|
+
const imagePath = typeof ref === "string" ? ref : ref.image;
|
|
23331
|
+
const referenceType = typeof ref === "string" ? "asset" : ref.referenceType || "asset";
|
|
23332
|
+
const { data: imageData, error } = this.loadImageData(imagePath);
|
|
23333
|
+
if (error) return { error };
|
|
23334
|
+
refs.push({
|
|
23335
|
+
image: { inlineData: {
|
|
23336
|
+
mimeType: "image/png",
|
|
23337
|
+
data: imageData
|
|
23338
|
+
} },
|
|
23339
|
+
referenceType
|
|
23340
|
+
});
|
|
23341
|
+
}
|
|
23342
|
+
instance.referenceImages = refs;
|
|
23343
|
+
}
|
|
23344
|
+
const sourceVideo = config.extendVideoId || config.sourceVideo;
|
|
23345
|
+
if (sourceVideo) {
|
|
23346
|
+
if (sourceVideo.includes("/operations/")) return { error: "Google AI Studio Veo does not accept operation IDs for video extension. Use `vertex:video:*` with `extendVideoId`, or provide base64/file:// video data via `sourceVideo`." };
|
|
23347
|
+
const { data: videoData, error } = this.loadVideoData(sourceVideo);
|
|
23348
|
+
if (error) return { error };
|
|
23349
|
+
instance.video = { inlineData: {
|
|
23350
|
+
mimeType: "video/mp4",
|
|
23351
|
+
data: videoData
|
|
23352
|
+
} };
|
|
23353
|
+
}
|
|
23289
23354
|
const body = { instances: [instance] };
|
|
23355
|
+
if (Object.keys(parameters).length > 0) body.parameters = parameters;
|
|
23356
|
+
return { body };
|
|
23357
|
+
}
|
|
23358
|
+
async createVertexVideoJob(prompt, config) {
|
|
23359
|
+
const url = await this.getVertexEndpoint("predictLongRunning");
|
|
23360
|
+
const { body, error: bodyError } = this.buildVertexRequestBody(prompt, config);
|
|
23361
|
+
if (bodyError || !body) return { error: bodyError || "Failed to build Vertex Veo request" };
|
|
23290
23362
|
try {
|
|
23291
23363
|
const client = await this.getClientWithCredentials();
|
|
23292
23364
|
logger.debug("[Google Video] Creating video job", {
|
|
@@ -23304,10 +23376,37 @@ var GoogleVideoProvider = class {
|
|
|
23304
23376
|
return { error: `Failed to create video job: ${error.response?.data?.error?.message || error.message || String(err)}` };
|
|
23305
23377
|
}
|
|
23306
23378
|
}
|
|
23379
|
+
async createAiStudioVideoJob(prompt, config) {
|
|
23380
|
+
const { body, error: bodyError } = this.buildAiStudioRequestBody(prompt, config);
|
|
23381
|
+
if (bodyError || !body) return { error: bodyError || "Failed to build Google AI Studio Veo request" };
|
|
23382
|
+
try {
|
|
23383
|
+
const headers = await this.getAiStudioHeaders(config);
|
|
23384
|
+
const url = this.getAiStudioEndpoint(`models/${this.modelName}:predictLongRunning`);
|
|
23385
|
+
logger.debug("[Google Video] Creating video job", {
|
|
23386
|
+
url,
|
|
23387
|
+
model: this.modelName,
|
|
23388
|
+
transport: "google-ai-studio"
|
|
23389
|
+
});
|
|
23390
|
+
const response = await fetchWithTimeout(url, {
|
|
23391
|
+
method: "POST",
|
|
23392
|
+
headers,
|
|
23393
|
+
body: JSON.stringify(body)
|
|
23394
|
+
}, REQUEST_TIMEOUT_MS);
|
|
23395
|
+
const data = await response.json();
|
|
23396
|
+
if (!response.ok) return { error: `Failed to create video job: ${data.error?.message || response.statusText}` };
|
|
23397
|
+
return { operation: data };
|
|
23398
|
+
} catch (err) {
|
|
23399
|
+
return { error: `Failed to create video job: ${err.message || String(err)}` };
|
|
23400
|
+
}
|
|
23401
|
+
}
|
|
23307
23402
|
/**
|
|
23308
23403
|
* Poll for video job completion using fetchPredictOperation endpoint
|
|
23309
23404
|
*/
|
|
23310
|
-
async pollOperationStatus(operationName, pollIntervalMs, maxPollTimeMs) {
|
|
23405
|
+
async pollOperationStatus(operationName, pollIntervalMs, maxPollTimeMs, config) {
|
|
23406
|
+
if (this.isVertexMode(config)) return this.pollVertexOperationStatus(operationName, pollIntervalMs, maxPollTimeMs);
|
|
23407
|
+
return this.pollAiStudioOperationStatus(operationName, pollIntervalMs, maxPollTimeMs, config);
|
|
23408
|
+
}
|
|
23409
|
+
async pollVertexOperationStatus(operationName, pollIntervalMs, maxPollTimeMs) {
|
|
23311
23410
|
const startTime = Date.now();
|
|
23312
23411
|
const location = this.getLocation();
|
|
23313
23412
|
const url = `https://${location}-aiplatform.googleapis.com/v1/projects/${await this.getProjectId()}/locations/${location}/publishers/google/models/${this.modelName}:fetchPredictOperation`;
|
|
@@ -23332,10 +23431,37 @@ var GoogleVideoProvider = class {
|
|
|
23332
23431
|
}
|
|
23333
23432
|
return { error: `Video generation timed out after ${maxPollTimeMs / 1e3} seconds` };
|
|
23334
23433
|
}
|
|
23434
|
+
async pollAiStudioOperationStatus(operationName, pollIntervalMs, maxPollTimeMs, config) {
|
|
23435
|
+
const startTime = Date.now();
|
|
23436
|
+
const url = this.getAiStudioEndpoint(operationName);
|
|
23437
|
+
const headers = await this.getAiStudioHeaders(config);
|
|
23438
|
+
logger.debug(`[Google Video] Polling operation via Google AI Studio: ${url}`);
|
|
23439
|
+
while (Date.now() - startTime < maxPollTimeMs) try {
|
|
23440
|
+
const response = await fetchWithTimeout(url, {
|
|
23441
|
+
method: "GET",
|
|
23442
|
+
headers
|
|
23443
|
+
}, REQUEST_TIMEOUT_MS);
|
|
23444
|
+
const operation = await response.json();
|
|
23445
|
+
if (!response.ok) return { error: `Polling error: ${operation.error?.message || response.statusText}` };
|
|
23446
|
+
logger.debug(`[Google Video] Operation status: done=${operation.done}, progress=${operation.metadata?.progress}%`);
|
|
23447
|
+
if (operation.done) {
|
|
23448
|
+
if (operation.error) return { error: `Video generation failed: ${operation.error.message}` };
|
|
23449
|
+
return { operation };
|
|
23450
|
+
}
|
|
23451
|
+
await sleep(pollIntervalMs);
|
|
23452
|
+
} catch (err) {
|
|
23453
|
+
return { error: `Polling error: ${err.message || String(err)}` };
|
|
23454
|
+
}
|
|
23455
|
+
return { error: `Video generation timed out after ${maxPollTimeMs / 1e3} seconds` };
|
|
23456
|
+
}
|
|
23335
23457
|
/**
|
|
23336
23458
|
* Download video from URI and store to blob storage
|
|
23337
23459
|
*/
|
|
23338
|
-
async downloadVideoToBlob(videoUri) {
|
|
23460
|
+
async downloadVideoToBlob(videoUri, config) {
|
|
23461
|
+
if (this.isVertexMode(config)) return this.downloadVertexVideoToBlob(videoUri);
|
|
23462
|
+
return this.downloadAiStudioVideoToBlob(videoUri, config);
|
|
23463
|
+
}
|
|
23464
|
+
async downloadVertexVideoToBlob(videoUri) {
|
|
23339
23465
|
try {
|
|
23340
23466
|
const response = await (await this.getClientWithCredentials()).request({
|
|
23341
23467
|
url: videoUri,
|
|
@@ -23352,6 +23478,23 @@ var GoogleVideoProvider = class {
|
|
|
23352
23478
|
return { error: `Download error: ${err.message || String(err)}` };
|
|
23353
23479
|
}
|
|
23354
23480
|
}
|
|
23481
|
+
async downloadAiStudioVideoToBlob(videoUri, config) {
|
|
23482
|
+
try {
|
|
23483
|
+
const response = await fetchWithTimeout(videoUri, {
|
|
23484
|
+
method: "GET",
|
|
23485
|
+
headers: await this.getAiStudioHeaders(config)
|
|
23486
|
+
}, REQUEST_TIMEOUT_MS);
|
|
23487
|
+
if (!response.ok) return { error: `Download error: ${response.statusText}` };
|
|
23488
|
+
const { ref } = await storeBlob(Buffer.from(await response.arrayBuffer()), "video/mp4", {
|
|
23489
|
+
kind: "video",
|
|
23490
|
+
location: "response.video"
|
|
23491
|
+
});
|
|
23492
|
+
logger.debug(`[Google Video] Stored video to blob storage: ${ref.uri}`);
|
|
23493
|
+
return { blobRef: ref };
|
|
23494
|
+
} catch (err) {
|
|
23495
|
+
return { error: `Download error: ${err.message || String(err)}` };
|
|
23496
|
+
}
|
|
23497
|
+
}
|
|
23355
23498
|
/**
|
|
23356
23499
|
* Store base64 encoded video to blob storage
|
|
23357
23500
|
*/
|
|
@@ -23369,20 +23512,40 @@ var GoogleVideoProvider = class {
|
|
|
23369
23512
|
}
|
|
23370
23513
|
async callApi(prompt, context) {
|
|
23371
23514
|
if (!prompt || prompt.trim() === "") return { error: "Prompt is required for video generation" };
|
|
23372
|
-
let
|
|
23373
|
-
if (!projectId) try {
|
|
23374
|
-
projectId = await resolveProjectId(this.config, this.env);
|
|
23375
|
-
} catch {
|
|
23376
|
-
return { error: "Google Veo video generation requires Vertex AI. Set GOOGLE_CLOUD_PROJECT environment variable or add `projectId` to the provider config, then run \"gcloud auth application-default login\"." };
|
|
23377
|
-
}
|
|
23378
|
-
const config = {
|
|
23515
|
+
let effectiveConfig = {
|
|
23379
23516
|
...this.config,
|
|
23380
23517
|
...context?.prompt?.config
|
|
23381
23518
|
};
|
|
23382
|
-
|
|
23383
|
-
|
|
23384
|
-
|
|
23385
|
-
|
|
23519
|
+
let isVertexMode = this.isVertexMode(effectiveConfig);
|
|
23520
|
+
if (isVertexMode) {
|
|
23521
|
+
let projectId = effectiveConfig.projectId || getEnvString("GOOGLE_CLOUD_PROJECT") || getEnvString("GOOGLE_PROJECT_ID") || this.env?.GOOGLE_CLOUD_PROJECT || this.env?.GOOGLE_PROJECT_ID;
|
|
23522
|
+
if (!projectId) try {
|
|
23523
|
+
projectId = await resolveProjectId(effectiveConfig, this.env);
|
|
23524
|
+
} catch {
|
|
23525
|
+
return { error: "Google Veo video generation via Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT or add `projectId` to the provider config, then run \"gcloud auth application-default login\"." };
|
|
23526
|
+
}
|
|
23527
|
+
effectiveConfig = {
|
|
23528
|
+
...effectiveConfig,
|
|
23529
|
+
vertexai: true,
|
|
23530
|
+
...projectId ? { projectId } : {}
|
|
23531
|
+
};
|
|
23532
|
+
} else if (!this.getApiKey(effectiveConfig)) try {
|
|
23533
|
+
const adcProjectId = await resolveProjectId(effectiveConfig, this.env);
|
|
23534
|
+
if (adcProjectId) {
|
|
23535
|
+
isVertexMode = true;
|
|
23536
|
+
effectiveConfig = {
|
|
23537
|
+
...effectiveConfig,
|
|
23538
|
+
vertexai: true,
|
|
23539
|
+
projectId: adcProjectId
|
|
23540
|
+
};
|
|
23541
|
+
} else return { error: "Google Veo video generation via Google AI Studio requires an API key. Set GOOGLE_API_KEY or GEMINI_API_KEY, or add `apiKey` to the provider config." };
|
|
23542
|
+
} catch {
|
|
23543
|
+
return { error: "Google Veo video generation via Google AI Studio requires an API key. Set GOOGLE_API_KEY or GEMINI_API_KEY, or add `apiKey` to the provider config." };
|
|
23544
|
+
}
|
|
23545
|
+
const model = effectiveConfig.model || this.modelName;
|
|
23546
|
+
const aspectRatio = effectiveConfig.aspectRatio || DEFAULT_ASPECT_RATIO$1;
|
|
23547
|
+
const resolution = effectiveConfig.resolution || DEFAULT_RESOLUTION$1;
|
|
23548
|
+
const durationSeconds = effectiveConfig.durationSeconds || effectiveConfig.duration || DEFAULT_DURATION$1;
|
|
23386
23549
|
const ratioValidation = validateAspectRatio$1(aspectRatio);
|
|
23387
23550
|
if (!ratioValidation.valid) return { error: ratioValidation.message };
|
|
23388
23551
|
const durationValidation = validateDuration$1(model, durationSeconds);
|
|
@@ -23392,7 +23555,7 @@ var GoogleVideoProvider = class {
|
|
|
23392
23555
|
const startTime = Date.now();
|
|
23393
23556
|
logger.info(`[Google Video] Creating video job for model ${model}...`);
|
|
23394
23557
|
const { operation: createdOp, error: createError } = await this.createVideoJob(prompt, {
|
|
23395
|
-
...
|
|
23558
|
+
...effectiveConfig,
|
|
23396
23559
|
aspectRatio,
|
|
23397
23560
|
resolution,
|
|
23398
23561
|
durationSeconds
|
|
@@ -23400,9 +23563,9 @@ var GoogleVideoProvider = class {
|
|
|
23400
23563
|
if (createError || !createdOp) return { error: createError || "Failed to create video job" };
|
|
23401
23564
|
const operationName = createdOp.name;
|
|
23402
23565
|
logger.info(`[Google Video] Video job created: ${operationName}`);
|
|
23403
|
-
const pollIntervalMs =
|
|
23404
|
-
const maxPollTimeMs =
|
|
23405
|
-
const { operation: completedOp, error: pollError } = await this.pollOperationStatus(operationName, pollIntervalMs, maxPollTimeMs);
|
|
23566
|
+
const pollIntervalMs = effectiveConfig.pollIntervalMs || DEFAULT_POLL_INTERVAL_MS$1;
|
|
23567
|
+
const maxPollTimeMs = effectiveConfig.maxPollTimeMs || DEFAULT_MAX_POLL_TIME_MS$1;
|
|
23568
|
+
const { operation: completedOp, error: pollError } = await this.pollOperationStatus(operationName, pollIntervalMs, maxPollTimeMs, effectiveConfig);
|
|
23406
23569
|
if (pollError || !completedOp) return { error: pollError || "Polling failed" };
|
|
23407
23570
|
let blobRef;
|
|
23408
23571
|
const base64Video = completedOp.response?.videos?.[0]?.bytesBase64Encoded;
|
|
@@ -23417,7 +23580,7 @@ var GoogleVideoProvider = class {
|
|
|
23417
23580
|
logger.debug(`[Google Video] Response: ${JSON.stringify(completedOp.response)}`);
|
|
23418
23581
|
return { error: "No video data in response" };
|
|
23419
23582
|
}
|
|
23420
|
-
const { blobRef: ref, error: downloadError } = await this.downloadVideoToBlob(videoUri);
|
|
23583
|
+
const { blobRef: ref, error: downloadError } = await this.downloadVideoToBlob(videoUri, effectiveConfig);
|
|
23421
23584
|
if (downloadError) return { error: downloadError };
|
|
23422
23585
|
blobRef = ref;
|
|
23423
23586
|
}
|
|
@@ -24107,13 +24270,22 @@ const ApiKeyAuthSchema = z.object({
|
|
|
24107
24270
|
placement: z.enum(["header", "query"]),
|
|
24108
24271
|
keyName: z.string()
|
|
24109
24272
|
});
|
|
24273
|
+
const FileAuthSchema = z.object({
|
|
24274
|
+
type: z.literal("file"),
|
|
24275
|
+
path: z.string().min(1)
|
|
24276
|
+
});
|
|
24110
24277
|
const AuthSchema = z.union([
|
|
24111
24278
|
OAuthClientCredentialsSchema,
|
|
24112
24279
|
OAuthPasswordSchema,
|
|
24113
24280
|
BasicAuthSchema,
|
|
24114
24281
|
BearerAuthSchema,
|
|
24115
|
-
ApiKeyAuthSchema
|
|
24282
|
+
ApiKeyAuthSchema,
|
|
24283
|
+
FileAuthSchema
|
|
24116
24284
|
]);
|
|
24285
|
+
const FileAuthResultSchema = z.object({
|
|
24286
|
+
token: z.string().min(1),
|
|
24287
|
+
expiration: z.number().finite().nullable().optional()
|
|
24288
|
+
});
|
|
24117
24289
|
/**
|
|
24118
24290
|
* Configuration for a separate session endpoint that must be called before the main API.
|
|
24119
24291
|
* The session endpoint returns a session ID that is then used in the main request.
|
|
@@ -24202,6 +24374,12 @@ async function loadTransformModule(transform) {
|
|
|
24202
24374
|
}
|
|
24203
24375
|
return transform;
|
|
24204
24376
|
}
|
|
24377
|
+
function hasOwnProperty(obj, key) {
|
|
24378
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
24379
|
+
}
|
|
24380
|
+
function parseFileAuthReference(filePath) {
|
|
24381
|
+
return filePath.startsWith("file://") ? parseFileUrl(filePath) : { filePath };
|
|
24382
|
+
}
|
|
24205
24383
|
async function createSessionParser(parser) {
|
|
24206
24384
|
if (!parser) return () => "";
|
|
24207
24385
|
if (typeof parser === "function") return (response) => parser(response);
|
|
@@ -24562,20 +24740,11 @@ var HttpProvider = class {
|
|
|
24562
24740
|
password: this.config.auth.password ? nunjucks.renderString(this.config.auth.password, vars) : void 0
|
|
24563
24741
|
} : baseConfig;
|
|
24564
24742
|
const now = Date.now();
|
|
24565
|
-
if (this.
|
|
24743
|
+
if (this.hasValidCachedToken(now)) {
|
|
24566
24744
|
logger.debug("[HTTP Provider Auth]: Using cached OAuth token");
|
|
24567
24745
|
return;
|
|
24568
24746
|
}
|
|
24569
|
-
if (this.tokenRefreshPromise != null)
|
|
24570
|
-
logger.debug("[HTTP Provider Auth]: Token refresh already in progress, waiting...");
|
|
24571
|
-
try {
|
|
24572
|
-
await this.tokenRefreshPromise;
|
|
24573
|
-
if (this.lastToken && this.lastTokenExpiresAt && Date.now() + 6e4 < this.lastTokenExpiresAt) return;
|
|
24574
|
-
logger.debug("[HTTP Provider Auth]: Token expired while waiting, refreshing again...");
|
|
24575
|
-
} catch {
|
|
24576
|
-
logger.debug("[HTTP Provider Auth]: Previous token refresh failed, retrying...");
|
|
24577
|
-
}
|
|
24578
|
-
}
|
|
24747
|
+
if (this.tokenRefreshPromise != null && await this.waitForInFlightTokenRefresh()) return;
|
|
24579
24748
|
logger.debug("[HTTP Provider Auth]: Refreshing OAuth token");
|
|
24580
24749
|
const refreshPromise = this.performTokenRefresh(oauthConfig, now);
|
|
24581
24750
|
this.tokenRefreshPromise = refreshPromise;
|
|
@@ -24604,7 +24773,7 @@ var HttpProvider = class {
|
|
|
24604
24773
|
body: tokenRequestBody.toString()
|
|
24605
24774
|
};
|
|
24606
24775
|
if (httpsAgent) fetchOptions.dispatcher = httpsAgent;
|
|
24607
|
-
const response = await fetchWithCache(oauthConfig.tokenUrl, fetchOptions, REQUEST_TIMEOUT_MS, "text", true, 0);
|
|
24776
|
+
const response = await fetchWithCache(oauthConfig.tokenUrl, fetchOptions, REQUEST_TIMEOUT_MS$1, "text", true, 0);
|
|
24608
24777
|
if (response.status < 200 || response.status >= 300) throw new Error(`OAuth token request failed with status ${response.status} ${response.statusText}: ${response.data}`);
|
|
24609
24778
|
const tokenData = JSON.parse(response.data);
|
|
24610
24779
|
if (!tokenData.access_token) throw new Error("OAuth token response missing access_token");
|
|
@@ -24617,6 +24786,70 @@ var HttpProvider = class {
|
|
|
24617
24786
|
}
|
|
24618
24787
|
invariant(this.lastToken, "OAuth token should be defined at this point");
|
|
24619
24788
|
}
|
|
24789
|
+
hasValidCachedToken(now = Date.now()) {
|
|
24790
|
+
if (!this.lastToken) return false;
|
|
24791
|
+
if (this.lastTokenExpiresAt == null) return this.config.auth?.type === "file";
|
|
24792
|
+
return now + TOKEN_REFRESH_BUFFER_MS < this.lastTokenExpiresAt;
|
|
24793
|
+
}
|
|
24794
|
+
async waitForInFlightTokenRefresh() {
|
|
24795
|
+
if (this.tokenRefreshPromise == null) return false;
|
|
24796
|
+
logger.debug("[HTTP Provider Auth]: Token refresh already in progress, waiting...");
|
|
24797
|
+
try {
|
|
24798
|
+
await this.tokenRefreshPromise;
|
|
24799
|
+
if (this.hasValidCachedToken()) return true;
|
|
24800
|
+
logger.debug("[HTTP Provider Auth]: Token expired while waiting, refreshing again...");
|
|
24801
|
+
} catch {
|
|
24802
|
+
logger.debug("[HTTP Provider Auth]: Previous token refresh failed, retrying...");
|
|
24803
|
+
}
|
|
24804
|
+
return false;
|
|
24805
|
+
}
|
|
24806
|
+
async refreshFileTokenIfNeeded(prompt, vars, context) {
|
|
24807
|
+
if (!this.config.auth || this.config.auth.type !== "file") {
|
|
24808
|
+
logger.debug("[HTTP Provider Auth]: No file auth configured");
|
|
24809
|
+
return;
|
|
24810
|
+
}
|
|
24811
|
+
if (this.hasValidCachedToken()) {
|
|
24812
|
+
logger.debug("[HTTP Provider Auth]: Using cached file auth token");
|
|
24813
|
+
return;
|
|
24814
|
+
}
|
|
24815
|
+
if (this.tokenRefreshPromise != null && await this.waitForInFlightTokenRefresh()) return;
|
|
24816
|
+
logger.debug("[HTTP Provider Auth]: Refreshing file auth token");
|
|
24817
|
+
const refreshPromise = this.performFileTokenRefresh(prompt, vars, context);
|
|
24818
|
+
this.tokenRefreshPromise = refreshPromise;
|
|
24819
|
+
try {
|
|
24820
|
+
await refreshPromise;
|
|
24821
|
+
} finally {
|
|
24822
|
+
if (this.tokenRefreshPromise === refreshPromise) this.tokenRefreshPromise = void 0;
|
|
24823
|
+
}
|
|
24824
|
+
}
|
|
24825
|
+
async performFileTokenRefresh(prompt, vars, context) {
|
|
24826
|
+
invariant(this.config.auth?.type === "file", "File auth should be configured");
|
|
24827
|
+
const { filePath, functionName } = parseFileAuthReference(this.config.auth.path);
|
|
24828
|
+
const defaultFunctionName = filePath.endsWith(".py") ? "get_auth" : "default";
|
|
24829
|
+
const authContext = {
|
|
24830
|
+
...context ?? {},
|
|
24831
|
+
prompt: context?.prompt ?? {
|
|
24832
|
+
raw: prompt,
|
|
24833
|
+
label: prompt
|
|
24834
|
+
},
|
|
24835
|
+
vars
|
|
24836
|
+
};
|
|
24837
|
+
try {
|
|
24838
|
+
const authFn = await loadFunction({
|
|
24839
|
+
filePath,
|
|
24840
|
+
functionName,
|
|
24841
|
+
defaultFunctionName
|
|
24842
|
+
});
|
|
24843
|
+
const result = FileAuthResultSchema.parse(await authFn(authContext));
|
|
24844
|
+
this.lastToken = result.token;
|
|
24845
|
+
this.lastTokenExpiresAt = result.expiration ?? void 0;
|
|
24846
|
+
logger.debug("[HTTP Provider Auth]: Successfully refreshed file auth token");
|
|
24847
|
+
} catch (err) {
|
|
24848
|
+
logger.error(`[HTTP Provider Auth]: Failed to refresh file auth token: ${String(err)}`);
|
|
24849
|
+
throw new Error(`Failed to refresh file auth token: ${String(err)}`);
|
|
24850
|
+
}
|
|
24851
|
+
invariant(this.lastToken, "File auth token should be defined at this point");
|
|
24852
|
+
}
|
|
24620
24853
|
async refreshSignatureIfNeeded(vars) {
|
|
24621
24854
|
if (!this.config.signatureAuth) {
|
|
24622
24855
|
logger.debug("[HTTP Provider Auth]: No signature auth configured");
|
|
@@ -24697,7 +24930,7 @@ var HttpProvider = class {
|
|
|
24697
24930
|
};
|
|
24698
24931
|
if (body) fetchOptions.body = body;
|
|
24699
24932
|
if (httpsAgent) fetchOptions.dispatcher = httpsAgent;
|
|
24700
|
-
const response = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS, "text", true, this.config.maxRetries);
|
|
24933
|
+
const response = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS$1, "text", true, this.config.maxRetries);
|
|
24701
24934
|
if (response.status < 200 || response.status >= 300) throw new Error(`Session endpoint request failed with status ${response.status} ${response.statusText}: ${response.data}`);
|
|
24702
24935
|
const rawText = response.data;
|
|
24703
24936
|
let parsedData;
|
|
@@ -24798,12 +25031,21 @@ var HttpProvider = class {
|
|
|
24798
25031
|
...context?.vars || {},
|
|
24799
25032
|
prompt,
|
|
24800
25033
|
...context?.evaluationId ? { evaluationId: context.evaluationId } : {},
|
|
24801
|
-
...transformedTools
|
|
24802
|
-
...transformedToolChoice
|
|
25034
|
+
...transformedTools === void 0 ? {} : { tools: serializeForTemplate(transformedTools) },
|
|
25035
|
+
...transformedToolChoice === void 0 ? {} : { tool_choice: serializeForTemplate(transformedToolChoice) }
|
|
24803
25036
|
};
|
|
24804
25037
|
if (this.config.auth?.type === "oauth") {
|
|
24805
25038
|
await this.refreshOAuthTokenIfNeeded(vars);
|
|
24806
25039
|
invariant(this.lastToken, "OAuth token should be defined at this point");
|
|
25040
|
+
if (hasOwnProperty(vars, "token")) logger.warn("[HTTP Provider Auth]: `token` is already defined in vars and will be overwritten");
|
|
25041
|
+
vars.token = this.lastToken;
|
|
25042
|
+
} else if (this.config.auth?.type === "file") {
|
|
25043
|
+
await this.refreshFileTokenIfNeeded(prompt, vars, context);
|
|
25044
|
+
invariant(this.lastToken, "File auth token should be defined at this point");
|
|
25045
|
+
if (hasOwnProperty(vars, "token")) logger.warn("[HTTP Provider Auth]: `token` is already defined in vars and will be overwritten");
|
|
25046
|
+
if (hasOwnProperty(vars, "expiration")) logger.warn("[HTTP Provider Auth]: `expiration` is already defined in vars and will be overwritten");
|
|
25047
|
+
vars.token = this.lastToken;
|
|
25048
|
+
vars.expiration = this.lastTokenExpiresAt;
|
|
24807
25049
|
}
|
|
24808
25050
|
if (this.config.signatureAuth) {
|
|
24809
25051
|
await this.refreshSignatureIfNeeded(vars);
|
|
@@ -24873,7 +25115,7 @@ var HttpProvider = class {
|
|
|
24873
25115
|
}
|
|
24874
25116
|
let data, cached = false, status, statusText, responseHeaders, latencyMs;
|
|
24875
25117
|
try {
|
|
24876
|
-
({data, cached, status, statusText, headers: responseHeaders, latencyMs} = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS, "text", context?.bustCache ?? context?.debug, this.config.maxRetries));
|
|
25118
|
+
({data, cached, status, statusText, headers: responseHeaders, latencyMs} = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS$1, "text", context?.bustCache ?? context?.debug, this.config.maxRetries));
|
|
24877
25119
|
} catch (err) {
|
|
24878
25120
|
throw err;
|
|
24879
25121
|
}
|
|
@@ -24991,7 +25233,7 @@ var HttpProvider = class {
|
|
|
24991
25233
|
}
|
|
24992
25234
|
let data, cached = false, status, statusText, responseHeaders, latencyMs;
|
|
24993
25235
|
try {
|
|
24994
|
-
({data, cached, status, statusText, headers: responseHeaders, latencyMs} = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS, "text", context?.bustCache ?? context?.debug, this.config.maxRetries));
|
|
25236
|
+
({data, cached, status, statusText, headers: responseHeaders, latencyMs} = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS$1, "text", context?.bustCache ?? context?.debug, this.config.maxRetries));
|
|
24995
25237
|
} catch (err) {
|
|
24996
25238
|
throw err;
|
|
24997
25239
|
}
|
|
@@ -25238,7 +25480,7 @@ var HuggingfaceTextGenerationProvider = class {
|
|
|
25238
25480
|
...this.getApiKey() ? { Authorization: `Bearer ${this.getApiKey()}` } : {}
|
|
25239
25481
|
},
|
|
25240
25482
|
body: JSON.stringify(params)
|
|
25241
|
-
}, REQUEST_TIMEOUT_MS);
|
|
25483
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
25242
25484
|
logger.debug("Huggingface Inference API response", { data: response.data });
|
|
25243
25485
|
if (response.data.error) return { error: `API call error: ${response.data.error}` };
|
|
25244
25486
|
if (!response.data[0] && !response.data.generated_text) return { error: `Malformed response data: ${response.data}` };
|
|
@@ -25280,7 +25522,7 @@ var HuggingfaceTextClassificationProvider = class {
|
|
|
25280
25522
|
...this.getApiKey() ? { Authorization: `Bearer ${this.getApiKey()}` } : {}
|
|
25281
25523
|
},
|
|
25282
25524
|
body: JSON.stringify(params)
|
|
25283
|
-
}, REQUEST_TIMEOUT_MS);
|
|
25525
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
25284
25526
|
if (response.data.error) return { error: `API call error: ${response.data.error}` };
|
|
25285
25527
|
if (!response.data[0] || !Array.isArray(response.data[0])) return { error: `Malformed response data: ${response.data}` };
|
|
25286
25528
|
const scores = {};
|
|
@@ -25343,7 +25585,7 @@ var HuggingfaceFeatureExtractionProvider = class {
|
|
|
25343
25585
|
...this.getApiKey() ? { Authorization: `Bearer ${this.getApiKey()}` } : {}
|
|
25344
25586
|
},
|
|
25345
25587
|
body: JSON.stringify(params)
|
|
25346
|
-
}, REQUEST_TIMEOUT_MS);
|
|
25588
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
25347
25589
|
if (typeof response.data === "object" && "error" in response.data) return { error: `API call error: ${response.data.error}` };
|
|
25348
25590
|
if (!Array.isArray(response.data)) return { error: `Malformed response data: ${response.data}` };
|
|
25349
25591
|
return { embedding: response.data };
|
|
@@ -25393,7 +25635,7 @@ var HuggingfaceSentenceSimilarityProvider = class {
|
|
|
25393
25635
|
...this.getApiKey() ? { Authorization: `Bearer ${this.getApiKey()}` } : {}
|
|
25394
25636
|
},
|
|
25395
25637
|
body: JSON.stringify(params)
|
|
25396
|
-
}, REQUEST_TIMEOUT_MS);
|
|
25638
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
25397
25639
|
if (typeof response.data === "object" && "error" in response.data) return { error: `API call error: ${response.data.error}` };
|
|
25398
25640
|
if (!Array.isArray(response.data)) return { error: `Malformed response data: ${response.data}` };
|
|
25399
25641
|
return { similarity: response.data[0] };
|
|
@@ -25435,7 +25677,7 @@ var HuggingfaceTokenExtractionProvider = class {
|
|
|
25435
25677
|
...this.getApiKey() ? { Authorization: `Bearer ${this.getApiKey()}` } : {}
|
|
25436
25678
|
},
|
|
25437
25679
|
body: JSON.stringify(params)
|
|
25438
|
-
}, REQUEST_TIMEOUT_MS);
|
|
25680
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
25439
25681
|
if (typeof response.data === "object" && "error" in response.data) return { error: `API call error: ${response.data.error}` };
|
|
25440
25682
|
if (!Array.isArray(response.data)) return { error: `Malformed response data: ${response.data}` };
|
|
25441
25683
|
const classification = {};
|
|
@@ -25514,7 +25756,7 @@ var LlamaProvider = class {
|
|
|
25514
25756
|
method: "POST",
|
|
25515
25757
|
headers: { "Content-Type": "application/json" },
|
|
25516
25758
|
body: JSON.stringify(body)
|
|
25517
|
-
}, REQUEST_TIMEOUT_MS));
|
|
25759
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
25518
25760
|
} catch (err) {
|
|
25519
25761
|
return { error: `API call error: ${String(err)}` };
|
|
25520
25762
|
}
|
|
@@ -25640,13 +25882,20 @@ function createLlamaApiProvider(providerPath, options = {}) {
|
|
|
25640
25882
|
}
|
|
25641
25883
|
//#endregion
|
|
25642
25884
|
//#region src/providers/localai.ts
|
|
25885
|
+
function parseEnvFloat(value) {
|
|
25886
|
+
if (value === void 0) return;
|
|
25887
|
+
const parsed = Number.parseFloat(value);
|
|
25888
|
+
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
25889
|
+
}
|
|
25643
25890
|
var LocalAiGenericProvider = class {
|
|
25644
25891
|
modelName;
|
|
25645
25892
|
apiBaseUrl;
|
|
25646
25893
|
config;
|
|
25894
|
+
env;
|
|
25647
25895
|
constructor(modelName, options = {}) {
|
|
25648
25896
|
const { id, config, env } = options;
|
|
25649
25897
|
this.modelName = modelName;
|
|
25898
|
+
this.env = env;
|
|
25650
25899
|
this.apiBaseUrl = config?.apiBaseUrl || env?.LOCALAI_BASE_URL || getEnvString("LOCALAI_BASE_URL") || "http://localhost:8080/v1";
|
|
25651
25900
|
this.config = config || {};
|
|
25652
25901
|
this.id = id ? () => id : this.id;
|
|
@@ -25670,7 +25919,7 @@ var LocalAiChatProvider = class extends LocalAiGenericProvider {
|
|
|
25670
25919
|
const body = {
|
|
25671
25920
|
model: this.modelName,
|
|
25672
25921
|
messages,
|
|
25673
|
-
temperature: this.config.temperature
|
|
25922
|
+
temperature: this.config.temperature ?? parseEnvFloat(this.env?.LOCALAI_TEMPERATURE) ?? getEnvFloat("LOCALAI_TEMPERATURE") ?? .7
|
|
25674
25923
|
};
|
|
25675
25924
|
let data;
|
|
25676
25925
|
try {
|
|
@@ -25678,7 +25927,7 @@ var LocalAiChatProvider = class extends LocalAiGenericProvider {
|
|
|
25678
25927
|
method: "POST",
|
|
25679
25928
|
headers: { "Content-Type": "application/json" },
|
|
25680
25929
|
body: JSON.stringify(body)
|
|
25681
|
-
}, REQUEST_TIMEOUT_MS));
|
|
25930
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
25682
25931
|
} catch (err) {
|
|
25683
25932
|
return { error: `API call error: ${String(err)}` };
|
|
25684
25933
|
}
|
|
@@ -25701,7 +25950,7 @@ var LocalAiEmbeddingProvider = class extends LocalAiGenericProvider {
|
|
|
25701
25950
|
method: "POST",
|
|
25702
25951
|
headers: { "Content-Type": "application/json" },
|
|
25703
25952
|
body: JSON.stringify(body)
|
|
25704
|
-
}, REQUEST_TIMEOUT_MS));
|
|
25953
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
25705
25954
|
} catch (err) {
|
|
25706
25955
|
return { error: `API call error: ${String(err)}` };
|
|
25707
25956
|
}
|
|
@@ -25719,7 +25968,7 @@ var LocalAiCompletionProvider = class extends LocalAiGenericProvider {
|
|
|
25719
25968
|
const body = {
|
|
25720
25969
|
model: this.modelName,
|
|
25721
25970
|
prompt,
|
|
25722
|
-
temperature: this.config.temperature
|
|
25971
|
+
temperature: this.config.temperature ?? parseEnvFloat(this.env?.LOCALAI_TEMPERATURE) ?? getEnvFloat("LOCALAI_TEMPERATURE") ?? .7
|
|
25723
25972
|
};
|
|
25724
25973
|
let data;
|
|
25725
25974
|
try {
|
|
@@ -25727,7 +25976,7 @@ var LocalAiCompletionProvider = class extends LocalAiGenericProvider {
|
|
|
25727
25976
|
method: "POST",
|
|
25728
25977
|
headers: { "Content-Type": "application/json" },
|
|
25729
25978
|
body: JSON.stringify(body)
|
|
25730
|
-
}, REQUEST_TIMEOUT_MS));
|
|
25979
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
25731
25980
|
} catch (err) {
|
|
25732
25981
|
return { error: `API call error: ${String(err)}` };
|
|
25733
25982
|
}
|
|
@@ -25969,7 +26218,7 @@ var NscaleImageProvider = class NscaleImageProvider extends OpenAiImageProvider
|
|
|
25969
26218
|
let data, status, statusText;
|
|
25970
26219
|
let cached = false;
|
|
25971
26220
|
try {
|
|
25972
|
-
({data, cached, status, statusText} = await callOpenAiImageApi(`${this.getApiUrl()}${endpoint}`, body, headers, REQUEST_TIMEOUT_MS));
|
|
26221
|
+
({data, cached, status, statusText} = await callOpenAiImageApi(`${this.getApiUrl()}${endpoint}`, body, headers, REQUEST_TIMEOUT_MS$1));
|
|
25973
26222
|
if (status < 200 || status >= 300) return { error: `API error: ${status} ${statusText}\n${typeof data === "string" ? data : JSON.stringify(data)}` };
|
|
25974
26223
|
} catch (err) {
|
|
25975
26224
|
logger.error(`API call error: ${String(err)}`);
|
|
@@ -26137,7 +26386,7 @@ var OllamaCompletionProvider = class {
|
|
|
26137
26386
|
if (OllamaCompletionOptionKeys.has(optionName) && optionName !== "think" && optionName !== "tools" && optionName !== "passthrough") options[optionName] = this.config[optionName];
|
|
26138
26387
|
return options;
|
|
26139
26388
|
}, {}),
|
|
26140
|
-
...this.config.think
|
|
26389
|
+
...this.config.think === void 0 ? {} : { think: this.config.think },
|
|
26141
26390
|
...this.config.passthrough || {}
|
|
26142
26391
|
};
|
|
26143
26392
|
if (this.config.think !== void 0) params.think = this.config.think;
|
|
@@ -26151,7 +26400,7 @@ var OllamaCompletionProvider = class {
|
|
|
26151
26400
|
...getEnvString("OLLAMA_API_KEY") ? { Authorization: `Bearer ${getEnvString("OLLAMA_API_KEY")}` } : {}
|
|
26152
26401
|
},
|
|
26153
26402
|
body: JSON.stringify(params)
|
|
26154
|
-
}, REQUEST_TIMEOUT_MS, "text");
|
|
26403
|
+
}, REQUEST_TIMEOUT_MS$1, "text");
|
|
26155
26404
|
} catch (err) {
|
|
26156
26405
|
return { error: `API call error: ${String(err)}. Output:\n${response?.data}` };
|
|
26157
26406
|
}
|
|
@@ -26236,7 +26485,7 @@ var OllamaChatProvider = class {
|
|
|
26236
26485
|
if (OllamaCompletionOptionKeys.has(optionName) && optionName !== "tools") options[optionName] = this.config[optionName];
|
|
26237
26486
|
return options;
|
|
26238
26487
|
}, {}),
|
|
26239
|
-
...this.config.think
|
|
26488
|
+
...this.config.think === void 0 ? {} : { think: this.config.think },
|
|
26240
26489
|
...this.config.passthrough || {}
|
|
26241
26490
|
};
|
|
26242
26491
|
if (this.config.tools) {
|
|
@@ -26253,7 +26502,7 @@ var OllamaChatProvider = class {
|
|
|
26253
26502
|
...getEnvString("OLLAMA_API_KEY") ? { Authorization: `Bearer ${getEnvString("OLLAMA_API_KEY")}` } : {}
|
|
26254
26503
|
},
|
|
26255
26504
|
body: JSON.stringify(params)
|
|
26256
|
-
}, REQUEST_TIMEOUT_MS, "text", context?.bustCache ?? context?.debug);
|
|
26505
|
+
}, REQUEST_TIMEOUT_MS$1, "text", context?.bustCache ?? context?.debug);
|
|
26257
26506
|
} catch (err) {
|
|
26258
26507
|
return { error: `API call error: ${String(err)}. Output:\n${response?.data}` };
|
|
26259
26508
|
}
|
|
@@ -26321,7 +26570,7 @@ var OllamaEmbeddingProvider = class extends OllamaCompletionProvider {
|
|
|
26321
26570
|
...getEnvString("OLLAMA_API_KEY") ? { Authorization: `Bearer ${getEnvString("OLLAMA_API_KEY")}` } : {}
|
|
26322
26571
|
},
|
|
26323
26572
|
body: JSON.stringify(params)
|
|
26324
|
-
}, REQUEST_TIMEOUT_MS, "json");
|
|
26573
|
+
}, REQUEST_TIMEOUT_MS$1, "json");
|
|
26325
26574
|
} catch (err) {
|
|
26326
26575
|
return { error: `API call error: ${String(err)}` };
|
|
26327
26576
|
}
|
|
@@ -26445,7 +26694,7 @@ var OpenAiAssistantProvider = class extends OpenAiGenericProvider {
|
|
|
26445
26694
|
organization: this.getOrganization(),
|
|
26446
26695
|
baseURL: this.getApiUrl(),
|
|
26447
26696
|
maxRetries: 3,
|
|
26448
|
-
timeout: REQUEST_TIMEOUT_MS,
|
|
26697
|
+
timeout: REQUEST_TIMEOUT_MS$1,
|
|
26449
26698
|
defaultHeaders: this.assistantConfig.headers
|
|
26450
26699
|
});
|
|
26451
26700
|
const messages = parseChatPrompt(prompt, [{
|
|
@@ -27578,7 +27827,12 @@ const SORA_COSTS = {
|
|
|
27578
27827
|
/**
|
|
27579
27828
|
* Valid video sizes (aspect ratios) for OpenAI Sora
|
|
27580
27829
|
*/
|
|
27581
|
-
const VALID_VIDEO_SIZES = [
|
|
27830
|
+
const VALID_VIDEO_SIZES = [
|
|
27831
|
+
"1280x720",
|
|
27832
|
+
"720x1280",
|
|
27833
|
+
"1792x1024",
|
|
27834
|
+
"1024x1792"
|
|
27835
|
+
];
|
|
27582
27836
|
/**
|
|
27583
27837
|
* Valid video durations in seconds for OpenAI Sora
|
|
27584
27838
|
*/
|
|
@@ -27746,7 +28000,7 @@ var OpenAiVideoProvider = class extends OpenAiGenericProvider {
|
|
|
27746
28000
|
* Download video content and store in media storage
|
|
27747
28001
|
*/
|
|
27748
28002
|
async downloadVideoContent(soraVideoId, variant, cacheKey, evalId) {
|
|
27749
|
-
const url = `${this.getApiUrl()}/videos/${soraVideoId}/content${variant
|
|
28003
|
+
const url = `${this.getApiUrl()}/videos/${soraVideoId}/content${variant === "video" ? "" : `?variant=${variant}`}`;
|
|
27750
28004
|
const headers = this.getAuthHeaders();
|
|
27751
28005
|
try {
|
|
27752
28006
|
const response = await fetchWithProxy(url, {
|
|
@@ -27976,7 +28230,7 @@ var OpenRouterProvider = class extends OpenAiChatCompletionProvider {
|
|
|
27976
28230
|
...config.headers
|
|
27977
28231
|
},
|
|
27978
28232
|
body: JSON.stringify(body)
|
|
27979
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug));
|
|
28233
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug));
|
|
27980
28234
|
if (status < 200 || status >= 300) return { error: `API error: ${status} ${statusText}\n${typeof data === "string" ? data : JSON.stringify(data)}` };
|
|
27981
28235
|
} catch (err) {
|
|
27982
28236
|
logger.error(`API call error: ${String(err)}`);
|
|
@@ -28243,7 +28497,7 @@ var PythonWorker = class {
|
|
|
28243
28497
|
maxCrashes = 3;
|
|
28244
28498
|
pendingRequest = null;
|
|
28245
28499
|
requestTimeout = null;
|
|
28246
|
-
constructor(scriptPath, functionName, pythonPath, timeout = REQUEST_TIMEOUT_MS, onReady) {
|
|
28500
|
+
constructor(scriptPath, functionName, pythonPath, timeout = REQUEST_TIMEOUT_MS$1, onReady) {
|
|
28247
28501
|
this.scriptPath = scriptPath;
|
|
28248
28502
|
this.functionName = functionName;
|
|
28249
28503
|
this.pythonPath = pythonPath;
|
|
@@ -28784,7 +29038,7 @@ var ReplicateProvider = class {
|
|
|
28784
29038
|
providerId: this.id(),
|
|
28785
29039
|
temperature: this.config.temperature,
|
|
28786
29040
|
topP: this.config.top_p,
|
|
28787
|
-
maxTokens: this.config.max_tokens
|
|
29041
|
+
maxTokens: this.config.max_tokens ?? this.config.max_length ?? this.config.max_new_tokens,
|
|
28788
29042
|
testIndex: context?.test?.vars?.__testIdx,
|
|
28789
29043
|
promptLabel: context?.prompt?.label,
|
|
28790
29044
|
traceparent: context?.traceparent
|
|
@@ -28828,14 +29082,14 @@ var ReplicateProvider = class {
|
|
|
28828
29082
|
let response;
|
|
28829
29083
|
try {
|
|
28830
29084
|
const inputOptions = {
|
|
28831
|
-
max_length: this.config.max_length
|
|
28832
|
-
max_new_tokens: this.config.max_new_tokens
|
|
28833
|
-
temperature: this.config.temperature
|
|
28834
|
-
top_p: this.config.top_p
|
|
28835
|
-
top_k: this.config.top_k
|
|
28836
|
-
repetition_penalty: this.config.repetition_penalty
|
|
28837
|
-
stop_sequences: this.config.stop_sequences
|
|
28838
|
-
seed: this.config.seed
|
|
29085
|
+
max_length: this.config.max_length ?? getEnvInt("REPLICATE_MAX_LENGTH"),
|
|
29086
|
+
max_new_tokens: this.config.max_new_tokens ?? getEnvInt("REPLICATE_MAX_NEW_TOKENS"),
|
|
29087
|
+
temperature: this.config.temperature ?? getEnvFloat("REPLICATE_TEMPERATURE"),
|
|
29088
|
+
top_p: this.config.top_p ?? getEnvFloat("REPLICATE_TOP_P"),
|
|
29089
|
+
top_k: this.config.top_k ?? getEnvInt("REPLICATE_TOP_K"),
|
|
29090
|
+
repetition_penalty: this.config.repetition_penalty ?? getEnvFloat("REPLICATE_REPETITION_PENALTY"),
|
|
29091
|
+
stop_sequences: this.config.stop_sequences ?? getEnvString("REPLICATE_STOP_SEQUENCES"),
|
|
29092
|
+
seed: this.config.seed ?? getEnvInt("REPLICATE_SEED"),
|
|
28839
29093
|
system_prompt: systemPrompt,
|
|
28840
29094
|
prompt: userPrompt
|
|
28841
29095
|
};
|
|
@@ -28854,7 +29108,7 @@ var ReplicateProvider = class {
|
|
|
28854
29108
|
Prefer: "wait=60"
|
|
28855
29109
|
},
|
|
28856
29110
|
body: JSON.stringify(data)
|
|
28857
|
-
}, REQUEST_TIMEOUT_MS, "json")).data;
|
|
29111
|
+
}, REQUEST_TIMEOUT_MS$1, "json")).data;
|
|
28858
29112
|
if (response.status === "starting" || response.status === "processing") response = await this.pollForCompletion(response.id);
|
|
28859
29113
|
if (response.status === "failed") throw new Error(response.error || "Prediction failed");
|
|
28860
29114
|
response = response.output;
|
|
@@ -28890,7 +29144,7 @@ var ReplicateProvider = class {
|
|
|
28890
29144
|
const prediction = (await fetchWithCache(`https://api.replicate.com/v1/predictions/${predictionId}`, {
|
|
28891
29145
|
method: "GET",
|
|
28892
29146
|
headers: { Authorization: `Bearer ${this.apiKey}` }
|
|
28893
|
-
}, REQUEST_TIMEOUT_MS, "json", false)).data;
|
|
29147
|
+
}, REQUEST_TIMEOUT_MS$1, "json", false)).data;
|
|
28894
29148
|
if (prediction.status === "succeeded" || prediction.status === "failed" || prediction.status === "canceled") return prediction;
|
|
28895
29149
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
28896
29150
|
}
|
|
@@ -28982,7 +29236,7 @@ var ReplicateImageProvider = class extends ReplicateProvider {
|
|
|
28982
29236
|
Prefer: "wait=60"
|
|
28983
29237
|
},
|
|
28984
29238
|
body: JSON.stringify(data)
|
|
28985
|
-
}, REQUEST_TIMEOUT_MS, "json")).data;
|
|
29239
|
+
}, REQUEST_TIMEOUT_MS$1, "json")).data;
|
|
28986
29240
|
logger.debug(`Initial prediction status: ${prediction.status}, ID: ${prediction.id}`);
|
|
28987
29241
|
if (prediction.status === "starting" || prediction.status === "processing") prediction = await this.pollForCompletion(prediction.id);
|
|
28988
29242
|
logger.debug(`Final prediction status: ${prediction.status}, output: ${JSON.stringify(prediction.output)}`);
|
|
@@ -29409,7 +29663,7 @@ var SnowflakeCortexProvider = class extends OpenAiChatCompletionProvider {
|
|
|
29409
29663
|
...config.headers
|
|
29410
29664
|
},
|
|
29411
29665
|
body: JSON.stringify(body)
|
|
29412
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug));
|
|
29666
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug));
|
|
29413
29667
|
if (status < 200 || status >= 300) return { error: `API error: ${status} ${statusText}\n${typeof data === "string" ? data : JSON.stringify(data)}` };
|
|
29414
29668
|
} catch (err) {
|
|
29415
29669
|
logger.error(`[Snowflake Cortex] API call error: ${String(err)}`);
|
|
@@ -29824,7 +30078,7 @@ function createTrueFoundryProvider(providerPath, options = {}) {
|
|
|
29824
30078
|
}
|
|
29825
30079
|
//#endregion
|
|
29826
30080
|
//#region src/providers/vercel.ts
|
|
29827
|
-
const DEFAULT_TIMEOUT_MS = REQUEST_TIMEOUT_MS;
|
|
30081
|
+
const DEFAULT_TIMEOUT_MS = REQUEST_TIMEOUT_MS$1;
|
|
29828
30082
|
/**
|
|
29829
30083
|
* Resolves the API key from config, environment variables, or defaults.
|
|
29830
30084
|
*/
|
|
@@ -30225,7 +30479,7 @@ var VoyageEmbeddingProvider = class {
|
|
|
30225
30479
|
...this.config.headers
|
|
30226
30480
|
},
|
|
30227
30481
|
body: JSON.stringify(body)
|
|
30228
|
-
}, REQUEST_TIMEOUT_MS));
|
|
30482
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
30229
30483
|
} catch (err) {
|
|
30230
30484
|
logger.error(`API call error: ${err}`);
|
|
30231
30485
|
throw err;
|
|
@@ -30335,7 +30589,7 @@ function generateConfigHash(config) {
|
|
|
30335
30589
|
}
|
|
30336
30590
|
async function fetchModelSpecs() {
|
|
30337
30591
|
try {
|
|
30338
|
-
const { data, cached: _cached, latencyMs: _latencyMs } = await fetchWithCache("https://us-south.ml.cloud.ibm.com/ml/v1/foundation_model_specs?version=2023-09-30", { headers: { "Content-Type": "application/json" } }, REQUEST_TIMEOUT_MS);
|
|
30592
|
+
const { data, cached: _cached, latencyMs: _latencyMs } = await fetchWithCache("https://us-south.ml.cloud.ibm.com/ml/v1/foundation_model_specs?version=2023-09-30", { headers: { "Content-Type": "application/json" } }, REQUEST_TIMEOUT_MS$1);
|
|
30339
30593
|
return (typeof data === "string" ? JSON.parse(data) : data)?.resources || [];
|
|
30340
30594
|
} catch (error) {
|
|
30341
30595
|
logger.error(`Failed to fetch model specs: ${error}`);
|
|
@@ -30634,7 +30888,7 @@ var WebhookProvider = class {
|
|
|
30634
30888
|
method: "POST",
|
|
30635
30889
|
headers: { "Content-Type": "application/json" },
|
|
30636
30890
|
body: JSON.stringify(params)
|
|
30637
|
-
}, REQUEST_TIMEOUT_MS, "json"));
|
|
30891
|
+
}, REQUEST_TIMEOUT_MS$1, "json"));
|
|
30638
30892
|
} catch (err) {
|
|
30639
30893
|
return { error: `Webhook call error: ${String(err)}` };
|
|
30640
30894
|
}
|
|
@@ -30712,7 +30966,7 @@ var WebSocketProvider = class {
|
|
|
30712
30966
|
constructor(url, options) {
|
|
30713
30967
|
this.config = options.config;
|
|
30714
30968
|
this.url = this.config.url || url;
|
|
30715
|
-
this.timeoutMs = this.config.timeoutMs || REQUEST_TIMEOUT_MS;
|
|
30969
|
+
this.timeoutMs = this.config.timeoutMs || REQUEST_TIMEOUT_MS$1;
|
|
30716
30970
|
this.transformResponse = createTransformResponse(this.config.transformResponse || this.config.responseParser);
|
|
30717
30971
|
this.streamResponse = this.config.streamResponse ? createStreamResponse(this.config.streamResponse) : void 0;
|
|
30718
30972
|
invariant(this.config.messageTemplate, `Expected WebSocket provider ${this.url} to have a config containing {messageTemplate}, but got ${safeJsonStringify(this.config)}`);
|
|
@@ -30729,7 +30983,7 @@ var WebSocketProvider = class {
|
|
|
30729
30983
|
prompt
|
|
30730
30984
|
};
|
|
30731
30985
|
const message = nunjucks.renderString(this.config.messageTemplate, vars);
|
|
30732
|
-
const streamResponse = this.streamResponse
|
|
30986
|
+
const streamResponse = this.streamResponse == null ? void 0 : await this.streamResponse;
|
|
30733
30987
|
logger.debug(`Sending WebSocket message to ${this.url}: ${message}`);
|
|
30734
30988
|
let accumulator = { error: "unknown error occurred" };
|
|
30735
30989
|
return new Promise((resolve, reject) => {
|
|
@@ -31167,7 +31421,7 @@ var XAIImageProvider = class extends OpenAiImageProvider {
|
|
|
31167
31421
|
let cached = false;
|
|
31168
31422
|
let latencyMs;
|
|
31169
31423
|
try {
|
|
31170
|
-
({data, cached, status, statusText, latencyMs} = await callOpenAiImageApi(`${this.getApiUrl()}${endpoint}`, body, headers, REQUEST_TIMEOUT_MS));
|
|
31424
|
+
({data, cached, status, statusText, latencyMs} = await callOpenAiImageApi(`${this.getApiUrl()}${endpoint}`, body, headers, REQUEST_TIMEOUT_MS$1));
|
|
31171
31425
|
if (status < 200 || status >= 300) return { error: `API error: ${status} ${statusText}\n${typeof data === "string" ? data : JSON.stringify(data)}` };
|
|
31172
31426
|
} catch (err) {
|
|
31173
31427
|
logger.error(`API call error: ${String(err)}`);
|
|
@@ -31291,10 +31545,10 @@ var XAIResponsesProvider = class {
|
|
|
31291
31545
|
const body = {
|
|
31292
31546
|
model: this.modelName,
|
|
31293
31547
|
input,
|
|
31294
|
-
...maxOutputTokens
|
|
31295
|
-
...temperature
|
|
31548
|
+
...maxOutputTokens === void 0 ? {} : { max_output_tokens: maxOutputTokens },
|
|
31549
|
+
...temperature === void 0 ? {} : { temperature },
|
|
31296
31550
|
...config.instructions ? { instructions: config.instructions } : {},
|
|
31297
|
-
...config.top_p
|
|
31551
|
+
...config.top_p === void 0 ? {} : { top_p: config.top_p },
|
|
31298
31552
|
...loadedTools && loadedTools.length > 0 ? { tools: loadedTools } : {},
|
|
31299
31553
|
...config.tool_choice ? { tool_choice: config.tool_choice } : {},
|
|
31300
31554
|
...config.previous_response_id ? { previous_response_id: config.previous_response_id } : {},
|
|
@@ -31340,7 +31594,7 @@ var XAIResponsesProvider = class {
|
|
|
31340
31594
|
...config.headers
|
|
31341
31595
|
},
|
|
31342
31596
|
body: JSON.stringify(body)
|
|
31343
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug, this.config.maxRetries);
|
|
31597
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug, this.config.maxRetries);
|
|
31344
31598
|
data = response.data;
|
|
31345
31599
|
cached = response.cached;
|
|
31346
31600
|
status = response.status;
|
|
@@ -32117,7 +32371,7 @@ const providerMap = [
|
|
|
32117
32371
|
{
|
|
32118
32372
|
test: (providerPath) => providerPath.startsWith("opencode:") || providerPath === "opencode",
|
|
32119
32373
|
create: async (providerPath, providerOptions, context) => {
|
|
32120
|
-
const { OpenCodeSDKProvider } = await import("./opencode-sdk-
|
|
32374
|
+
const { OpenCodeSDKProvider } = await import("./opencode-sdk-CHCs7dEb.js");
|
|
32121
32375
|
return new OpenCodeSDKProvider({
|
|
32122
32376
|
...providerOptions,
|
|
32123
32377
|
id: providerPath,
|
|
@@ -32129,18 +32383,15 @@ const providerMap = [
|
|
|
32129
32383
|
{
|
|
32130
32384
|
test: (providerPath) => providerPath.startsWith("openclaw:") || providerPath === "openclaw",
|
|
32131
32385
|
create: async (providerPath, providerOptions, context) => {
|
|
32132
|
-
const { createOpenClawProvider } = await import("./openclaw-
|
|
32386
|
+
const { createOpenClawProvider } = await import("./openclaw-D1FSCps-.js");
|
|
32133
32387
|
return createOpenClawProvider(providerPath, providerOptions, context.env);
|
|
32134
32388
|
}
|
|
32135
32389
|
},
|
|
32136
32390
|
{
|
|
32137
32391
|
test: (providerPath) => providerPath.startsWith("anthropic:claude-agent-sdk") || providerPath.startsWith("anthropic:claude-code"),
|
|
32138
|
-
create: async (_providerPath, providerOptions,
|
|
32139
|
-
const { ClaudeCodeSDKProvider } = await import("./claude-agent-sdk-
|
|
32140
|
-
return new ClaudeCodeSDKProvider({
|
|
32141
|
-
...providerOptions,
|
|
32142
|
-
env: context.env
|
|
32143
|
-
});
|
|
32392
|
+
create: async (_providerPath, providerOptions, _context) => {
|
|
32393
|
+
const { ClaudeCodeSDKProvider } = await import("./claude-agent-sdk-HgbFioFw.js");
|
|
32394
|
+
return new ClaudeCodeSDKProvider({ ...providerOptions });
|
|
32144
32395
|
}
|
|
32145
32396
|
},
|
|
32146
32397
|
{
|
|
@@ -32193,25 +32444,25 @@ const providerMap = [
|
|
|
32193
32444
|
const modelName = splits.slice(2).join(":");
|
|
32194
32445
|
if (modelType === "converse") return new AwsBedrockConverseProvider(modelName, providerOptions);
|
|
32195
32446
|
if (modelType === "nova-sonic" || modelType.includes("amazon.nova-sonic")) {
|
|
32196
|
-
const { NovaSonicProvider } = await import("./nova-sonic-
|
|
32447
|
+
const { NovaSonicProvider } = await import("./nova-sonic-Ogqf-csn.js");
|
|
32197
32448
|
return new NovaSonicProvider("amazon.nova-sonic-v1:0", providerOptions);
|
|
32198
32449
|
}
|
|
32199
32450
|
if (modelType.includes("luma.ray") || modelName.includes("luma.ray")) {
|
|
32200
|
-
const { LumaRayVideoProvider } = await import("./luma-ray-
|
|
32451
|
+
const { LumaRayVideoProvider } = await import("./luma-ray-C9q8rdQe.js");
|
|
32201
32452
|
return new LumaRayVideoProvider(modelName.includes("luma.ray") ? modelName : splits.slice(1).join(":") || "luma.ray-v2:0", providerOptions);
|
|
32202
32453
|
}
|
|
32203
32454
|
if (modelType.includes("amazon.nova-reel") || modelType === "video" && (modelName.includes("amazon.nova-reel") || modelName === "")) {
|
|
32204
|
-
const { NovaReelVideoProvider } = await import("./nova-reel-
|
|
32455
|
+
const { NovaReelVideoProvider } = await import("./nova-reel-Xw1SXLpg.js");
|
|
32205
32456
|
return new NovaReelVideoProvider(modelName || "amazon.nova-reel-v1:1", providerOptions);
|
|
32206
32457
|
}
|
|
32207
32458
|
if (modelType === "agents") {
|
|
32208
|
-
const { AwsBedrockAgentsProvider } = await import("./agents-
|
|
32459
|
+
const { AwsBedrockAgentsProvider } = await import("./agents-wg3ohknq.js");
|
|
32209
32460
|
return new AwsBedrockAgentsProvider(modelName, providerOptions);
|
|
32210
32461
|
}
|
|
32211
32462
|
if (modelType === "completion") return new AwsBedrockCompletionProvider(modelName, providerOptions);
|
|
32212
32463
|
if (modelType === "embeddings" || modelType === "embedding") return new AwsBedrockEmbeddingProvider(modelName, providerOptions);
|
|
32213
32464
|
if (modelType === "kb" || modelType === "knowledge-base") {
|
|
32214
|
-
const { AwsBedrockKnowledgeBaseProvider } = await import("./knowledgeBase-
|
|
32465
|
+
const { AwsBedrockKnowledgeBaseProvider } = await import("./knowledgeBase-Bi7CmDbx.js");
|
|
32215
32466
|
return new AwsBedrockKnowledgeBaseProvider(modelName, providerOptions);
|
|
32216
32467
|
}
|
|
32217
32468
|
return new AwsBedrockCompletionProvider(splits.slice(1).join(":"), providerOptions);
|
|
@@ -32221,7 +32472,7 @@ const providerMap = [
|
|
|
32221
32472
|
test: (providerPath) => providerPath.startsWith("bedrock-agent:"),
|
|
32222
32473
|
create: async (providerPath, providerOptions, _context) => {
|
|
32223
32474
|
const agentId = providerPath.substring(14);
|
|
32224
|
-
const { AwsBedrockAgentsProvider } = await import("./agents-
|
|
32475
|
+
const { AwsBedrockAgentsProvider } = await import("./agents-wg3ohknq.js");
|
|
32225
32476
|
return new AwsBedrockAgentsProvider(agentId, providerOptions);
|
|
32226
32477
|
}
|
|
32227
32478
|
},
|
|
@@ -32231,7 +32482,7 @@ const providerMap = [
|
|
|
32231
32482
|
const splits = providerPath.split(":");
|
|
32232
32483
|
const modelType = splits[1];
|
|
32233
32484
|
const endpointName = splits.slice(2).join(":");
|
|
32234
|
-
const { SageMakerCompletionProvider, SageMakerEmbeddingProvider } = await import("./sagemaker-
|
|
32485
|
+
const { SageMakerCompletionProvider, SageMakerEmbeddingProvider } = await import("./sagemaker-CVv8W7so.js");
|
|
32235
32486
|
if (modelType === "embedding" || modelType === "embeddings") return new SageMakerEmbeddingProvider(endpointName || modelType, providerOptions);
|
|
32236
32487
|
if (splits.length === 2) return new SageMakerCompletionProvider(modelType, providerOptions);
|
|
32237
32488
|
if (endpointName.includes("jumpstart") || modelType === "jumpstart") return new SageMakerCompletionProvider(endpointName, {
|
|
@@ -32272,7 +32523,7 @@ const providerMap = [
|
|
|
32272
32523
|
{
|
|
32273
32524
|
test: (providerPath) => providerPath.startsWith("cloudflare-ai:"),
|
|
32274
32525
|
create: async (providerPath, providerOptions, context) => {
|
|
32275
|
-
const { createCloudflareAiProvider } = await import("./cloudflare-ai-
|
|
32526
|
+
const { createCloudflareAiProvider } = await import("./cloudflare-ai-BGyXlpXJ.js");
|
|
32276
32527
|
return createCloudflareAiProvider(providerPath, {
|
|
32277
32528
|
...providerOptions,
|
|
32278
32529
|
env: context.env
|
|
@@ -32282,7 +32533,7 @@ const providerMap = [
|
|
|
32282
32533
|
{
|
|
32283
32534
|
test: (providerPath) => providerPath.startsWith("cloudflare-gateway:"),
|
|
32284
32535
|
create: async (providerPath, providerOptions, context) => {
|
|
32285
|
-
const { createCloudflareGatewayProvider } = await import("./cloudflare-gateway-
|
|
32536
|
+
const { createCloudflareGatewayProvider } = await import("./cloudflare-gateway-DXhtXDRb.js");
|
|
32286
32537
|
return createCloudflareGatewayProvider(providerPath, {
|
|
32287
32538
|
...providerOptions,
|
|
32288
32539
|
env: context.env
|
|
@@ -32434,27 +32685,27 @@ const providerMap = [
|
|
|
32434
32685
|
create: async (providerPath, providerOptions, context) => {
|
|
32435
32686
|
const modelType = providerPath.split(":")[1];
|
|
32436
32687
|
if (modelType === "image") {
|
|
32437
|
-
const { createHyperbolicImageProvider } = await import("./image-
|
|
32688
|
+
const { createHyperbolicImageProvider } = await import("./image-6WQXK8m8.js");
|
|
32438
32689
|
return createHyperbolicImageProvider(providerPath, {
|
|
32439
32690
|
...providerOptions,
|
|
32440
32691
|
env: context.env
|
|
32441
32692
|
});
|
|
32442
32693
|
}
|
|
32443
32694
|
if (modelType === "audio") {
|
|
32444
|
-
const { createHyperbolicAudioProvider } = await import("./audio-
|
|
32695
|
+
const { createHyperbolicAudioProvider } = await import("./audio-DDA5WHdx.js");
|
|
32445
32696
|
return createHyperbolicAudioProvider(providerPath, {
|
|
32446
32697
|
...providerOptions,
|
|
32447
32698
|
env: context.env
|
|
32448
32699
|
});
|
|
32449
32700
|
}
|
|
32450
|
-
const { createHyperbolicProvider } = await import("./chat-
|
|
32701
|
+
const { createHyperbolicProvider } = await import("./chat-DK1U-eZ-.js");
|
|
32451
32702
|
return createHyperbolicProvider(providerPath, providerOptions);
|
|
32452
32703
|
}
|
|
32453
32704
|
},
|
|
32454
32705
|
{
|
|
32455
32706
|
test: (providerPath) => providerPath.startsWith("litellm:"),
|
|
32456
32707
|
create: async (providerPath, providerOptions, context) => {
|
|
32457
|
-
const { createLiteLLMProvider } = await import("./litellm-
|
|
32708
|
+
const { createLiteLLMProvider } = await import("./litellm-Tc294Jhj.js");
|
|
32458
32709
|
return createLiteLLMProvider(providerPath, {
|
|
32459
32710
|
config: providerOptions,
|
|
32460
32711
|
env: context.env
|
|
@@ -32511,9 +32762,16 @@ const providerMap = [
|
|
|
32511
32762
|
const modelName = splits.slice(2).join(":");
|
|
32512
32763
|
const configuredModel = getConfiguredOpenAiModel(providerOptions);
|
|
32513
32764
|
if (modelType === "codex-sdk" || modelType === "codex") {
|
|
32514
|
-
const { OpenAICodexSDKProvider } = await import("./codex-sdk-
|
|
32765
|
+
const { OpenAICodexSDKProvider } = await import("./codex-sdk-BQEw16R_.js");
|
|
32766
|
+
const codexModel = modelName || configuredModel;
|
|
32767
|
+
const codexProviderId = providerOptions.id ?? providerPath;
|
|
32515
32768
|
return new OpenAICodexSDKProvider({
|
|
32516
32769
|
...providerOptions,
|
|
32770
|
+
id: codexProviderId,
|
|
32771
|
+
config: codexModel ? {
|
|
32772
|
+
...providerOptions.config,
|
|
32773
|
+
model: codexModel
|
|
32774
|
+
} : providerOptions.config,
|
|
32517
32775
|
env: context.env
|
|
32518
32776
|
});
|
|
32519
32777
|
}
|
|
@@ -32524,7 +32782,7 @@ const providerMap = [
|
|
|
32524
32782
|
if (modelType === "realtime") return new OpenAiRealtimeProvider(modelName || configuredModel || "gpt-4o-realtime-preview-2024-12-17", providerOptions);
|
|
32525
32783
|
if (modelType === "responses") return new OpenAiResponsesProvider(modelName || configuredModel || "gpt-4.1-2025-04-14", providerOptions);
|
|
32526
32784
|
if (modelType === "transcription") {
|
|
32527
|
-
const { OpenAiTranscriptionProvider } = await import("./transcription-
|
|
32785
|
+
const { OpenAiTranscriptionProvider } = await import("./transcription-CaMivnjG.js");
|
|
32528
32786
|
return new OpenAiTranscriptionProvider(modelName || configuredModel || "gpt-4o-transcribe-diarize", providerOptions);
|
|
32529
32787
|
}
|
|
32530
32788
|
if (OpenAiChatCompletionProvider.OPENAI_CHAT_MODEL_NAMES.includes(modelType)) return new OpenAiChatCompletionProvider(modelType, providerOptions);
|
|
@@ -32532,11 +32790,11 @@ const providerMap = [
|
|
|
32532
32790
|
if (OpenAiRealtimeProvider.OPENAI_REALTIME_MODEL_NAMES.includes(modelType)) return new OpenAiRealtimeProvider(modelType, providerOptions);
|
|
32533
32791
|
if (OpenAiResponsesProvider.OPENAI_RESPONSES_MODEL_NAMES.includes(modelType)) return new OpenAiResponsesProvider(modelType, providerOptions);
|
|
32534
32792
|
if (modelType === "agents") {
|
|
32535
|
-
const { OpenAiAgentsProvider } = await import("./agents-
|
|
32793
|
+
const { OpenAiAgentsProvider } = await import("./agents-DSSTV4bv.js");
|
|
32536
32794
|
return new OpenAiAgentsProvider(modelName || "default-agent", providerOptions);
|
|
32537
32795
|
}
|
|
32538
32796
|
if (modelType === "chatkit") {
|
|
32539
|
-
const { OpenAiChatKitProvider } = await import("./chatkit-
|
|
32797
|
+
const { OpenAiChatKitProvider } = await import("./chatkit-a2D6mY6s.js");
|
|
32540
32798
|
return new OpenAiChatKitProvider(modelName || "", providerOptions);
|
|
32541
32799
|
}
|
|
32542
32800
|
if (modelType === "assistant") return new OpenAiAssistantProvider(modelName, providerOptions);
|
|
@@ -32579,7 +32837,7 @@ const providerMap = [
|
|
|
32579
32837
|
{
|
|
32580
32838
|
test: (providerPath) => providerPath.startsWith("quiverai:"),
|
|
32581
32839
|
create: async (providerPath, providerOptions, context) => {
|
|
32582
|
-
const { createQuiverAiProvider } = await import("./quiverai-
|
|
32840
|
+
const { createQuiverAiProvider } = await import("./quiverai-BeofbLVc.js");
|
|
32583
32841
|
return createQuiverAiProvider(providerPath, providerOptions, context.env);
|
|
32584
32842
|
}
|
|
32585
32843
|
},
|
|
@@ -32597,7 +32855,7 @@ const providerMap = [
|
|
|
32597
32855
|
{
|
|
32598
32856
|
test: (providerPath) => providerPath.startsWith("modelslab:"),
|
|
32599
32857
|
create: async (providerPath, providerOptions, context) => {
|
|
32600
|
-
const { ModelsLabImageProvider } = await import("./modelslab-
|
|
32858
|
+
const { ModelsLabImageProvider } = await import("./modelslab-BTOT8FUO.js");
|
|
32601
32859
|
const splits = providerPath.split(":");
|
|
32602
32860
|
const modelType = splits[1];
|
|
32603
32861
|
const modelName = splits.slice(2).join(":");
|
|
@@ -32641,7 +32899,7 @@ const providerMap = [
|
|
|
32641
32899
|
{
|
|
32642
32900
|
test: (providerPath) => providerPath.startsWith("aimlapi:"),
|
|
32643
32901
|
create: async (providerPath, providerOptions, context) => {
|
|
32644
|
-
const { createAimlApiProvider } = await import("./aimlapi-
|
|
32902
|
+
const { createAimlApiProvider } = await import("./aimlapi-BwGC1TtS.js");
|
|
32645
32903
|
return createAimlApiProvider(providerPath, {
|
|
32646
32904
|
...providerOptions,
|
|
32647
32905
|
env: context.env
|
|
@@ -32651,7 +32909,7 @@ const providerMap = [
|
|
|
32651
32909
|
{
|
|
32652
32910
|
test: (providerPath) => providerPath.startsWith("cometapi:"),
|
|
32653
32911
|
create: async (providerPath, providerOptions, context) => {
|
|
32654
|
-
const { createCometApiProvider } = await import("./cometapi-
|
|
32912
|
+
const { createCometApiProvider } = await import("./cometapi-hhL4TAh3.js");
|
|
32655
32913
|
return createCometApiProvider(providerPath, {
|
|
32656
32914
|
...providerOptions,
|
|
32657
32915
|
env: context.env
|
|
@@ -32661,7 +32919,7 @@ const providerMap = [
|
|
|
32661
32919
|
{
|
|
32662
32920
|
test: (providerPath) => providerPath.startsWith("docker:"),
|
|
32663
32921
|
create: async (providerPath, providerOptions, context) => {
|
|
32664
|
-
const { createDockerProvider } = await import("./docker-
|
|
32922
|
+
const { createDockerProvider } = await import("./docker-CxCkwMzc.js");
|
|
32665
32923
|
return createDockerProvider(providerPath, {
|
|
32666
32924
|
...providerOptions,
|
|
32667
32925
|
env: context.env
|
|
@@ -32682,6 +32940,14 @@ const providerMap = [
|
|
|
32682
32940
|
create: async (providerPath, providerOptions, _context) => {
|
|
32683
32941
|
const splits = providerPath.split(":");
|
|
32684
32942
|
const firstPart = splits[1];
|
|
32943
|
+
if (firstPart === "video") return new GoogleVideoProvider(splits.slice(2).join(":"), {
|
|
32944
|
+
...providerOptions,
|
|
32945
|
+
id: providerPath,
|
|
32946
|
+
config: {
|
|
32947
|
+
...providerOptions.config,
|
|
32948
|
+
vertexai: true
|
|
32949
|
+
}
|
|
32950
|
+
});
|
|
32685
32951
|
if (firstPart === "chat") return new VertexChatProvider(splits.slice(2).join(":"), providerOptions);
|
|
32686
32952
|
if (firstPart === "embedding" || firstPart === "embeddings") return new VertexEmbeddingProvider(splits.slice(2).join(":"), providerOptions);
|
|
32687
32953
|
return new VertexChatProvider(splits.slice(1).join(":"), providerOptions);
|
|
@@ -32748,7 +33014,10 @@ const providerMap = [
|
|
|
32748
33014
|
const modelName = splits.slice(2).join(":");
|
|
32749
33015
|
if (serviceType === "live") return new GoogleLiveProvider(modelName, providerOptions);
|
|
32750
33016
|
else if (serviceType === "image") return new GoogleImageProvider(modelName, providerOptions);
|
|
32751
|
-
else if (serviceType === "video") return new GoogleVideoProvider(modelName,
|
|
33017
|
+
else if (serviceType === "video") return new GoogleVideoProvider(modelName, {
|
|
33018
|
+
...providerOptions,
|
|
33019
|
+
id: providerPath
|
|
33020
|
+
});
|
|
32752
33021
|
}
|
|
32753
33022
|
const modelName = splits[1];
|
|
32754
33023
|
if (modelName.includes("-image")) return new GeminiImageProvider(modelName, providerOptions);
|
|
@@ -32927,7 +33196,7 @@ const providerMap = [
|
|
|
32927
33196
|
{
|
|
32928
33197
|
test: (providerPath) => providerPath.startsWith("transformers:") || providerPath.startsWith("transformers.js:"),
|
|
32929
33198
|
create: async (providerPath, providerOptions, _context) => {
|
|
32930
|
-
const { validateTransformersDependency } = await import("./transformersAvailability-
|
|
33199
|
+
const { validateTransformersDependency } = await import("./transformersAvailability-BGkzavwb.js");
|
|
32931
33200
|
await validateTransformersDependency();
|
|
32932
33201
|
const splits = providerPath.split(":");
|
|
32933
33202
|
if (splits.length < 3) throw new Error(`Invalid Transformers.js provider path: ${providerPath}. Format: transformers:<task>:<model>
|
|
@@ -32947,7 +33216,7 @@ Example: transformers:feature-extraction:Xenova/all-MiniLM-L6-v2`);
|
|
|
32947
33216
|
test: (providerPath) => providerPath === "slack" || providerPath.startsWith("slack:"),
|
|
32948
33217
|
create: async (providerPath, providerOptions, _context) => {
|
|
32949
33218
|
try {
|
|
32950
|
-
const { SlackProvider } = await import("./slack-
|
|
33219
|
+
const { SlackProvider } = await import("./slack-2sdpGzbt.js");
|
|
32951
33220
|
if (providerPath === "slack") return new SlackProvider(providerOptions);
|
|
32952
33221
|
const splits = providerPath.split(":");
|
|
32953
33222
|
if (splits.length < 2) throw new Error("Invalid Slack provider path. Use slack:<channel_id> or slack:channel:<channel_id>");
|
|
@@ -33243,4 +33512,4 @@ function getProviderIds(providerPaths) {
|
|
|
33243
33512
|
//#endregion
|
|
33244
33513
|
export { DefaultSynthesizeProvider as $, removePrefix as A, PromptfooHarmfulCompletionProvider as B, extractInputVarsFromPrompt as C, getShortPluginId as D, getSessionId as E, loadFromPackage as F, DefaultEmbeddingProvider as G, OpenAiModerationProvider as H, redteamProviderManager as I, AIStudioChatProvider as J, DefaultGradingProvider as K, TokenUsageTracker as L, renderPrompt as M, runExtensionHook as N, isBasicRefusal as O, isPackagePath as P, DefaultSuggestionsProvider as Q, createRateLimitRegistry as R, extractGoalFromPrompt as S, extractVariablesFromJson as T, MistralChatCompletionProvider as U, REDTEAM_MEMORY_POISONING_PLUGIN_ID as V, MistralEmbeddingProvider as W, DefaultGradingProvider$1 as X, DefaultGradingJsonProvider as Y, DefaultLlmRubricProvider as Z, mediaExists as _, resolveProviderConfigs as a, getEvalConfigFromCloud as at, checkExfilTracking as b, MCPProvider as c, getPoliciesFromCloud as ct, createTransformResponse$1 as d, AzureModerationProvider as et, GoogleLiveProvider as f, getMediaStorage as g, validateStrategies as h, resolveProvider as i, getCloudDatabaseId as it, collectFileMetadata as j, isEmptyResponse as k, HttpProvider as l, isCloudProvider as lt, loadStrategy as m, loadApiProvider as n, AzureChatCompletionProvider as nt, getFileHashes as o, getOrgContext as ot, Strategies as p, VertexChatProvider as q, loadApiProviders as r, checkCloudPermissions as rt, parseScriptParts as s, getPluginSeverityOverridesFromCloud as st, getProviderIds as t, AzureEmbeddingProvider as tt, createTransformRequest as u, resolveTeamId as ut, retrieveMedia as v, extractPromptFromTags as w, extractAllPromptsFromTags as x, pluginMatchesStrategyTargets as y, createProviderRateLimitOptions as z };
|
|
33245
33514
|
|
|
33246
|
-
//# sourceMappingURL=providers-
|
|
33515
|
+
//# sourceMappingURL=providers-DvddrgxL.js.map
|