promptfoo 0.121.1 → 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-xrUGFA6n.js → accounts-B2XmGjty.js} +5 -5
- package/dist/src/{accounts-Bx-x3bmW.cjs → accounts-BPyfpSeU.cjs} +5 -5
- package/dist/src/{accounts-CMqkzrVf.js → accounts-CFLK3mnD.js} +6 -6
- package/dist/src/{accounts-BgNJDBE6.js → accounts-Xatc0RYb.js} +5 -5
- package/dist/src/{agentic-utils-BKIN5PKu.js → agentic-utils-36epdqwB.js} +3 -3
- package/dist/src/{cometapi-DkXrKi5z.js → agentic-utils-D8yXo5Lm.js} +4 -61
- package/dist/src/{cometapi-vY6aDZgo.cjs → agentic-utils-DAVsChuB.cjs} +24 -62
- package/dist/src/agentic-utils-DIYAAYE7.js +153 -0
- package/dist/src/{agents-C-dDThPK.js → agents-BBVJCIYr.js} +226 -13
- package/dist/src/{agents-CErsqg5U.cjs → agents-BBWxKSM0.cjs} +7 -7
- package/dist/src/{agents-Dy2YpZpa.js → agents-Bqgfdokm.js} +227 -14
- package/dist/src/{agents-B0f4HICh.cjs → agents-CAYbM7qD.cjs} +226 -13
- package/dist/src/{agents-CVIn-Utx.js → agents-CLQ-P15P.js} +7 -7
- package/dist/src/{agents-DeH4Gu94.js → agents-CgBniSlI.js} +8 -8
- package/dist/src/{agents-CXknwsFX.js → agents-DSSTV4bv.js} +226 -13
- package/dist/src/{agents-aF4-T121.js → agents-wg3ohknq.js} +7 -7
- package/dist/src/{aimlapi-tg0Gkcvr.cjs → aimlapi-Bv8Fmc-b.cjs} +14 -14
- package/dist/src/{aimlapi-BNfTBexL.js → aimlapi-BwGC1TtS.js} +13 -13
- package/dist/src/{aimlapi-BAGZDo5G.js → aimlapi-DaC3qZ-o.js} +14 -14
- package/dist/src/{aimlapi-DHRKlBEA.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-charts-BnDWwBlI.js +36 -0
- package/dist/src/app/assets/vendor-markdown-Bz7N-ca6.js +29 -0
- package/dist/src/app/index.html +4 -4
- package/dist/src/{audio-tf_NBjlC.js → audio-Bn44pQxv.js} +4 -4
- package/dist/src/{audio-CHQ4r-RV.js → audio-DDA5WHdx.js} +4 -4
- package/dist/src/{audio-BWeaWovU.cjs → audio-DVFjQ67_.cjs} +4 -4
- package/dist/src/{audio-BRODU0UK.js → audio-DjU9GswO.js} +5 -5
- package/dist/src/{base-DBtwl2FR.cjs → base-BboXIF_0.cjs} +3 -3
- package/dist/src/{base-B4QJRyFS.js → base-CKjwebIH.js} +3 -3
- package/dist/src/{base-B0tcrnq_.js → base-CqzQ4K8j.js} +3 -3
- package/dist/src/{base-fEDN28WM.js → base-Cz2ZC_iA.js} +3 -3
- package/dist/src/{blobs-BAU-dXan.js → blobs-B1JriOyi.js} +3 -3
- package/dist/src/{blobs-qTYm-1PY.js → blobs-BUWmKWzo.js} +3 -3
- package/dist/src/{blobs-DvS-O6be.cjs → blobs-C6j0bvFz.cjs} +3 -3
- package/dist/src/{blobs-Bpg5rH6i.js → blobs-DXTl6J3H.js} +3 -3
- package/dist/src/{cache-COish3-W.cjs → cache-C5yFZ4gC.cjs} +75 -58
- package/dist/src/{cache-8XhNqPKW.js → cache-CaT5tPgo.js} +75 -58
- package/dist/src/cache-CyCanoMu.js +6 -0
- package/dist/src/{cache-CG0SlR1d.js → cache-DSqR6ezl.js} +75 -58
- package/dist/src/cache-Df_QFDNu.cjs +5 -0
- package/dist/src/{cache-D3eqDYGU.js → cache-HP0NP4k3.js} +75 -58
- package/dist/src/{chat-DHMH-N64.js → chat-B-52XYI1.js} +12 -12
- package/dist/src/{chat-BKm79wib.js → chat-B0iaWhoh.js} +16 -14
- package/dist/src/{chat-DxysjBvt.js → chat-BE0qTA8e.js} +13 -13
- package/dist/src/{chat-CRWNNq73.js → chat-BEwdgGEg.js} +16 -14
- package/dist/src/{chat-2K608PeQ.cjs → chat-BtIKkLKx.cjs} +13 -13
- package/dist/src/{chat-DaqekjFr.cjs → chat-CM8qWR3_.cjs} +17 -15
- package/dist/src/{chat-CM_kyI8B.js → chat-DK1U-eZ-.js} +12 -12
- package/dist/src/{chat-CznLWr_D.js → chat-pxmiVpWe.js} +16 -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-CJH22shf.cjs → claude-agent-sdk-8ddRp1L2.cjs} +35 -17
- package/dist/src/{claude-agent-sdk-Dy5lT-Tx.js → claude-agent-sdk-Bq5EArsX.js} +33 -15
- package/dist/src/{claude-agent-sdk-BLTu0WBO.js → claude-agent-sdk-CMjh4LFH.js} +33 -15
- package/dist/src/{claude-agent-sdk-D6_k9FKA.js → claude-agent-sdk-HgbFioFw.js} +33 -15
- package/dist/src/cloud-DE3t1-ZI.js +4 -0
- package/dist/src/{cloud-Bc9526yV.js → cloud-z8KZpUoa.js} +3 -3
- package/dist/src/{cloudflare-ai-CWWJCRim.js → cloudflare-ai-BGyXlpXJ.js} +13 -13
- package/dist/src/{cloudflare-ai-C9r2sRhw.js → cloudflare-ai-Bbp26N0L.js} +13 -13
- package/dist/src/{cloudflare-ai-ClWSdor4.cjs → cloudflare-ai-C62x6MQG.cjs} +14 -14
- package/dist/src/{cloudflare-ai-ICsOuD-z.js → cloudflare-ai-DdKP9TKT.js} +14 -14
- package/dist/src/{cloudflare-gateway-D6xFc5pa.js → cloudflare-gateway-BwAaUgeW.js} +14 -14
- package/dist/src/{cloudflare-gateway-D6O7AlYb.js → cloudflare-gateway-D-e9i1Sn.js} +15 -15
- package/dist/src/{cloudflare-gateway-pXGHxJ47.js → cloudflare-gateway-DXhtXDRb.js} +15 -163
- package/dist/src/{cloudflare-gateway-C2_-KG5o.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-Bbjp5V4x.js → cometapi-hhL4TAh3.js} +14 -14
- package/dist/src/{cometapi-BasUi7-_.js → cometapi-sp7sJpBD.js} +15 -15
- package/dist/src/{completion-C_P3ypkJ.js → completion-BCimtq-h.js} +6 -6
- package/dist/src/{completion-6Mx_iXxK.js → completion-DCjv7RZ3.js} +6 -6
- package/dist/src/{completion-CDOouNzq.cjs → completion-DlXUhj5c.cjs} +6 -6
- package/dist/src/{completion-C5rtR_9P.js → completion-DoYy49ti.js} +6 -6
- package/dist/src/{createHash-CfZSc0b4.cjs → createHash-BYwImsYv.cjs} +2 -2
- package/dist/src/{docker-BwsKwxFs.cjs → docker-Cqj2-QVi.cjs} +14 -14
- package/dist/src/{docker-CZnqU1XV.js → docker-CxCkwMzc.js} +13 -13
- package/dist/src/{docker-DzxyDPIj.js → docker-DpguQj-w.js} +14 -14
- package/dist/src/{docker-5KcG-_86.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-DmFyWU7i.js → eval-BTqTn7lb.js} +10 -10
- package/dist/src/{evalResult-CDQiuUuf.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-CTG2AHOS.js → evalResult-DUDShQrm.js} +7 -7
- package/dist/src/{evalResult-Dap2CekP.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-DPFRbFIL.js → evaluator-BcvOGaam.js} +833 -79
- package/dist/src/{extractor-YMU_Gvt8.js → extractor-C8XwivI9.js} +6 -6
- package/dist/src/{extractor-CFG6bcWJ.js → extractor-CAZ2G3Kh.js} +6 -6
- package/dist/src/{extractor-DX36oYEv.cjs → extractor-DG3sSfXE.cjs} +6 -6
- package/dist/src/{extractor-M67RUtg6.js → extractor-D_wd8jxt.js} +6 -6
- package/dist/src/{fetch-4M3YRaqL.js → fetch-BiYv2BZc.js} +3 -3
- package/dist/src/{fetch-BxUk8odA.cjs → fetch-BnR9wSnm.cjs} +3 -3
- package/dist/src/{fetch-60Gzydls.js → fetch-CVAtKnI3.js} +3 -3
- package/dist/src/{fetch-BMv0O527.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-DOXycdlG.cjs → graders-BElhu9ZY.cjs} +126 -55
- package/dist/src/{graders-R9rYUM0d.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-CpdqD9PI.js → graders-DG7mhg-b.js} +120 -55
- package/dist/src/graders-DjCXfj0l.cjs +32 -0
- package/dist/src/{graders-CHO8EPM4.js → graders-RjHF8VfG.js} +120 -55
- package/dist/src/graders-kHzIWOKu.js +32 -0
- package/dist/src/{image-DTedmQPg.cjs → image--F58eEIn.cjs} +6 -6
- package/dist/src/{image-DJEvKveK.js → image-6WQXK8m8.js} +4 -4
- package/dist/src/{image-pAX56tPG.js → image-B8b6f36E.js} +6 -6
- package/dist/src/{image-BmEZqVmk.js → image-CoxZp9PZ.js} +6 -6
- package/dist/src/{image-gvmivTEe.js → image-DO0RYnjH.js} +5 -5
- package/dist/src/{image-CBBVXWuT.js → image-PoF6DN3x.js} +6 -6
- package/dist/src/{image-CDLQOcqT.cjs → image-fza3zuKs.cjs} +4 -4
- package/dist/src/{image-tL5hIOFh.js → image-xNbw5ph2.js} +4 -4
- package/dist/src/index.cjs +863 -110
- package/dist/src/index.d.cts +833 -60
- package/dist/src/index.d.ts +833 -60
- package/dist/src/index.js +860 -108
- package/dist/src/{interactiveCheck-BgLZUIt3.js → interactiveCheck-BnMYOjMu.js} +2 -2
- package/dist/src/{knowledgeBase-CoU-UQBg.js → knowledgeBase-Bi7CmDbx.js} +7 -7
- package/dist/src/{knowledgeBase-CLJybhnF.js → knowledgeBase-Ce3ofVan.js} +8 -8
- package/dist/src/{knowledgeBase-DjWPVqSb.js → knowledgeBase-DFRXPZl_.js} +7 -7
- package/dist/src/{knowledgeBase-wkxuRFhA.cjs → knowledgeBase-DqrLX8fy.cjs} +7 -7
- package/dist/src/{litellm-B9Hysuri.js → litellm-Bo2gQXpo.js} +16 -15
- package/dist/src/{litellm-ePxtr9F1.js → litellm-CKiAxnoM.js} +15 -14
- package/dist/src/{litellm-NYpQ8RQu.cjs → litellm-CnHI69aj.cjs} +16 -15
- package/dist/src/{litellm-CTfa0hqi.js → litellm-Tc294Jhj.js} +15 -14
- 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-BW9IRGIc.js → luma-ray-0ehMPt5N.js} +10 -10
- package/dist/src/{luma-ray-BE2mOt6N.js → luma-ray-C9q8rdQe.js} +9 -9
- package/dist/src/{luma-ray-Cm1KZBhs.js → luma-ray-DP0QA9qn.js} +9 -9
- package/dist/src/{luma-ray-B0GGNRc1.cjs → luma-ray-m9Ku2meV.cjs} +9 -9
- package/dist/src/main.js +69 -71
- package/dist/src/{messages-1x9atZmP.js → messages-DJNo37Ko.js} +14 -9
- package/dist/src/{messages-BLbWdsyt.js → messages-Dy9QecMs.js} +14 -9
- package/dist/src/{messages-1JrJs91T.cjs → messages-HJsyEh4o.cjs} +15 -10
- package/dist/src/{messages-D8EA0oDc.js → messages-biC_ex-p.js} +14 -9
- package/dist/src/{modelslab-C1OLRmVX.js → modelslab-B5J-ZM5c.js} +9 -9
- package/dist/src/{modelslab-CqXBy3U8.js → modelslab-BI458moT.js} +10 -10
- package/dist/src/{modelslab-X5-4LroM.js → modelslab-BTOT8FUO.js} +9 -9
- package/dist/src/{modelslab-DcOSFwKh.cjs → modelslab-IQbNg-r7.cjs} +9 -9
- package/dist/src/{nova-reel-DihqLeol.js → nova-reel-BZ9y-Y5s.js} +9 -9
- package/dist/src/{nova-reel-D9xfaMBs.cjs → nova-reel-CE5etkv9.cjs} +9 -9
- package/dist/src/{nova-reel-D2ZkOSyr.js → nova-reel-DEeQlnOJ.js} +10 -10
- package/dist/src/{nova-reel-BgS1ZWuK.js → nova-reel-Xw1SXLpg.js} +9 -9
- package/dist/src/{nova-sonic-Q3BOJeig.js → nova-sonic-DWswpN1E.js} +7 -7
- package/dist/src/{nova-sonic-DezhVUYT.js → nova-sonic-DXTLpi-r.js} +6 -6
- package/dist/src/{nova-sonic-DVu3mMIy.cjs → nova-sonic-N0yCm0vb.cjs} +6 -6
- package/dist/src/{nova-sonic-P-CdUMlV.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-Bv1DINsX.js → openclaw-0Sv7AK3O.js} +172 -109
- package/dist/src/{openclaw-DAfWQn-o.cjs → openclaw-CXxbKgDH.cjs} +174 -110
- package/dist/src/{openclaw-BiSZPL7J.js → openclaw-D1FSCps-.js} +172 -109
- package/dist/src/{openclaw-D1D_ej1z.js → openclaw-D2ENvu7a.js} +173 -110
- package/dist/src/{opencode-sdk-D95s6SnR.js → opencode-sdk-C71Z0ehR.js} +13 -13
- package/dist/src/{opencode-sdk-DxUPkLT7.js → opencode-sdk-CHCs7dEb.js} +12 -12
- package/dist/src/{opencode-sdk-C7m-wRfI.js → opencode-sdk-DDxj4QqH.js} +12 -12
- package/dist/src/{opencode-sdk-CfaLN8PY.cjs → opencode-sdk-WWJhnbKr.cjs} +16 -16
- package/dist/src/{otlpReceiver-g3ByGaXs.js → otlpReceiver-C9KlUtxh.js} +6 -6
- package/dist/src/{otlpReceiver--AIRW_S4.js → otlpReceiver-CZL48YfC.js} +6 -6
- package/dist/src/{otlpReceiver-Bn5wGB1v.js → otlpReceiver-CavGAA6k.js} +6 -6
- package/dist/src/{otlpReceiver-Diec4cln.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-CFu-TZl-.cjs → providers-CScd1wN6.cjs} +733 -464
- package/dist/src/{providers-CFLy1_ji.js → providers-Ch6Mr0gn.js} +795 -526
- package/dist/src/{providers-BKRJTjBz.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-B3HvufyI.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-CI6gYJVI.js → quiverai-BeofbLVc.js} +4 -4
- package/dist/src/{quiverai-MHSxbmmZ.js → quiverai-CCQn73lq.js} +5 -5
- package/dist/src/{quiverai-CLkWkyZc.cjs → quiverai-CcUhPIBg.cjs} +4 -4
- package/dist/src/{quiverai-C2jVwbH1.js → quiverai-DVSEqJiq.js} +4 -4
- package/dist/src/{render-Drod8m7K.js → render-BHl6QVq9.js} +3 -3
- package/dist/src/{responses-CGw0DCzh.js → responses-BKP_WYis.js} +16 -12
- package/dist/src/{responses-BKqJmhhc.js → responses-CQb1Tj69.js} +16 -12
- package/dist/src/{responses-jxdehPkC.js → responses-CgNyTPsY.js} +16 -12
- package/dist/src/{responses-tD4Bd4dc.cjs → responses-mo0KQDbu.cjs} +16 -12
- 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-BK4Zb993.js → sagemaker-CVv8W7so.js} +17 -17
- package/dist/src/{sagemaker-D2Q1c-sD.js → sagemaker-CqeASYE5.js} +17 -17
- package/dist/src/{sagemaker-BfiWTmvn.js → sagemaker-MUbD5V3v.js} +18 -18
- package/dist/src/{sagemaker-CcQHM1jV.cjs → sagemaker-jiw1wQa-.cjs} +17 -17
- package/dist/src/{scanner-J8CA3LsV.js → scanner-DVDeUz1r.js} +10 -10
- package/dist/src/server/index.js +864 -112
- package/dist/src/server-B0Xh1Gx-.js +7 -0
- package/dist/src/{server-B0PPuDw-.cjs → server-BtoCXeXI.cjs} +4 -4
- package/dist/src/{server-BC7XJFgr.js → server-CP9qKM40.js} +4 -4
- package/dist/src/{server-OAs3nBRT.js → server-Cns05F1j.js} +5 -5
- package/dist/src/server-DJTKu9IR.cjs +5 -0
- package/dist/src/{server-DbFphssR.js → server-DZ9MtCn0.js} +6 -6
- package/dist/src/{signal-BOTbd53Z.js → signal-C3ZTsUgi.js} +3 -3
- package/dist/src/{slack-DXMKtA-f.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-DOdy_kyv.js → slack-DCEV-vWP.js} +2 -2
- package/dist/src/store-C5u6MgC8.js +6 -0
- package/dist/src/{store-BSc-TF2w.cjs → store-CLyU7AtI.cjs} +17 -5
- package/dist/src/store-CNHk-De4.cjs +5 -0
- package/dist/src/{store-DQLEjuEO.js → store-Cj258DgL.js} +17 -5
- package/dist/src/{store-D1tv90v3.js → store-P8OKm19S.js} +17 -5
- package/dist/src/{store-Ub2vaGJ1.js → store-VB0GP46K.js} +17 -5
- package/dist/src/{tables-xKANLRBD.js → tables-BEIFz2tM.js} +3 -3
- package/dist/src/{tables-C7K-XKWp.cjs → tables-BdZQEpRz.cjs} +3 -3
- package/dist/src/{tables-D36WTqKX.js → tables-DmzvLbeZ.js} +3 -3
- package/dist/src/{tables-5EvT_Bwn.js → tables-kC7R5kiK.js} +3 -3
- package/dist/src/{telemetry-C2YDkUQH.js → telemetry-BnH5VJAU.js} +4 -4
- package/dist/src/{telemetry-C15ziL8u.js → telemetry-BugWqKiu.js} +4 -4
- package/dist/src/{telemetry-DMb2Mpfm.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-CbrnxHp_.cjs → telemetry-re627Lre.cjs} +4 -4
- package/dist/src/{transcription-CL78qbOU.cjs → transcription-BvtsrzRG.cjs} +13 -13
- package/dist/src/{transcription-DAtxHhAM.js → transcription-CaMivnjG.js} +13 -13
- package/dist/src/{transcription-QHh3AH6Z.js → transcription-DOMMTu01.js} +14 -14
- package/dist/src/{transcription-LNZTNUUL.js → transcription-Hb3VnC4M.js} +13 -13
- package/dist/src/{transform-DOcQeLld.cjs → transform-0BwoBsvO.cjs} +19 -5
- package/dist/src/{transform-DGxXocjk.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-Cgi24fJ7.js → transform-DrleutM3.js} +8 -6
- package/dist/src/{transform-DGLazrMm.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-CH3Ge2sE.js → types-CIhFeUC4.js} +45 -11
- package/dist/src/{types-CN_TZ2GJ.js → types-Cd3ygw8W.js} +45 -11
- package/dist/src/{types-LJ0r3wbR.cjs → types-D8cGDZbL.cjs} +46 -12
- package/dist/src/{types-CLKiCBW3.js → types-q8GXGF65.js} +45 -11
- package/dist/src/{util-CchiqXh_.cjs → util--9u9UVCt.cjs} +3 -3
- package/dist/src/{util-5cB-L7U3.js → util-BLvy9qfE.js} +7 -11
- package/dist/src/{util-YT5HPZaS.js → util-Bm3E9jpK.js} +7 -11
- package/dist/src/{util-6-GqIvzS.js → util-BtoGs5Cb.js} +18 -4
- package/dist/src/{util-Db0a0AFH.cjs → util-CFj4YKIn.cjs} +18 -4
- package/dist/src/{util-Dlz_Wvgm.js → util-CMMkIxfU.js} +7 -11
- package/dist/src/{util-Betm42rL.js → util-CgDCK4KI.js} +18 -4
- package/dist/src/{util-Yz-1aEhW.cjs → util-CuLo2pMR.cjs} +7 -11
- package/dist/src/{util-C-PPYSMq.js → util-DM2rTn_6.js} +18 -4
- package/dist/src/{util-B7T3SiBS.js → util-DMFeUvLz.js} +3 -3
- package/dist/src/{util-ZZH-3QZz.js → util-DbVG-yZU.js} +3 -3
- package/dist/src/{util-DaWTWKBK.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 +38 -38
- package/dist/src/app/assets/index-BFCZg7hQ.js +0 -439
- package/dist/src/app/assets/index-NCn4eVBv.css +0 -1
- package/dist/src/app/assets/sync-9qqYcY-B.js +0 -4
- package/dist/src/app/assets/vendor-charts-CCl15Imd.js +0 -36
- package/dist/src/app/assets/vendor-markdown-0tekx3KX.js +0 -29
- package/dist/src/cache-Bbn1Nyrd.cjs +0 -5
- package/dist/src/cache-BwsMSda7.js +0 -6
- package/dist/src/cloud-DmE0EwsY.js +0 -4
- package/dist/src/eval-17JizQIv.js +0 -15
- package/dist/src/evalResult-Cqj8pldJ.js +0 -12
- package/dist/src/evalResult-DvcJAWJU.cjs +0 -10
- package/dist/src/evalResult-Hftn-S_i.js +0 -10
- package/dist/src/evaluator-B2CFNt-P.js +0 -36
- package/dist/src/fetch-KV5kNASw.js +0 -5
- package/dist/src/graders-Bu0H9nXi.js +0 -32
- package/dist/src/graders-Cfhkvx-e.js +0 -34
- package/dist/src/graders-DClJVpGP.cjs +0 -32
- package/dist/src/graders-DcnJsrMO.js +0 -32
- package/dist/src/providers-C1rOSHiR.js +0 -32
- package/dist/src/providers-CxmDwEFf.cjs +0 -31
- package/dist/src/providers-Dodakqr0.js +0 -30
- package/dist/src/providers-GIQ2TcsA.js +0 -30
- package/dist/src/rubyUtils-BUHu6PhO.js +0 -5
- package/dist/src/rubyUtils-CP42kMvq.cjs +0 -4
- package/dist/src/server-B1vi21hA.js +0 -7
- package/dist/src/server-Cm9Kai_h.cjs +0 -5
- package/dist/src/store-BNmZ1KAz.cjs +0 -5
- package/dist/src/store-BltJg2cd.js +0 -6
- package/dist/src/telemetry-5BCRNBbe.cjs +0 -5
- package/dist/src/telemetry-D4W5hboe.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 {
|
|
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-DO8_zM18.js";
|
|
2
2
|
import { t as invariant } from "./invariant-Ddh24eXh.js";
|
|
3
|
-
import { a as safeJoin, i as resolvePackageEntryPoint, n as getWrapperDir, o as safeResolve, r as importModule } from "./esm-
|
|
4
|
-
import { i as validatePythonPath, n as getEnvInt$1, r as runPython, t as getConfiguredPythonPath } from "./pythonUtils-
|
|
3
|
+
import { a as safeJoin, i as resolvePackageEntryPoint, n as getWrapperDir, o as safeResolve, r as importModule } from "./esm-SUNIX1x3.js";
|
|
4
|
+
import { i as validatePythonPath, n as getEnvInt$1, r as runPython, t as getConfiguredPythonPath } from "./pythonUtils-Cpo0Ez1p.js";
|
|
5
5
|
import { a as isVideoFile, i as isJavascriptFile, n as isAudioFile, r as isImageFile } from "./fileExtensions-DnqA1y9x.js";
|
|
6
|
-
import { i as getProcessShim, n as transform, t as TransformInputType } from "./transform-
|
|
7
|
-
import { $ as pluginDescriptions, A as isApiProvider, G as MULTI_TURN_STRATEGIES, H as AGENTIC_STRATEGIES, N as ProviderOptionsSchema, U as DATASET_PLUGINS, V as isUuid, Y as isCustomStrategy, j as isProviderOptions, yt as STRATEGY_EXEMPT_PLUGINS } from "./types-
|
|
8
|
-
import { c as maybeLoadFromExternalFile, d as maybeLoadToolsFromExternalFile, f as parsePathOrGlob, g as renderVarsInObject, h as renderEnvOnlyInObject, l as maybeLoadFromExternalFileWithVars, o as getResolvedRelativePath, s as maybeLoadConfigFromExternalFile, u as maybeLoadResponseFormatFromExternalFile, v as extractVariablesFromTemplates, x as parseFileUrl, y as getNunjucksEngine } from "./util-
|
|
9
|
-
import { C as transformTools, N 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-
|
|
10
|
-
import { a as isCacheEnabled, c as isTransientConnectionError, i as getCache, r as fetchWithCache } from "./cache-
|
|
6
|
+
import { i as getProcessShim, n as transform, t as TransformInputType } from "./transform-BqPkNPYm.js";
|
|
7
|
+
import { $ as pluginDescriptions, A as isApiProvider, G as MULTI_TURN_STRATEGIES, H as AGENTIC_STRATEGIES, N as ProviderOptionsSchema, U as DATASET_PLUGINS, V as isUuid, Y as isCustomStrategy, j as isProviderOptions, yt as STRATEGY_EXEMPT_PLUGINS } from "./types-q8GXGF65.js";
|
|
8
|
+
import { b as loadFunction, c as maybeLoadFromExternalFile, d as maybeLoadToolsFromExternalFile, f as parsePathOrGlob, g as renderVarsInObject, h as renderEnvOnlyInObject, l as maybeLoadFromExternalFileWithVars, o as getResolvedRelativePath, s as maybeLoadConfigFromExternalFile, u as maybeLoadResponseFormatFromExternalFile, v as extractVariablesFromTemplates, x as parseFileUrl, y as getNunjucksEngine } from "./util-CMMkIxfU.js";
|
|
9
|
+
import { C as transformTools, N 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-CVAtKnI3.js";
|
|
10
|
+
import { a as isCacheEnabled, c as isTransientConnectionError, i as getCache, r as fetchWithCache } from "./cache-CaT5tPgo.js";
|
|
11
11
|
import { n as sha256 } from "./createHash-DmPQkvBh.js";
|
|
12
12
|
import { n as withGenAISpan } from "./genaiTracer-D3fD9dNV.js";
|
|
13
|
-
import { i as normalizeFinishReason, n as MCPClient, r as FINISH_REASON_MAP, t as OpenAiChatCompletionProvider } from "./chat-
|
|
13
|
+
import { i as normalizeFinishReason, n as MCPClient, r as FINISH_REASON_MAP, t as OpenAiChatCompletionProvider } from "./chat-pxmiVpWe.js";
|
|
14
14
|
import { a as createEmptyTokenUsage, n as accumulateResponseTokenUsage, r as accumulateTokenUsage } from "./tokenUsageUtils-NYT-WKS6.js";
|
|
15
|
-
import {
|
|
16
|
-
import { n as AnthropicGenericProvider, t as AnthropicMessagesProvider } from "./messages-
|
|
17
|
-
import { a as parseMessages, i as outputFromMessage, n as calculateAnthropicCost, r as getTokenUsage$2, t as ANTHROPIC_MODELS } from "./util-
|
|
18
|
-
import { n as ResponsesProcessor, r as FunctionCallbackHandler, t as OpenAiResponsesProvider } from "./responses-
|
|
19
|
-
import { t as OpenAiGenericProvider } from "./openai-
|
|
20
|
-
import { a as calculateOpenAICost, c as getTokenUsage$3, o as failApiCall, r as OPENAI_REALTIME_MODELS, s as formatOpenAiError } from "./util-
|
|
21
|
-
import { n as OpenAiEmbeddingProvider, t as OpenAiCompletionProvider } from "./completion-
|
|
22
|
-
import { i as getUserEmail, o as isLoggedIntoCloud } from "./accounts-
|
|
23
|
-
import { a as getRemoteGenerationUrlForUnaligned, c as neverGenerateRemoteForRegularEvals, i as getRemoteGenerationUrl, l as shouldGenerateRemote, s as neverGenerateRemote, t as checkServerFeatureSupport } from "./server-
|
|
24
|
-
import { r as storeBlob } from "./blobs-
|
|
25
|
-
import { i as evalResultsTable, p as getDb } from "./tables-
|
|
26
|
-
import { n as isBlobStorageEnabled, r as shouldAttemptRemoteBlobUpload, t as extractAndStoreBinaryData } from "./extractor-
|
|
27
|
-
import { t as telemetry } from "./telemetry-
|
|
15
|
+
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-DyDAwEpE.js";
|
|
16
|
+
import { n as AnthropicGenericProvider, t as AnthropicMessagesProvider } from "./messages-Dy9QecMs.js";
|
|
17
|
+
import { a as parseMessages, i as outputFromMessage, n as calculateAnthropicCost, r as getTokenUsage$2, t as ANTHROPIC_MODELS } from "./util-vNmDL5DT.js";
|
|
18
|
+
import { n as ResponsesProcessor, r as FunctionCallbackHandler, t as OpenAiResponsesProvider } from "./responses-CQb1Tj69.js";
|
|
19
|
+
import { t as OpenAiGenericProvider } from "./openai-BcB5KlTk.js";
|
|
20
|
+
import { a as calculateOpenAICost, c as getTokenUsage$3, o as failApiCall, r as OPENAI_REALTIME_MODELS, s as formatOpenAiError } from "./util-CgDCK4KI.js";
|
|
21
|
+
import { n as OpenAiEmbeddingProvider, t as OpenAiCompletionProvider } from "./completion-DCjv7RZ3.js";
|
|
22
|
+
import { i as getUserEmail, o as isLoggedIntoCloud } from "./accounts-B2XmGjty.js";
|
|
23
|
+
import { a as getRemoteGenerationUrlForUnaligned, c as neverGenerateRemoteForRegularEvals, i as getRemoteGenerationUrl, l as shouldGenerateRemote, s as neverGenerateRemote, t as checkServerFeatureSupport } from "./server-CP9qKM40.js";
|
|
24
|
+
import { r as storeBlob } from "./blobs-DXTl6J3H.js";
|
|
25
|
+
import { i as evalResultsTable, p as getDb } from "./tables-kC7R5kiK.js";
|
|
26
|
+
import { n as isBlobStorageEnabled, r as shouldAttemptRemoteBlobUpload, t as extractAndStoreBinaryData } from "./extractor-D_wd8jxt.js";
|
|
27
|
+
import { t as telemetry } from "./telemetry-BugWqKiu.js";
|
|
28
28
|
import { n as escapeRegExp, t as ellipsize } from "./text-B_UCRPp2.js";
|
|
29
|
-
import { t as getTraceStore } from "./store-
|
|
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-
|
|
29
|
+
import { t as getTraceStore } from "./store-Cj258DgL.js";
|
|
30
|
+
import { a as novaParseMessages, i as novaOutputFromMessage, t as AwsBedrockGenericProvider } from "./base-CqzQ4K8j.js";
|
|
31
|
+
import { i as formatOutput, n as buildStructuredImageOutputs, r as callOpenAiImageApi, t as OpenAiImageProvider } from "./image-CoxZp9PZ.js";
|
|
32
|
+
import { t as providerRegistry } from "./providerRegistry-CUWki5mQ.js";
|
|
33
|
+
import { n as runRuby } from "./rubyUtils-PgU-gHmx.js";
|
|
34
34
|
import * as fs$1 from "fs";
|
|
35
35
|
import fs, { promises } from "fs";
|
|
36
36
|
import * as path$1 from "path";
|
|
@@ -215,6 +215,62 @@ const AZURE_MODELS = [
|
|
|
215
215
|
output: 20 / 1e6
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
|
+
{
|
|
219
|
+
id: "gpt-5.4",
|
|
220
|
+
cost: {
|
|
221
|
+
input: 2.5 / 1e6,
|
|
222
|
+
output: 10 / 1e6
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
id: "gpt-5.4-2026-03-05",
|
|
227
|
+
cost: {
|
|
228
|
+
input: 2.5 / 1e6,
|
|
229
|
+
output: 10 / 1e6
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
id: "gpt-5.4-pro",
|
|
234
|
+
cost: {
|
|
235
|
+
input: 5 / 1e6,
|
|
236
|
+
output: 20 / 1e6
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: "gpt-5.4-pro-2026-03-05",
|
|
241
|
+
cost: {
|
|
242
|
+
input: 5 / 1e6,
|
|
243
|
+
output: 20 / 1e6
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
id: "gpt-5.4-mini",
|
|
248
|
+
cost: {
|
|
249
|
+
input: .4 / 1e6,
|
|
250
|
+
output: 1.6 / 1e6
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
id: "gpt-5.4-mini-2026-03-17",
|
|
255
|
+
cost: {
|
|
256
|
+
input: .4 / 1e6,
|
|
257
|
+
output: 1.6 / 1e6
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
id: "gpt-5.4-nano",
|
|
262
|
+
cost: {
|
|
263
|
+
input: .1 / 1e6,
|
|
264
|
+
output: .4 / 1e6
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: "gpt-5.4-nano-2026-03-17",
|
|
269
|
+
cost: {
|
|
270
|
+
input: .1 / 1e6,
|
|
271
|
+
output: .4 / 1e6
|
|
272
|
+
}
|
|
273
|
+
},
|
|
218
274
|
{
|
|
219
275
|
id: "gpt-5-mini",
|
|
220
276
|
cost: {
|
|
@@ -1641,7 +1697,7 @@ var AzureChatCompletionProvider = class extends AzureGenericProvider {
|
|
|
1641
1697
|
...this.config.headers
|
|
1642
1698
|
},
|
|
1643
1699
|
body: JSON.stringify(body)
|
|
1644
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug);
|
|
1700
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug);
|
|
1645
1701
|
cached = isCached;
|
|
1646
1702
|
latencyMs = fetchLatencyMs;
|
|
1647
1703
|
if (typeof responseData === "string") try {
|
|
@@ -1741,7 +1797,7 @@ var AzureEmbeddingProvider = class extends AzureGenericProvider {
|
|
|
1741
1797
|
...this.config.headers
|
|
1742
1798
|
},
|
|
1743
1799
|
body: JSON.stringify(body)
|
|
1744
|
-
}, REQUEST_TIMEOUT_MS));
|
|
1800
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
1745
1801
|
} catch (err) {
|
|
1746
1802
|
return {
|
|
1747
1803
|
error: `API call error: ${String(err)}`,
|
|
@@ -1902,7 +1958,7 @@ var AzureModerationProvider = class AzureModerationProvider extends AzureGeneric
|
|
|
1902
1958
|
...this.configWithHeaders.passthrough || {}
|
|
1903
1959
|
};
|
|
1904
1960
|
const controller = new AbortController();
|
|
1905
|
-
const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
1961
|
+
const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS$1);
|
|
1906
1962
|
const response = await fetchWithProxy(url, {
|
|
1907
1963
|
method: "POST",
|
|
1908
1964
|
headers,
|
|
@@ -2149,7 +2205,7 @@ var GoogleGenericProvider = class {
|
|
|
2149
2205
|
* Get the request timeout in milliseconds.
|
|
2150
2206
|
*/
|
|
2151
2207
|
getTimeout() {
|
|
2152
|
-
return this.config.timeoutMs || REQUEST_TIMEOUT_MS;
|
|
2208
|
+
return this.config.timeoutMs || REQUEST_TIMEOUT_MS$1;
|
|
2153
2209
|
}
|
|
2154
2210
|
};
|
|
2155
2211
|
//#endregion
|
|
@@ -2291,7 +2347,7 @@ var AIStudioChatProvider = class extends GoogleGenericProvider {
|
|
|
2291
2347
|
headers,
|
|
2292
2348
|
body: JSON.stringify(body),
|
|
2293
2349
|
...authDiscriminator && { _authHash: authDiscriminator }
|
|
2294
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug));
|
|
2350
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug));
|
|
2295
2351
|
} catch (err) {
|
|
2296
2352
|
return { error: `API call error: ${String(err)}` };
|
|
2297
2353
|
}
|
|
@@ -2318,7 +2374,7 @@ var AIStudioChatProvider = class extends GoogleGenericProvider {
|
|
|
2318
2374
|
rejectedPrediction: 0
|
|
2319
2375
|
} }
|
|
2320
2376
|
};
|
|
2321
|
-
const completionForCost = data.usageMetadata?.candidatesTokenCount
|
|
2377
|
+
const completionForCost = data.usageMetadata?.candidatesTokenCount == null ? void 0 : data.usageMetadata.candidatesTokenCount + (data.usageMetadata?.thoughtsTokenCount ?? 0);
|
|
2322
2378
|
return {
|
|
2323
2379
|
output,
|
|
2324
2380
|
tokenUsage,
|
|
@@ -2373,7 +2429,7 @@ var AIStudioChatProvider = class extends GoogleGenericProvider {
|
|
|
2373
2429
|
headers,
|
|
2374
2430
|
body: JSON.stringify(body),
|
|
2375
2431
|
...authDiscriminator && { _authHash: authDiscriminator }
|
|
2376
|
-
}, REQUEST_TIMEOUT_MS, "json", false));
|
|
2432
|
+
}, REQUEST_TIMEOUT_MS$1, "json", false));
|
|
2377
2433
|
} catch (err) {
|
|
2378
2434
|
return { error: `API call error: ${String(err)}` };
|
|
2379
2435
|
}
|
|
@@ -2415,7 +2471,7 @@ var AIStudioChatProvider = class extends GoogleGenericProvider {
|
|
|
2415
2471
|
rejectedPrediction: 0
|
|
2416
2472
|
} }
|
|
2417
2473
|
};
|
|
2418
|
-
const completionForCost = data.usageMetadata?.candidatesTokenCount
|
|
2474
|
+
const completionForCost = data.usageMetadata?.candidatesTokenCount == null ? void 0 : data.usageMetadata.candidatesTokenCount + (data.usageMetadata?.thoughtsTokenCount ?? 0);
|
|
2419
2475
|
const cost = cached ? void 0 : calculateGoogleCost(this.modelName, config, data.usageMetadata?.promptTokenCount, completionForCost);
|
|
2420
2476
|
return {
|
|
2421
2477
|
output,
|
|
@@ -2606,7 +2662,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
2606
2662
|
method: "POST",
|
|
2607
2663
|
headers: { "Content-Type": "application/json; charset=utf-8" },
|
|
2608
2664
|
data: body,
|
|
2609
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
2665
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
2610
2666
|
})).data;
|
|
2611
2667
|
} catch (err) {
|
|
2612
2668
|
const error = err;
|
|
@@ -2720,7 +2776,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
2720
2776
|
method: "POST",
|
|
2721
2777
|
headers: await this.getAuthHeaders(),
|
|
2722
2778
|
body: JSON.stringify(body),
|
|
2723
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
2779
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS$1)
|
|
2724
2780
|
});
|
|
2725
2781
|
if (!res.ok) {
|
|
2726
2782
|
const errorData = await res.json().catch(() => null);
|
|
@@ -2736,7 +2792,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
2736
2792
|
url,
|
|
2737
2793
|
method: "POST",
|
|
2738
2794
|
data: body,
|
|
2739
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
2795
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
2740
2796
|
})).data;
|
|
2741
2797
|
}
|
|
2742
2798
|
} catch (err) {
|
|
@@ -2839,7 +2895,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
2839
2895
|
rejectedPrediction: 0
|
|
2840
2896
|
} }
|
|
2841
2897
|
};
|
|
2842
|
-
const completionForCost = completionTokenCount
|
|
2898
|
+
const completionForCost = completionTokenCount == null ? void 0 : completionTokenCount + (thoughtsTokenCount ?? 0);
|
|
2843
2899
|
const cost = calculateGoogleCost(this.modelName, config, promptTokenCount, completionForCost, true);
|
|
2844
2900
|
response = {
|
|
2845
2901
|
cached: false,
|
|
@@ -2926,7 +2982,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
2926
2982
|
method: "POST",
|
|
2927
2983
|
headers: { "Content-Type": "application/json" },
|
|
2928
2984
|
data: body,
|
|
2929
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
2985
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
2930
2986
|
})).data;
|
|
2931
2987
|
} catch (err) {
|
|
2932
2988
|
return { error: `API call error: ${JSON.stringify(err)}` };
|
|
@@ -2995,7 +3051,7 @@ var VertexChatProvider = class extends GoogleGenericProvider {
|
|
|
2995
3051
|
method: "POST",
|
|
2996
3052
|
headers: { "Content-Type": "application/json; charset=utf-8" },
|
|
2997
3053
|
data: body,
|
|
2998
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
3054
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
2999
3055
|
})).data;
|
|
3000
3056
|
logger.debug(`Llama API response: ${JSON.stringify(data)}`);
|
|
3001
3057
|
} catch (err) {
|
|
@@ -3322,12 +3378,14 @@ var MistralChatCompletionProvider = class MistralChatCompletionProvider {
|
|
|
3322
3378
|
};
|
|
3323
3379
|
return withGenAISpan(spanContext, () => this.callApiInternal(prompt, context, config), resultExtractor);
|
|
3324
3380
|
}
|
|
3325
|
-
async callApiInternal(prompt,
|
|
3381
|
+
async callApiInternal(prompt, context, config = {}) {
|
|
3326
3382
|
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.");
|
|
3327
3383
|
const messages = parseChatPrompt(prompt, [{
|
|
3328
3384
|
role: "user",
|
|
3329
3385
|
content: prompt
|
|
3330
3386
|
}]);
|
|
3387
|
+
const loadedTools = config.tools ? await maybeLoadToolsFromExternalFile(config.tools, context?.vars) : void 0;
|
|
3388
|
+
const hasTools = Array.isArray(loadedTools) ? loadedTools.length > 0 : loadedTools !== void 0;
|
|
3331
3389
|
const params = {
|
|
3332
3390
|
model: this.modelName,
|
|
3333
3391
|
messages,
|
|
@@ -3336,6 +3394,9 @@ var MistralChatCompletionProvider = class MistralChatCompletionProvider {
|
|
|
3336
3394
|
max_tokens: config?.max_tokens || 1024,
|
|
3337
3395
|
safe_prompt: config?.safe_prompt || false,
|
|
3338
3396
|
random_seed: config?.random_seed || null,
|
|
3397
|
+
...hasTools ? { tools: loadedTools } : {},
|
|
3398
|
+
...config?.tool_choice ? { tool_choice: config.tool_choice } : {},
|
|
3399
|
+
..."parallel_tool_calls" in config ? { parallel_tool_calls: Boolean(config.parallel_tool_calls) } : {},
|
|
3339
3400
|
...config?.response_format ? { response_format: config.response_format } : {}
|
|
3340
3401
|
};
|
|
3341
3402
|
const cacheKey = `mistral:${JSON.stringify(params)}`;
|
|
@@ -3370,15 +3431,20 @@ var MistralChatCompletionProvider = class MistralChatCompletionProvider {
|
|
|
3370
3431
|
Authorization: `Bearer ${this.getApiKey()}`
|
|
3371
3432
|
},
|
|
3372
3433
|
body: JSON.stringify(params)
|
|
3373
|
-
}, REQUEST_TIMEOUT_MS));
|
|
3434
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
3374
3435
|
} catch (err) {
|
|
3375
3436
|
return { error: `API call error: ${String(err)}` };
|
|
3376
3437
|
}
|
|
3377
3438
|
logger.debug("Mistral API response", { data });
|
|
3378
3439
|
if (data.error) return { error: `API call error: ${data.error}` };
|
|
3379
|
-
if (!data.choices || !data.choices[0] || !data.choices[0].message
|
|
3440
|
+
if (!data.choices || !data.choices[0] || !data.choices[0].message) return { error: `Malformed response data: ${JSON.stringify(data)}` };
|
|
3441
|
+
const message = data.choices[0].message;
|
|
3442
|
+
let output;
|
|
3443
|
+
if (message.content && message.tool_calls?.length) output = message;
|
|
3444
|
+
else if (message.tool_calls?.length) output = message.tool_calls;
|
|
3445
|
+
else output = message.content;
|
|
3380
3446
|
const result = {
|
|
3381
|
-
output
|
|
3447
|
+
output,
|
|
3382
3448
|
tokenUsage: getTokenUsage$1(data, cached),
|
|
3383
3449
|
cached,
|
|
3384
3450
|
cost: calculateMistralCost(this.modelName, config, data.usage?.prompt_tokens, data.usage?.completion_tokens)
|
|
@@ -3451,7 +3517,7 @@ var MistralEmbeddingProvider = class {
|
|
|
3451
3517
|
Authorization: `Bearer ${this.getApiKey()}`
|
|
3452
3518
|
},
|
|
3453
3519
|
body: JSON.stringify(body)
|
|
3454
|
-
}, REQUEST_TIMEOUT_MS));
|
|
3520
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
3455
3521
|
} catch (err) {
|
|
3456
3522
|
logger.error(`API call error: ${err}`);
|
|
3457
3523
|
throw err;
|
|
@@ -3587,7 +3653,7 @@ var OpenAiModerationProvider = class OpenAiModerationProvider extends OpenAiGene
|
|
|
3587
3653
|
method: "POST",
|
|
3588
3654
|
headers,
|
|
3589
3655
|
body: requestBody
|
|
3590
|
-
}, REQUEST_TIMEOUT_MS, "json", false, this.config.maxRetries);
|
|
3656
|
+
}, REQUEST_TIMEOUT_MS$1, "json", false, this.config.maxRetries);
|
|
3591
3657
|
if (status < 200 || status >= 300) return handleApiError$1(`${status} ${statusText}`, typeof data === "string" ? data : JSON.stringify(data));
|
|
3592
3658
|
logger.debug(`\tOpenAI moderation API response: ${JSON.stringify(data)}`);
|
|
3593
3659
|
const response = parseOpenAIModerationResponse(data);
|
|
@@ -3709,9 +3775,9 @@ function normalizeEvalConfig(config) {
|
|
|
3709
3775
|
const tests = Array.isArray(config.tests) ? config.tests : Array.isArray(config.testCases) ? config.testCases : [];
|
|
3710
3776
|
const commandLineOptions = {
|
|
3711
3777
|
...isRecord(config.commandLineOptions) ? config.commandLineOptions : {},
|
|
3712
|
-
...config.maxConcurrency
|
|
3713
|
-
...config.delay
|
|
3714
|
-
...config.verbose
|
|
3778
|
+
...config.maxConcurrency == null ? {} : { maxConcurrency: config.maxConcurrency },
|
|
3779
|
+
...config.delay == null ? {} : { delay: config.delay },
|
|
3780
|
+
...config.verbose == null ? {} : { verbose: config.verbose }
|
|
3715
3781
|
};
|
|
3716
3782
|
const normalizedConfig = {
|
|
3717
3783
|
...config,
|
|
@@ -4215,7 +4281,7 @@ var PromptfooChatCompletionProvider = class {
|
|
|
4215
4281
|
headers: { "Content-Type": "application/json" },
|
|
4216
4282
|
body: JSON.stringify(body),
|
|
4217
4283
|
...callApiOptions?.abortSignal && { signal: callApiOptions.abortSignal }
|
|
4218
|
-
}, REQUEST_TIMEOUT_MS);
|
|
4284
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
4219
4285
|
const data = await response.json();
|
|
4220
4286
|
if (!data.result) {
|
|
4221
4287
|
logger.debug(`Error from promptfoo completion provider. Status: ${response.status} ${response.statusText} ${JSON.stringify(data)} `);
|
|
@@ -4274,7 +4340,7 @@ var PromptfooSimulatedUserProvider = class {
|
|
|
4274
4340
|
headers: { "Content-Type": "application/json" },
|
|
4275
4341
|
body: JSON.stringify(body),
|
|
4276
4342
|
...callApiOptions?.abortSignal && { signal: callApiOptions.abortSignal }
|
|
4277
|
-
}, REQUEST_TIMEOUT_MS);
|
|
4343
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
4278
4344
|
if (!response.ok) throw new Error(`API call failed with status ${response.status}: ${await response.text()}`);
|
|
4279
4345
|
const data = await response.json();
|
|
4280
4346
|
return {
|
|
@@ -5341,7 +5407,7 @@ async function loadRedteamProvider({ provider, jsonOnly = false, preferSmallMode
|
|
|
5341
5407
|
ret = redteamProvider;
|
|
5342
5408
|
} else if (typeof redteamProvider === "string" || isProviderOptions(redteamProvider)) {
|
|
5343
5409
|
logger.debug(`Loading ${purpose} provider`, { provider: redteamProvider });
|
|
5344
|
-
ret = (await (await import("./providers-
|
|
5410
|
+
ret = (await (await import("./providers-sS2WI8YD.js")).loadApiProviders([redteamProvider]))[0];
|
|
5345
5411
|
} else {
|
|
5346
5412
|
const defaultModel = preferSmallModel ? ATTACKER_MODEL_SMALL : ATTACKER_MODEL;
|
|
5347
5413
|
logger.debug(`Using default ${purpose} provider: ${defaultModel}`);
|
|
@@ -5628,7 +5694,7 @@ async function externalizeResponseForRedteamHistory(response, context) {
|
|
|
5628
5694
|
*/
|
|
5629
5695
|
async function tryUnblocking({ messages, lastResponse, goal, purpose }) {
|
|
5630
5696
|
try {
|
|
5631
|
-
const { checkServerFeatureSupport } = await import("./server-
|
|
5697
|
+
const { checkServerFeatureSupport } = await import("./server-CP9qKM40.js").then((n) => n.n);
|
|
5632
5698
|
const supportsUnblocking = await checkServerFeatureSupport("blocking-question-analysis", "2025-06-16T14:49:11-07:00");
|
|
5633
5699
|
if (!getEnvBool("PROMPTFOO_ENABLE_UNBLOCKING")) {
|
|
5634
5700
|
logger.debug("[Unblocking] Disabled by default (set PROMPTFOO_ENABLE_UNBLOCKING=true to enable)");
|
|
@@ -6597,7 +6663,7 @@ async function extractGoalFromPrompt(prompt, purpose, pluginId, policy) {
|
|
|
6597
6663
|
method: "POST",
|
|
6598
6664
|
headers: { "Content-Type": "application/json" },
|
|
6599
6665
|
body: JSON.stringify(requestBody)
|
|
6600
|
-
}, REQUEST_TIMEOUT_MS);
|
|
6666
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
6601
6667
|
logger.debug(`Goal extraction response - Status: ${status} ${statusText || ""}, Data: ${JSON.stringify(data)}`);
|
|
6602
6668
|
if (status !== 200) {
|
|
6603
6669
|
logger.warn(`Failed to extract goal from prompt: HTTP ${status} ${statusText || ""}, Response Data: ${JSON.stringify(data)}`);
|
|
@@ -7096,7 +7162,7 @@ async function generateCitations(testCases, injectVar, config) {
|
|
|
7096
7162
|
method: "POST",
|
|
7097
7163
|
headers: { "Content-Type": "application/json" },
|
|
7098
7164
|
body: JSON.stringify(payload)
|
|
7099
|
-
}, REQUEST_TIMEOUT_MS);
|
|
7165
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
7100
7166
|
logger.debug(`Got remote citation generation result for case ${Number(index) + 1}: ${JSON.stringify(data)}`);
|
|
7101
7167
|
if (data.error) {
|
|
7102
7168
|
logger.error(`[Citation] Error in citation generation: ${data.error}`);
|
|
@@ -7233,7 +7299,7 @@ async function generateGcgPrompts(testCases, injectVar, config) {
|
|
|
7233
7299
|
method: "POST",
|
|
7234
7300
|
headers: { "Content-Type": "application/json" },
|
|
7235
7301
|
body: JSON.stringify(payload)
|
|
7236
|
-
}, REQUEST_TIMEOUT_MS);
|
|
7302
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
7237
7303
|
logger.debug(`Got GCG generation result for case ${Number(index) + 1}: ${JSON.stringify(data)}`);
|
|
7238
7304
|
if (data.error) {
|
|
7239
7305
|
logger.error(`[GCG] Error in GCG generation: ${data.error}`);
|
|
@@ -8158,7 +8224,7 @@ async function generateLikertPrompts(testCases, injectVar, config) {
|
|
|
8158
8224
|
method: "POST",
|
|
8159
8225
|
headers: { "Content-Type": "application/json" },
|
|
8160
8226
|
body: JSON.stringify(payload)
|
|
8161
|
-
}, REQUEST_TIMEOUT_MS);
|
|
8227
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
8162
8228
|
logger.debug(`Got Likert jailbreak generation result for case ${Number(index) + 1}: ${JSON.stringify(data)}`);
|
|
8163
8229
|
if (data.error || !data.modifiedPrompts) {
|
|
8164
8230
|
logger.error(`[jailbreak:likert] Error in Likert generation: ${data.error}}`);
|
|
@@ -8243,7 +8309,7 @@ async function generateMathPrompt(testCases, injectVar, config) {
|
|
|
8243
8309
|
method: "POST",
|
|
8244
8310
|
headers: { "Content-Type": "application/json" },
|
|
8245
8311
|
body: JSON.stringify(payload)
|
|
8246
|
-
}, REQUEST_TIMEOUT_MS);
|
|
8312
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
8247
8313
|
logger.debug(`Got remote MathPrompt generation result for batch ${Number(index) + 1}: ${JSON.stringify(data)}`);
|
|
8248
8314
|
allResults = allResults.concat(data.result);
|
|
8249
8315
|
processedBatches++;
|
|
@@ -9121,7 +9187,7 @@ async function textToAudio(text, language = "en", options) {
|
|
|
9121
9187
|
method: "POST",
|
|
9122
9188
|
headers: { "Content-Type": "application/json" },
|
|
9123
9189
|
body: JSON.stringify(payload)
|
|
9124
|
-
}, REQUEST_TIMEOUT_MS);
|
|
9190
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
9125
9191
|
if (data.error || !data.audioBase64) throw new Error(`Error in remote audio generation: ${data.error || "No audio data returned"}`);
|
|
9126
9192
|
logger.debug(`Received audio base64 from remote API (${data.audioBase64.length} chars)`);
|
|
9127
9193
|
const base64Audio = data.audioBase64;
|
|
@@ -9537,13 +9603,21 @@ async function generateCompositePrompts(testCases, injectVar, config) {
|
|
|
9537
9603
|
email: getUserEmail(),
|
|
9538
9604
|
...config.n && { n: config.n },
|
|
9539
9605
|
...config.modelFamily && { modelFamily: config.modelFamily },
|
|
9540
|
-
...inputs && { inputs }
|
|
9606
|
+
...inputs && { inputs },
|
|
9607
|
+
...config.techniques && { techniques: config.techniques },
|
|
9608
|
+
...config.evasions && { evasions: config.evasions },
|
|
9609
|
+
...config.alwaysIncludeTechniques && { alwaysIncludeTechniques: config.alwaysIncludeTechniques },
|
|
9610
|
+
...config.compositionOrder && { compositionOrder: config.compositionOrder },
|
|
9611
|
+
...config.combinationMode && { combinationMode: config.combinationMode },
|
|
9612
|
+
...config.includeEvasionGuidance != null && { includeEvasionGuidance: config.includeEvasionGuidance },
|
|
9613
|
+
...config.evasionGuidance && { evasionGuidance: config.evasionGuidance },
|
|
9614
|
+
...config.targetContext && { targetContext: config.targetContext }
|
|
9541
9615
|
};
|
|
9542
9616
|
const { data } = await fetchWithCache(getRemoteGenerationUrl(), {
|
|
9543
9617
|
method: "POST",
|
|
9544
9618
|
headers: { "Content-Type": "application/json" },
|
|
9545
9619
|
body: JSON.stringify(payload)
|
|
9546
|
-
}, REQUEST_TIMEOUT_MS);
|
|
9620
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
9547
9621
|
logger.debug(`Got composite jailbreak generation result for case ${Number(index) + 1}: ${JSON.stringify(data)}`);
|
|
9548
9622
|
if (data.error || !data.modifiedPrompts) {
|
|
9549
9623
|
logger.error(`[jailbreak:composite] Error in composite generation: ${data.error}}`);
|
|
@@ -10668,7 +10742,7 @@ var CrescendoProvider = class {
|
|
|
10668
10742
|
});
|
|
10669
10743
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
10670
10744
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
10671
|
-
const { getGraderById } = await import("./graders-
|
|
10745
|
+
const { getGraderById } = await import("./graders-kHzIWOKu.js");
|
|
10672
10746
|
let graderPassed;
|
|
10673
10747
|
const additionalRubric = getGoalRubric(this.userGoal);
|
|
10674
10748
|
while (roundNum < this.maxTurns) try {
|
|
@@ -10774,18 +10848,7 @@ var CrescendoProvider = class {
|
|
|
10774
10848
|
if (grader) {
|
|
10775
10849
|
const gradingTraceSummary = tracingOptions.includeInGrading ? response.traceSummary ?? (response.traceContext ? formatTraceSummary(response.traceContext) : void 0) : void 0;
|
|
10776
10850
|
let gradingContext;
|
|
10777
|
-
if (lastResponse.metadata?.wasExfiltrated
|
|
10778
|
-
logger.debug("[Crescendo] Using exfil data from provider response metadata");
|
|
10779
|
-
gradingContext = {
|
|
10780
|
-
...tracingOptions.includeInGrading ? {
|
|
10781
|
-
traceContext: response.traceContext,
|
|
10782
|
-
traceSummary: gradingTraceSummary
|
|
10783
|
-
} : {},
|
|
10784
|
-
wasExfiltrated: Boolean(lastResponse.metadata.wasExfiltrated),
|
|
10785
|
-
exfilCount: Number(lastResponse.metadata.exfilCount) || 0,
|
|
10786
|
-
exfilRecords: []
|
|
10787
|
-
};
|
|
10788
|
-
} else {
|
|
10851
|
+
if (lastResponse.metadata?.wasExfiltrated === void 0) {
|
|
10789
10852
|
const webPageUuid = test.metadata?.webPageUuid;
|
|
10790
10853
|
if (webPageUuid) {
|
|
10791
10854
|
const evalId = context?.evaluationId ?? test.metadata?.evaluationId;
|
|
@@ -10804,6 +10867,17 @@ var CrescendoProvider = class {
|
|
|
10804
10867
|
exfilRecords: exfilData.exfilRecords
|
|
10805
10868
|
};
|
|
10806
10869
|
}
|
|
10870
|
+
} else {
|
|
10871
|
+
logger.debug("[Crescendo] Using exfil data from provider response metadata");
|
|
10872
|
+
gradingContext = {
|
|
10873
|
+
...tracingOptions.includeInGrading ? {
|
|
10874
|
+
traceContext: response.traceContext,
|
|
10875
|
+
traceSummary: gradingTraceSummary
|
|
10876
|
+
} : {},
|
|
10877
|
+
wasExfiltrated: Boolean(lastResponse.metadata.wasExfiltrated),
|
|
10878
|
+
exfilCount: Number(lastResponse.metadata.exfilCount) || 0,
|
|
10879
|
+
exfilRecords: []
|
|
10880
|
+
};
|
|
10807
10881
|
}
|
|
10808
10882
|
if (!gradingContext && tracingOptions.includeInGrading) gradingContext = {
|
|
10809
10883
|
traceContext: response.traceContext,
|
|
@@ -11359,7 +11433,7 @@ var CustomProvider = class {
|
|
|
11359
11433
|
let lastTransformResult;
|
|
11360
11434
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
11361
11435
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
11362
|
-
const { getGraderById } = await import("./graders-
|
|
11436
|
+
const { getGraderById } = await import("./graders-kHzIWOKu.js");
|
|
11363
11437
|
let graderPassed;
|
|
11364
11438
|
let storedGraderResult;
|
|
11365
11439
|
const additionalRubric = getGoalRubric(this.userGoal);
|
|
@@ -11857,7 +11931,7 @@ var GoatProvider = class {
|
|
|
11857
11931
|
let assertToUse;
|
|
11858
11932
|
let graderPassed;
|
|
11859
11933
|
let storedGraderResult;
|
|
11860
|
-
const { getGraderById } = await import("./graders-
|
|
11934
|
+
const { getGraderById } = await import("./graders-kHzIWOKu.js");
|
|
11861
11935
|
let test;
|
|
11862
11936
|
if (context?.test) {
|
|
11863
11937
|
test = context?.test;
|
|
@@ -12140,18 +12214,7 @@ var GoatProvider = class {
|
|
|
12140
12214
|
const grader = assertToUse ? getGraderById(assertToUse.type) : void 0;
|
|
12141
12215
|
if (test && grader && finalOutput) {
|
|
12142
12216
|
let gradingContext;
|
|
12143
|
-
if (finalResponse.metadata?.wasExfiltrated
|
|
12144
|
-
logger.debug("[GOAT] Using exfil data from provider response metadata");
|
|
12145
|
-
gradingContext = {
|
|
12146
|
-
...tracingOptions.includeInGrading ? {
|
|
12147
|
-
traceContext: targetResponse.traceContext,
|
|
12148
|
-
traceSummary: gradingTraceSummary
|
|
12149
|
-
} : {},
|
|
12150
|
-
wasExfiltrated: Boolean(finalResponse.metadata.wasExfiltrated),
|
|
12151
|
-
exfilCount: Number(finalResponse.metadata.exfilCount) || 0,
|
|
12152
|
-
exfilRecords: []
|
|
12153
|
-
};
|
|
12154
|
-
} else {
|
|
12217
|
+
if (finalResponse.metadata?.wasExfiltrated === void 0) {
|
|
12155
12218
|
const webPageUuid = test.metadata?.webPageUuid;
|
|
12156
12219
|
if (webPageUuid) {
|
|
12157
12220
|
const evalId = context?.evaluationId ?? test.metadata?.evaluationId;
|
|
@@ -12170,6 +12233,17 @@ var GoatProvider = class {
|
|
|
12170
12233
|
exfilRecords: exfilData.exfilRecords
|
|
12171
12234
|
};
|
|
12172
12235
|
}
|
|
12236
|
+
} else {
|
|
12237
|
+
logger.debug("[GOAT] Using exfil data from provider response metadata");
|
|
12238
|
+
gradingContext = {
|
|
12239
|
+
...tracingOptions.includeInGrading ? {
|
|
12240
|
+
traceContext: targetResponse.traceContext,
|
|
12241
|
+
traceSummary: gradingTraceSummary
|
|
12242
|
+
} : {},
|
|
12243
|
+
wasExfiltrated: Boolean(finalResponse.metadata.wasExfiltrated),
|
|
12244
|
+
exfilCount: Number(finalResponse.metadata.exfilCount) || 0,
|
|
12245
|
+
exfilRecords: []
|
|
12246
|
+
};
|
|
12173
12247
|
}
|
|
12174
12248
|
if (!gradingContext && tracingOptions.includeInGrading) gradingContext = {
|
|
12175
12249
|
traceContext: targetResponse.traceContext,
|
|
@@ -12330,7 +12404,7 @@ var HydraProvider = class {
|
|
|
12330
12404
|
let lastTransformResult;
|
|
12331
12405
|
let lastTransformDisplayVars;
|
|
12332
12406
|
let lastFinalAttackPrompt;
|
|
12333
|
-
const { getGraderById } = await import("./graders-
|
|
12407
|
+
const { getGraderById } = await import("./graders-kHzIWOKu.js");
|
|
12334
12408
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
12335
12409
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
12336
12410
|
let previousTraceSummary;
|
|
@@ -13184,7 +13258,7 @@ async function runRedteamConversation$2({ context, filters, injectVar, numIterat
|
|
|
13184
13258
|
if (sessionId) sessionIds.push(sessionId);
|
|
13185
13259
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
13186
13260
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
13187
|
-
const { getGraderById } = await import("./graders-
|
|
13261
|
+
const { getGraderById } = await import("./graders-kHzIWOKu.js");
|
|
13188
13262
|
if (test && assertToUse) {
|
|
13189
13263
|
const grader = getGraderById(assertToUse.type);
|
|
13190
13264
|
if (grader) {
|
|
@@ -14011,7 +14085,7 @@ async function runMetaAgentRedteam({ context, filters, injectVar, numIterations,
|
|
|
14011
14085
|
previousTraceSummary = attackTraceSummary;
|
|
14012
14086
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
14013
14087
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
14014
|
-
const { getGraderById } = await import("./graders-
|
|
14088
|
+
const { getGraderById } = await import("./graders-kHzIWOKu.js");
|
|
14015
14089
|
if (test && assertToUse) {
|
|
14016
14090
|
const grader = getGraderById(assertToUse.type);
|
|
14017
14091
|
if (grader) {
|
|
@@ -14595,7 +14669,7 @@ async function runRedteamConversation({ context, filters, injectVar, options, pr
|
|
|
14595
14669
|
noImprovementCount++;
|
|
14596
14670
|
if (noImprovementCount % 5 === 0) logger.debug(`[Depth ${depth}, Attempt ${attempts}] No improvement for ${noImprovementCount} consecutive iterations. Max score: ${maxScore}`);
|
|
14597
14671
|
}
|
|
14598
|
-
const { getGraderById } = await import("./graders-
|
|
14672
|
+
const { getGraderById } = await import("./graders-kHzIWOKu.js");
|
|
14599
14673
|
let graderPassed;
|
|
14600
14674
|
let assertToUse = test?.assert?.find((a) => a.type && a.type.includes(test.metadata?.pluginId));
|
|
14601
14675
|
if (!assertToUse) assertToUse = test?.assert?.find((a) => a.type);
|
|
@@ -15269,7 +15343,7 @@ var AI21ChatCompletionProvider = class AI21ChatCompletionProvider {
|
|
|
15269
15343
|
messages,
|
|
15270
15344
|
temperature: config?.temperature ?? .1,
|
|
15271
15345
|
top_p: config?.top_p || 1,
|
|
15272
|
-
max_tokens: config?.max_tokens
|
|
15346
|
+
max_tokens: config?.max_tokens ?? 1024,
|
|
15273
15347
|
n: 1,
|
|
15274
15348
|
stop: [],
|
|
15275
15349
|
response_format: config.response_format || { type: "text" }
|
|
@@ -15284,7 +15358,7 @@ var AI21ChatCompletionProvider = class AI21ChatCompletionProvider {
|
|
|
15284
15358
|
Authorization: `Bearer ${this.getApiKey()}`
|
|
15285
15359
|
},
|
|
15286
15360
|
body: JSON.stringify(body)
|
|
15287
|
-
}, REQUEST_TIMEOUT_MS));
|
|
15361
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
15288
15362
|
} catch (err) {
|
|
15289
15363
|
return { error: `API call error: ${String(err)}` };
|
|
15290
15364
|
}
|
|
@@ -15450,7 +15524,7 @@ var AnthropicCompletionProvider = class extends AnthropicGenericProvider {
|
|
|
15450
15524
|
const params = {
|
|
15451
15525
|
model: this.modelName,
|
|
15452
15526
|
prompt: `${Anthropic.HUMAN_PROMPT} ${prompt} ${Anthropic.AI_PROMPT}`,
|
|
15453
|
-
max_tokens_to_sample: this.config?.max_tokens_to_sample
|
|
15527
|
+
max_tokens_to_sample: this.config?.max_tokens_to_sample ?? getEnvInt("ANTHROPIC_MAX_TOKENS", 1024),
|
|
15454
15528
|
temperature: this.config.temperature ?? getEnvFloat("ANTHROPIC_TEMPERATURE", 0),
|
|
15455
15529
|
stop_sequences: stop
|
|
15456
15530
|
};
|
|
@@ -15624,7 +15698,7 @@ var AzureAssistantProvider = class extends AzureGenericProvider {
|
|
|
15624
15698
|
* Helper method to make HTTP requests using fetchWithCache
|
|
15625
15699
|
*/
|
|
15626
15700
|
async makeRequest(url, options) {
|
|
15627
|
-
const timeoutMs = this.assistantConfig.timeoutMs || REQUEST_TIMEOUT_MS;
|
|
15701
|
+
const timeoutMs = this.assistantConfig.timeoutMs || REQUEST_TIMEOUT_MS$1;
|
|
15628
15702
|
const retries = this.assistantConfig.retryOptions?.maxRetries || 4;
|
|
15629
15703
|
const shouldBustCache = url.includes("/runs/") && options.method === "GET" || url.includes("/threads") && options.method === "POST" && !url.includes("/messages") && !url.includes("submit_tool_outputs");
|
|
15630
15704
|
try {
|
|
@@ -15922,7 +15996,7 @@ var AzureCompletionProvider = class extends AzureGenericProvider {
|
|
|
15922
15996
|
...this.config.headers
|
|
15923
15997
|
},
|
|
15924
15998
|
body: JSON.stringify(body)
|
|
15925
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug));
|
|
15999
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug));
|
|
15926
16000
|
} catch (err) {
|
|
15927
16001
|
return { error: `API call error: ${String(err)}` };
|
|
15928
16002
|
}
|
|
@@ -15989,61 +16063,65 @@ var AzureCompletionProvider = class extends AzureGenericProvider {
|
|
|
15989
16063
|
var AzureFoundryAgentProvider = class extends AzureGenericProvider {
|
|
15990
16064
|
assistantConfig;
|
|
15991
16065
|
loadedFunctionCallbacks = {};
|
|
16066
|
+
processor;
|
|
15992
16067
|
projectClient = null;
|
|
15993
16068
|
projectUrl;
|
|
16069
|
+
resolvedAgent = null;
|
|
16070
|
+
warnedUnsupportedFields = /* @__PURE__ */ new Set();
|
|
15994
16071
|
constructor(deploymentName, options = {}) {
|
|
15995
16072
|
super(deploymentName, options);
|
|
15996
16073
|
this.assistantConfig = options.config || {};
|
|
15997
16074
|
this.projectUrl = options.config?.projectUrl || process.env.AZURE_AI_PROJECT_URL || "";
|
|
15998
16075
|
if (!this.projectUrl) throw new Error("Azure AI Project URL must be provided via projectUrl option or AZURE_AI_PROJECT_URL environment variable");
|
|
16076
|
+
this.processor = new ResponsesProcessor({
|
|
16077
|
+
modelName: this.assistantConfig.modelName || deploymentName,
|
|
16078
|
+
providerType: "azure",
|
|
16079
|
+
functionCallbackHandler: new FunctionCallbackHandler(),
|
|
16080
|
+
costCalculator: (_modelName, usage, requestConfig) => calculateAzureCost(requestConfig?.model || this.assistantConfig.modelName || this.deploymentName, usage) ?? 0
|
|
16081
|
+
});
|
|
15999
16082
|
if (this.assistantConfig.functionToolCallbacks) this.preloadFunctionCallbacks();
|
|
16000
16083
|
}
|
|
16001
|
-
/**
|
|
16002
|
-
* Initialize the Azure AI Project client
|
|
16003
|
-
*/
|
|
16004
16084
|
async initializeClient() {
|
|
16005
16085
|
if (this.projectClient) return this.projectClient;
|
|
16006
16086
|
try {
|
|
16007
16087
|
const { AIProjectClient } = await import("@azure/ai-projects");
|
|
16008
16088
|
const { DefaultAzureCredential } = await import("@azure/identity");
|
|
16009
|
-
|
|
16089
|
+
const projectClient = new AIProjectClient(this.projectUrl, new DefaultAzureCredential());
|
|
16090
|
+
this.projectClient = projectClient;
|
|
16010
16091
|
logger.debug("Azure AI Project client initialized successfully");
|
|
16011
|
-
return
|
|
16092
|
+
return projectClient;
|
|
16012
16093
|
} catch (error) {
|
|
16013
|
-
|
|
16014
|
-
|
|
16094
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
16095
|
+
logger.error(`Failed to initialize Azure AI Project client: ${errorMessage}`);
|
|
16096
|
+
throw new Error(`Failed to initialize Azure AI Project client: ${errorMessage}`);
|
|
16015
16097
|
}
|
|
16016
16098
|
}
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16099
|
+
async resolveAgent(client) {
|
|
16100
|
+
if (this.resolvedAgent) return this.resolvedAgent;
|
|
16101
|
+
try {
|
|
16102
|
+
const agent = await client.agents.get(this.deploymentName);
|
|
16103
|
+
this.resolvedAgent = agent;
|
|
16104
|
+
return agent;
|
|
16105
|
+
} catch (error) {
|
|
16106
|
+
logger.debug(`[AzureFoundryAgentProvider] Direct agent lookup failed for '${this.deploymentName}', falling back to list lookup`, { error: error instanceof Error ? error.message : String(error) });
|
|
16107
|
+
}
|
|
16108
|
+
for await (const agent of client.agents.list()) if (agent.id === this.deploymentName || agent.name === this.deploymentName) {
|
|
16109
|
+
this.resolvedAgent = agent;
|
|
16110
|
+
return agent;
|
|
16111
|
+
}
|
|
16112
|
+
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.`);
|
|
16113
|
+
}
|
|
16020
16114
|
async preloadFunctionCallbacks() {
|
|
16021
16115
|
if (!this.assistantConfig.functionToolCallbacks) return;
|
|
16022
16116
|
const callbacks = this.assistantConfig.functionToolCallbacks;
|
|
16023
16117
|
for (const [name, callback] of Object.entries(callbacks)) try {
|
|
16024
|
-
if (typeof callback === "string")
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
const fn = await this.loadExternalFunction(callbackStr);
|
|
16028
|
-
this.loadedFunctionCallbacks[name] = fn;
|
|
16029
|
-
logger.debug(`Successfully preloaded function callback '${name}' from file`);
|
|
16030
|
-
} else {
|
|
16031
|
-
this.loadedFunctionCallbacks[name] = new Function("return " + callbackStr)();
|
|
16032
|
-
logger.debug(`Successfully preloaded inline function callback '${name}'`);
|
|
16033
|
-
}
|
|
16034
|
-
} else if (typeof callback === "function") {
|
|
16035
|
-
this.loadedFunctionCallbacks[name] = callback;
|
|
16036
|
-
logger.debug(`Successfully stored function callback '${name}'`);
|
|
16037
|
-
}
|
|
16118
|
+
if (typeof callback === "string") if (callback.startsWith("file://")) this.loadedFunctionCallbacks[name] = await this.loadExternalFunction(callback);
|
|
16119
|
+
else this.loadedFunctionCallbacks[name] = new Function("return " + callback)();
|
|
16120
|
+
else if (typeof callback === "function") this.loadedFunctionCallbacks[name] = callback;
|
|
16038
16121
|
} catch (error) {
|
|
16039
16122
|
logger.error(`Failed to preload function callback '${name}': ${error}`);
|
|
16040
16123
|
}
|
|
16041
16124
|
}
|
|
16042
|
-
/**
|
|
16043
|
-
* Loads a function from an external file
|
|
16044
|
-
* @param fileRef The file reference in the format 'file://path/to/file:functionName'
|
|
16045
|
-
* @returns The loaded function
|
|
16046
|
-
*/
|
|
16047
16125
|
async loadExternalFunction(fileRef) {
|
|
16048
16126
|
let filePath = fileRef.slice(7);
|
|
16049
16127
|
let functionName;
|
|
@@ -16052,11 +16130,9 @@ var AzureFoundryAgentProvider = class extends AzureGenericProvider {
|
|
|
16052
16130
|
if (splits[0] && isJavascriptFile(splits[0])) [filePath, functionName] = splits;
|
|
16053
16131
|
}
|
|
16054
16132
|
try {
|
|
16055
|
-
const
|
|
16056
|
-
logger.debug(`Loading function from ${resolvedPath}${functionName ? `:${functionName}` : ""}`);
|
|
16057
|
-
const requiredModule = await importModule(resolvedPath, functionName);
|
|
16133
|
+
const requiredModule = await importModule(path.resolve(state.basePath || "", filePath), functionName);
|
|
16058
16134
|
if (typeof requiredModule === "function") return requiredModule;
|
|
16059
|
-
|
|
16135
|
+
if (requiredModule && typeof requiredModule === "object" && functionName && functionName in requiredModule) {
|
|
16060
16136
|
const fn = requiredModule[functionName];
|
|
16061
16137
|
if (typeof fn === "function") return fn;
|
|
16062
16138
|
}
|
|
@@ -16065,139 +16141,197 @@ var AzureFoundryAgentProvider = class extends AzureGenericProvider {
|
|
|
16065
16141
|
throw new Error(`Error loading function from ${filePath}: ${error.message || String(error)}`);
|
|
16066
16142
|
}
|
|
16067
16143
|
}
|
|
16068
|
-
|
|
16069
|
-
* Executes a function callback with proper error handling
|
|
16070
|
-
*/
|
|
16071
|
-
async executeFunctionCallback(functionName, args, context) {
|
|
16144
|
+
async executeFunctionCallback(functionName, args, context, callbacks) {
|
|
16072
16145
|
try {
|
|
16073
16146
|
let callback = this.loadedFunctionCallbacks[functionName];
|
|
16147
|
+
const effectiveCallbacks = callbacks || this.assistantConfig.functionToolCallbacks;
|
|
16074
16148
|
if (!callback) {
|
|
16075
|
-
const callbackRef =
|
|
16076
|
-
if (callbackRef && typeof callbackRef === "string")
|
|
16077
|
-
|
|
16078
|
-
|
|
16079
|
-
|
|
16080
|
-
this.loadedFunctionCallbacks[functionName] = callback;
|
|
16081
|
-
} else if (typeof callbackRef === "function") {
|
|
16082
|
-
callback = callbackRef;
|
|
16083
|
-
this.loadedFunctionCallbacks[functionName] = callback;
|
|
16084
|
-
}
|
|
16149
|
+
const callbackRef = effectiveCallbacks?.[functionName];
|
|
16150
|
+
if (callbackRef && typeof callbackRef === "string") if (callbackRef.startsWith("file://")) callback = await this.loadExternalFunction(callbackRef);
|
|
16151
|
+
else callback = new Function("return " + callbackRef)();
|
|
16152
|
+
else if (typeof callbackRef === "function") callback = callbackRef;
|
|
16153
|
+
if (callback) this.loadedFunctionCallbacks[functionName] = callback;
|
|
16085
16154
|
}
|
|
16086
16155
|
if (!callback) throw new Error(`No callback found for function '${functionName}'`);
|
|
16087
|
-
logger.debug(`Executing function '${functionName}' with args: ${args}${context ? ` and context: ${JSON.stringify(context)}` : ""}`);
|
|
16088
16156
|
const result = await callback(args, context);
|
|
16089
16157
|
if (result === void 0 || result === null) return "";
|
|
16090
|
-
|
|
16091
|
-
|
|
16092
|
-
} catch (error) {
|
|
16093
|
-
logger.warn(`Error stringifying result from function '${functionName}': ${error}`);
|
|
16094
|
-
return String(result);
|
|
16095
|
-
}
|
|
16096
|
-
else return String(result);
|
|
16158
|
+
if (typeof result === "object") return JSON.stringify(result);
|
|
16159
|
+
return String(result);
|
|
16097
16160
|
} catch (error) {
|
|
16098
16161
|
logger.error(`Error executing function '${functionName}': ${error.message || String(error)}`);
|
|
16099
16162
|
return JSON.stringify({ error: `Error in ${functionName}: ${error.message || String(error)}` });
|
|
16100
16163
|
}
|
|
16101
16164
|
}
|
|
16165
|
+
parsePromptInput(prompt) {
|
|
16166
|
+
try {
|
|
16167
|
+
const parsedJson = JSON.parse(prompt);
|
|
16168
|
+
if (Array.isArray(parsedJson)) return parsedJson;
|
|
16169
|
+
} catch {}
|
|
16170
|
+
return [{
|
|
16171
|
+
type: "message",
|
|
16172
|
+
role: "user",
|
|
16173
|
+
content: prompt
|
|
16174
|
+
}];
|
|
16175
|
+
}
|
|
16176
|
+
warnForUnsupportedConfig(config) {
|
|
16177
|
+
const unsupportedFields = [
|
|
16178
|
+
config.frequency_penalty === void 0 ? null : "frequency_penalty",
|
|
16179
|
+
config.presence_penalty === void 0 ? null : "presence_penalty",
|
|
16180
|
+
config.retryOptions ? "retryOptions" : null,
|
|
16181
|
+
config.seed === void 0 ? null : "seed",
|
|
16182
|
+
config.stop?.length ? "stop" : null,
|
|
16183
|
+
config.timeoutMs === void 0 ? null : "timeoutMs",
|
|
16184
|
+
config.tool_resources ? "tool_resources" : null
|
|
16185
|
+
].filter(Boolean);
|
|
16186
|
+
if (unsupportedFields.length === 0) return;
|
|
16187
|
+
const warningKey = unsupportedFields.sort().join(",");
|
|
16188
|
+
if (this.warnedUnsupportedFields.has(warningKey)) return;
|
|
16189
|
+
this.warnedUnsupportedFields.add(warningKey);
|
|
16190
|
+
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.`);
|
|
16191
|
+
}
|
|
16192
|
+
async buildResponsesBody(prompt, context) {
|
|
16193
|
+
const config = {
|
|
16194
|
+
...this.assistantConfig,
|
|
16195
|
+
...context?.prompt?.config
|
|
16196
|
+
};
|
|
16197
|
+
this.warnForUnsupportedConfig(config);
|
|
16198
|
+
const responseFormat = maybeLoadResponseFormatFromExternalFile(config.response_format, context?.vars);
|
|
16199
|
+
const loadedTools = config.tools ? await maybeLoadToolsFromExternalFile(config.tools, context?.vars) : void 0;
|
|
16200
|
+
const reasoningEffort = config.reasoning_effort ? renderVarsInObject(config.reasoning_effort, context?.vars) : void 0;
|
|
16201
|
+
const maxOutputTokens = config.max_output_tokens ?? config.max_completion_tokens ?? config.max_tokens;
|
|
16202
|
+
let text;
|
|
16203
|
+
if (responseFormat?.type === "json_object") text = { format: { type: "json_object" } };
|
|
16204
|
+
else if (responseFormat?.type === "json_schema") {
|
|
16205
|
+
const schema = responseFormat.schema || responseFormat.json_schema?.schema;
|
|
16206
|
+
text = { format: {
|
|
16207
|
+
type: "json_schema",
|
|
16208
|
+
name: responseFormat.json_schema?.name || responseFormat.name || "response_schema",
|
|
16209
|
+
schema,
|
|
16210
|
+
strict: responseFormat.json_schema?.strict ?? responseFormat.strict ?? true
|
|
16211
|
+
} };
|
|
16212
|
+
}
|
|
16213
|
+
if (config.verbosity) text = {
|
|
16214
|
+
...text || {},
|
|
16215
|
+
verbosity: config.verbosity
|
|
16216
|
+
};
|
|
16217
|
+
return {
|
|
16218
|
+
body: {
|
|
16219
|
+
input: this.parsePromptInput(prompt),
|
|
16220
|
+
...config.instructions ? { instructions: config.instructions } : {},
|
|
16221
|
+
...config.metadata ? { metadata: config.metadata } : {},
|
|
16222
|
+
...config.modelName ? { model: config.modelName } : {},
|
|
16223
|
+
...maxOutputTokens === void 0 ? {} : { max_output_tokens: maxOutputTokens },
|
|
16224
|
+
...reasoningEffort ? { reasoning: { effort: reasoningEffort } } : {},
|
|
16225
|
+
...config.temperature === void 0 ? {} : { temperature: config.temperature },
|
|
16226
|
+
...config.top_p === void 0 ? {} : { top_p: config.top_p },
|
|
16227
|
+
...config.tool_choice ? { tool_choice: config.tool_choice } : {},
|
|
16228
|
+
...loadedTools ? { tools: loadedTools } : {},
|
|
16229
|
+
...text ? { text } : {},
|
|
16230
|
+
...config.passthrough || {}
|
|
16231
|
+
},
|
|
16232
|
+
effectiveConfig: {
|
|
16233
|
+
...config,
|
|
16234
|
+
response_format: responseFormat,
|
|
16235
|
+
tools: loadedTools
|
|
16236
|
+
}
|
|
16237
|
+
};
|
|
16238
|
+
}
|
|
16239
|
+
getFunctionCalls(response) {
|
|
16240
|
+
return (response.output || []).filter((item) => {
|
|
16241
|
+
return item?.type === "function_call" && typeof item.id === "string" && typeof item.call_id === "string" && typeof item.name === "string" && typeof item.arguments === "string";
|
|
16242
|
+
});
|
|
16243
|
+
}
|
|
16244
|
+
getCallableFunctionCalls(response, callbacks) {
|
|
16245
|
+
const functionCalls = this.getFunctionCalls(response);
|
|
16246
|
+
if (functionCalls.length === 0 || !callbacks || Object.keys(callbacks).length === 0) return [];
|
|
16247
|
+
const missingCallbacks = functionCalls.filter((call) => !(call.name in callbacks));
|
|
16248
|
+
if (missingCallbacks.length > 0) {
|
|
16249
|
+
logger.debug(`[AzureFoundryAgentProvider] Returning unresolved function calls because callbacks are missing for: ${missingCallbacks.map((call) => call.name).join(", ")}`);
|
|
16250
|
+
return [];
|
|
16251
|
+
}
|
|
16252
|
+
return functionCalls;
|
|
16253
|
+
}
|
|
16254
|
+
async buildFunctionCallOutputs(functionCalls, response, agent, callbacks) {
|
|
16255
|
+
const callbackContext = {
|
|
16256
|
+
threadId: response.conversation?.id || response.id,
|
|
16257
|
+
runId: response.id,
|
|
16258
|
+
assistantId: agent.id,
|
|
16259
|
+
provider: "azure-foundry"
|
|
16260
|
+
};
|
|
16261
|
+
return Promise.all(functionCalls.map(async (call) => ({
|
|
16262
|
+
type: "function_call_output",
|
|
16263
|
+
call_id: call.call_id,
|
|
16264
|
+
output: await this.executeFunctionCallback(call.name, call.arguments, callbackContext, callbacks)
|
|
16265
|
+
})));
|
|
16266
|
+
}
|
|
16267
|
+
getAgentReference(agent) {
|
|
16268
|
+
return { body: { agent: {
|
|
16269
|
+
name: agent.name,
|
|
16270
|
+
type: "agent_reference"
|
|
16271
|
+
} } };
|
|
16272
|
+
}
|
|
16273
|
+
async processResponse(response, effectiveConfig) {
|
|
16274
|
+
const result = await this.processor.processResponseOutput(response, effectiveConfig, false);
|
|
16275
|
+
if (!result.error) return result;
|
|
16276
|
+
if (response.output_text) {
|
|
16277
|
+
logger.debug(`[AzureFoundryAgentProvider] ResponsesProcessor returned an error, falling back to output_text`, { processorError: result.error });
|
|
16278
|
+
return {
|
|
16279
|
+
...result,
|
|
16280
|
+
error: void 0,
|
|
16281
|
+
output: response.output_text,
|
|
16282
|
+
raw: response
|
|
16283
|
+
};
|
|
16284
|
+
}
|
|
16285
|
+
return result;
|
|
16286
|
+
}
|
|
16102
16287
|
async callApi(prompt, context, _callApiOptions) {
|
|
16103
|
-
const
|
|
16104
|
-
|
|
16105
|
-
instructions: this.assistantConfig.instructions,
|
|
16106
|
-
max_completion_tokens: this.assistantConfig.max_completion_tokens,
|
|
16107
|
-
max_tokens: this.assistantConfig.max_tokens,
|
|
16108
|
-
model: this.assistantConfig.modelName,
|
|
16109
|
-
presence_penalty: this.assistantConfig.presence_penalty,
|
|
16110
|
-
prompt,
|
|
16111
|
-
response_format: this.assistantConfig.response_format,
|
|
16112
|
-
seed: this.assistantConfig.seed,
|
|
16113
|
-
stop: this.assistantConfig.stop,
|
|
16114
|
-
temperature: this.assistantConfig.temperature,
|
|
16115
|
-
tool_choice: this.assistantConfig.tool_choice,
|
|
16116
|
-
tool_resources: this.assistantConfig.tool_resources,
|
|
16117
|
-
tools: JSON.stringify(await maybeLoadToolsFromExternalFile(this.assistantConfig.tools, context?.vars)),
|
|
16118
|
-
top_p: this.assistantConfig.top_p
|
|
16119
|
-
})}`;
|
|
16288
|
+
const { body, effectiveConfig } = await this.buildResponsesBody(prompt, context);
|
|
16289
|
+
const cacheKey = `azure_foundry_agent:${this.deploymentName}:${JSON.stringify(body)}`;
|
|
16120
16290
|
if (isCacheEnabled()) try {
|
|
16121
16291
|
const cachedResult = await (await getCache()).get(cacheKey);
|
|
16122
16292
|
if (cachedResult) {
|
|
16123
|
-
logger.debug(`Cache hit for agent prompt: ${prompt.substring(0, 50)}...`);
|
|
16293
|
+
logger.debug(`Cache hit for Foundry agent prompt: ${prompt.substring(0, 50)}...`);
|
|
16124
16294
|
return {
|
|
16125
16295
|
...cachedResult,
|
|
16126
16296
|
cached: true
|
|
16127
16297
|
};
|
|
16128
16298
|
}
|
|
16129
|
-
} catch (
|
|
16130
|
-
logger.warn(`Error checking cache: ${
|
|
16299
|
+
} catch (error) {
|
|
16300
|
+
logger.warn(`Error checking cache for Azure Foundry agent response: ${error}`);
|
|
16131
16301
|
}
|
|
16132
16302
|
try {
|
|
16133
16303
|
const client = await this.initializeClient();
|
|
16134
|
-
|
|
16135
|
-
const
|
|
16136
|
-
|
|
16137
|
-
const
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16148
|
-
|
|
16149
|
-
|
|
16150
|
-
if (
|
|
16151
|
-
|
|
16152
|
-
if (this.assistantConfig.tool_choice) runOptions.tool_choice = this.assistantConfig.tool_choice;
|
|
16153
|
-
if (this.assistantConfig.tools) {
|
|
16154
|
-
const loadedTools = await maybeLoadToolsFromExternalFile(this.assistantConfig.tools, context?.vars);
|
|
16155
|
-
if (loadedTools !== void 0) runOptions.tools = loadedTools;
|
|
16156
|
-
}
|
|
16157
|
-
if (this.assistantConfig.modelName) runOptions.model = this.assistantConfig.modelName;
|
|
16158
|
-
if (this.assistantConfig.instructions) runOptions.instructions = this.assistantConfig.instructions;
|
|
16159
|
-
const run = await client.agents.runs.create(thread.id, agent.id, runOptions);
|
|
16160
|
-
logger.debug(`Created run: ${run.id}`);
|
|
16161
|
-
let result;
|
|
16162
|
-
if (this.assistantConfig.functionToolCallbacks && Object.keys(this.assistantConfig.functionToolCallbacks).length > 0) result = await this.pollRunWithToolCallHandling(client, thread.id, run);
|
|
16163
|
-
else {
|
|
16164
|
-
const completedRun = await this.pollRun(client, thread.id, run.id);
|
|
16165
|
-
if (completedRun.status === "completed") result = await this.processCompletedRun(client, thread.id, completedRun);
|
|
16166
|
-
else if (completedRun.lastError) {
|
|
16167
|
-
const errorCode = completedRun.lastError.code || "";
|
|
16168
|
-
const errorMessage = completedRun.lastError.message || "";
|
|
16169
|
-
if (errorCode === "content_filter" || this.isContentFilterError(errorMessage)) {
|
|
16170
|
-
const lowerErrorMessage = errorMessage.toLowerCase();
|
|
16171
|
-
const isInputFiltered = lowerErrorMessage.includes("prompt") || lowerErrorMessage.includes("input");
|
|
16172
|
-
const isOutputFiltered = lowerErrorMessage.includes("output") || lowerErrorMessage.includes("response");
|
|
16173
|
-
result = {
|
|
16174
|
-
output: "The generated content was filtered due to triggering Azure OpenAI Service's content filtering system.",
|
|
16175
|
-
guardrails: {
|
|
16176
|
-
flagged: true,
|
|
16177
|
-
flaggedInput: isInputFiltered,
|
|
16178
|
-
flaggedOutput: !isInputFiltered && (isOutputFiltered || !isOutputFiltered)
|
|
16179
|
-
}
|
|
16180
|
-
};
|
|
16181
|
-
} else result = { error: `Thread run failed: ${errorCode} - ${errorMessage}` };
|
|
16182
|
-
} else result = { error: `Thread run failed with status: ${completedRun.status}` };
|
|
16183
|
-
}
|
|
16304
|
+
const agent = await this.resolveAgent(client);
|
|
16305
|
+
const openAIClient = client.getOpenAIClient();
|
|
16306
|
+
const responseOptions = this.getAgentReference(agent);
|
|
16307
|
+
const maxLoopTimeMs = this.assistantConfig.maxPollTimeMs || 3e5;
|
|
16308
|
+
const startTime = Date.now();
|
|
16309
|
+
let response = await openAIClient.responses.create(body, responseOptions);
|
|
16310
|
+
while (Date.now() - startTime <= maxLoopTimeMs) {
|
|
16311
|
+
const functionCalls = this.getCallableFunctionCalls(response, effectiveConfig.functionToolCallbacks);
|
|
16312
|
+
if (functionCalls.length === 0) break;
|
|
16313
|
+
const outputs = await this.buildFunctionCallOutputs(functionCalls, response, agent, effectiveConfig.functionToolCallbacks);
|
|
16314
|
+
logger.debug(`[AzureFoundryAgentProvider] Submitting ${outputs.length} function_call_output item(s)`);
|
|
16315
|
+
response = await openAIClient.responses.create({
|
|
16316
|
+
input: outputs,
|
|
16317
|
+
previous_response_id: response.id
|
|
16318
|
+
}, responseOptions);
|
|
16319
|
+
}
|
|
16320
|
+
if (Date.now() - startTime > maxLoopTimeMs) return { error: `Azure Foundry agent tool-calling loop timed out after ${maxLoopTimeMs}ms.` };
|
|
16321
|
+
const result = await this.processResponse(response, effectiveConfig);
|
|
16184
16322
|
if (isCacheEnabled() && !result.error) try {
|
|
16185
16323
|
await (await getCache()).set(cacheKey, result);
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
logger.warn(`Error caching result: ${err}`);
|
|
16324
|
+
} catch (error) {
|
|
16325
|
+
logger.warn(`Error caching Azure Foundry agent response: ${error}`);
|
|
16189
16326
|
}
|
|
16190
16327
|
return result;
|
|
16191
|
-
} catch (
|
|
16192
|
-
logger.error(`Error in Azure Foundry Agent API call: ${
|
|
16193
|
-
return this.formatError(
|
|
16328
|
+
} catch (error) {
|
|
16329
|
+
logger.error(`Error in Azure Foundry Agent API call: ${error}`);
|
|
16330
|
+
return this.formatError(error);
|
|
16194
16331
|
}
|
|
16195
16332
|
}
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
*/
|
|
16199
|
-
formatError(err) {
|
|
16200
|
-
const errorMessage = err.message || String(err);
|
|
16333
|
+
formatError(error) {
|
|
16334
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
16201
16335
|
if (this.isContentFilterError(errorMessage)) {
|
|
16202
16336
|
const lowerErrorMessage = errorMessage.toLowerCase();
|
|
16203
16337
|
const isInputFiltered = lowerErrorMessage.includes("prompt") || lowerErrorMessage.includes("input");
|
|
@@ -16211,14 +16345,10 @@ var AzureFoundryAgentProvider = class extends AzureGenericProvider {
|
|
|
16211
16345
|
}
|
|
16212
16346
|
};
|
|
16213
16347
|
}
|
|
16214
|
-
if (errorMessage.includes("Can't add messages to thread") && errorMessage.includes("while a run")) return { error: `Error in Azure Foundry Agent API call: ${errorMessage}` };
|
|
16215
16348
|
if (this.isRateLimitError(errorMessage)) return { error: `Rate limit exceeded: ${errorMessage}` };
|
|
16216
16349
|
if (this.isServiceError(errorMessage)) return { error: `Service error: ${errorMessage}` };
|
|
16217
16350
|
return { error: `Error in Azure Foundry Agent API call: ${errorMessage}` };
|
|
16218
16351
|
}
|
|
16219
|
-
/**
|
|
16220
|
-
* Helper methods to check for specific error types
|
|
16221
|
-
*/
|
|
16222
16352
|
isContentFilterError(errorMessage) {
|
|
16223
16353
|
const lowerErrorMessage = errorMessage.toLowerCase();
|
|
16224
16354
|
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");
|
|
@@ -16229,160 +16359,6 @@ var AzureFoundryAgentProvider = class extends AzureGenericProvider {
|
|
|
16229
16359
|
isServiceError(errorMessage) {
|
|
16230
16360
|
return errorMessage.includes("Service unavailable") || errorMessage.includes("Bad gateway") || errorMessage.includes("Gateway timeout") || errorMessage.includes("Server is busy") || errorMessage.includes("Sorry, something went wrong");
|
|
16231
16361
|
}
|
|
16232
|
-
isServerError(errorMessage) {
|
|
16233
|
-
return errorMessage.includes("500") || errorMessage.includes("502") || errorMessage.includes("503") || errorMessage.includes("504");
|
|
16234
|
-
}
|
|
16235
|
-
isRetryableError(code, message) {
|
|
16236
|
-
if (code === "rate_limit_exceeded") return true;
|
|
16237
|
-
if (!message) return false;
|
|
16238
|
-
return this.isRateLimitError(message) || this.isServiceError(message) || this.isServerError(message);
|
|
16239
|
-
}
|
|
16240
|
-
/**
|
|
16241
|
-
* Poll a run until it completes or fails
|
|
16242
|
-
*/
|
|
16243
|
-
async pollRun(client, threadId, runId, pollIntervalMs = 1e3) {
|
|
16244
|
-
const maxPollTime = this.assistantConfig.maxPollTimeMs || 3e5;
|
|
16245
|
-
const startTime = Date.now();
|
|
16246
|
-
let run = await client.agents.runs.get(threadId, runId);
|
|
16247
|
-
while (["queued", "in_progress"].includes(run.status)) {
|
|
16248
|
-
if (Date.now() - startTime > maxPollTime) throw new Error(`Run polling timed out after ${maxPollTime}ms. Last status: ${run.status}`);
|
|
16249
|
-
await sleep(pollIntervalMs);
|
|
16250
|
-
run = await client.agents.runs.get(threadId, runId);
|
|
16251
|
-
if (Date.now() - startTime > 3e4) pollIntervalMs = Math.min(pollIntervalMs * 1.5, 5e3);
|
|
16252
|
-
}
|
|
16253
|
-
return run;
|
|
16254
|
-
}
|
|
16255
|
-
/**
|
|
16256
|
-
* Handle tool calls during run polling
|
|
16257
|
-
*/
|
|
16258
|
-
async pollRunWithToolCallHandling(client, threadId, initialRun) {
|
|
16259
|
-
const maxPollTime = this.assistantConfig.maxPollTimeMs || 3e5;
|
|
16260
|
-
const startTime = Date.now();
|
|
16261
|
-
let pollIntervalMs = 1e3;
|
|
16262
|
-
let run = initialRun;
|
|
16263
|
-
while (true) {
|
|
16264
|
-
if (Date.now() - startTime > maxPollTime) return { error: `Run polling timed out after ${maxPollTime}ms. The operation may still be in progress.` };
|
|
16265
|
-
try {
|
|
16266
|
-
run = await client.agents.runs.get(threadId, run.id);
|
|
16267
|
-
logger.debug(`Run status: ${run.status}`);
|
|
16268
|
-
if (run.status === "requires_action") if (run.requiredAction?.type === "submit_tool_outputs" && run.requiredAction.submitToolOutputs?.toolCalls) {
|
|
16269
|
-
const toolCalls = run.requiredAction.submitToolOutputs.toolCalls;
|
|
16270
|
-
const functionCallsWithCallbacks = toolCalls.filter((toolCall) => {
|
|
16271
|
-
return toolCall.type === "function" && toolCall.function && toolCall.function.name in (this.assistantConfig.functionToolCallbacks ?? {});
|
|
16272
|
-
});
|
|
16273
|
-
if (functionCallsWithCallbacks.length === 0) {
|
|
16274
|
-
logger.debug(`No matching callbacks found for tool calls. Available functions: ${Object.keys(this.assistantConfig.functionToolCallbacks || {}).join(", ")}. Tool calls: ${JSON.stringify(toolCalls)}`);
|
|
16275
|
-
const emptyOutputs = toolCalls.map((toolCall) => ({
|
|
16276
|
-
toolCallId: toolCall.id,
|
|
16277
|
-
output: JSON.stringify({ message: `No callback registered for function ${toolCall.type === "function" ? toolCall.function?.name : toolCall.type}` })
|
|
16278
|
-
}));
|
|
16279
|
-
try {
|
|
16280
|
-
await client.agents.runs.submitToolOutputs(threadId, run.id, emptyOutputs);
|
|
16281
|
-
await sleep(pollIntervalMs);
|
|
16282
|
-
continue;
|
|
16283
|
-
} catch (error) {
|
|
16284
|
-
logger.error(`Error submitting empty tool outputs: ${error.message}`);
|
|
16285
|
-
return { error: `Error submitting empty tool outputs: ${error.message}` };
|
|
16286
|
-
}
|
|
16287
|
-
}
|
|
16288
|
-
const callbackContext = {
|
|
16289
|
-
threadId,
|
|
16290
|
-
runId: run.id,
|
|
16291
|
-
assistantId: this.deploymentName,
|
|
16292
|
-
provider: "azure-foundry"
|
|
16293
|
-
};
|
|
16294
|
-
const toolOutputs = await Promise.all(functionCallsWithCallbacks.map(async (toolCall) => {
|
|
16295
|
-
const functionName = toolCall.function.name;
|
|
16296
|
-
const functionArgs = toolCall.function.arguments;
|
|
16297
|
-
try {
|
|
16298
|
-
logger.debug(`Calling function ${functionName} with args: ${functionArgs}`);
|
|
16299
|
-
const outputResult = await this.executeFunctionCallback(functionName, functionArgs, callbackContext);
|
|
16300
|
-
logger.debug(`Function ${functionName} result: ${outputResult}`);
|
|
16301
|
-
return {
|
|
16302
|
-
toolCallId: toolCall.id,
|
|
16303
|
-
output: outputResult
|
|
16304
|
-
};
|
|
16305
|
-
} catch (error) {
|
|
16306
|
-
logger.error(`Error calling function ${functionName}: ${error}`);
|
|
16307
|
-
return {
|
|
16308
|
-
toolCallId: toolCall.id,
|
|
16309
|
-
output: JSON.stringify({ error: String(error) })
|
|
16310
|
-
};
|
|
16311
|
-
}
|
|
16312
|
-
}));
|
|
16313
|
-
if (toolOutputs.length === 0) {
|
|
16314
|
-
logger.error("No valid tool outputs to submit");
|
|
16315
|
-
break;
|
|
16316
|
-
}
|
|
16317
|
-
logger.debug(`Submitting tool outputs: ${JSON.stringify(toolOutputs)}`);
|
|
16318
|
-
try {
|
|
16319
|
-
await client.agents.runs.submitToolOutputs(threadId, run.id, toolOutputs);
|
|
16320
|
-
} catch (error) {
|
|
16321
|
-
logger.error(`Error submitting tool outputs: ${error.message}`);
|
|
16322
|
-
return { error: `Error submitting tool outputs: ${error.message}` };
|
|
16323
|
-
}
|
|
16324
|
-
} else {
|
|
16325
|
-
logger.error(`Unknown required action type: ${run.requiredAction?.type}`);
|
|
16326
|
-
break;
|
|
16327
|
-
}
|
|
16328
|
-
else if ([
|
|
16329
|
-
"completed",
|
|
16330
|
-
"failed",
|
|
16331
|
-
"cancelled",
|
|
16332
|
-
"expired"
|
|
16333
|
-
].includes(run.status)) {
|
|
16334
|
-
if (run.status !== "completed") {
|
|
16335
|
-
if (run.lastError) {
|
|
16336
|
-
const errorCode = run.lastError.code || "";
|
|
16337
|
-
const errorMessage = run.lastError.message || "";
|
|
16338
|
-
if (errorCode === "content_filter" || this.isContentFilterError(errorMessage)) {
|
|
16339
|
-
const lowerErrorMessage = errorMessage.toLowerCase();
|
|
16340
|
-
const isInputFiltered = lowerErrorMessage.includes("prompt") || lowerErrorMessage.includes("input");
|
|
16341
|
-
const isOutputFiltered = lowerErrorMessage.includes("output") || lowerErrorMessage.includes("response");
|
|
16342
|
-
return {
|
|
16343
|
-
output: "The generated content was filtered due to triggering Azure OpenAI Service's content filtering system.",
|
|
16344
|
-
guardrails: {
|
|
16345
|
-
flagged: true,
|
|
16346
|
-
flaggedInput: isInputFiltered,
|
|
16347
|
-
flaggedOutput: !isInputFiltered && (isOutputFiltered || !isOutputFiltered)
|
|
16348
|
-
}
|
|
16349
|
-
};
|
|
16350
|
-
}
|
|
16351
|
-
return { error: `Thread run failed: ${errorCode} - ${errorMessage}` };
|
|
16352
|
-
}
|
|
16353
|
-
return { error: `Thread run failed with status: ${run.status}` };
|
|
16354
|
-
}
|
|
16355
|
-
break;
|
|
16356
|
-
}
|
|
16357
|
-
await sleep(pollIntervalMs);
|
|
16358
|
-
if (Date.now() - startTime > 3e4) pollIntervalMs = Math.min(pollIntervalMs * 1.5, 5e3);
|
|
16359
|
-
} catch (error) {
|
|
16360
|
-
logger.error(`Error polling run status: ${error}`);
|
|
16361
|
-
const errorMessage = error.message || String(error);
|
|
16362
|
-
if (this.isRetryableError("", errorMessage)) return { error: `Error polling run status: ${errorMessage}` };
|
|
16363
|
-
return { error: `Error polling run status: ${errorMessage}` };
|
|
16364
|
-
}
|
|
16365
|
-
}
|
|
16366
|
-
return await this.processCompletedRun(client, threadId, run);
|
|
16367
|
-
}
|
|
16368
|
-
/**
|
|
16369
|
-
* Process a completed run to extract messages
|
|
16370
|
-
*/
|
|
16371
|
-
async processCompletedRun(client, threadId, _run) {
|
|
16372
|
-
try {
|
|
16373
|
-
const messages = [];
|
|
16374
|
-
for await (const message of client.agents.messages.list(threadId, { order: "asc" })) messages.push(message);
|
|
16375
|
-
const outputBlocks = [];
|
|
16376
|
-
messages.forEach((message) => {
|
|
16377
|
-
const contentBlocks = message.content.map((content) => content.type === "text" && content.text ? content.text.value : `<${content.type} output>`).join("\n");
|
|
16378
|
-
outputBlocks.push(`[${toTitleCase(message.role)}] ${contentBlocks}`);
|
|
16379
|
-
});
|
|
16380
|
-
return { output: outputBlocks.join("\n\n").trim() };
|
|
16381
|
-
} catch (err) {
|
|
16382
|
-
logger.error(`Error processing run results: ${err}`);
|
|
16383
|
-
return { error: `Error processing run results: ${err.message || String(err)}` };
|
|
16384
|
-
}
|
|
16385
|
-
}
|
|
16386
16362
|
};
|
|
16387
16363
|
//#endregion
|
|
16388
16364
|
//#region src/providers/azure/responses.ts
|
|
@@ -16452,9 +16428,9 @@ var AzureResponsesProvider = class extends AzureGenericProvider {
|
|
|
16452
16428
|
const body = {
|
|
16453
16429
|
model: this.deploymentName,
|
|
16454
16430
|
input,
|
|
16455
|
-
...maxOutputTokens
|
|
16431
|
+
...maxOutputTokens === void 0 ? {} : { max_output_tokens: maxOutputTokens },
|
|
16456
16432
|
...reasoningEffort ? { reasoning: { effort: reasoningEffort } } : {},
|
|
16457
|
-
...temperature
|
|
16433
|
+
...temperature === void 0 ? {} : { temperature },
|
|
16458
16434
|
...instructions ? { instructions } : {},
|
|
16459
16435
|
...config.top_p !== void 0 || getEnvString("OPENAI_TOP_P") ? { top_p: config.top_p ?? getEnvFloat("OPENAI_TOP_P", 1) } : {},
|
|
16460
16436
|
...config.tools ? { tools: await maybeLoadToolsFromExternalFile(config.tools, context?.vars) } : {},
|
|
@@ -16485,7 +16461,7 @@ var AzureResponsesProvider = class extends AzureGenericProvider {
|
|
|
16485
16461
|
}
|
|
16486
16462
|
const body = await this.getAzureResponsesBody(prompt, context, callApiOptions);
|
|
16487
16463
|
const isDeepResearchModel = this.deploymentName.includes("deep-research");
|
|
16488
|
-
let timeout = REQUEST_TIMEOUT_MS;
|
|
16464
|
+
let timeout = REQUEST_TIMEOUT_MS$1;
|
|
16489
16465
|
if (isDeepResearchModel) {
|
|
16490
16466
|
const evalTimeout = getEnvInt("PROMPTFOO_EVAL_TIMEOUT_MS", 0);
|
|
16491
16467
|
timeout = evalTimeout > 0 ? evalTimeout : LONG_RUNNING_MODEL_TIMEOUT_MS;
|
|
@@ -17489,9 +17465,9 @@ var AwsBedrockConverseProvider = class extends AwsBedrockGenericProvider {
|
|
|
17489
17465
|
const temperature = reasoningEnabled ? void 0 : temperatureValue;
|
|
17490
17466
|
const topP = reasoningEnabled ? void 0 : topPValue;
|
|
17491
17467
|
if (maxTokens !== void 0 || temperature !== void 0 || topP !== void 0 || stopSequences) return {
|
|
17492
|
-
...maxTokens
|
|
17493
|
-
...temperature
|
|
17494
|
-
...topP
|
|
17468
|
+
...maxTokens === void 0 ? {} : { maxTokens },
|
|
17469
|
+
...temperature === void 0 ? {} : { temperature },
|
|
17470
|
+
...topP === void 0 ? {} : { topP },
|
|
17495
17471
|
...stopSequences ? { stopSequences } : {}
|
|
17496
17472
|
};
|
|
17497
17473
|
}
|
|
@@ -17711,7 +17687,7 @@ var AwsBedrockConverseProvider = class extends AwsBedrockGenericProvider {
|
|
|
17711
17687
|
if (hasSuccessfulCallback && results.length > 0) return {
|
|
17712
17688
|
output: results.join("\n"),
|
|
17713
17689
|
tokenUsage,
|
|
17714
|
-
...cost
|
|
17690
|
+
...cost === void 0 ? {} : { cost },
|
|
17715
17691
|
...Object.keys(metadata).length > 0 ? { metadata } : {},
|
|
17716
17692
|
...guardrails ? { guardrails } : {},
|
|
17717
17693
|
...malformedError ? { error: malformedError } : {}
|
|
@@ -17721,7 +17697,7 @@ var AwsBedrockConverseProvider = class extends AwsBedrockGenericProvider {
|
|
|
17721
17697
|
return {
|
|
17722
17698
|
output: extractTextFromContentBlocks(content, showThinking),
|
|
17723
17699
|
tokenUsage,
|
|
17724
|
-
...cost
|
|
17700
|
+
...cost === void 0 ? {} : { cost },
|
|
17725
17701
|
...Object.keys(metadata).length > 0 ? { metadata } : {},
|
|
17726
17702
|
...guardrails ? { guardrails } : {},
|
|
17727
17703
|
...malformedError ? { error: malformedError } : {}
|
|
@@ -17835,7 +17811,7 @@ var AwsBedrockConverseProvider = class extends AwsBedrockGenericProvider {
|
|
|
17835
17811
|
return {
|
|
17836
17812
|
output: finalOutput,
|
|
17837
17813
|
tokenUsage,
|
|
17838
|
-
...cost
|
|
17814
|
+
...cost === void 0 ? {} : { cost },
|
|
17839
17815
|
...Object.keys(metadata).length > 0 ? { metadata } : {},
|
|
17840
17816
|
...malformedError ? { error: malformedError } : {}
|
|
17841
17817
|
};
|
|
@@ -19499,7 +19475,7 @@ var CohereChatCompletionProvider = class CohereChatCompletionProvider {
|
|
|
19499
19475
|
"X-Client-Name": getEnvString("COHERE_CLIENT_NAME") || "promptfoo"
|
|
19500
19476
|
},
|
|
19501
19477
|
body: JSON.stringify(body)
|
|
19502
|
-
}, REQUEST_TIMEOUT_MS));
|
|
19478
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
19503
19479
|
if (data.message) return { error: data.message };
|
|
19504
19480
|
const tokenUsage = {
|
|
19505
19481
|
cached: cached ? data.token_count?.total_tokens || 0 : 0,
|
|
@@ -19561,7 +19537,7 @@ var CohereEmbeddingProvider = class {
|
|
|
19561
19537
|
"X-Client-Name": getEnvString("COHERE_CLIENT_NAME") || "promptfoo"
|
|
19562
19538
|
},
|
|
19563
19539
|
body: JSON.stringify(body)
|
|
19564
|
-
}, REQUEST_TIMEOUT_MS));
|
|
19540
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
19565
19541
|
} catch (err) {
|
|
19566
19542
|
logger.error(`API call error: ${err}`);
|
|
19567
19543
|
throw err;
|
|
@@ -20470,7 +20446,7 @@ var ElevenLabsAgentsProvider = class {
|
|
|
20470
20446
|
promptLength: prompt.length
|
|
20471
20447
|
});
|
|
20472
20448
|
const simulationRequest = buildSimulationRequest(parseConversation(prompt, context), this.config.simulatedUser, this.config.evaluationCriteria, this.config.toolMockConfig);
|
|
20473
|
-
simulationRequest.new_turns_limit = this.config.maxTurns
|
|
20449
|
+
simulationRequest.new_turns_limit = this.config.maxTurns ?? 10;
|
|
20474
20450
|
logger.debug("[ElevenLabs Agents] Request payload", {
|
|
20475
20451
|
endpoint: `/convai/agents/${agentId}/simulate-conversation`,
|
|
20476
20452
|
payload: simulationRequest
|
|
@@ -20597,7 +20573,7 @@ var ElevenLabsAgentsProvider = class {
|
|
|
20597
20573
|
simulatedUser: config?.simulatedUser,
|
|
20598
20574
|
evaluationCriteria: config?.evaluationCriteria,
|
|
20599
20575
|
toolMockConfig: config?.toolMockConfig,
|
|
20600
|
-
maxTurns: config?.maxTurns
|
|
20576
|
+
maxTurns: config?.maxTurns ?? 10,
|
|
20601
20577
|
label: options.label || options.id
|
|
20602
20578
|
};
|
|
20603
20579
|
}
|
|
@@ -22468,7 +22444,7 @@ var GeminiImageProvider = class {
|
|
|
22468
22444
|
headers,
|
|
22469
22445
|
body: JSON.stringify(body),
|
|
22470
22446
|
...authDiscriminator && { _authHash: authDiscriminator }
|
|
22471
|
-
}, REQUEST_TIMEOUT_MS, "json", false);
|
|
22447
|
+
}, REQUEST_TIMEOUT_MS$1, "json", false);
|
|
22472
22448
|
const latencyMs = Date.now() - startTime;
|
|
22473
22449
|
return this.processResponse(data, cached, latencyMs);
|
|
22474
22450
|
} catch (err) {
|
|
@@ -22496,7 +22472,7 @@ var GeminiImageProvider = class {
|
|
|
22496
22472
|
...this.config.headers || {}
|
|
22497
22473
|
},
|
|
22498
22474
|
data: body,
|
|
22499
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
22475
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
22500
22476
|
});
|
|
22501
22477
|
const latencyMs = Date.now() - startTime;
|
|
22502
22478
|
return this.processResponse(response.data, false, latencyMs);
|
|
@@ -22657,7 +22633,7 @@ var GoogleImageProvider = class {
|
|
|
22657
22633
|
...this.config.headers || {}
|
|
22658
22634
|
},
|
|
22659
22635
|
data: body,
|
|
22660
|
-
timeout: REQUEST_TIMEOUT_MS
|
|
22636
|
+
timeout: REQUEST_TIMEOUT_MS$1
|
|
22661
22637
|
}), "Vertex AI API call");
|
|
22662
22638
|
const latencyMs = Date.now() - startTime;
|
|
22663
22639
|
return this.processResponse(response.data, false, latencyMs);
|
|
@@ -22694,7 +22670,7 @@ var GoogleImageProvider = class {
|
|
|
22694
22670
|
headers,
|
|
22695
22671
|
body: JSON.stringify(body),
|
|
22696
22672
|
...authDiscriminator && { _authHash: authDiscriminator }
|
|
22697
|
-
}, REQUEST_TIMEOUT_MS, "json"), "Google AI Studio API call");
|
|
22673
|
+
}, REQUEST_TIMEOUT_MS$1, "json"), "Google AI Studio API call");
|
|
22698
22674
|
return this.processResponse(response.data, response.cached, response.latencyMs);
|
|
22699
22675
|
} catch (err) {
|
|
22700
22676
|
return { error: `API call error: ${String(err)}` };
|
|
@@ -23242,6 +23218,8 @@ const DEFAULT_RESOLUTION$1 = "720p";
|
|
|
23242
23218
|
const DEFAULT_DURATION$1 = 8;
|
|
23243
23219
|
const DEFAULT_POLL_INTERVAL_MS$1 = 1e4;
|
|
23244
23220
|
const DEFAULT_MAX_POLL_TIME_MS$1 = 6e5;
|
|
23221
|
+
const REQUEST_TIMEOUT_MS = 3e5;
|
|
23222
|
+
const AI_STUDIO_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
23245
23223
|
function validateAspectRatio$1(ratio) {
|
|
23246
23224
|
if (!["16:9", "9:16"].includes(ratio)) return {
|
|
23247
23225
|
valid: false,
|
|
@@ -23293,6 +23271,13 @@ var GoogleVideoProvider = class {
|
|
|
23293
23271
|
async getProjectId() {
|
|
23294
23272
|
return await resolveProjectId(this.config, this.env);
|
|
23295
23273
|
}
|
|
23274
|
+
isVertexMode(config = this.config) {
|
|
23275
|
+
return determineGoogleVertexMode(config, this.env);
|
|
23276
|
+
}
|
|
23277
|
+
getApiKey(config = this.config) {
|
|
23278
|
+
const { apiKey } = getGoogleApiKey(config, this.env, this.isVertexMode(config));
|
|
23279
|
+
return apiKey;
|
|
23280
|
+
}
|
|
23296
23281
|
async getClientWithCredentials() {
|
|
23297
23282
|
const { client } = await getGoogleClient({ credentials: loadCredentials(this.config.credentials) });
|
|
23298
23283
|
return client;
|
|
@@ -23301,6 +23286,17 @@ var GoogleVideoProvider = class {
|
|
|
23301
23286
|
const location = this.getLocation();
|
|
23302
23287
|
return `https://${location}-aiplatform.googleapis.com/v1/projects/${await this.getProjectId()}/locations/${location}/publishers/google/models/${this.modelName}:${action}`;
|
|
23303
23288
|
}
|
|
23289
|
+
getAiStudioEndpoint(pathSuffix) {
|
|
23290
|
+
return `${AI_STUDIO_BASE_URL}/${pathSuffix}`;
|
|
23291
|
+
}
|
|
23292
|
+
async getAiStudioHeaders(config) {
|
|
23293
|
+
const apiKey = this.getApiKey(config);
|
|
23294
|
+
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.");
|
|
23295
|
+
return {
|
|
23296
|
+
"Content-Type": "application/json",
|
|
23297
|
+
"x-goog-api-key": apiKey
|
|
23298
|
+
};
|
|
23299
|
+
}
|
|
23304
23300
|
/**
|
|
23305
23301
|
* Load image data from file:// path or return as-is if base64
|
|
23306
23302
|
*/
|
|
@@ -23313,10 +23309,24 @@ var GoogleVideoProvider = class {
|
|
|
23313
23309
|
return { data: imagePath };
|
|
23314
23310
|
}
|
|
23315
23311
|
/**
|
|
23312
|
+
* Load video data from file:// path or return as-is if base64
|
|
23313
|
+
*/
|
|
23314
|
+
loadVideoData(videoPath) {
|
|
23315
|
+
if (videoPath.startsWith("file://")) {
|
|
23316
|
+
const filePath = videoPath.slice(7);
|
|
23317
|
+
if (!fs.existsSync(filePath)) return { error: `Video file not found: ${filePath}` };
|
|
23318
|
+
return { data: fs.readFileSync(filePath).toString("base64") };
|
|
23319
|
+
}
|
|
23320
|
+
return { data: videoPath };
|
|
23321
|
+
}
|
|
23322
|
+
/**
|
|
23316
23323
|
* Create a new video generation job
|
|
23317
23324
|
*/
|
|
23318
23325
|
async createVideoJob(prompt, config) {
|
|
23319
|
-
|
|
23326
|
+
if (this.isVertexMode(config)) return this.createVertexVideoJob(prompt, config);
|
|
23327
|
+
return this.createAiStudioVideoJob(prompt, config);
|
|
23328
|
+
}
|
|
23329
|
+
buildVertexRequestBody(prompt, config) {
|
|
23320
23330
|
const instance = { prompt };
|
|
23321
23331
|
if (config.aspectRatio) instance.aspectRatio = config.aspectRatio;
|
|
23322
23332
|
if (config.resolution) instance.resolution = config.resolution;
|
|
@@ -23360,7 +23370,69 @@ var GoogleVideoProvider = class {
|
|
|
23360
23370
|
}
|
|
23361
23371
|
const extendVideoId = config.extendVideoId || config.sourceVideo;
|
|
23362
23372
|
if (extendVideoId) instance.video = { operationName: extendVideoId };
|
|
23373
|
+
return { body: { instances: [instance] } };
|
|
23374
|
+
}
|
|
23375
|
+
buildAiStudioRequestBody(prompt, config) {
|
|
23376
|
+
const instance = { prompt };
|
|
23377
|
+
const parameters = {};
|
|
23378
|
+
if (config.aspectRatio) parameters.aspectRatio = config.aspectRatio;
|
|
23379
|
+
if (config.resolution) parameters.resolution = config.resolution;
|
|
23380
|
+
if (config.durationSeconds) parameters.durationSeconds = config.durationSeconds;
|
|
23381
|
+
if (config.negativePrompt) parameters.negativePrompt = config.negativePrompt;
|
|
23382
|
+
if (config.personGeneration) parameters.personGeneration = config.personGeneration;
|
|
23383
|
+
if (config.seed !== void 0) parameters.seed = config.seed;
|
|
23384
|
+
if (config.image) {
|
|
23385
|
+
const { data: imageData, error } = this.loadImageData(config.image);
|
|
23386
|
+
if (error) return { error };
|
|
23387
|
+
instance.image = { inlineData: {
|
|
23388
|
+
mimeType: "image/png",
|
|
23389
|
+
data: imageData
|
|
23390
|
+
} };
|
|
23391
|
+
}
|
|
23392
|
+
const lastFrame = config.lastFrame || config.lastImage;
|
|
23393
|
+
if (lastFrame) {
|
|
23394
|
+
const { data: lastFrameData, error } = this.loadImageData(lastFrame);
|
|
23395
|
+
if (error) return { error };
|
|
23396
|
+
instance.lastFrame = { inlineData: {
|
|
23397
|
+
mimeType: "image/png",
|
|
23398
|
+
data: lastFrameData
|
|
23399
|
+
} };
|
|
23400
|
+
}
|
|
23401
|
+
if (config.referenceImages && config.referenceImages.length > 0) {
|
|
23402
|
+
const refs = [];
|
|
23403
|
+
for (const ref of config.referenceImages.slice(0, 3)) {
|
|
23404
|
+
const imagePath = typeof ref === "string" ? ref : ref.image;
|
|
23405
|
+
const referenceType = typeof ref === "string" ? "asset" : ref.referenceType || "asset";
|
|
23406
|
+
const { data: imageData, error } = this.loadImageData(imagePath);
|
|
23407
|
+
if (error) return { error };
|
|
23408
|
+
refs.push({
|
|
23409
|
+
image: { inlineData: {
|
|
23410
|
+
mimeType: "image/png",
|
|
23411
|
+
data: imageData
|
|
23412
|
+
} },
|
|
23413
|
+
referenceType
|
|
23414
|
+
});
|
|
23415
|
+
}
|
|
23416
|
+
instance.referenceImages = refs;
|
|
23417
|
+
}
|
|
23418
|
+
const sourceVideo = config.extendVideoId || config.sourceVideo;
|
|
23419
|
+
if (sourceVideo) {
|
|
23420
|
+
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`." };
|
|
23421
|
+
const { data: videoData, error } = this.loadVideoData(sourceVideo);
|
|
23422
|
+
if (error) return { error };
|
|
23423
|
+
instance.video = { inlineData: {
|
|
23424
|
+
mimeType: "video/mp4",
|
|
23425
|
+
data: videoData
|
|
23426
|
+
} };
|
|
23427
|
+
}
|
|
23363
23428
|
const body = { instances: [instance] };
|
|
23429
|
+
if (Object.keys(parameters).length > 0) body.parameters = parameters;
|
|
23430
|
+
return { body };
|
|
23431
|
+
}
|
|
23432
|
+
async createVertexVideoJob(prompt, config) {
|
|
23433
|
+
const url = await this.getVertexEndpoint("predictLongRunning");
|
|
23434
|
+
const { body, error: bodyError } = this.buildVertexRequestBody(prompt, config);
|
|
23435
|
+
if (bodyError || !body) return { error: bodyError || "Failed to build Vertex Veo request" };
|
|
23364
23436
|
try {
|
|
23365
23437
|
const client = await this.getClientWithCredentials();
|
|
23366
23438
|
logger.debug("[Google Video] Creating video job", {
|
|
@@ -23378,10 +23450,37 @@ var GoogleVideoProvider = class {
|
|
|
23378
23450
|
return { error: `Failed to create video job: ${error.response?.data?.error?.message || error.message || String(err)}` };
|
|
23379
23451
|
}
|
|
23380
23452
|
}
|
|
23453
|
+
async createAiStudioVideoJob(prompt, config) {
|
|
23454
|
+
const { body, error: bodyError } = this.buildAiStudioRequestBody(prompt, config);
|
|
23455
|
+
if (bodyError || !body) return { error: bodyError || "Failed to build Google AI Studio Veo request" };
|
|
23456
|
+
try {
|
|
23457
|
+
const headers = await this.getAiStudioHeaders(config);
|
|
23458
|
+
const url = this.getAiStudioEndpoint(`models/${this.modelName}:predictLongRunning`);
|
|
23459
|
+
logger.debug("[Google Video] Creating video job", {
|
|
23460
|
+
url,
|
|
23461
|
+
model: this.modelName,
|
|
23462
|
+
transport: "google-ai-studio"
|
|
23463
|
+
});
|
|
23464
|
+
const response = await fetchWithTimeout(url, {
|
|
23465
|
+
method: "POST",
|
|
23466
|
+
headers,
|
|
23467
|
+
body: JSON.stringify(body)
|
|
23468
|
+
}, REQUEST_TIMEOUT_MS);
|
|
23469
|
+
const data = await response.json();
|
|
23470
|
+
if (!response.ok) return { error: `Failed to create video job: ${data.error?.message || response.statusText}` };
|
|
23471
|
+
return { operation: data };
|
|
23472
|
+
} catch (err) {
|
|
23473
|
+
return { error: `Failed to create video job: ${err.message || String(err)}` };
|
|
23474
|
+
}
|
|
23475
|
+
}
|
|
23381
23476
|
/**
|
|
23382
23477
|
* Poll for video job completion using fetchPredictOperation endpoint
|
|
23383
23478
|
*/
|
|
23384
|
-
async pollOperationStatus(operationName, pollIntervalMs, maxPollTimeMs) {
|
|
23479
|
+
async pollOperationStatus(operationName, pollIntervalMs, maxPollTimeMs, config) {
|
|
23480
|
+
if (this.isVertexMode(config)) return this.pollVertexOperationStatus(operationName, pollIntervalMs, maxPollTimeMs);
|
|
23481
|
+
return this.pollAiStudioOperationStatus(operationName, pollIntervalMs, maxPollTimeMs, config);
|
|
23482
|
+
}
|
|
23483
|
+
async pollVertexOperationStatus(operationName, pollIntervalMs, maxPollTimeMs) {
|
|
23385
23484
|
const startTime = Date.now();
|
|
23386
23485
|
const location = this.getLocation();
|
|
23387
23486
|
const url = `https://${location}-aiplatform.googleapis.com/v1/projects/${await this.getProjectId()}/locations/${location}/publishers/google/models/${this.modelName}:fetchPredictOperation`;
|
|
@@ -23406,10 +23505,37 @@ var GoogleVideoProvider = class {
|
|
|
23406
23505
|
}
|
|
23407
23506
|
return { error: `Video generation timed out after ${maxPollTimeMs / 1e3} seconds` };
|
|
23408
23507
|
}
|
|
23508
|
+
async pollAiStudioOperationStatus(operationName, pollIntervalMs, maxPollTimeMs, config) {
|
|
23509
|
+
const startTime = Date.now();
|
|
23510
|
+
const url = this.getAiStudioEndpoint(operationName);
|
|
23511
|
+
const headers = await this.getAiStudioHeaders(config);
|
|
23512
|
+
logger.debug(`[Google Video] Polling operation via Google AI Studio: ${url}`);
|
|
23513
|
+
while (Date.now() - startTime < maxPollTimeMs) try {
|
|
23514
|
+
const response = await fetchWithTimeout(url, {
|
|
23515
|
+
method: "GET",
|
|
23516
|
+
headers
|
|
23517
|
+
}, REQUEST_TIMEOUT_MS);
|
|
23518
|
+
const operation = await response.json();
|
|
23519
|
+
if (!response.ok) return { error: `Polling error: ${operation.error?.message || response.statusText}` };
|
|
23520
|
+
logger.debug(`[Google Video] Operation status: done=${operation.done}, progress=${operation.metadata?.progress}%`);
|
|
23521
|
+
if (operation.done) {
|
|
23522
|
+
if (operation.error) return { error: `Video generation failed: ${operation.error.message}` };
|
|
23523
|
+
return { operation };
|
|
23524
|
+
}
|
|
23525
|
+
await sleep(pollIntervalMs);
|
|
23526
|
+
} catch (err) {
|
|
23527
|
+
return { error: `Polling error: ${err.message || String(err)}` };
|
|
23528
|
+
}
|
|
23529
|
+
return { error: `Video generation timed out after ${maxPollTimeMs / 1e3} seconds` };
|
|
23530
|
+
}
|
|
23409
23531
|
/**
|
|
23410
23532
|
* Download video from URI and store to blob storage
|
|
23411
23533
|
*/
|
|
23412
|
-
async downloadVideoToBlob(videoUri) {
|
|
23534
|
+
async downloadVideoToBlob(videoUri, config) {
|
|
23535
|
+
if (this.isVertexMode(config)) return this.downloadVertexVideoToBlob(videoUri);
|
|
23536
|
+
return this.downloadAiStudioVideoToBlob(videoUri, config);
|
|
23537
|
+
}
|
|
23538
|
+
async downloadVertexVideoToBlob(videoUri) {
|
|
23413
23539
|
try {
|
|
23414
23540
|
const response = await (await this.getClientWithCredentials()).request({
|
|
23415
23541
|
url: videoUri,
|
|
@@ -23426,6 +23552,23 @@ var GoogleVideoProvider = class {
|
|
|
23426
23552
|
return { error: `Download error: ${err.message || String(err)}` };
|
|
23427
23553
|
}
|
|
23428
23554
|
}
|
|
23555
|
+
async downloadAiStudioVideoToBlob(videoUri, config) {
|
|
23556
|
+
try {
|
|
23557
|
+
const response = await fetchWithTimeout(videoUri, {
|
|
23558
|
+
method: "GET",
|
|
23559
|
+
headers: await this.getAiStudioHeaders(config)
|
|
23560
|
+
}, REQUEST_TIMEOUT_MS);
|
|
23561
|
+
if (!response.ok) return { error: `Download error: ${response.statusText}` };
|
|
23562
|
+
const { ref } = await storeBlob(Buffer.from(await response.arrayBuffer()), "video/mp4", {
|
|
23563
|
+
kind: "video",
|
|
23564
|
+
location: "response.video"
|
|
23565
|
+
});
|
|
23566
|
+
logger.debug(`[Google Video] Stored video to blob storage: ${ref.uri}`);
|
|
23567
|
+
return { blobRef: ref };
|
|
23568
|
+
} catch (err) {
|
|
23569
|
+
return { error: `Download error: ${err.message || String(err)}` };
|
|
23570
|
+
}
|
|
23571
|
+
}
|
|
23429
23572
|
/**
|
|
23430
23573
|
* Store base64 encoded video to blob storage
|
|
23431
23574
|
*/
|
|
@@ -23443,20 +23586,40 @@ var GoogleVideoProvider = class {
|
|
|
23443
23586
|
}
|
|
23444
23587
|
async callApi(prompt, context) {
|
|
23445
23588
|
if (!prompt || prompt.trim() === "") return { error: "Prompt is required for video generation" };
|
|
23446
|
-
let
|
|
23447
|
-
if (!projectId) try {
|
|
23448
|
-
projectId = await resolveProjectId(this.config, this.env);
|
|
23449
|
-
} catch {
|
|
23450
|
-
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\"." };
|
|
23451
|
-
}
|
|
23452
|
-
const config = {
|
|
23589
|
+
let effectiveConfig = {
|
|
23453
23590
|
...this.config,
|
|
23454
23591
|
...context?.prompt?.config
|
|
23455
23592
|
};
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23593
|
+
let isVertexMode = this.isVertexMode(effectiveConfig);
|
|
23594
|
+
if (isVertexMode) {
|
|
23595
|
+
let projectId = effectiveConfig.projectId || getEnvString("GOOGLE_CLOUD_PROJECT") || getEnvString("GOOGLE_PROJECT_ID") || this.env?.GOOGLE_CLOUD_PROJECT || this.env?.GOOGLE_PROJECT_ID;
|
|
23596
|
+
if (!projectId) try {
|
|
23597
|
+
projectId = await resolveProjectId(effectiveConfig, this.env);
|
|
23598
|
+
} catch {
|
|
23599
|
+
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\"." };
|
|
23600
|
+
}
|
|
23601
|
+
effectiveConfig = {
|
|
23602
|
+
...effectiveConfig,
|
|
23603
|
+
vertexai: true,
|
|
23604
|
+
...projectId ? { projectId } : {}
|
|
23605
|
+
};
|
|
23606
|
+
} else if (!this.getApiKey(effectiveConfig)) try {
|
|
23607
|
+
const adcProjectId = await resolveProjectId(effectiveConfig, this.env);
|
|
23608
|
+
if (adcProjectId) {
|
|
23609
|
+
isVertexMode = true;
|
|
23610
|
+
effectiveConfig = {
|
|
23611
|
+
...effectiveConfig,
|
|
23612
|
+
vertexai: true,
|
|
23613
|
+
projectId: adcProjectId
|
|
23614
|
+
};
|
|
23615
|
+
} 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." };
|
|
23616
|
+
} catch {
|
|
23617
|
+
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." };
|
|
23618
|
+
}
|
|
23619
|
+
const model = effectiveConfig.model || this.modelName;
|
|
23620
|
+
const aspectRatio = effectiveConfig.aspectRatio || DEFAULT_ASPECT_RATIO$1;
|
|
23621
|
+
const resolution = effectiveConfig.resolution || DEFAULT_RESOLUTION$1;
|
|
23622
|
+
const durationSeconds = effectiveConfig.durationSeconds || effectiveConfig.duration || DEFAULT_DURATION$1;
|
|
23460
23623
|
const ratioValidation = validateAspectRatio$1(aspectRatio);
|
|
23461
23624
|
if (!ratioValidation.valid) return { error: ratioValidation.message };
|
|
23462
23625
|
const durationValidation = validateDuration$1(model, durationSeconds);
|
|
@@ -23466,7 +23629,7 @@ var GoogleVideoProvider = class {
|
|
|
23466
23629
|
const startTime = Date.now();
|
|
23467
23630
|
logger.info(`[Google Video] Creating video job for model ${model}...`);
|
|
23468
23631
|
const { operation: createdOp, error: createError } = await this.createVideoJob(prompt, {
|
|
23469
|
-
...
|
|
23632
|
+
...effectiveConfig,
|
|
23470
23633
|
aspectRatio,
|
|
23471
23634
|
resolution,
|
|
23472
23635
|
durationSeconds
|
|
@@ -23474,9 +23637,9 @@ var GoogleVideoProvider = class {
|
|
|
23474
23637
|
if (createError || !createdOp) return { error: createError || "Failed to create video job" };
|
|
23475
23638
|
const operationName = createdOp.name;
|
|
23476
23639
|
logger.info(`[Google Video] Video job created: ${operationName}`);
|
|
23477
|
-
const pollIntervalMs =
|
|
23478
|
-
const maxPollTimeMs =
|
|
23479
|
-
const { operation: completedOp, error: pollError } = await this.pollOperationStatus(operationName, pollIntervalMs, maxPollTimeMs);
|
|
23640
|
+
const pollIntervalMs = effectiveConfig.pollIntervalMs || DEFAULT_POLL_INTERVAL_MS$1;
|
|
23641
|
+
const maxPollTimeMs = effectiveConfig.maxPollTimeMs || DEFAULT_MAX_POLL_TIME_MS$1;
|
|
23642
|
+
const { operation: completedOp, error: pollError } = await this.pollOperationStatus(operationName, pollIntervalMs, maxPollTimeMs, effectiveConfig);
|
|
23480
23643
|
if (pollError || !completedOp) return { error: pollError || "Polling failed" };
|
|
23481
23644
|
let blobRef;
|
|
23482
23645
|
const base64Video = completedOp.response?.videos?.[0]?.bytesBase64Encoded;
|
|
@@ -23491,7 +23654,7 @@ var GoogleVideoProvider = class {
|
|
|
23491
23654
|
logger.debug(`[Google Video] Response: ${JSON.stringify(completedOp.response)}`);
|
|
23492
23655
|
return { error: "No video data in response" };
|
|
23493
23656
|
}
|
|
23494
|
-
const { blobRef: ref, error: downloadError } = await this.downloadVideoToBlob(videoUri);
|
|
23657
|
+
const { blobRef: ref, error: downloadError } = await this.downloadVideoToBlob(videoUri, effectiveConfig);
|
|
23495
23658
|
if (downloadError) return { error: downloadError };
|
|
23496
23659
|
blobRef = ref;
|
|
23497
23660
|
}
|
|
@@ -24181,13 +24344,22 @@ const ApiKeyAuthSchema = z.object({
|
|
|
24181
24344
|
placement: z.enum(["header", "query"]),
|
|
24182
24345
|
keyName: z.string()
|
|
24183
24346
|
});
|
|
24347
|
+
const FileAuthSchema = z.object({
|
|
24348
|
+
type: z.literal("file"),
|
|
24349
|
+
path: z.string().min(1)
|
|
24350
|
+
});
|
|
24184
24351
|
const AuthSchema = z.union([
|
|
24185
24352
|
OAuthClientCredentialsSchema,
|
|
24186
24353
|
OAuthPasswordSchema,
|
|
24187
24354
|
BasicAuthSchema,
|
|
24188
24355
|
BearerAuthSchema,
|
|
24189
|
-
ApiKeyAuthSchema
|
|
24356
|
+
ApiKeyAuthSchema,
|
|
24357
|
+
FileAuthSchema
|
|
24190
24358
|
]);
|
|
24359
|
+
const FileAuthResultSchema = z.object({
|
|
24360
|
+
token: z.string().min(1),
|
|
24361
|
+
expiration: z.number().finite().nullable().optional()
|
|
24362
|
+
});
|
|
24191
24363
|
/**
|
|
24192
24364
|
* Configuration for a separate session endpoint that must be called before the main API.
|
|
24193
24365
|
* The session endpoint returns a session ID that is then used in the main request.
|
|
@@ -24276,6 +24448,12 @@ async function loadTransformModule(transform) {
|
|
|
24276
24448
|
}
|
|
24277
24449
|
return transform;
|
|
24278
24450
|
}
|
|
24451
|
+
function hasOwnProperty(obj, key) {
|
|
24452
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
24453
|
+
}
|
|
24454
|
+
function parseFileAuthReference(filePath) {
|
|
24455
|
+
return filePath.startsWith("file://") ? parseFileUrl(filePath) : { filePath };
|
|
24456
|
+
}
|
|
24279
24457
|
async function createSessionParser(parser) {
|
|
24280
24458
|
if (!parser) return () => "";
|
|
24281
24459
|
if (typeof parser === "function") return (response) => parser(response);
|
|
@@ -24636,20 +24814,11 @@ var HttpProvider = class {
|
|
|
24636
24814
|
password: this.config.auth.password ? nunjucks.renderString(this.config.auth.password, vars) : void 0
|
|
24637
24815
|
} : baseConfig;
|
|
24638
24816
|
const now = Date.now();
|
|
24639
|
-
if (this.
|
|
24817
|
+
if (this.hasValidCachedToken(now)) {
|
|
24640
24818
|
logger.debug("[HTTP Provider Auth]: Using cached OAuth token");
|
|
24641
24819
|
return;
|
|
24642
24820
|
}
|
|
24643
|
-
if (this.tokenRefreshPromise != null)
|
|
24644
|
-
logger.debug("[HTTP Provider Auth]: Token refresh already in progress, waiting...");
|
|
24645
|
-
try {
|
|
24646
|
-
await this.tokenRefreshPromise;
|
|
24647
|
-
if (this.lastToken && this.lastTokenExpiresAt && Date.now() + 6e4 < this.lastTokenExpiresAt) return;
|
|
24648
|
-
logger.debug("[HTTP Provider Auth]: Token expired while waiting, refreshing again...");
|
|
24649
|
-
} catch {
|
|
24650
|
-
logger.debug("[HTTP Provider Auth]: Previous token refresh failed, retrying...");
|
|
24651
|
-
}
|
|
24652
|
-
}
|
|
24821
|
+
if (this.tokenRefreshPromise != null && await this.waitForInFlightTokenRefresh()) return;
|
|
24653
24822
|
logger.debug("[HTTP Provider Auth]: Refreshing OAuth token");
|
|
24654
24823
|
const refreshPromise = this.performTokenRefresh(oauthConfig, now);
|
|
24655
24824
|
this.tokenRefreshPromise = refreshPromise;
|
|
@@ -24678,7 +24847,7 @@ var HttpProvider = class {
|
|
|
24678
24847
|
body: tokenRequestBody.toString()
|
|
24679
24848
|
};
|
|
24680
24849
|
if (httpsAgent) fetchOptions.dispatcher = httpsAgent;
|
|
24681
|
-
const response = await fetchWithCache(oauthConfig.tokenUrl, fetchOptions, REQUEST_TIMEOUT_MS, "text", true, 0);
|
|
24850
|
+
const response = await fetchWithCache(oauthConfig.tokenUrl, fetchOptions, REQUEST_TIMEOUT_MS$1, "text", true, 0);
|
|
24682
24851
|
if (response.status < 200 || response.status >= 300) throw new Error(`OAuth token request failed with status ${response.status} ${response.statusText}: ${response.data}`);
|
|
24683
24852
|
const tokenData = JSON.parse(response.data);
|
|
24684
24853
|
if (!tokenData.access_token) throw new Error("OAuth token response missing access_token");
|
|
@@ -24691,6 +24860,70 @@ var HttpProvider = class {
|
|
|
24691
24860
|
}
|
|
24692
24861
|
invariant(this.lastToken, "OAuth token should be defined at this point");
|
|
24693
24862
|
}
|
|
24863
|
+
hasValidCachedToken(now = Date.now()) {
|
|
24864
|
+
if (!this.lastToken) return false;
|
|
24865
|
+
if (this.lastTokenExpiresAt == null) return this.config.auth?.type === "file";
|
|
24866
|
+
return now + TOKEN_REFRESH_BUFFER_MS < this.lastTokenExpiresAt;
|
|
24867
|
+
}
|
|
24868
|
+
async waitForInFlightTokenRefresh() {
|
|
24869
|
+
if (this.tokenRefreshPromise == null) return false;
|
|
24870
|
+
logger.debug("[HTTP Provider Auth]: Token refresh already in progress, waiting...");
|
|
24871
|
+
try {
|
|
24872
|
+
await this.tokenRefreshPromise;
|
|
24873
|
+
if (this.hasValidCachedToken()) return true;
|
|
24874
|
+
logger.debug("[HTTP Provider Auth]: Token expired while waiting, refreshing again...");
|
|
24875
|
+
} catch {
|
|
24876
|
+
logger.debug("[HTTP Provider Auth]: Previous token refresh failed, retrying...");
|
|
24877
|
+
}
|
|
24878
|
+
return false;
|
|
24879
|
+
}
|
|
24880
|
+
async refreshFileTokenIfNeeded(prompt, vars, context) {
|
|
24881
|
+
if (!this.config.auth || this.config.auth.type !== "file") {
|
|
24882
|
+
logger.debug("[HTTP Provider Auth]: No file auth configured");
|
|
24883
|
+
return;
|
|
24884
|
+
}
|
|
24885
|
+
if (this.hasValidCachedToken()) {
|
|
24886
|
+
logger.debug("[HTTP Provider Auth]: Using cached file auth token");
|
|
24887
|
+
return;
|
|
24888
|
+
}
|
|
24889
|
+
if (this.tokenRefreshPromise != null && await this.waitForInFlightTokenRefresh()) return;
|
|
24890
|
+
logger.debug("[HTTP Provider Auth]: Refreshing file auth token");
|
|
24891
|
+
const refreshPromise = this.performFileTokenRefresh(prompt, vars, context);
|
|
24892
|
+
this.tokenRefreshPromise = refreshPromise;
|
|
24893
|
+
try {
|
|
24894
|
+
await refreshPromise;
|
|
24895
|
+
} finally {
|
|
24896
|
+
if (this.tokenRefreshPromise === refreshPromise) this.tokenRefreshPromise = void 0;
|
|
24897
|
+
}
|
|
24898
|
+
}
|
|
24899
|
+
async performFileTokenRefresh(prompt, vars, context) {
|
|
24900
|
+
invariant(this.config.auth?.type === "file", "File auth should be configured");
|
|
24901
|
+
const { filePath, functionName } = parseFileAuthReference(this.config.auth.path);
|
|
24902
|
+
const defaultFunctionName = filePath.endsWith(".py") ? "get_auth" : "default";
|
|
24903
|
+
const authContext = {
|
|
24904
|
+
...context ?? {},
|
|
24905
|
+
prompt: context?.prompt ?? {
|
|
24906
|
+
raw: prompt,
|
|
24907
|
+
label: prompt
|
|
24908
|
+
},
|
|
24909
|
+
vars
|
|
24910
|
+
};
|
|
24911
|
+
try {
|
|
24912
|
+
const authFn = await loadFunction({
|
|
24913
|
+
filePath,
|
|
24914
|
+
functionName,
|
|
24915
|
+
defaultFunctionName
|
|
24916
|
+
});
|
|
24917
|
+
const result = FileAuthResultSchema.parse(await authFn(authContext));
|
|
24918
|
+
this.lastToken = result.token;
|
|
24919
|
+
this.lastTokenExpiresAt = result.expiration ?? void 0;
|
|
24920
|
+
logger.debug("[HTTP Provider Auth]: Successfully refreshed file auth token");
|
|
24921
|
+
} catch (err) {
|
|
24922
|
+
logger.error(`[HTTP Provider Auth]: Failed to refresh file auth token: ${String(err)}`);
|
|
24923
|
+
throw new Error(`Failed to refresh file auth token: ${String(err)}`);
|
|
24924
|
+
}
|
|
24925
|
+
invariant(this.lastToken, "File auth token should be defined at this point");
|
|
24926
|
+
}
|
|
24694
24927
|
async refreshSignatureIfNeeded(vars) {
|
|
24695
24928
|
if (!this.config.signatureAuth) {
|
|
24696
24929
|
logger.debug("[HTTP Provider Auth]: No signature auth configured");
|
|
@@ -24771,7 +25004,7 @@ var HttpProvider = class {
|
|
|
24771
25004
|
};
|
|
24772
25005
|
if (body) fetchOptions.body = body;
|
|
24773
25006
|
if (httpsAgent) fetchOptions.dispatcher = httpsAgent;
|
|
24774
|
-
const response = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS, "text", true, this.config.maxRetries);
|
|
25007
|
+
const response = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS$1, "text", true, this.config.maxRetries);
|
|
24775
25008
|
if (response.status < 200 || response.status >= 300) throw new Error(`Session endpoint request failed with status ${response.status} ${response.statusText}: ${response.data}`);
|
|
24776
25009
|
const rawText = response.data;
|
|
24777
25010
|
let parsedData;
|
|
@@ -24872,12 +25105,21 @@ var HttpProvider = class {
|
|
|
24872
25105
|
...context?.vars || {},
|
|
24873
25106
|
prompt,
|
|
24874
25107
|
...context?.evaluationId ? { evaluationId: context.evaluationId } : {},
|
|
24875
|
-
...transformedTools
|
|
24876
|
-
...transformedToolChoice
|
|
25108
|
+
...transformedTools === void 0 ? {} : { tools: serializeForTemplate(transformedTools) },
|
|
25109
|
+
...transformedToolChoice === void 0 ? {} : { tool_choice: serializeForTemplate(transformedToolChoice) }
|
|
24877
25110
|
};
|
|
24878
25111
|
if (this.config.auth?.type === "oauth") {
|
|
24879
25112
|
await this.refreshOAuthTokenIfNeeded(vars);
|
|
24880
25113
|
invariant(this.lastToken, "OAuth token should be defined at this point");
|
|
25114
|
+
if (hasOwnProperty(vars, "token")) logger.warn("[HTTP Provider Auth]: `token` is already defined in vars and will be overwritten");
|
|
25115
|
+
vars.token = this.lastToken;
|
|
25116
|
+
} else if (this.config.auth?.type === "file") {
|
|
25117
|
+
await this.refreshFileTokenIfNeeded(prompt, vars, context);
|
|
25118
|
+
invariant(this.lastToken, "File auth token should be defined at this point");
|
|
25119
|
+
if (hasOwnProperty(vars, "token")) logger.warn("[HTTP Provider Auth]: `token` is already defined in vars and will be overwritten");
|
|
25120
|
+
if (hasOwnProperty(vars, "expiration")) logger.warn("[HTTP Provider Auth]: `expiration` is already defined in vars and will be overwritten");
|
|
25121
|
+
vars.token = this.lastToken;
|
|
25122
|
+
vars.expiration = this.lastTokenExpiresAt;
|
|
24881
25123
|
}
|
|
24882
25124
|
if (this.config.signatureAuth) {
|
|
24883
25125
|
await this.refreshSignatureIfNeeded(vars);
|
|
@@ -24947,7 +25189,7 @@ var HttpProvider = class {
|
|
|
24947
25189
|
}
|
|
24948
25190
|
let data, cached = false, status, statusText, responseHeaders, latencyMs;
|
|
24949
25191
|
try {
|
|
24950
|
-
({data, cached, status, statusText, headers: responseHeaders, latencyMs} = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS, "text", context?.bustCache ?? context?.debug, this.config.maxRetries));
|
|
25192
|
+
({data, cached, status, statusText, headers: responseHeaders, latencyMs} = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS$1, "text", context?.bustCache ?? context?.debug, this.config.maxRetries));
|
|
24951
25193
|
} catch (err) {
|
|
24952
25194
|
throw err;
|
|
24953
25195
|
}
|
|
@@ -25065,7 +25307,7 @@ var HttpProvider = class {
|
|
|
25065
25307
|
}
|
|
25066
25308
|
let data, cached = false, status, statusText, responseHeaders, latencyMs;
|
|
25067
25309
|
try {
|
|
25068
|
-
({data, cached, status, statusText, headers: responseHeaders, latencyMs} = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS, "text", context?.bustCache ?? context?.debug, this.config.maxRetries));
|
|
25310
|
+
({data, cached, status, statusText, headers: responseHeaders, latencyMs} = await fetchWithCache(url, fetchOptions, REQUEST_TIMEOUT_MS$1, "text", context?.bustCache ?? context?.debug, this.config.maxRetries));
|
|
25069
25311
|
} catch (err) {
|
|
25070
25312
|
throw err;
|
|
25071
25313
|
}
|
|
@@ -25312,7 +25554,7 @@ var HuggingfaceTextGenerationProvider = class {
|
|
|
25312
25554
|
...this.getApiKey() ? { Authorization: `Bearer ${this.getApiKey()}` } : {}
|
|
25313
25555
|
},
|
|
25314
25556
|
body: JSON.stringify(params)
|
|
25315
|
-
}, REQUEST_TIMEOUT_MS);
|
|
25557
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
25316
25558
|
logger.debug("Huggingface Inference API response", { data: response.data });
|
|
25317
25559
|
if (response.data.error) return { error: `API call error: ${response.data.error}` };
|
|
25318
25560
|
if (!response.data[0] && !response.data.generated_text) return { error: `Malformed response data: ${response.data}` };
|
|
@@ -25354,7 +25596,7 @@ var HuggingfaceTextClassificationProvider = class {
|
|
|
25354
25596
|
...this.getApiKey() ? { Authorization: `Bearer ${this.getApiKey()}` } : {}
|
|
25355
25597
|
},
|
|
25356
25598
|
body: JSON.stringify(params)
|
|
25357
|
-
}, REQUEST_TIMEOUT_MS);
|
|
25599
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
25358
25600
|
if (response.data.error) return { error: `API call error: ${response.data.error}` };
|
|
25359
25601
|
if (!response.data[0] || !Array.isArray(response.data[0])) return { error: `Malformed response data: ${response.data}` };
|
|
25360
25602
|
const scores = {};
|
|
@@ -25417,7 +25659,7 @@ var HuggingfaceFeatureExtractionProvider = class {
|
|
|
25417
25659
|
...this.getApiKey() ? { Authorization: `Bearer ${this.getApiKey()}` } : {}
|
|
25418
25660
|
},
|
|
25419
25661
|
body: JSON.stringify(params)
|
|
25420
|
-
}, REQUEST_TIMEOUT_MS);
|
|
25662
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
25421
25663
|
if (typeof response.data === "object" && "error" in response.data) return { error: `API call error: ${response.data.error}` };
|
|
25422
25664
|
if (!Array.isArray(response.data)) return { error: `Malformed response data: ${response.data}` };
|
|
25423
25665
|
return { embedding: response.data };
|
|
@@ -25467,7 +25709,7 @@ var HuggingfaceSentenceSimilarityProvider = class {
|
|
|
25467
25709
|
...this.getApiKey() ? { Authorization: `Bearer ${this.getApiKey()}` } : {}
|
|
25468
25710
|
},
|
|
25469
25711
|
body: JSON.stringify(params)
|
|
25470
|
-
}, REQUEST_TIMEOUT_MS);
|
|
25712
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
25471
25713
|
if (typeof response.data === "object" && "error" in response.data) return { error: `API call error: ${response.data.error}` };
|
|
25472
25714
|
if (!Array.isArray(response.data)) return { error: `Malformed response data: ${response.data}` };
|
|
25473
25715
|
return { similarity: response.data[0] };
|
|
@@ -25509,7 +25751,7 @@ var HuggingfaceTokenExtractionProvider = class {
|
|
|
25509
25751
|
...this.getApiKey() ? { Authorization: `Bearer ${this.getApiKey()}` } : {}
|
|
25510
25752
|
},
|
|
25511
25753
|
body: JSON.stringify(params)
|
|
25512
|
-
}, REQUEST_TIMEOUT_MS);
|
|
25754
|
+
}, REQUEST_TIMEOUT_MS$1);
|
|
25513
25755
|
if (typeof response.data === "object" && "error" in response.data) return { error: `API call error: ${response.data.error}` };
|
|
25514
25756
|
if (!Array.isArray(response.data)) return { error: `Malformed response data: ${response.data}` };
|
|
25515
25757
|
const classification = {};
|
|
@@ -25588,7 +25830,7 @@ var LlamaProvider = class {
|
|
|
25588
25830
|
method: "POST",
|
|
25589
25831
|
headers: { "Content-Type": "application/json" },
|
|
25590
25832
|
body: JSON.stringify(body)
|
|
25591
|
-
}, REQUEST_TIMEOUT_MS));
|
|
25833
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
25592
25834
|
} catch (err) {
|
|
25593
25835
|
return { error: `API call error: ${String(err)}` };
|
|
25594
25836
|
}
|
|
@@ -25714,13 +25956,20 @@ function createLlamaApiProvider(providerPath, options = {}) {
|
|
|
25714
25956
|
}
|
|
25715
25957
|
//#endregion
|
|
25716
25958
|
//#region src/providers/localai.ts
|
|
25959
|
+
function parseEnvFloat(value) {
|
|
25960
|
+
if (value === void 0) return;
|
|
25961
|
+
const parsed = Number.parseFloat(value);
|
|
25962
|
+
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
25963
|
+
}
|
|
25717
25964
|
var LocalAiGenericProvider = class {
|
|
25718
25965
|
modelName;
|
|
25719
25966
|
apiBaseUrl;
|
|
25720
25967
|
config;
|
|
25968
|
+
env;
|
|
25721
25969
|
constructor(modelName, options = {}) {
|
|
25722
25970
|
const { id, config, env } = options;
|
|
25723
25971
|
this.modelName = modelName;
|
|
25972
|
+
this.env = env;
|
|
25724
25973
|
this.apiBaseUrl = config?.apiBaseUrl || env?.LOCALAI_BASE_URL || getEnvString("LOCALAI_BASE_URL") || "http://localhost:8080/v1";
|
|
25725
25974
|
this.config = config || {};
|
|
25726
25975
|
this.id = id ? () => id : this.id;
|
|
@@ -25744,7 +25993,7 @@ var LocalAiChatProvider = class extends LocalAiGenericProvider {
|
|
|
25744
25993
|
const body = {
|
|
25745
25994
|
model: this.modelName,
|
|
25746
25995
|
messages,
|
|
25747
|
-
temperature: this.config.temperature
|
|
25996
|
+
temperature: this.config.temperature ?? parseEnvFloat(this.env?.LOCALAI_TEMPERATURE) ?? getEnvFloat("LOCALAI_TEMPERATURE") ?? .7
|
|
25748
25997
|
};
|
|
25749
25998
|
let data;
|
|
25750
25999
|
try {
|
|
@@ -25752,7 +26001,7 @@ var LocalAiChatProvider = class extends LocalAiGenericProvider {
|
|
|
25752
26001
|
method: "POST",
|
|
25753
26002
|
headers: { "Content-Type": "application/json" },
|
|
25754
26003
|
body: JSON.stringify(body)
|
|
25755
|
-
}, REQUEST_TIMEOUT_MS));
|
|
26004
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
25756
26005
|
} catch (err) {
|
|
25757
26006
|
return { error: `API call error: ${String(err)}` };
|
|
25758
26007
|
}
|
|
@@ -25775,7 +26024,7 @@ var LocalAiEmbeddingProvider = class extends LocalAiGenericProvider {
|
|
|
25775
26024
|
method: "POST",
|
|
25776
26025
|
headers: { "Content-Type": "application/json" },
|
|
25777
26026
|
body: JSON.stringify(body)
|
|
25778
|
-
}, REQUEST_TIMEOUT_MS));
|
|
26027
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
25779
26028
|
} catch (err) {
|
|
25780
26029
|
return { error: `API call error: ${String(err)}` };
|
|
25781
26030
|
}
|
|
@@ -25793,7 +26042,7 @@ var LocalAiCompletionProvider = class extends LocalAiGenericProvider {
|
|
|
25793
26042
|
const body = {
|
|
25794
26043
|
model: this.modelName,
|
|
25795
26044
|
prompt,
|
|
25796
|
-
temperature: this.config.temperature
|
|
26045
|
+
temperature: this.config.temperature ?? parseEnvFloat(this.env?.LOCALAI_TEMPERATURE) ?? getEnvFloat("LOCALAI_TEMPERATURE") ?? .7
|
|
25797
26046
|
};
|
|
25798
26047
|
let data;
|
|
25799
26048
|
try {
|
|
@@ -25801,7 +26050,7 @@ var LocalAiCompletionProvider = class extends LocalAiGenericProvider {
|
|
|
25801
26050
|
method: "POST",
|
|
25802
26051
|
headers: { "Content-Type": "application/json" },
|
|
25803
26052
|
body: JSON.stringify(body)
|
|
25804
|
-
}, REQUEST_TIMEOUT_MS));
|
|
26053
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
25805
26054
|
} catch (err) {
|
|
25806
26055
|
return { error: `API call error: ${String(err)}` };
|
|
25807
26056
|
}
|
|
@@ -26043,7 +26292,7 @@ var NscaleImageProvider = class NscaleImageProvider extends OpenAiImageProvider
|
|
|
26043
26292
|
let data, status, statusText;
|
|
26044
26293
|
let cached = false;
|
|
26045
26294
|
try {
|
|
26046
|
-
({data, cached, status, statusText} = await callOpenAiImageApi(`${this.getApiUrl()}${endpoint}`, body, headers, REQUEST_TIMEOUT_MS));
|
|
26295
|
+
({data, cached, status, statusText} = await callOpenAiImageApi(`${this.getApiUrl()}${endpoint}`, body, headers, REQUEST_TIMEOUT_MS$1));
|
|
26047
26296
|
if (status < 200 || status >= 300) return { error: `API error: ${status} ${statusText}\n${typeof data === "string" ? data : JSON.stringify(data)}` };
|
|
26048
26297
|
} catch (err) {
|
|
26049
26298
|
logger.error(`API call error: ${String(err)}`);
|
|
@@ -26211,7 +26460,7 @@ var OllamaCompletionProvider = class {
|
|
|
26211
26460
|
if (OllamaCompletionOptionKeys.has(optionName) && optionName !== "think" && optionName !== "tools" && optionName !== "passthrough") options[optionName] = this.config[optionName];
|
|
26212
26461
|
return options;
|
|
26213
26462
|
}, {}),
|
|
26214
|
-
...this.config.think
|
|
26463
|
+
...this.config.think === void 0 ? {} : { think: this.config.think },
|
|
26215
26464
|
...this.config.passthrough || {}
|
|
26216
26465
|
};
|
|
26217
26466
|
if (this.config.think !== void 0) params.think = this.config.think;
|
|
@@ -26225,7 +26474,7 @@ var OllamaCompletionProvider = class {
|
|
|
26225
26474
|
...getEnvString("OLLAMA_API_KEY") ? { Authorization: `Bearer ${getEnvString("OLLAMA_API_KEY")}` } : {}
|
|
26226
26475
|
},
|
|
26227
26476
|
body: JSON.stringify(params)
|
|
26228
|
-
}, REQUEST_TIMEOUT_MS, "text");
|
|
26477
|
+
}, REQUEST_TIMEOUT_MS$1, "text");
|
|
26229
26478
|
} catch (err) {
|
|
26230
26479
|
return { error: `API call error: ${String(err)}. Output:\n${response?.data}` };
|
|
26231
26480
|
}
|
|
@@ -26310,7 +26559,7 @@ var OllamaChatProvider = class {
|
|
|
26310
26559
|
if (OllamaCompletionOptionKeys.has(optionName) && optionName !== "tools") options[optionName] = this.config[optionName];
|
|
26311
26560
|
return options;
|
|
26312
26561
|
}, {}),
|
|
26313
|
-
...this.config.think
|
|
26562
|
+
...this.config.think === void 0 ? {} : { think: this.config.think },
|
|
26314
26563
|
...this.config.passthrough || {}
|
|
26315
26564
|
};
|
|
26316
26565
|
if (this.config.tools) {
|
|
@@ -26327,7 +26576,7 @@ var OllamaChatProvider = class {
|
|
|
26327
26576
|
...getEnvString("OLLAMA_API_KEY") ? { Authorization: `Bearer ${getEnvString("OLLAMA_API_KEY")}` } : {}
|
|
26328
26577
|
},
|
|
26329
26578
|
body: JSON.stringify(params)
|
|
26330
|
-
}, REQUEST_TIMEOUT_MS, "text", context?.bustCache ?? context?.debug);
|
|
26579
|
+
}, REQUEST_TIMEOUT_MS$1, "text", context?.bustCache ?? context?.debug);
|
|
26331
26580
|
} catch (err) {
|
|
26332
26581
|
return { error: `API call error: ${String(err)}. Output:\n${response?.data}` };
|
|
26333
26582
|
}
|
|
@@ -26395,7 +26644,7 @@ var OllamaEmbeddingProvider = class extends OllamaCompletionProvider {
|
|
|
26395
26644
|
...getEnvString("OLLAMA_API_KEY") ? { Authorization: `Bearer ${getEnvString("OLLAMA_API_KEY")}` } : {}
|
|
26396
26645
|
},
|
|
26397
26646
|
body: JSON.stringify(params)
|
|
26398
|
-
}, REQUEST_TIMEOUT_MS, "json");
|
|
26647
|
+
}, REQUEST_TIMEOUT_MS$1, "json");
|
|
26399
26648
|
} catch (err) {
|
|
26400
26649
|
return { error: `API call error: ${String(err)}` };
|
|
26401
26650
|
}
|
|
@@ -26519,7 +26768,7 @@ var OpenAiAssistantProvider = class extends OpenAiGenericProvider {
|
|
|
26519
26768
|
organization: this.getOrganization(),
|
|
26520
26769
|
baseURL: this.getApiUrl(),
|
|
26521
26770
|
maxRetries: 3,
|
|
26522
|
-
timeout: REQUEST_TIMEOUT_MS,
|
|
26771
|
+
timeout: REQUEST_TIMEOUT_MS$1,
|
|
26523
26772
|
defaultHeaders: this.assistantConfig.headers
|
|
26524
26773
|
});
|
|
26525
26774
|
const messages = parseChatPrompt(prompt, [{
|
|
@@ -27652,7 +27901,12 @@ const SORA_COSTS = {
|
|
|
27652
27901
|
/**
|
|
27653
27902
|
* Valid video sizes (aspect ratios) for OpenAI Sora
|
|
27654
27903
|
*/
|
|
27655
|
-
const VALID_VIDEO_SIZES = [
|
|
27904
|
+
const VALID_VIDEO_SIZES = [
|
|
27905
|
+
"1280x720",
|
|
27906
|
+
"720x1280",
|
|
27907
|
+
"1792x1024",
|
|
27908
|
+
"1024x1792"
|
|
27909
|
+
];
|
|
27656
27910
|
/**
|
|
27657
27911
|
* Valid video durations in seconds for OpenAI Sora
|
|
27658
27912
|
*/
|
|
@@ -27820,7 +28074,7 @@ var OpenAiVideoProvider = class extends OpenAiGenericProvider {
|
|
|
27820
28074
|
* Download video content and store in media storage
|
|
27821
28075
|
*/
|
|
27822
28076
|
async downloadVideoContent(soraVideoId, variant, cacheKey, evalId) {
|
|
27823
|
-
const url = `${this.getApiUrl()}/videos/${soraVideoId}/content${variant
|
|
28077
|
+
const url = `${this.getApiUrl()}/videos/${soraVideoId}/content${variant === "video" ? "" : `?variant=${variant}`}`;
|
|
27824
28078
|
const headers = this.getAuthHeaders();
|
|
27825
28079
|
try {
|
|
27826
28080
|
const response = await fetchWithProxy(url, {
|
|
@@ -28050,7 +28304,7 @@ var OpenRouterProvider = class extends OpenAiChatCompletionProvider {
|
|
|
28050
28304
|
...config.headers
|
|
28051
28305
|
},
|
|
28052
28306
|
body: JSON.stringify(body)
|
|
28053
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug));
|
|
28307
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug));
|
|
28054
28308
|
if (status < 200 || status >= 300) return { error: `API error: ${status} ${statusText}\n${typeof data === "string" ? data : JSON.stringify(data)}` };
|
|
28055
28309
|
} catch (err) {
|
|
28056
28310
|
logger.error(`API call error: ${String(err)}`);
|
|
@@ -28317,7 +28571,7 @@ var PythonWorker = class {
|
|
|
28317
28571
|
maxCrashes = 3;
|
|
28318
28572
|
pendingRequest = null;
|
|
28319
28573
|
requestTimeout = null;
|
|
28320
|
-
constructor(scriptPath, functionName, pythonPath, timeout = REQUEST_TIMEOUT_MS, onReady) {
|
|
28574
|
+
constructor(scriptPath, functionName, pythonPath, timeout = REQUEST_TIMEOUT_MS$1, onReady) {
|
|
28321
28575
|
this.scriptPath = scriptPath;
|
|
28322
28576
|
this.functionName = functionName;
|
|
28323
28577
|
this.pythonPath = pythonPath;
|
|
@@ -28858,7 +29112,7 @@ var ReplicateProvider = class {
|
|
|
28858
29112
|
providerId: this.id(),
|
|
28859
29113
|
temperature: this.config.temperature,
|
|
28860
29114
|
topP: this.config.top_p,
|
|
28861
|
-
maxTokens: this.config.max_tokens
|
|
29115
|
+
maxTokens: this.config.max_tokens ?? this.config.max_length ?? this.config.max_new_tokens,
|
|
28862
29116
|
testIndex: context?.test?.vars?.__testIdx,
|
|
28863
29117
|
promptLabel: context?.prompt?.label,
|
|
28864
29118
|
traceparent: context?.traceparent
|
|
@@ -28902,14 +29156,14 @@ var ReplicateProvider = class {
|
|
|
28902
29156
|
let response;
|
|
28903
29157
|
try {
|
|
28904
29158
|
const inputOptions = {
|
|
28905
|
-
max_length: this.config.max_length
|
|
28906
|
-
max_new_tokens: this.config.max_new_tokens
|
|
28907
|
-
temperature: this.config.temperature
|
|
28908
|
-
top_p: this.config.top_p
|
|
28909
|
-
top_k: this.config.top_k
|
|
28910
|
-
repetition_penalty: this.config.repetition_penalty
|
|
28911
|
-
stop_sequences: this.config.stop_sequences
|
|
28912
|
-
seed: this.config.seed
|
|
29159
|
+
max_length: this.config.max_length ?? getEnvInt("REPLICATE_MAX_LENGTH"),
|
|
29160
|
+
max_new_tokens: this.config.max_new_tokens ?? getEnvInt("REPLICATE_MAX_NEW_TOKENS"),
|
|
29161
|
+
temperature: this.config.temperature ?? getEnvFloat("REPLICATE_TEMPERATURE"),
|
|
29162
|
+
top_p: this.config.top_p ?? getEnvFloat("REPLICATE_TOP_P"),
|
|
29163
|
+
top_k: this.config.top_k ?? getEnvInt("REPLICATE_TOP_K"),
|
|
29164
|
+
repetition_penalty: this.config.repetition_penalty ?? getEnvFloat("REPLICATE_REPETITION_PENALTY"),
|
|
29165
|
+
stop_sequences: this.config.stop_sequences ?? getEnvString("REPLICATE_STOP_SEQUENCES"),
|
|
29166
|
+
seed: this.config.seed ?? getEnvInt("REPLICATE_SEED"),
|
|
28913
29167
|
system_prompt: systemPrompt,
|
|
28914
29168
|
prompt: userPrompt
|
|
28915
29169
|
};
|
|
@@ -28928,7 +29182,7 @@ var ReplicateProvider = class {
|
|
|
28928
29182
|
Prefer: "wait=60"
|
|
28929
29183
|
},
|
|
28930
29184
|
body: JSON.stringify(data)
|
|
28931
|
-
}, REQUEST_TIMEOUT_MS, "json")).data;
|
|
29185
|
+
}, REQUEST_TIMEOUT_MS$1, "json")).data;
|
|
28932
29186
|
if (response.status === "starting" || response.status === "processing") response = await this.pollForCompletion(response.id);
|
|
28933
29187
|
if (response.status === "failed") throw new Error(response.error || "Prediction failed");
|
|
28934
29188
|
response = response.output;
|
|
@@ -28964,7 +29218,7 @@ var ReplicateProvider = class {
|
|
|
28964
29218
|
const prediction = (await fetchWithCache(`https://api.replicate.com/v1/predictions/${predictionId}`, {
|
|
28965
29219
|
method: "GET",
|
|
28966
29220
|
headers: { Authorization: `Bearer ${this.apiKey}` }
|
|
28967
|
-
}, REQUEST_TIMEOUT_MS, "json", false)).data;
|
|
29221
|
+
}, REQUEST_TIMEOUT_MS$1, "json", false)).data;
|
|
28968
29222
|
if (prediction.status === "succeeded" || prediction.status === "failed" || prediction.status === "canceled") return prediction;
|
|
28969
29223
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
28970
29224
|
}
|
|
@@ -29056,7 +29310,7 @@ var ReplicateImageProvider = class extends ReplicateProvider {
|
|
|
29056
29310
|
Prefer: "wait=60"
|
|
29057
29311
|
},
|
|
29058
29312
|
body: JSON.stringify(data)
|
|
29059
|
-
}, REQUEST_TIMEOUT_MS, "json")).data;
|
|
29313
|
+
}, REQUEST_TIMEOUT_MS$1, "json")).data;
|
|
29060
29314
|
logger.debug(`Initial prediction status: ${prediction.status}, ID: ${prediction.id}`);
|
|
29061
29315
|
if (prediction.status === "starting" || prediction.status === "processing") prediction = await this.pollForCompletion(prediction.id);
|
|
29062
29316
|
logger.debug(`Final prediction status: ${prediction.status}, output: ${JSON.stringify(prediction.output)}`);
|
|
@@ -29397,7 +29651,7 @@ var SnowflakeCortexProvider = class extends OpenAiChatCompletionProvider {
|
|
|
29397
29651
|
...config.headers
|
|
29398
29652
|
},
|
|
29399
29653
|
body: JSON.stringify(body)
|
|
29400
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug));
|
|
29654
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug));
|
|
29401
29655
|
if (status < 200 || status >= 300) return { error: `API error: ${status} ${statusText}\n${typeof data === "string" ? data : JSON.stringify(data)}` };
|
|
29402
29656
|
} catch (err) {
|
|
29403
29657
|
logger.error(`[Snowflake Cortex] API call error: ${String(err)}`);
|
|
@@ -29812,7 +30066,7 @@ function createTrueFoundryProvider(providerPath, options = {}) {
|
|
|
29812
30066
|
}
|
|
29813
30067
|
//#endregion
|
|
29814
30068
|
//#region src/providers/vercel.ts
|
|
29815
|
-
const DEFAULT_TIMEOUT_MS = REQUEST_TIMEOUT_MS;
|
|
30069
|
+
const DEFAULT_TIMEOUT_MS = REQUEST_TIMEOUT_MS$1;
|
|
29816
30070
|
/**
|
|
29817
30071
|
* Resolves the API key from config, environment variables, or defaults.
|
|
29818
30072
|
*/
|
|
@@ -30213,7 +30467,7 @@ var VoyageEmbeddingProvider = class {
|
|
|
30213
30467
|
...this.config.headers
|
|
30214
30468
|
},
|
|
30215
30469
|
body: JSON.stringify(body)
|
|
30216
|
-
}, REQUEST_TIMEOUT_MS));
|
|
30470
|
+
}, REQUEST_TIMEOUT_MS$1));
|
|
30217
30471
|
} catch (err) {
|
|
30218
30472
|
logger.error(`API call error: ${err}`);
|
|
30219
30473
|
throw err;
|
|
@@ -30323,7 +30577,7 @@ function generateConfigHash(config) {
|
|
|
30323
30577
|
}
|
|
30324
30578
|
async function fetchModelSpecs() {
|
|
30325
30579
|
try {
|
|
30326
|
-
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);
|
|
30580
|
+
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);
|
|
30327
30581
|
return (typeof data === "string" ? JSON.parse(data) : data)?.resources || [];
|
|
30328
30582
|
} catch (error) {
|
|
30329
30583
|
logger.error(`Failed to fetch model specs: ${error}`);
|
|
@@ -30622,7 +30876,7 @@ var WebhookProvider = class {
|
|
|
30622
30876
|
method: "POST",
|
|
30623
30877
|
headers: { "Content-Type": "application/json" },
|
|
30624
30878
|
body: JSON.stringify(params)
|
|
30625
|
-
}, REQUEST_TIMEOUT_MS, "json"));
|
|
30879
|
+
}, REQUEST_TIMEOUT_MS$1, "json"));
|
|
30626
30880
|
} catch (err) {
|
|
30627
30881
|
return { error: `Webhook call error: ${String(err)}` };
|
|
30628
30882
|
}
|
|
@@ -30700,7 +30954,7 @@ var WebSocketProvider = class {
|
|
|
30700
30954
|
constructor(url, options) {
|
|
30701
30955
|
this.config = options.config;
|
|
30702
30956
|
this.url = this.config.url || url;
|
|
30703
|
-
this.timeoutMs = this.config.timeoutMs || REQUEST_TIMEOUT_MS;
|
|
30957
|
+
this.timeoutMs = this.config.timeoutMs || REQUEST_TIMEOUT_MS$1;
|
|
30704
30958
|
this.transformResponse = createTransformResponse(this.config.transformResponse || this.config.responseParser);
|
|
30705
30959
|
this.streamResponse = this.config.streamResponse ? createStreamResponse(this.config.streamResponse) : void 0;
|
|
30706
30960
|
invariant(this.config.messageTemplate, `Expected WebSocket provider ${this.url} to have a config containing {messageTemplate}, but got ${safeJsonStringify(this.config)}`);
|
|
@@ -30717,7 +30971,7 @@ var WebSocketProvider = class {
|
|
|
30717
30971
|
prompt
|
|
30718
30972
|
};
|
|
30719
30973
|
const message = nunjucks.renderString(this.config.messageTemplate, vars);
|
|
30720
|
-
const streamResponse = this.streamResponse
|
|
30974
|
+
const streamResponse = this.streamResponse == null ? void 0 : await this.streamResponse;
|
|
30721
30975
|
logger.debug(`Sending WebSocket message to ${this.url}: ${message}`);
|
|
30722
30976
|
let accumulator = { error: "unknown error occurred" };
|
|
30723
30977
|
return new Promise((resolve, reject) => {
|
|
@@ -31155,7 +31409,7 @@ var XAIImageProvider = class extends OpenAiImageProvider {
|
|
|
31155
31409
|
let cached = false;
|
|
31156
31410
|
let latencyMs;
|
|
31157
31411
|
try {
|
|
31158
|
-
({data, cached, status, statusText, latencyMs} = await callOpenAiImageApi(`${this.getApiUrl()}${endpoint}`, body, headers, REQUEST_TIMEOUT_MS));
|
|
31412
|
+
({data, cached, status, statusText, latencyMs} = await callOpenAiImageApi(`${this.getApiUrl()}${endpoint}`, body, headers, REQUEST_TIMEOUT_MS$1));
|
|
31159
31413
|
if (status < 200 || status >= 300) return { error: `API error: ${status} ${statusText}\n${typeof data === "string" ? data : JSON.stringify(data)}` };
|
|
31160
31414
|
} catch (err) {
|
|
31161
31415
|
logger.error(`API call error: ${String(err)}`);
|
|
@@ -31279,10 +31533,10 @@ var XAIResponsesProvider = class {
|
|
|
31279
31533
|
const body = {
|
|
31280
31534
|
model: this.modelName,
|
|
31281
31535
|
input,
|
|
31282
|
-
...maxOutputTokens
|
|
31283
|
-
...temperature
|
|
31536
|
+
...maxOutputTokens === void 0 ? {} : { max_output_tokens: maxOutputTokens },
|
|
31537
|
+
...temperature === void 0 ? {} : { temperature },
|
|
31284
31538
|
...config.instructions ? { instructions: config.instructions } : {},
|
|
31285
|
-
...config.top_p
|
|
31539
|
+
...config.top_p === void 0 ? {} : { top_p: config.top_p },
|
|
31286
31540
|
...loadedTools && loadedTools.length > 0 ? { tools: loadedTools } : {},
|
|
31287
31541
|
...config.tool_choice ? { tool_choice: config.tool_choice } : {},
|
|
31288
31542
|
...config.previous_response_id ? { previous_response_id: config.previous_response_id } : {},
|
|
@@ -31328,7 +31582,7 @@ var XAIResponsesProvider = class {
|
|
|
31328
31582
|
...config.headers
|
|
31329
31583
|
},
|
|
31330
31584
|
body: JSON.stringify(body)
|
|
31331
|
-
}, REQUEST_TIMEOUT_MS, "json", context?.bustCache ?? context?.debug, this.config.maxRetries);
|
|
31585
|
+
}, REQUEST_TIMEOUT_MS$1, "json", context?.bustCache ?? context?.debug, this.config.maxRetries);
|
|
31332
31586
|
data = response.data;
|
|
31333
31587
|
cached = response.cached;
|
|
31334
31588
|
status = response.status;
|
|
@@ -32105,7 +32359,7 @@ const providerMap = [
|
|
|
32105
32359
|
{
|
|
32106
32360
|
test: (providerPath) => providerPath.startsWith("opencode:") || providerPath === "opencode",
|
|
32107
32361
|
create: async (providerPath, providerOptions, context) => {
|
|
32108
|
-
const { OpenCodeSDKProvider } = await import("./opencode-sdk-
|
|
32362
|
+
const { OpenCodeSDKProvider } = await import("./opencode-sdk-DDxj4QqH.js");
|
|
32109
32363
|
return new OpenCodeSDKProvider({
|
|
32110
32364
|
...providerOptions,
|
|
32111
32365
|
id: providerPath,
|
|
@@ -32117,18 +32371,15 @@ const providerMap = [
|
|
|
32117
32371
|
{
|
|
32118
32372
|
test: (providerPath) => providerPath.startsWith("openclaw:") || providerPath === "openclaw",
|
|
32119
32373
|
create: async (providerPath, providerOptions, context) => {
|
|
32120
|
-
const { createOpenClawProvider } = await import("./openclaw-
|
|
32374
|
+
const { createOpenClawProvider } = await import("./openclaw-0Sv7AK3O.js");
|
|
32121
32375
|
return createOpenClawProvider(providerPath, providerOptions, context.env);
|
|
32122
32376
|
}
|
|
32123
32377
|
},
|
|
32124
32378
|
{
|
|
32125
32379
|
test: (providerPath) => providerPath.startsWith("anthropic:claude-agent-sdk") || providerPath.startsWith("anthropic:claude-code"),
|
|
32126
|
-
create: async (_providerPath, providerOptions,
|
|
32127
|
-
const { ClaudeCodeSDKProvider } = await import("./claude-agent-sdk-
|
|
32128
|
-
return new ClaudeCodeSDKProvider({
|
|
32129
|
-
...providerOptions,
|
|
32130
|
-
env: context.env
|
|
32131
|
-
});
|
|
32380
|
+
create: async (_providerPath, providerOptions, _context) => {
|
|
32381
|
+
const { ClaudeCodeSDKProvider } = await import("./claude-agent-sdk-CMjh4LFH.js");
|
|
32382
|
+
return new ClaudeCodeSDKProvider({ ...providerOptions });
|
|
32132
32383
|
}
|
|
32133
32384
|
},
|
|
32134
32385
|
{
|
|
@@ -32181,25 +32432,25 @@ const providerMap = [
|
|
|
32181
32432
|
const modelName = splits.slice(2).join(":");
|
|
32182
32433
|
if (modelType === "converse") return new AwsBedrockConverseProvider(modelName, providerOptions);
|
|
32183
32434
|
if (modelType === "nova-sonic" || modelType.includes("amazon.nova-sonic")) {
|
|
32184
|
-
const { NovaSonicProvider } = await import("./nova-sonic-
|
|
32435
|
+
const { NovaSonicProvider } = await import("./nova-sonic-DXTLpi-r.js");
|
|
32185
32436
|
return new NovaSonicProvider("amazon.nova-sonic-v1:0", providerOptions);
|
|
32186
32437
|
}
|
|
32187
32438
|
if (modelType.includes("luma.ray") || modelName.includes("luma.ray")) {
|
|
32188
|
-
const { LumaRayVideoProvider } = await import("./luma-ray-
|
|
32439
|
+
const { LumaRayVideoProvider } = await import("./luma-ray-DP0QA9qn.js");
|
|
32189
32440
|
return new LumaRayVideoProvider(modelName.includes("luma.ray") ? modelName : splits.slice(1).join(":") || "luma.ray-v2:0", providerOptions);
|
|
32190
32441
|
}
|
|
32191
32442
|
if (modelType.includes("amazon.nova-reel") || modelType === "video" && (modelName.includes("amazon.nova-reel") || modelName === "")) {
|
|
32192
|
-
const { NovaReelVideoProvider } = await import("./nova-reel-
|
|
32443
|
+
const { NovaReelVideoProvider } = await import("./nova-reel-BZ9y-Y5s.js");
|
|
32193
32444
|
return new NovaReelVideoProvider(modelName || "amazon.nova-reel-v1:1", providerOptions);
|
|
32194
32445
|
}
|
|
32195
32446
|
if (modelType === "agents") {
|
|
32196
|
-
const { AwsBedrockAgentsProvider } = await import("./agents-
|
|
32447
|
+
const { AwsBedrockAgentsProvider } = await import("./agents-CLQ-P15P.js");
|
|
32197
32448
|
return new AwsBedrockAgentsProvider(modelName, providerOptions);
|
|
32198
32449
|
}
|
|
32199
32450
|
if (modelType === "completion") return new AwsBedrockCompletionProvider(modelName, providerOptions);
|
|
32200
32451
|
if (modelType === "embeddings" || modelType === "embedding") return new AwsBedrockEmbeddingProvider(modelName, providerOptions);
|
|
32201
32452
|
if (modelType === "kb" || modelType === "knowledge-base") {
|
|
32202
|
-
const { AwsBedrockKnowledgeBaseProvider } = await import("./knowledgeBase-
|
|
32453
|
+
const { AwsBedrockKnowledgeBaseProvider } = await import("./knowledgeBase-DFRXPZl_.js");
|
|
32203
32454
|
return new AwsBedrockKnowledgeBaseProvider(modelName, providerOptions);
|
|
32204
32455
|
}
|
|
32205
32456
|
return new AwsBedrockCompletionProvider(splits.slice(1).join(":"), providerOptions);
|
|
@@ -32209,7 +32460,7 @@ const providerMap = [
|
|
|
32209
32460
|
test: (providerPath) => providerPath.startsWith("bedrock-agent:"),
|
|
32210
32461
|
create: async (providerPath, providerOptions, _context) => {
|
|
32211
32462
|
const agentId = providerPath.substring(14);
|
|
32212
|
-
const { AwsBedrockAgentsProvider } = await import("./agents-
|
|
32463
|
+
const { AwsBedrockAgentsProvider } = await import("./agents-CLQ-P15P.js");
|
|
32213
32464
|
return new AwsBedrockAgentsProvider(agentId, providerOptions);
|
|
32214
32465
|
}
|
|
32215
32466
|
},
|
|
@@ -32219,7 +32470,7 @@ const providerMap = [
|
|
|
32219
32470
|
const splits = providerPath.split(":");
|
|
32220
32471
|
const modelType = splits[1];
|
|
32221
32472
|
const endpointName = splits.slice(2).join(":");
|
|
32222
|
-
const { SageMakerCompletionProvider, SageMakerEmbeddingProvider } = await import("./sagemaker-
|
|
32473
|
+
const { SageMakerCompletionProvider, SageMakerEmbeddingProvider } = await import("./sagemaker-CqeASYE5.js");
|
|
32223
32474
|
if (modelType === "embedding" || modelType === "embeddings") return new SageMakerEmbeddingProvider(endpointName || modelType, providerOptions);
|
|
32224
32475
|
if (splits.length === 2) return new SageMakerCompletionProvider(modelType, providerOptions);
|
|
32225
32476
|
if (endpointName.includes("jumpstart") || modelType === "jumpstart") return new SageMakerCompletionProvider(endpointName, {
|
|
@@ -32260,7 +32511,7 @@ const providerMap = [
|
|
|
32260
32511
|
{
|
|
32261
32512
|
test: (providerPath) => providerPath.startsWith("cloudflare-ai:"),
|
|
32262
32513
|
create: async (providerPath, providerOptions, context) => {
|
|
32263
|
-
const { createCloudflareAiProvider } = await import("./cloudflare-ai-
|
|
32514
|
+
const { createCloudflareAiProvider } = await import("./cloudflare-ai-Bbp26N0L.js");
|
|
32264
32515
|
return createCloudflareAiProvider(providerPath, {
|
|
32265
32516
|
...providerOptions,
|
|
32266
32517
|
env: context.env
|
|
@@ -32270,7 +32521,7 @@ const providerMap = [
|
|
|
32270
32521
|
{
|
|
32271
32522
|
test: (providerPath) => providerPath.startsWith("cloudflare-gateway:"),
|
|
32272
32523
|
create: async (providerPath, providerOptions, context) => {
|
|
32273
|
-
const { createCloudflareGatewayProvider } = await import("./cloudflare-gateway-
|
|
32524
|
+
const { createCloudflareGatewayProvider } = await import("./cloudflare-gateway-BwAaUgeW.js");
|
|
32274
32525
|
return createCloudflareGatewayProvider(providerPath, {
|
|
32275
32526
|
...providerOptions,
|
|
32276
32527
|
env: context.env
|
|
@@ -32422,27 +32673,27 @@ const providerMap = [
|
|
|
32422
32673
|
create: async (providerPath, providerOptions, context) => {
|
|
32423
32674
|
const modelType = providerPath.split(":")[1];
|
|
32424
32675
|
if (modelType === "image") {
|
|
32425
|
-
const { createHyperbolicImageProvider } = await import("./image-
|
|
32676
|
+
const { createHyperbolicImageProvider } = await import("./image-xNbw5ph2.js");
|
|
32426
32677
|
return createHyperbolicImageProvider(providerPath, {
|
|
32427
32678
|
...providerOptions,
|
|
32428
32679
|
env: context.env
|
|
32429
32680
|
});
|
|
32430
32681
|
}
|
|
32431
32682
|
if (modelType === "audio") {
|
|
32432
|
-
const { createHyperbolicAudioProvider } = await import("./audio-
|
|
32683
|
+
const { createHyperbolicAudioProvider } = await import("./audio-Bn44pQxv.js");
|
|
32433
32684
|
return createHyperbolicAudioProvider(providerPath, {
|
|
32434
32685
|
...providerOptions,
|
|
32435
32686
|
env: context.env
|
|
32436
32687
|
});
|
|
32437
32688
|
}
|
|
32438
|
-
const { createHyperbolicProvider } = await import("./chat-
|
|
32689
|
+
const { createHyperbolicProvider } = await import("./chat-B-52XYI1.js");
|
|
32439
32690
|
return createHyperbolicProvider(providerPath, providerOptions);
|
|
32440
32691
|
}
|
|
32441
32692
|
},
|
|
32442
32693
|
{
|
|
32443
32694
|
test: (providerPath) => providerPath.startsWith("litellm:"),
|
|
32444
32695
|
create: async (providerPath, providerOptions, context) => {
|
|
32445
|
-
const { createLiteLLMProvider } = await import("./litellm-
|
|
32696
|
+
const { createLiteLLMProvider } = await import("./litellm-CKiAxnoM.js");
|
|
32446
32697
|
return createLiteLLMProvider(providerPath, {
|
|
32447
32698
|
config: providerOptions,
|
|
32448
32699
|
env: context.env
|
|
@@ -32499,9 +32750,16 @@ const providerMap = [
|
|
|
32499
32750
|
const modelName = splits.slice(2).join(":");
|
|
32500
32751
|
const configuredModel = getConfiguredOpenAiModel(providerOptions);
|
|
32501
32752
|
if (modelType === "codex-sdk" || modelType === "codex") {
|
|
32502
|
-
const { OpenAICodexSDKProvider } = await import("./codex-sdk-
|
|
32753
|
+
const { OpenAICodexSDKProvider } = await import("./codex-sdk-C_07GuVS.js");
|
|
32754
|
+
const codexModel = modelName || configuredModel;
|
|
32755
|
+
const codexProviderId = providerOptions.id ?? providerPath;
|
|
32503
32756
|
return new OpenAICodexSDKProvider({
|
|
32504
32757
|
...providerOptions,
|
|
32758
|
+
id: codexProviderId,
|
|
32759
|
+
config: codexModel ? {
|
|
32760
|
+
...providerOptions.config,
|
|
32761
|
+
model: codexModel
|
|
32762
|
+
} : providerOptions.config,
|
|
32505
32763
|
env: context.env
|
|
32506
32764
|
});
|
|
32507
32765
|
}
|
|
@@ -32512,7 +32770,7 @@ const providerMap = [
|
|
|
32512
32770
|
if (modelType === "realtime") return new OpenAiRealtimeProvider(modelName || configuredModel || "gpt-4o-realtime-preview-2024-12-17", providerOptions);
|
|
32513
32771
|
if (modelType === "responses") return new OpenAiResponsesProvider(modelName || configuredModel || "gpt-4.1-2025-04-14", providerOptions);
|
|
32514
32772
|
if (modelType === "transcription") {
|
|
32515
|
-
const { OpenAiTranscriptionProvider } = await import("./transcription-
|
|
32773
|
+
const { OpenAiTranscriptionProvider } = await import("./transcription-Hb3VnC4M.js");
|
|
32516
32774
|
return new OpenAiTranscriptionProvider(modelName || configuredModel || "gpt-4o-transcribe-diarize", providerOptions);
|
|
32517
32775
|
}
|
|
32518
32776
|
if (OpenAiChatCompletionProvider.OPENAI_CHAT_MODEL_NAMES.includes(modelType)) return new OpenAiChatCompletionProvider(modelType, providerOptions);
|
|
@@ -32520,11 +32778,11 @@ const providerMap = [
|
|
|
32520
32778
|
if (OpenAiRealtimeProvider.OPENAI_REALTIME_MODEL_NAMES.includes(modelType)) return new OpenAiRealtimeProvider(modelType, providerOptions);
|
|
32521
32779
|
if (OpenAiResponsesProvider.OPENAI_RESPONSES_MODEL_NAMES.includes(modelType)) return new OpenAiResponsesProvider(modelType, providerOptions);
|
|
32522
32780
|
if (modelType === "agents") {
|
|
32523
|
-
const { OpenAiAgentsProvider } = await import("./agents-
|
|
32781
|
+
const { OpenAiAgentsProvider } = await import("./agents-BBVJCIYr.js");
|
|
32524
32782
|
return new OpenAiAgentsProvider(modelName || "default-agent", providerOptions);
|
|
32525
32783
|
}
|
|
32526
32784
|
if (modelType === "chatkit") {
|
|
32527
|
-
const { OpenAiChatKitProvider } = await import("./chatkit-
|
|
32785
|
+
const { OpenAiChatKitProvider } = await import("./chatkit-BYGQlHlV.js");
|
|
32528
32786
|
return new OpenAiChatKitProvider(modelName || "", providerOptions);
|
|
32529
32787
|
}
|
|
32530
32788
|
if (modelType === "assistant") return new OpenAiAssistantProvider(modelName, providerOptions);
|
|
@@ -32567,7 +32825,7 @@ const providerMap = [
|
|
|
32567
32825
|
{
|
|
32568
32826
|
test: (providerPath) => providerPath.startsWith("quiverai:"),
|
|
32569
32827
|
create: async (providerPath, providerOptions, context) => {
|
|
32570
|
-
const { createQuiverAiProvider } = await import("./quiverai-
|
|
32828
|
+
const { createQuiverAiProvider } = await import("./quiverai-DVSEqJiq.js");
|
|
32571
32829
|
return createQuiverAiProvider(providerPath, providerOptions, context.env);
|
|
32572
32830
|
}
|
|
32573
32831
|
},
|
|
@@ -32585,7 +32843,7 @@ const providerMap = [
|
|
|
32585
32843
|
{
|
|
32586
32844
|
test: (providerPath) => providerPath.startsWith("modelslab:"),
|
|
32587
32845
|
create: async (providerPath, providerOptions, context) => {
|
|
32588
|
-
const { ModelsLabImageProvider } = await import("./modelslab-
|
|
32846
|
+
const { ModelsLabImageProvider } = await import("./modelslab-B5J-ZM5c.js");
|
|
32589
32847
|
const splits = providerPath.split(":");
|
|
32590
32848
|
const modelType = splits[1];
|
|
32591
32849
|
const modelName = splits.slice(2).join(":");
|
|
@@ -32629,7 +32887,7 @@ const providerMap = [
|
|
|
32629
32887
|
{
|
|
32630
32888
|
test: (providerPath) => providerPath.startsWith("aimlapi:"),
|
|
32631
32889
|
create: async (providerPath, providerOptions, context) => {
|
|
32632
|
-
const { createAimlApiProvider } = await import("./aimlapi-
|
|
32890
|
+
const { createAimlApiProvider } = await import("./aimlapi-MgSLdvy7.js");
|
|
32633
32891
|
return createAimlApiProvider(providerPath, {
|
|
32634
32892
|
...providerOptions,
|
|
32635
32893
|
env: context.env
|
|
@@ -32639,7 +32897,7 @@ const providerMap = [
|
|
|
32639
32897
|
{
|
|
32640
32898
|
test: (providerPath) => providerPath.startsWith("cometapi:"),
|
|
32641
32899
|
create: async (providerPath, providerOptions, context) => {
|
|
32642
|
-
const { createCometApiProvider } = await import("./cometapi-
|
|
32900
|
+
const { createCometApiProvider } = await import("./cometapi-BDyV-NNm.js");
|
|
32643
32901
|
return createCometApiProvider(providerPath, {
|
|
32644
32902
|
...providerOptions,
|
|
32645
32903
|
env: context.env
|
|
@@ -32649,7 +32907,7 @@ const providerMap = [
|
|
|
32649
32907
|
{
|
|
32650
32908
|
test: (providerPath) => providerPath.startsWith("docker:"),
|
|
32651
32909
|
create: async (providerPath, providerOptions, context) => {
|
|
32652
|
-
const { createDockerProvider } = await import("./docker-
|
|
32910
|
+
const { createDockerProvider } = await import("./docker-FeBni2dw.js");
|
|
32653
32911
|
return createDockerProvider(providerPath, {
|
|
32654
32912
|
...providerOptions,
|
|
32655
32913
|
env: context.env
|
|
@@ -32670,6 +32928,14 @@ const providerMap = [
|
|
|
32670
32928
|
create: async (providerPath, providerOptions, _context) => {
|
|
32671
32929
|
const splits = providerPath.split(":");
|
|
32672
32930
|
const firstPart = splits[1];
|
|
32931
|
+
if (firstPart === "video") return new GoogleVideoProvider(splits.slice(2).join(":"), {
|
|
32932
|
+
...providerOptions,
|
|
32933
|
+
id: providerPath,
|
|
32934
|
+
config: {
|
|
32935
|
+
...providerOptions.config,
|
|
32936
|
+
vertexai: true
|
|
32937
|
+
}
|
|
32938
|
+
});
|
|
32673
32939
|
if (firstPart === "chat") return new VertexChatProvider(splits.slice(2).join(":"), providerOptions);
|
|
32674
32940
|
if (firstPart === "embedding" || firstPart === "embeddings") return new VertexEmbeddingProvider(splits.slice(2).join(":"), providerOptions);
|
|
32675
32941
|
return new VertexChatProvider(splits.slice(1).join(":"), providerOptions);
|
|
@@ -32736,7 +33002,10 @@ const providerMap = [
|
|
|
32736
33002
|
const modelName = splits.slice(2).join(":");
|
|
32737
33003
|
if (serviceType === "live") return new GoogleLiveProvider(modelName, providerOptions);
|
|
32738
33004
|
else if (serviceType === "image") return new GoogleImageProvider(modelName, providerOptions);
|
|
32739
|
-
else if (serviceType === "video") return new GoogleVideoProvider(modelName,
|
|
33005
|
+
else if (serviceType === "video") return new GoogleVideoProvider(modelName, {
|
|
33006
|
+
...providerOptions,
|
|
33007
|
+
id: providerPath
|
|
33008
|
+
});
|
|
32740
33009
|
}
|
|
32741
33010
|
const modelName = splits[1];
|
|
32742
33011
|
if (modelName.includes("-image")) return new GeminiImageProvider(modelName, providerOptions);
|
|
@@ -32915,7 +33184,7 @@ const providerMap = [
|
|
|
32915
33184
|
{
|
|
32916
33185
|
test: (providerPath) => providerPath.startsWith("transformers:") || providerPath.startsWith("transformers.js:"),
|
|
32917
33186
|
create: async (providerPath, providerOptions, _context) => {
|
|
32918
|
-
const { validateTransformersDependency } = await import("./transformersAvailability-
|
|
33187
|
+
const { validateTransformersDependency } = await import("./transformersAvailability-BGkzavwb.js");
|
|
32919
33188
|
await validateTransformersDependency();
|
|
32920
33189
|
const splits = providerPath.split(":");
|
|
32921
33190
|
if (splits.length < 3) throw new Error(`Invalid Transformers.js provider path: ${providerPath}. Format: transformers:<task>:<model>
|
|
@@ -32935,7 +33204,7 @@ Example: transformers:feature-extraction:Xenova/all-MiniLM-L6-v2`);
|
|
|
32935
33204
|
test: (providerPath) => providerPath === "slack" || providerPath.startsWith("slack:"),
|
|
32936
33205
|
create: async (providerPath, providerOptions, _context) => {
|
|
32937
33206
|
try {
|
|
32938
|
-
const { SlackProvider } = await import("./slack-
|
|
33207
|
+
const { SlackProvider } = await import("./slack-DCEV-vWP.js");
|
|
32939
33208
|
if (providerPath === "slack") return new SlackProvider(providerOptions);
|
|
32940
33209
|
const splits = providerPath.split(":");
|
|
32941
33210
|
if (splits.length < 2) throw new Error("Invalid Slack provider path. Use slack:<channel_id> or slack:channel:<channel_id>");
|
|
@@ -33231,4 +33500,4 @@ function getProviderIds(providerPaths) {
|
|
|
33231
33500
|
//#endregion
|
|
33232
33501
|
export { DefaultSynthesizeProvider as $, createRateLimitRegistry as A, isCloudProvider as B, collectFileMetadata as C, loadFromPackage as D, isPackagePath as E, getCloudDatabaseId as F, DefaultEmbeddingProvider as G, OpenAiModerationProvider as H, getEvalConfigFromCloud as I, AIStudioChatProvider as J, DefaultGradingProvider as K, getOrgContext as L, PromptfooHarmfulCompletionProvider as M, REDTEAM_MEMORY_POISONING_PLUGIN_ID as N, redteamProviderManager as O, checkCloudPermissions as P, DefaultSuggestionsProvider as Q, getPluginSeverityOverridesFromCloud as R, removePrefix as S, runExtensionHook as T, MistralChatCompletionProvider as U, resolveTeamId as V, MistralEmbeddingProvider as W, DefaultGradingProvider$1 as X, DefaultGradingJsonProvider as Y, DefaultLlmRubricProvider as Z, extractVariablesFromJson as _, resolveProviderConfigs as a, isBasicRefusal as b, Strategies as c, pluginMatchesStrategyTargets as d, AzureModerationProvider as et, checkExfilTracking as f, extractPromptFromTags as g, extractInputVarsFromPrompt as h, resolveProvider as i, parseScriptParts as it, createProviderRateLimitOptions as j, TokenUsageTracker as k, loadStrategy as l, extractGoalFromPrompt as m, loadApiProvider as n, AzureChatCompletionProvider as nt, MCPProvider as o, extractAllPromptsFromTags as p, VertexChatProvider as q, loadApiProviders as r, getFileHashes as rt, GoogleLiveProvider as s, getProviderIds as t, AzureEmbeddingProvider as tt, validateStrategies as u, getSessionId as v, renderPrompt as w, isEmptyResponse as x, getShortPluginId as y, getPoliciesFromCloud as z };
|
|
33233
33502
|
|
|
33234
|
-
//# sourceMappingURL=providers-
|
|
33503
|
+
//# sourceMappingURL=providers-Cn73d5sr.js.map
|