promptfoo 0.121.3 → 0.121.4
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 +1 -1
- package/dist/src/{ListApp-Du7YVwj5.js → ListApp-DQkFNqE9.js} +1 -1
- package/dist/src/{accounts-Xatc0RYb.js → accounts-DdJ2pHMI.js} +5 -5
- package/dist/src/{accounts-B2XmGjty.js → accounts-DhMYUUbu.js} +5 -5
- package/dist/src/{accounts-BPyfpSeU.cjs → accounts-Dy17bs4D.cjs} +5 -5
- package/dist/src/{accounts-CFLK3mnD.js → accounts-F9d_5sMC.js} +6 -6
- package/dist/src/{agentic-utils-DAVsChuB.cjs → agentic-utils-BpX5b23w.cjs} +3 -3
- package/dist/src/{agentic-utils-DIYAAYE7.js → agentic-utils-P172hM8B.js} +3 -3
- package/dist/src/{agentic-utils-D8yXo5Lm.js → agentic-utils-qFlm6zes.js} +4 -4
- package/dist/src/{agentic-utils-36epdqwB.js → agentic-utils-w68v6_Dz.js} +3 -3
- package/dist/src/{agents-CLQ-P15P.js → agents-8FDnTriG.js} +6 -7
- package/dist/src/{agents-CAYbM7qD.cjs → agents-BahDpe5G.cjs} +34 -12
- package/dist/src/{agents-DSSTV4bv.js → agents-C-R_jfzI.js} +35 -13
- package/dist/src/{agents-wg3ohknq.js → agents-CgaMXvLM.js} +5 -7
- package/dist/src/{agents-BBWxKSM0.cjs → agents-D7-HGxUj.cjs} +5 -7
- package/dist/src/{agents-BBVJCIYr.js → agents-DJ35I3Nt.js} +35 -13
- package/dist/src/{agents-CgBniSlI.js → agents-aYPQLf8W.js} +5 -9
- package/dist/src/{agents-Bqgfdokm.js → agents-pQeBEXMm.js} +35 -14
- package/dist/src/{aimlapi-BwGC1TtS.js → aimlapi-BCq3MHeL.js} +8 -14
- package/dist/src/{aimlapi-MgSLdvy7.js → aimlapi-BD6J9oKt.js} +7 -14
- package/dist/src/{aimlapi-Bv8Fmc-b.cjs → aimlapi-qcK4OT55.cjs} +8 -15
- package/dist/src/{aimlapi-DaC3qZ-o.js → aimlapi-sgYnkE54.js} +7 -16
- package/dist/src/app/app/tsconfig.app.tsbuildinfo +1 -0
- package/dist/src/app/assets/Report-CQYFezYu.js +1 -0
- package/dist/src/app/assets/index-BXGkeMwh.css +1 -0
- package/dist/src/app/assets/index-BzJt18Jz.js +385 -0
- package/dist/src/app/assets/rolldown-runtime-COnpUsM8.js +1 -0
- package/dist/src/app/assets/scroll-timeline-D9IT_e8Z.js +1 -0
- package/dist/src/app/assets/sync-IjzpWrOE.js +4 -0
- package/dist/src/app/assets/vendor-charts-BNdH8TCw.js +36 -0
- package/dist/src/app/assets/vendor-markdown-Ch00wnNI.js +29 -0
- package/dist/src/app/assets/vendor-react-CVvmk1UB.js +9 -0
- package/dist/src/app/assets/vendor-utils-BnEYbx2Q.js +37 -0
- package/dist/src/app/index.html +7 -7
- package/dist/src/{audio-DjU9GswO.js → audio-B7izf48x.js} +4 -5
- package/dist/src/{audio-DVFjQ67_.cjs → audio-BQtNuYBj.cjs} +4 -4
- package/dist/src/{audio-Bn44pQxv.js → audio-COrn8rM6.js} +4 -4
- package/dist/src/{audio-DDA5WHdx.js → audio-DcVKoInv.js} +4 -4
- package/dist/src/{base-BboXIF_0.cjs → base-D-670DX8.cjs} +3 -3
- package/dist/src/{base-CqzQ4K8j.js → base-PYJvBE1i.js} +3 -3
- package/dist/src/{base-CKjwebIH.js → base-fZ9wgg50.js} +3 -3
- package/dist/src/{base-Cz2ZC_iA.js → base-yrI1Yal4.js} +3 -3
- package/dist/src/{blobs-BUWmKWzo.js → blobs-BCZavS8s.js} +4 -4
- package/dist/src/{blobs-B1JriOyi.js → blobs-BQWqnnvL.js} +4 -4
- package/dist/src/{blobs-DXTl6J3H.js → blobs-C-F78Kfn.js} +3 -3
- package/dist/src/{blobs-C6j0bvFz.cjs → blobs-D2FAd1Q5.cjs} +3 -3
- package/dist/src/cache-BIyPcp5v.cjs +376 -0
- package/dist/src/cache-C4Xb-hNb.js +310 -0
- package/dist/src/cache-Cr9oLMUa.js +3 -0
- package/dist/src/cache-D5NZmMiT.js +310 -0
- package/dist/src/cache-DbLsVWB2.cjs +3 -0
- package/dist/src/cache-mb7c8hbp.js +280 -0
- package/dist/src/{chat-DK1U-eZ-.js → chat-0bwXjVP0.js} +3 -13
- package/dist/src/{chat-BtIKkLKx.cjs → chat-BPXSW8Bv.cjs} +3 -13
- package/dist/src/{chat-B0iaWhoh.js → chat-BfPaS15_.js} +63 -37
- package/dist/src/{chat-CM8qWR3_.cjs → chat-CclRbxGf.cjs} +63 -37
- package/dist/src/{chat-BEwdgGEg.js → chat-Dr3DUQ0D.js} +63 -37
- package/dist/src/{chat-pxmiVpWe.js → chat-I9izLm49.js} +62 -36
- package/dist/src/{chat-B-52XYI1.js → chat-MKxMnZJZ.js} +3 -13
- package/dist/src/{chat-BE0qTA8e.js → chat-mW0ORo8G.js} +3 -14
- package/dist/src/{chatkit-Cx174XI3.cjs → chatkit-BoWoSgXl.cjs} +4 -4
- package/dist/src/{chatkit-BYGQlHlV.js → chatkit-CJnHRRMM.js} +4 -4
- package/dist/src/{chatkit-a2D6mY6s.js → chatkit-Cv6AhukM.js} +4 -4
- package/dist/src/{chatkit-_8eJqKcD.js → chatkit-zUIVoDos.js} +4 -4
- package/dist/src/{claude-agent-sdk-CMjh4LFH.js → claude-agent-sdk-BQNuLaAK.js} +19 -14
- package/dist/src/{claude-agent-sdk-8ddRp1L2.cjs → claude-agent-sdk-CPJo3dBQ.cjs} +21 -16
- package/dist/src/{claude-agent-sdk-HgbFioFw.js → claude-agent-sdk-Dtq_L-Sc.js} +20 -15
- package/dist/src/{claude-agent-sdk-Bq5EArsX.js → claude-agent-sdk-nfAIcxNf.js} +21 -17
- package/dist/src/{cloud-z8KZpUoa.js → cloud-DQZ5sVjW.js} +25 -13
- package/dist/src/cloud-Hphvo8kr.js +3 -0
- package/dist/src/{cloudflare-ai-Bbp26N0L.js → cloudflare-ai-BIB567w6.js} +5 -14
- package/dist/src/{cloudflare-ai-BGyXlpXJ.js → cloudflare-ai-DGLte7Py.js} +5 -14
- package/dist/src/{cloudflare-ai-C62x6MQG.cjs → cloudflare-ai-Dl3N9OVD.cjs} +6 -15
- package/dist/src/{cloudflare-ai-DdKP9TKT.js → cloudflare-ai-DlKr0rY7.js} +5 -15
- package/dist/src/{cloudflare-gateway-D-e9i1Sn.js → cloudflare-gateway-BDZrYydE.js} +4 -16
- package/dist/src/{cloudflare-gateway-Dx36ftqF.cjs → cloudflare-gateway-BYDp495F.cjs} +4 -15
- package/dist/src/{cloudflare-gateway-DXhtXDRb.js → cloudflare-gateway-CiIZHU0Q.js} +4 -15
- package/dist/src/{cloudflare-gateway-BwAaUgeW.js → cloudflare-gateway-DI1HNP5F.js} +4 -15
- package/dist/src/codex-sdk-BAmYE7qy.js +3 -0
- package/dist/src/codex-sdk-C2_M2pl_.cjs +1172 -0
- package/dist/src/codex-sdk-CErXn7qh.js +1165 -0
- package/dist/src/codex-sdk-CWEnH70W.cjs +2 -0
- package/dist/src/codex-sdk-CpqiOqDO.js +1164 -0
- package/dist/src/codex-sdk-Rtky3M4I.js +1165 -0
- package/dist/src/{cometapi-BDyV-NNm.js → cometapi-BUlt_ELa.js} +8 -15
- package/dist/src/{cometapi-hhL4TAh3.js → cometapi-CtJ-mS8R.js} +9 -15
- package/dist/src/{cometapi-sp7sJpBD.js → cometapi-DT-jlVCB.js} +8 -17
- package/dist/src/{cometapi-C3hOlM7-.cjs → cometapi-UVOryo4W.cjs} +9 -16
- package/dist/src/{completion-DlXUhj5c.cjs → completion-BozdoXba.cjs} +7 -62
- package/dist/src/{completion-BCimtq-h.js → completion-Dnxn7E-j.js} +8 -57
- package/dist/src/{completion-DCjv7RZ3.js → completion-HUe8wDhZ.js} +8 -57
- package/dist/src/{completion-DoYy49ti.js → completion-x0a_c2y1.js} +8 -57
- package/dist/src/{createHash-CTQmL3G2.js → createHash-4gFQpDDv.js} +3 -3
- package/dist/src/{createHash-BYwImsYv.cjs → createHash-B7KvgoOD.cjs} +4 -4
- package/dist/src/{createHash-Da8fMwqB.js → createHash-ChI45QR1.js} +3 -3
- package/dist/src/{createHash-DmPQkvBh.js → createHash-CwDVU5xr.js} +3 -3
- package/dist/src/{docker-FeBni2dw.js → docker-CQmlA2NU.js} +7 -14
- package/dist/src/{docker-CxCkwMzc.js → docker-ClnmCf1Z.js} +6 -14
- package/dist/src/{docker-DpguQj-w.js → docker-DCgsveLD.js} +6 -16
- package/dist/src/{docker-Cqj2-QVi.cjs → docker-DS4_Osau.cjs} +7 -15
- package/dist/src/embedding-D3xTseo7.js +59 -0
- package/dist/src/embedding-DD9wa3ae.js +58 -0
- package/dist/src/embedding-I45KG3o7.cjs +63 -0
- package/dist/src/embedding-nFbumxcv.js +58 -0
- package/dist/src/entrypoint.js +69 -6
- package/dist/src/{errors-P6ll7XSJ.js → errors-Cw810C93.js} +1 -1
- package/dist/src/{esm-SUNIX1x3.js → esm-C7PnfdF8.js} +15 -6
- package/dist/src/{esm-CipptfDu.cjs → esm-CtEPLdAj.cjs} +15 -6
- package/dist/src/{esm-CKWP3u_P.js → esm-Dh4dOLlt.js} +16 -7
- package/dist/src/{esm-7UIl0pPM.js → esm-tVgYPY-f.js} +27 -18
- package/dist/src/eval-CzJFfFO9.js +3 -0
- package/dist/src/{eval-BTqTn7lb.js → eval-u4UVafl6.js} +49 -20
- package/dist/src/{evalResult-BkIhRdTe.js → evalResult-Bgm9ZH31.js} +7 -7
- package/dist/src/{evalResult-DUDShQrm.js → evalResult-D3hVYFis.js} +7 -7
- package/dist/src/evalResult-D8MT9p0s.js +3 -0
- package/dist/src/evalResult-DElBuddX.js +2 -0
- package/dist/src/evalResult-Dvc-iucu.cjs +2 -0
- package/dist/src/{evalResult-DpARzUCb.cjs → evalResult-KZqXl4XP.cjs} +7 -7
- package/dist/src/evaluator-CVessDWe.js +3 -0
- package/dist/src/{evaluator-BcvOGaam.js → evaluator-IvuDYSvQ.js} +3178 -2102
- package/dist/src/{extractor-C8XwivI9.js → extractor-CAfTSraf.js} +6 -6
- package/dist/src/{extractor-CAZ2G3Kh.js → extractor-DNSeBVOJ.js} +6 -6
- package/dist/src/{extractor-D_wd8jxt.js → extractor-Dk6bRWkv.js} +6 -6
- package/dist/src/{extractor-DG3sSfXE.cjs → extractor-WVPOrH43.cjs} +6 -6
- package/dist/src/{fetch-BiYv2BZc.js → fetch-B0Z3Oe4k.js} +218 -55
- package/dist/src/{fetch-DoVRJZhJ.js → fetch-BEWnXrrG.js} +195 -45
- package/dist/src/fetch-C7bGKDlQ.js +3 -0
- package/dist/src/{fetch-BnR9wSnm.cjs → fetch-CJU5ELPa.cjs} +223 -48
- package/dist/src/{fetch-CVAtKnI3.js → fetch-Di00EQrc.js} +218 -55
- package/dist/src/{fileExtensions-Ds-foDzt.js → fileExtensions-AWa2ZML4.js} +1 -1
- package/dist/src/{fileExtensions-LcDYkU4v.js → fileExtensions-BArZuxsI.js} +1 -1
- package/dist/src/{formatDuration-DgBVMN65.js → formatDuration-DZzPsexs.js} +1 -1
- package/dist/src/{genaiTracer-70Z8BIuV.js → genaiTracer-COYDi-tC.js} +6 -2
- package/dist/src/{genaiTracer-C1rxGO8Q.js → genaiTracer-DWdZ28hY.js} +6 -2
- package/dist/src/{genaiTracer-D3fD9dNV.js → genaiTracer-XnrcgDCe.js} +6 -2
- package/dist/src/{genaiTracer-BfxrvSUb.cjs → genaiTracer-yRuxj9-L.cjs} +7 -3
- package/dist/src/golang/wrapper.go +1 -1
- package/dist/src/{graders-BElhu9ZY.cjs → graders--zknU_uk.cjs} +3772 -1302
- package/dist/src/graders-BOAzQEUe.cjs +2 -0
- package/dist/src/graders-D4BTsZdG2.js +3 -0
- package/dist/src/graders-DOJK1XpV.js +2 -0
- package/dist/src/graders-NAv9LcBn.js +2 -0
- package/dist/src/{graders-DG7mhg-b.js → graders-Zy3x0zqX.js} +5691 -3247
- package/dist/src/{graders-RjHF8VfG.js → graders-eIHhRqoC.js} +5683 -3239
- package/dist/src/{graders-BXAJ0sbS.js → graders-pvbReLLn.js} +5692 -3248
- package/dist/src/{image-6WQXK8m8.js → image-9302QVqR.js} +4 -4
- package/dist/src/{image-B8b6f36E.js → image-B5Mv-Z3h.js} +8 -8
- package/dist/src/{image-PoF6DN3x.js → image-DVz2RiMF.js} +8 -8
- package/dist/src/{image-fza3zuKs.cjs → image-De2FBmYV.cjs} +4 -4
- package/dist/src/{image-DO0RYnjH.js → image-dnoUgPrC.js} +4 -5
- package/dist/src/{image-CoxZp9PZ.js → image-qUpPvmNZ.js} +8 -8
- package/dist/src/{image-xNbw5ph2.js → image-u7-rKnYU.js} +4 -4
- package/dist/src/{image--F58eEIn.cjs → image-x6KqLQl4.cjs} +8 -8
- package/dist/src/index.cjs +3641 -2144
- package/dist/src/index.d.cts +2660 -20
- package/dist/src/index.d.ts +2660 -20
- package/dist/src/index.js +3649 -2152
- package/dist/src/{interactiveCheck-BnMYOjMu.js → interactiveCheck-CLERUB0c.js} +2 -2
- package/dist/src/{knowledgeBase-DqrLX8fy.cjs → knowledgeBase-Bpoe_nLu.cjs} +6 -8
- package/dist/src/{knowledgeBase-Bi7CmDbx.js → knowledgeBase-Dgc7CBWF.js} +6 -8
- package/dist/src/{knowledgeBase-DFRXPZl_.js → knowledgeBase-RhFPGWDc.js} +6 -8
- package/dist/src/{knowledgeBase-Ce3ofVan.js → knowledgeBase-lm9RXSAm.js} +6 -9
- package/dist/src/{litellm-CKiAxnoM.js → litellm-C2kqjxqp.js} +6 -14
- package/dist/src/{litellm-CnHI69aj.cjs → litellm-CoyI4IAl.cjs} +6 -15
- package/dist/src/{litellm-Tc294Jhj.js → litellm-DRjpcSa7.js} +5 -14
- package/dist/src/{litellm-Bo2gQXpo.js → litellm-p37R1dzQ.js} +5 -16
- package/dist/src/{logger-BnkjG2jt.js → logger-B88EkIn6.js} +40 -11
- package/dist/src/{logger-D5iKBpu_.cjs → logger-COuQb2xB.cjs} +51 -10
- package/dist/src/{logger-DO8_zM18.js → logger-Ct2S6Yx-.js} +40 -11
- package/dist/src/{logger-BcJBzSSA.js → logger-DksKw1Qc.js} +40 -11
- package/dist/src/{luma-ray-C9q8rdQe.js → luma-ray-B863CmuZ.js} +6 -10
- package/dist/src/{luma-ray-DP0QA9qn.js → luma-ray-BTTLtqQ8.js} +7 -10
- package/dist/src/{luma-ray-m9Ku2meV.cjs → luma-ray-BxVKaW2a.cjs} +6 -10
- package/dist/src/{luma-ray-0ehMPt5N.js → luma-ray-KgTCXrZC.js} +6 -12
- package/dist/src/main.d.ts +1 -26
- package/dist/src/main.js +985 -520
- package/dist/src/{messages-HJsyEh4o.cjs → messages-811uVVW5.cjs} +69 -19
- package/dist/src/{messages-Dy9QecMs.js → messages-BTQz42fn.js} +69 -19
- package/dist/src/{messages-biC_ex-p.js → messages-MYTQ2TWp.js} +69 -19
- package/dist/src/{messages-DJNo37Ko.js → messages-zWbkLLHz.js} +69 -19
- package/dist/src/{meteor-D-SotUw9.js → meteor-CU5UAE-H.js} +1 -1
- package/dist/src/{meteor-DLZZ3osF.cjs → meteor-Co1VQ1u5.cjs} +1 -1
- package/dist/src/{meteor-44VjEACX.js → meteor-DHdzY1Ss.js} +1 -1
- package/dist/src/{meteor-DUiCJRC-.js → meteor-DuAFv6gF.js} +1 -1
- package/dist/src/{modelslab-B5J-ZM5c.js → modelslab-D0erNWKe.js} +7 -10
- package/dist/src/{modelslab-BTOT8FUO.js → modelslab-DIq-6y7x.js} +7 -10
- package/dist/src/{modelslab-IQbNg-r7.cjs → modelslab-Dk1JAtVo.cjs} +7 -10
- package/dist/src/{modelslab-BI458moT.js → modelslab-wu9yi5GE.js} +7 -11
- package/dist/src/{nova-reel-BZ9y-Y5s.js → nova-reel-CCFRfeRb.js} +7 -10
- package/dist/src/{nova-reel-CE5etkv9.cjs → nova-reel-CrLXVKQf.cjs} +6 -10
- package/dist/src/{nova-reel-Xw1SXLpg.js → nova-reel-DQrm74ng.js} +6 -10
- package/dist/src/{nova-reel-DEeQlnOJ.js → nova-reel-gr11WG7f.js} +6 -12
- package/dist/src/{nova-sonic-Ogqf-csn.js → nova-sonic-BYdp-QLs.js} +5 -7
- package/dist/src/{nova-sonic-DXTLpi-r.js → nova-sonic-B_ZXcUJB.js} +4 -7
- package/dist/src/{nova-sonic-DWswpN1E.js → nova-sonic-TDgrlTk7.js} +4 -9
- package/dist/src/{nova-sonic-N0yCm0vb.cjs → nova-sonic-i5tUvXKn.cjs} +4 -7
- package/dist/src/{openai-BcB5KlTk.js → openai-DhVEmgeZ.js} +6 -3
- package/dist/src/{openai-BMcwgD5C.js → openai-Qsvz25mV.js} +6 -3
- package/dist/src/{openai-CoxGAQwn.cjs → openai-URNyItar.cjs} +6 -3
- package/dist/src/{openai-D6wITiVn.js → openai-iYtrXzOX.js} +6 -3
- package/dist/src/openclaw-CLWrW03k.js +1200 -0
- package/dist/src/openclaw-CnQ363Wi.js +1199 -0
- package/dist/src/openclaw-CwzlQSQX.js +1199 -0
- package/dist/src/openclaw-wX9rtfke.cjs +1205 -0
- package/dist/src/{opencode-sdk-CHCs7dEb.js → opencode-sdk-BUu5Nevv.js} +6 -8
- package/dist/src/{opencode-sdk-WWJhnbKr.cjs → opencode-sdk-BZ2idgYA.cjs} +6 -8
- package/dist/src/{opencode-sdk-DDxj4QqH.js → opencode-sdk-BxD8vXp_.js} +7 -8
- package/dist/src/{opencode-sdk-C71Z0ehR.js → opencode-sdk-GI2KaAXq.js} +6 -10
- package/dist/src/{otlpReceiver-CZL48YfC.js → otlpReceiver-B2z58l4e.js} +154 -98
- package/dist/src/{otlpReceiver-DHKqJlsz.cjs → otlpReceiver-BfcVq2Nq.cjs} +154 -98
- package/dist/src/{otlpReceiver-CavGAA6k.js → otlpReceiver-BntK801g.js} +154 -98
- package/dist/src/{otlpReceiver-C9KlUtxh.js → otlpReceiver-DmVulbhC.js} +154 -98
- package/dist/src/{providerRegistry-BkzVH5Ba.js → providerRegistry-Bvh8mv85.js} +2 -2
- package/dist/src/{providerRegistry-CUWki5mQ.js → providerRegistry-CPQ_CmVO.js} +2 -2
- package/dist/src/{providerRegistry-BTDgfV5h.cjs → providerRegistry-CQMdTmHP.cjs} +2 -2
- package/dist/src/{providerRegistry-B9lh-_tx.js → providerRegistry-CWoPjKFZ.js} +2 -2
- package/dist/src/{providers-CScd1wN6.cjs → providers-1eKkXBKp.cjs} +792 -556
- package/dist/src/{providers-Ch6Mr0gn.js → providers-BV_KMZje.js} +699 -493
- package/dist/src/providers-Bp4S-FvO.js +2 -0
- package/dist/src/providers-DV3ax9e_.cjs +3 -0
- package/dist/src/{providers-DvddrgxL.js → providers-Domz_llv.js} +707 -501
- package/dist/src/{providers-Cn73d5sr.js → providers-DruaQfwu.js} +704 -498
- package/dist/src/providers-iUt5fbAN.js +3 -0
- package/dist/src/providers-u9Enmfok.js +2 -0
- package/dist/src/python/persistent_wrapper.py +0 -5
- package/dist/src/{pythonUtils-Cpo0Ez1p.js → pythonUtils-C2UQ30Rz.js} +3 -3
- package/dist/src/{pythonUtils-Bzwbgpbg.js → pythonUtils-Cldx7huE.js} +3 -3
- package/dist/src/{pythonUtils-wIqk7zAf.js → pythonUtils-CnndUbW-.js} +3 -3
- package/dist/src/{pythonUtils-dAVigVK-.cjs → pythonUtils-tAJvvpS-.cjs} +3 -3
- package/dist/src/{quiverai-BeofbLVc.js → quiverai-CtWi6x_g.js} +4 -4
- package/dist/src/{quiverai-CcUhPIBg.cjs → quiverai-DFotyafY.cjs} +4 -4
- package/dist/src/{quiverai-DVSEqJiq.js → quiverai-DR0SnIQV.js} +4 -4
- package/dist/src/{quiverai-CCQn73lq.js → quiverai-aPPvXOgn.js} +4 -5
- package/dist/src/render-CH-62LbA.js +135 -0
- package/dist/src/render-CMEpfLaO.js +136 -0
- package/dist/src/{render-BHl6QVq9.js → render-CgVDrJmM.js} +2 -3
- package/dist/src/render-DHIZ6_k8.js +135 -0
- package/dist/src/render-DfQSFxGE.cjs +165 -0
- package/dist/src/{responses-CQb1Tj69.js → responses--OsX2aYW.js} +17 -12
- package/dist/src/{responses-mo0KQDbu.cjs → responses-Bi9vBuW_.cjs} +18 -13
- package/dist/src/{responses-CgNyTPsY.js → responses-C-flexAY.js} +18 -13
- package/dist/src/{responses-BKP_WYis.js → responses-DL9m8CyY.js} +18 -13
- package/dist/src/{rubyUtils-CGeUtCfW.cjs → rubyUtils-B6eljPuh.cjs} +3 -3
- package/dist/src/{rubyUtils-DECSbsfY.js → rubyUtils-CYSQEG4a.js} +3 -3
- package/dist/src/rubyUtils-D1L2d3jb.js +3 -0
- package/dist/src/rubyUtils-DUbq4tff.cjs +2 -0
- package/dist/src/{rubyUtils-PgU-gHmx.js → rubyUtils-DVLeA2jg.js} +3 -3
- package/dist/src/{rubyUtils-CiVfln3g.js → rubyUtils-DsGrTx8R.js} +3 -3
- package/dist/src/{sagemaker-CqeASYE5.js → sagemaker-BVkaG2-l.js} +14 -18
- package/dist/src/{sagemaker-CVv8W7so.js → sagemaker-BveBvuxm.js} +14 -18
- package/dist/src/{sagemaker-MUbD5V3v.js → sagemaker-D67yzMzs.js} +14 -19
- package/dist/src/{sagemaker-jiw1wQa-.cjs → sagemaker-XnfhheQv.cjs} +14 -18
- package/dist/src/{scanner-DVDeUz1r.js → scanner-1DqWi1Ej.js} +130 -35
- package/dist/src/server/golang/wrapper.go +1 -1
- package/dist/src/server/index.js +3596 -2098
- package/dist/src/server/python/persistent_wrapper.py +0 -5
- package/dist/src/{server-DZ9MtCn0.js → server-BNYztJkh.js} +128 -9
- package/dist/src/{server-Cns05F1j.js → server-BSB45Nt9.js} +127 -8
- package/dist/src/{server-CP9qKM40.js → server-D6Il2Sob.js} +126 -7
- package/dist/src/server-DCtHUqlp.js +3 -0
- package/dist/src/server-DaA2eR26.cjs +2 -0
- package/dist/src/{server-BtoCXeXI.cjs → server-Dx2TyCH2.cjs} +140 -6
- package/dist/src/{signal-C3ZTsUgi.js → signal-CE5G3a7x.js} +3 -3
- package/dist/src/{slack-94iG3T0s.cjs → slack-1Rhq0EoV.cjs} +2 -2
- package/dist/src/{slack-BR0HtO3K.js → slack-D5Wpy8LM.js} +2 -2
- package/dist/src/{slack-DCEV-vWP.js → slack-DDUe-5MC.js} +2 -2
- package/dist/src/{slack-2sdpGzbt.js → slack-acRb0IqQ.js} +2 -2
- package/dist/src/store-CWOSz6D_.cjs +2 -0
- package/dist/src/{store-P8OKm19S.js → store-CYEy5J2D.js} +3 -3
- package/dist/src/{store-CLyU7AtI.cjs → store-DAAyxcy6.cjs} +3 -3
- package/dist/src/store-DCDBhv7B.js +3 -0
- package/dist/src/{store-VB0GP46K.js → store-Dn9HUkdW.js} +3 -3
- package/dist/src/{store-Cj258DgL.js → store-M0b1WfYb.js} +3 -3
- package/dist/src/{tables-DmzvLbeZ.js → tables-C4CH3zRr.js} +3 -3
- package/dist/src/{tables-BEIFz2tM.js → tables-CsWou1Bx.js} +3 -3
- package/dist/src/{tables-kC7R5kiK.js → tables-DQ4WU5tX.js} +3 -3
- package/dist/src/{tables-BdZQEpRz.cjs → tables-DUfh1F7Z.cjs} +3 -3
- package/dist/src/telemetry-C1IqxcdW.js +3 -0
- package/dist/src/telemetry-C4ZEa_es.cjs +2 -0
- package/dist/src/{telemetry-BnH5VJAU.js → telemetry-CQPez_Jp.js} +4 -4
- package/dist/src/{telemetry-re627Lre.cjs → telemetry-Dsw_faFj.cjs} +4 -4
- package/dist/src/{telemetry-BugWqKiu.js → telemetry-Dvqxv3YC.js} +4 -4
- package/dist/src/{telemetry-DPXLd7UE.js → telemetry-dbaJ0E98.js} +4 -4
- package/dist/src/{text-CW1cyrwj.cjs → text-BVi-cLPJ.cjs} +1 -1
- package/dist/src/{text-B_UCRPp2.js → text-CZr46tp_.js} +1 -1
- package/dist/src/{text-TIv0QYnd.js → text-DHxdyQqT.js} +1 -1
- package/dist/src/{text-Db-Wt2u2.js → text-KvuD2Iko.js} +1 -1
- package/dist/src/{tokenUsageUtils-bVa1ga6f.cjs → tokenUsageUtils-Bb7DkZPz.cjs} +7 -3
- package/dist/src/{tokenUsageUtils-BDGe-iyI.js → tokenUsageUtils-C-bmyHoE.js} +7 -3
- package/dist/src/{tokenUsageUtils-DflFMjS0.js → tokenUsageUtils-CXrvO-wA.js} +7 -3
- package/dist/src/{transcription-BvtsrzRG.cjs → transcription-BvjmiYB1.cjs} +9 -13
- package/dist/src/{transcription-Hb3VnC4M.js → transcription-CJspiD2c.js} +8 -11
- package/dist/src/{transcription-CaMivnjG.js → transcription-DuWDupG7.js} +7 -11
- package/dist/src/{transcription-DOMMTu01.js → transcription-V2HaAmy2.js} +7 -13
- package/dist/src/{transform-BqPkNPYm.js → transform-Bbg6A8Jk.js} +4 -4
- package/dist/src/{transform-DrleutM3.js → transform-CG0ehZNG.js} +9 -8
- package/dist/src/{transform-0BwoBsvO.cjs → transform-CTeuTR3S.cjs} +16 -8
- package/dist/src/{transform-ZrG2dvlo.cjs → transform-CUnzlsbn.cjs} +4 -4
- package/dist/src/{transform-BzK09Q_9.js → transform-DYX1_Xnh.js} +5 -5
- package/dist/src/transform-DgKlRr73.cjs +2 -0
- package/dist/src/transform-M6ITAESf.js +3 -0
- package/dist/src/{transform-ljLYHEPh.js → transform-UN5UGu8U.js} +5 -5
- package/dist/src/{transform-B2-jIv68.js → transform-lQrDE1BQ.js} +8 -6
- package/dist/src/{transform-DyDAwEpE.js → transform-zDhMmzwX.js} +10 -7
- package/dist/src/{transformersAvailability-BGkzavwb.js → transformersAvailability-CcHusyhw.js} +1 -1
- package/dist/src/{transformersAvailability-DKoRtQLy.cjs → transformersAvailability-Cju9mHgR.cjs} +1 -1
- package/dist/src/{transformersAvailability-D6c6ROpT.js → transformersAvailability-DLlROWhg.js} +1 -1
- package/dist/src/{types-q8GXGF65.js → types-BGQDAP8i.js} +351 -22
- package/dist/src/{types-Cd3ygw8W.js → types-Bgh5SOn6.js} +352 -24
- package/dist/src/{types-D8cGDZbL.cjs → types-CeaeaZdP.cjs} +387 -22
- package/dist/src/{types-CIhFeUC4.js → types-Dm9JM6Vb.js} +362 -23
- package/dist/src/{util-vNmDL5DT.js → util-BYvQUPp7.js} +138 -36
- package/dist/src/{util-CuLo2pMR.cjs → util-Bxn8emtE.cjs} +14 -167
- package/dist/src/{util-BLvy9qfE.js → util-C8e5uydV.js} +18 -141
- package/dist/src/{util-DM2rTn_6.js → util-C9J8ahRn.js} +4 -4
- package/dist/src/{util-CFj4YKIn.cjs → util-CN3SrLT4.cjs} +4 -4
- package/dist/src/{util-BtoGs5Cb.js → util-D3q0WQ-0.js} +4 -4
- package/dist/src/{util-CgDCK4KI.js → util-D9TisOyk.js} +4 -4
- package/dist/src/{util-DMFeUvLz.js → util-DDs-7g6-.js} +138 -36
- package/dist/src/{util-DbVG-yZU.js → util-DvU2Pw8c.js} +138 -36
- package/dist/src/{util-Bm3E9jpK.js → util-DxWpWjhc.js} +12 -135
- package/dist/src/{util-CMMkIxfU.js → util-oGMLA7vc.js} +16 -139
- package/dist/src/{util--9u9UVCt.cjs → util-olYL5C6N.cjs} +143 -35
- package/dist/src/{utils-DKw8mrgr.cjs → utils-B05gLxER.cjs} +6 -4
- package/dist/src/{utils-DEuL4VNB.js → utils-BLJKfv0y.js} +6 -4
- package/dist/src/{utils-DOjD4dTC.js → utils-DJfvjyMj.js} +6 -4
- package/dist/src/{utils-CFxO9KGo.js → utils-hXtCYanr.js} +6 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +51 -42
- package/dist/src/app/assets/index-B6l9CVVb.js +0 -439
- package/dist/src/app/assets/index-DyZ0Ep37.css +0 -1
- package/dist/src/app/assets/scroll-timeline-BdJZVXlz.js +0 -1
- package/dist/src/app/assets/sync-CStkzc6u.js +0 -4
- package/dist/src/app/assets/vendor-charts-BnDWwBlI.js +0 -36
- package/dist/src/app/assets/vendor-markdown-Bz7N-ca6.js +0 -29
- package/dist/src/app/assets/vendor-react-AtKqiNEf.js +0 -4
- package/dist/src/app/assets/vendor-syntax-D06x6TQF.js +0 -2
- package/dist/src/app/assets/vendor-utils-BvMHZmO7.js +0 -37
- package/dist/src/cache-C5yFZ4gC.cjs +0 -816
- package/dist/src/cache-CaT5tPgo.js +0 -756
- package/dist/src/cache-CyCanoMu.js +0 -6
- package/dist/src/cache-DSqR6ezl.js +0 -726
- package/dist/src/cache-Df_QFDNu.cjs +0 -5
- package/dist/src/cache-HP0NP4k3.js +0 -756
- package/dist/src/cloud-DE3t1-ZI.js +0 -4
- package/dist/src/codex-sdk-BQEw16R_.js +0 -834
- package/dist/src/codex-sdk-C_07GuVS.js +0 -834
- package/dist/src/codex-sdk-DE5G18dx.js +0 -835
- package/dist/src/codex-sdk-ZLKfDjqP.cjs +0 -838
- package/dist/src/eval-7aEqoMs3.js +0 -15
- package/dist/src/evalResult-CYNHkk5A.js +0 -12
- package/dist/src/evalResult-CuvJeNiM.js +0 -10
- package/dist/src/evalResult-tGdilrWt.cjs +0 -10
- package/dist/src/evaluator-BBUqRhz1.js +0 -36
- package/dist/src/fetch-UWU706qb.js +0 -5
- package/dist/src/graders-BxfEguVY.js +0 -32
- package/dist/src/graders-CzVMbEnv.js +0 -34
- package/dist/src/graders-DjCXfj0l.cjs +0 -32
- package/dist/src/graders-kHzIWOKu.js +0 -32
- package/dist/src/openclaw-0Sv7AK3O.js +0 -580
- package/dist/src/openclaw-CXxbKgDH.cjs +0 -586
- package/dist/src/openclaw-D1FSCps-.js +0 -580
- package/dist/src/openclaw-D2ENvu7a.js +0 -582
- package/dist/src/providers-BSLEaIQG.js +0 -32
- package/dist/src/providers-D-FnDg8k.cjs +0 -31
- package/dist/src/providers-DEYiFVAo.js +0 -30
- package/dist/src/providers-sS2WI8YD.js +0 -30
- package/dist/src/rubyUtils-B1HXG4ej.cjs +0 -4
- package/dist/src/rubyUtils-Rt6pKA96.js +0 -5
- package/dist/src/server-B0Xh1Gx-.js +0 -7
- package/dist/src/server-DJTKu9IR.cjs +0 -5
- package/dist/src/store-C5u6MgC8.js +0 -6
- package/dist/src/store-CNHk-De4.cjs +0 -5
- package/dist/src/telemetry-Yig0Tino.js +0 -7
- package/dist/src/telemetry-p8Pwqm1i.cjs +0 -5
- package/dist/src/tokenUsageUtils-NYT-WKS6.js +0 -138
- package/dist/src/transform-ChNIpHz7.js +0 -6
- package/dist/src/transform-PtQ6rAE3.cjs +0 -5
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { g as calculateCost } from "./fetch-Di00EQrc.js";
|
|
2
|
+
import { w as parseDataUrl } from "./transform-CG0ehZNG.js";
|
|
3
3
|
//#region src/providers/anthropic/util.ts
|
|
4
4
|
const ANTHROPIC_MODELS = [
|
|
5
|
+
...["claude-mythos-preview"].map((model) => ({
|
|
6
|
+
id: model,
|
|
7
|
+
cost: {
|
|
8
|
+
input: 25 / 1e6,
|
|
9
|
+
output: 125 / 1e6
|
|
10
|
+
}
|
|
11
|
+
})),
|
|
5
12
|
...["claude-sonnet-4-6", "claude-sonnet-4-6-latest"].map((model) => ({
|
|
6
13
|
id: model,
|
|
7
14
|
cost: {
|
|
@@ -16,7 +23,11 @@ const ANTHROPIC_MODELS = [
|
|
|
16
23
|
output: 25 / 1e6
|
|
17
24
|
}
|
|
18
25
|
})),
|
|
19
|
-
...[
|
|
26
|
+
...[
|
|
27
|
+
"claude-opus-4-5",
|
|
28
|
+
"claude-opus-4-5-20251101",
|
|
29
|
+
"claude-opus-4-5-latest"
|
|
30
|
+
].map((model) => ({
|
|
20
31
|
id: model,
|
|
21
32
|
cost: {
|
|
22
33
|
input: 5 / 1e6,
|
|
@@ -24,6 +35,7 @@ const ANTHROPIC_MODELS = [
|
|
|
24
35
|
}
|
|
25
36
|
})),
|
|
26
37
|
...[
|
|
38
|
+
"claude-opus-4-1",
|
|
27
39
|
"claude-opus-4-1-20250805",
|
|
28
40
|
"claude-opus-4-20250514",
|
|
29
41
|
"claude-opus-4-0",
|
|
@@ -36,6 +48,7 @@ const ANTHROPIC_MODELS = [
|
|
|
36
48
|
}
|
|
37
49
|
})),
|
|
38
50
|
...[
|
|
51
|
+
"claude-sonnet-4-5",
|
|
39
52
|
"claude-sonnet-4-5-20250929",
|
|
40
53
|
"claude-sonnet-4-5-latest",
|
|
41
54
|
"claude-sonnet-4-20250514",
|
|
@@ -48,7 +61,11 @@ const ANTHROPIC_MODELS = [
|
|
|
48
61
|
output: 15 / 1e6
|
|
49
62
|
}
|
|
50
63
|
})),
|
|
51
|
-
...[
|
|
64
|
+
...[
|
|
65
|
+
"claude-haiku-4-5",
|
|
66
|
+
"claude-haiku-4-5-20251001",
|
|
67
|
+
"claude-haiku-4-5-latest"
|
|
68
|
+
].map((model) => ({
|
|
52
69
|
id: model,
|
|
53
70
|
cost: {
|
|
54
71
|
input: 1 / 1e6,
|
|
@@ -209,31 +226,72 @@ function parseMessages(messages) {
|
|
|
209
226
|
thinking
|
|
210
227
|
};
|
|
211
228
|
}
|
|
212
|
-
|
|
229
|
+
/**
|
|
230
|
+
* Compute input cost with Anthropic cache pricing applied.
|
|
231
|
+
* Anthropic docs: input_tokens is the non-cached portion; cache_read and cache_creation are additive.
|
|
232
|
+
* Cache reads cost 10% of base rate (90% discount), cache writes cost 125% of base rate (25% surcharge).
|
|
233
|
+
*/
|
|
234
|
+
function calculateCacheInputCost(baseInputRate, uncachedInputTokens, cacheRead, cacheCreation) {
|
|
235
|
+
return uncachedInputTokens * baseInputRate + cacheRead * baseInputRate * .1 + cacheCreation * baseInputRate * 1.25;
|
|
236
|
+
}
|
|
237
|
+
function calculateAnthropicCost(modelName, config, promptTokens, completionTokens, cacheReadTokens, cacheCreationTokens) {
|
|
238
|
+
if (config.cost != null) return calculateCost(modelName, config, promptTokens, completionTokens, ANTHROPIC_MODELS);
|
|
239
|
+
if (!Number.isFinite(promptTokens) || !Number.isFinite(completionTokens) || typeof promptTokens === "undefined" || typeof completionTokens === "undefined") return calculateCost(modelName, config, promptTokens, completionTokens, ANTHROPIC_MODELS);
|
|
240
|
+
const cacheRead = cacheReadTokens ?? 0;
|
|
241
|
+
const cacheCreation = cacheCreationTokens ?? 0;
|
|
242
|
+
const effectiveInputTokens = promptTokens + cacheRead + cacheCreation;
|
|
213
243
|
if ([
|
|
244
|
+
"claude-sonnet-4-5",
|
|
214
245
|
"claude-sonnet-4-5-20250929",
|
|
215
246
|
"claude-sonnet-4-5-latest",
|
|
216
247
|
"claude-sonnet-4-6",
|
|
217
248
|
"claude-sonnet-4-6-latest"
|
|
218
|
-
].includes(modelName)
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
|
|
249
|
+
].includes(modelName)) {
|
|
250
|
+
const isLongContext = effectiveInputTokens > 2e5;
|
|
251
|
+
const baseInputRate = isLongContext ? 6 / 1e6 : 3 / 1e6;
|
|
252
|
+
const outputRate = isLongContext ? 22.5 / 1e6 : 15 / 1e6;
|
|
253
|
+
return calculateCacheInputCost(baseInputRate, promptTokens, cacheRead, cacheCreation) + completionTokens * outputRate;
|
|
254
|
+
}
|
|
255
|
+
if (cacheRead || cacheCreation) {
|
|
256
|
+
const modelInfo = ANTHROPIC_MODELS.find((m) => m.id === modelName);
|
|
257
|
+
if (modelInfo) return calculateCacheInputCost(modelInfo.cost.input, promptTokens, cacheRead, cacheCreation) + completionTokens * modelInfo.cost.output;
|
|
222
258
|
}
|
|
223
259
|
return calculateCost(modelName, config, promptTokens, completionTokens, ANTHROPIC_MODELS);
|
|
224
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Extract refusal details from the Anthropic stop_details field.
|
|
263
|
+
* Returns a human-readable string if the response was refused, or undefined otherwise.
|
|
264
|
+
*/
|
|
265
|
+
function getRefusalDetails(data) {
|
|
266
|
+
if (data.stop_reason !== "refusal" || !data.stop_details) return;
|
|
267
|
+
const details = data.stop_details;
|
|
268
|
+
const parts = ["Content refused by Anthropic safety filters"];
|
|
269
|
+
if (details.category) parts.push(`category: ${details.category}`);
|
|
270
|
+
if (details.explanation) parts.push(`explanation: ${details.explanation}`);
|
|
271
|
+
return parts.join(" — ");
|
|
272
|
+
}
|
|
225
273
|
function getTokenUsage(data, cached) {
|
|
226
274
|
if (data.usage) {
|
|
227
|
-
const
|
|
275
|
+
const cacheRead = data.usage.cache_read_input_tokens ?? 0;
|
|
276
|
+
const cacheCreation = data.usage.cache_creation_input_tokens ?? 0;
|
|
277
|
+
const allInputTokens = (data.usage.input_tokens ?? 0) + cacheRead + cacheCreation;
|
|
278
|
+
const total_tokens = allInputTokens + (data.usage.output_tokens ?? 0);
|
|
228
279
|
if (cached) return {
|
|
229
280
|
cached: total_tokens,
|
|
230
281
|
total: total_tokens
|
|
231
282
|
};
|
|
232
|
-
else
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
283
|
+
else {
|
|
284
|
+
const usage = {
|
|
285
|
+
total: total_tokens,
|
|
286
|
+
prompt: allInputTokens,
|
|
287
|
+
completion: data.usage.output_tokens ?? 0
|
|
288
|
+
};
|
|
289
|
+
if (data.usage.cache_read_input_tokens != null || data.usage.cache_creation_input_tokens != null) usage.completionDetails = {
|
|
290
|
+
cacheReadInputTokens: cacheRead,
|
|
291
|
+
cacheCreationInputTokens: cacheCreation
|
|
292
|
+
};
|
|
293
|
+
return usage;
|
|
294
|
+
}
|
|
237
295
|
}
|
|
238
296
|
return {};
|
|
239
297
|
}
|
|
@@ -243,16 +301,20 @@ function getTokenUsage(data, cached) {
|
|
|
243
301
|
function processAnthropicTools(tools = []) {
|
|
244
302
|
const processedTools = [];
|
|
245
303
|
const requiredBetaFeatures = [];
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
304
|
+
const addRequiredBetaFeature = (feature) => {
|
|
305
|
+
if (!requiredBetaFeatures.includes(feature)) requiredBetaFeatures.push(feature);
|
|
306
|
+
};
|
|
307
|
+
for (const tool of tools) {
|
|
308
|
+
if ("type" in tool) if (tool.type === "web_fetch_20250910") {
|
|
309
|
+
processedTools.push(transformWebFetchTool(tool));
|
|
310
|
+
addRequiredBetaFeature("web-fetch-2025-09-10");
|
|
311
|
+
} else if (tool.type === "web_fetch_20260209") processedTools.push(transformWebFetchTool20260209(tool));
|
|
312
|
+
else if (tool.type === "web_fetch_20260309") processedTools.push(transformWebFetchToolV2(tool));
|
|
313
|
+
else if (tool.type === "web_search_20250305") processedTools.push(transformWebSearchTool(tool));
|
|
314
|
+
else if (tool.type === "web_search_20260209") processedTools.push(transformWebSearchTool20260209(tool));
|
|
315
|
+
else processedTools.push(tool);
|
|
316
|
+
else processedTools.push(tool);
|
|
317
|
+
if ("strict" in tool && tool.strict === true) addRequiredBetaFeature("structured-outputs-2025-11-13");
|
|
256
318
|
}
|
|
257
319
|
return {
|
|
258
320
|
processedTools,
|
|
@@ -260,21 +322,54 @@ function processAnthropicTools(tools = []) {
|
|
|
260
322
|
};
|
|
261
323
|
}
|
|
262
324
|
/**
|
|
263
|
-
*
|
|
325
|
+
* Apply shared web fetch tool fields from config onto the SDK tool object.
|
|
264
326
|
*/
|
|
327
|
+
function applyWebFetchFields(tool, config) {
|
|
328
|
+
if (config.allowed_callers !== void 0) tool.allowed_callers = config.allowed_callers;
|
|
329
|
+
if (config.max_uses !== void 0) tool.max_uses = config.max_uses;
|
|
330
|
+
if (config.allowed_domains !== void 0) tool.allowed_domains = config.allowed_domains;
|
|
331
|
+
if (config.blocked_domains !== void 0) tool.blocked_domains = config.blocked_domains;
|
|
332
|
+
if (config.citations !== void 0) tool.citations = config.citations;
|
|
333
|
+
if (config.max_content_tokens !== void 0) tool.max_content_tokens = config.max_content_tokens;
|
|
334
|
+
if (config.cache_control !== void 0) tool.cache_control = config.cache_control;
|
|
335
|
+
if (config.defer_loading !== void 0) tool.defer_loading = config.defer_loading;
|
|
336
|
+
if (config.strict !== void 0) tool.strict = config.strict;
|
|
337
|
+
}
|
|
265
338
|
function transformWebFetchTool(config) {
|
|
266
339
|
const tool = {
|
|
267
340
|
type: "web_fetch_20250910",
|
|
268
341
|
name: "web_fetch"
|
|
269
342
|
};
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
343
|
+
applyWebFetchFields(tool, config);
|
|
344
|
+
return tool;
|
|
345
|
+
}
|
|
346
|
+
function transformWebFetchTool20260209(config) {
|
|
347
|
+
const tool = {
|
|
348
|
+
type: "web_fetch_20260209",
|
|
349
|
+
name: "web_fetch"
|
|
350
|
+
};
|
|
351
|
+
applyWebFetchFields(tool, config);
|
|
352
|
+
return tool;
|
|
353
|
+
}
|
|
354
|
+
function transformWebFetchToolV2(config) {
|
|
355
|
+
const tool = {
|
|
356
|
+
type: "web_fetch_20260309",
|
|
357
|
+
name: "web_fetch"
|
|
358
|
+
};
|
|
359
|
+
applyWebFetchFields(tool, config);
|
|
360
|
+
if (config.use_cache !== void 0) tool.use_cache = config.use_cache;
|
|
276
361
|
return tool;
|
|
277
362
|
}
|
|
363
|
+
function applyWebSearchFields(tool, config) {
|
|
364
|
+
if (config.allowed_callers !== void 0) tool.allowed_callers = config.allowed_callers;
|
|
365
|
+
if (config.allowed_domains !== void 0) tool.allowed_domains = config.allowed_domains;
|
|
366
|
+
if (config.blocked_domains !== void 0) tool.blocked_domains = config.blocked_domains;
|
|
367
|
+
if (config.cache_control !== void 0) tool.cache_control = config.cache_control;
|
|
368
|
+
if (config.defer_loading !== void 0) tool.defer_loading = config.defer_loading;
|
|
369
|
+
if (config.max_uses !== void 0) tool.max_uses = config.max_uses;
|
|
370
|
+
if (config.strict !== void 0) tool.strict = config.strict;
|
|
371
|
+
if (config.user_location !== void 0) tool.user_location = config.user_location;
|
|
372
|
+
}
|
|
278
373
|
/**
|
|
279
374
|
* Transform web search tool config to Anthropic beta tool format
|
|
280
375
|
*/
|
|
@@ -283,11 +378,18 @@ function transformWebSearchTool(config) {
|
|
|
283
378
|
type: "web_search_20250305",
|
|
284
379
|
name: "web_search"
|
|
285
380
|
};
|
|
286
|
-
|
|
287
|
-
|
|
381
|
+
applyWebSearchFields(tool, config);
|
|
382
|
+
return tool;
|
|
383
|
+
}
|
|
384
|
+
function transformWebSearchTool20260209(config) {
|
|
385
|
+
const tool = {
|
|
386
|
+
type: "web_search_20260209",
|
|
387
|
+
name: "web_search"
|
|
388
|
+
};
|
|
389
|
+
applyWebSearchFields(tool, config);
|
|
288
390
|
return tool;
|
|
289
391
|
}
|
|
290
392
|
//#endregion
|
|
291
|
-
export {
|
|
393
|
+
export { outputFromMessage as a, getTokenUsage as i, calculateAnthropicCost as n, parseMessages as o, getRefusalDetails as r, processAnthropicTools as s, ANTHROPIC_MODELS as t };
|
|
292
394
|
|
|
293
|
-
//# sourceMappingURL=util-
|
|
395
|
+
//# sourceMappingURL=util-DvU2Pw8c.js.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { N as state, T as getEnvBool, m as sanitizeObject, s as logger } from "./logger-DksKw1Qc.js";
|
|
3
|
+
import { F as VERSION, k as TERMINAL_MAX_WIDTH, n as fetchWithProxy } from "./fetch-BEWnXrrG.js";
|
|
4
4
|
import { t as invariant } from "./invariant-BtWWVVhl.js";
|
|
5
|
-
import { m as isProviderOptions, o as OutputFileExtension, p as isApiProvider, s as ResultFailureReason } from "./types-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { m as isProviderOptions, o as OutputFileExtension, p as isApiProvider, s as ResultFailureReason } from "./types-Dm9JM6Vb.js";
|
|
6
|
+
import { o as safeResolve, r as importModule, t as getDirectory } from "./esm-tVgYPY-f.js";
|
|
7
|
+
import { a as getNunjucksEngine, n as renderVarsInObject } from "./render-CMEpfLaO.js";
|
|
8
|
+
import { i as isJavascriptFile, t as JAVASCRIPT_EXTENSIONS } from "./fileExtensions-AWa2ZML4.js";
|
|
9
|
+
import { r as runPython } from "./pythonUtils-CnndUbW-.js";
|
|
9
10
|
import dotenv from "dotenv";
|
|
10
11
|
import * as fs$2 from "fs";
|
|
11
12
|
import * as path$1 from "path";
|
|
@@ -14,10 +15,10 @@ import * as os$1 from "os";
|
|
|
14
15
|
import yaml from "js-yaml";
|
|
15
16
|
import * as fsPromises from "fs/promises";
|
|
16
17
|
import dedent from "dedent";
|
|
18
|
+
import nunjucks from "nunjucks";
|
|
17
19
|
import deepEqual from "fast-deep-equal";
|
|
18
20
|
import { parse as parse$1 } from "csv-parse/sync";
|
|
19
21
|
import { globSync, hasMagic } from "glob";
|
|
20
|
-
import nunjucks from "nunjucks";
|
|
21
22
|
import { XMLBuilder } from "fast-xml-parser";
|
|
22
23
|
import { stringify } from "csv-stringify/sync";
|
|
23
24
|
//#region src/util/provider.ts
|
|
@@ -371,130 +372,6 @@ function parseFileUrl(fileUrl) {
|
|
|
371
372
|
return { filePath: urlWithoutProtocol };
|
|
372
373
|
}
|
|
373
374
|
//#endregion
|
|
374
|
-
//#region src/util/templates.ts
|
|
375
|
-
/**
|
|
376
|
-
* Get a Nunjucks engine instance with optional filters and configuration.
|
|
377
|
-
* @param filters - Optional map of custom Nunjucks filters.
|
|
378
|
-
* @param throwOnUndefined - Whether to throw an error on undefined variables.
|
|
379
|
-
* @param isGrader - Whether this engine is being used in a grader context.
|
|
380
|
-
* Nunjucks is always enabled in grader mode.
|
|
381
|
-
* @returns A configured Nunjucks environment.
|
|
382
|
-
*/
|
|
383
|
-
function getNunjucksEngine(filters, throwOnUndefined = false, isGrader = false) {
|
|
384
|
-
if (!isGrader && getEnvBool("PROMPTFOO_DISABLE_TEMPLATING")) return { renderString: (template) => template };
|
|
385
|
-
const env = nunjucks.configure({
|
|
386
|
-
autoescape: false,
|
|
387
|
-
throwOnUndefined
|
|
388
|
-
});
|
|
389
|
-
const envGlobals = {
|
|
390
|
-
...getEnvBool("PROMPTFOO_DISABLE_TEMPLATE_ENV_VARS", getEnvBool("PROMPTFOO_SELF_HOSTED", false)) ? {} : process.env,
|
|
391
|
-
...state.config?.env
|
|
392
|
-
};
|
|
393
|
-
env.addGlobal("env", envGlobals);
|
|
394
|
-
env.addFilter("load", function(str) {
|
|
395
|
-
return JSON.parse(str);
|
|
396
|
-
});
|
|
397
|
-
if (filters) for (const [name, filter] of Object.entries(filters)) env.addFilter(name, filter);
|
|
398
|
-
return env;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Parse Nunjucks template to extract variables.
|
|
402
|
-
* @param template - The Nunjucks template string.
|
|
403
|
-
* @returns An array of variables used in the template.
|
|
404
|
-
*/
|
|
405
|
-
function extractVariablesFromTemplate(template) {
|
|
406
|
-
const variableSet = /* @__PURE__ */ new Set();
|
|
407
|
-
const regex = /\{\{[\s]*([^{}\s|]+)[\s]*(?:\|[^}]+)?\}\}|\{%[\s]*(?:if|for)[\s]+([^{}\s]+)[\s]*.*?%\}/g;
|
|
408
|
-
template = template.replace(/\{#[\s\S]*?#\}/g, "");
|
|
409
|
-
let match;
|
|
410
|
-
while ((match = regex.exec(template)) !== null) {
|
|
411
|
-
const variable = match[1] || match[2];
|
|
412
|
-
if (variable) variableSet.add(variable);
|
|
413
|
-
}
|
|
414
|
-
const forLoopRegex = /\{%[\s]*for[\s]+(\w+)[\s]+in[\s]+(\w+)[\s]*%\}/g;
|
|
415
|
-
while ((match = forLoopRegex.exec(template)) !== null) {
|
|
416
|
-
variableSet.delete(match[1]);
|
|
417
|
-
variableSet.add(match[2]);
|
|
418
|
-
}
|
|
419
|
-
return Array.from(variableSet);
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Extract variables from multiple Nunjucks templates.
|
|
423
|
-
* @param templates - An array of Nunjucks template strings.
|
|
424
|
-
* @returns An array of variables used in the templates.
|
|
425
|
-
*/
|
|
426
|
-
function extractVariablesFromTemplates(templates) {
|
|
427
|
-
const variableSet = /* @__PURE__ */ new Set();
|
|
428
|
-
for (const template of templates) extractVariablesFromTemplate(template).forEach((variable) => variableSet.add(variable));
|
|
429
|
-
return Array.from(variableSet);
|
|
430
|
-
}
|
|
431
|
-
//#endregion
|
|
432
|
-
//#region src/util/render.ts
|
|
433
|
-
/**
|
|
434
|
-
* Renders ONLY environment variable templates in an object, leaving all other templates untouched.
|
|
435
|
-
* This allows env vars to be resolved at provider load time while preserving runtime var templates.
|
|
436
|
-
*
|
|
437
|
-
* Supports full Nunjucks syntax for env vars including filters and expressions:
|
|
438
|
-
* - {{ env.VAR_NAME }}
|
|
439
|
-
* - {{ env['VAR-NAME'] }}
|
|
440
|
-
* - {{ env["VAR-NAME"] }}
|
|
441
|
-
* - {{ env.VAR | default('fallback') }}
|
|
442
|
-
* - {{ env.VAR | upper }}
|
|
443
|
-
*
|
|
444
|
-
* Preserves non-env templates for runtime rendering:
|
|
445
|
-
* - {{ vars.x }} - preserved as literal
|
|
446
|
-
* - {{ prompt }} - preserved as literal
|
|
447
|
-
*
|
|
448
|
-
* Implementation: Uses regex to find env templates, delegates to Nunjucks for rendering.
|
|
449
|
-
* This ensures full Nunjucks feature support while preserving non-env templates.
|
|
450
|
-
*
|
|
451
|
-
* @param obj - The object to process
|
|
452
|
-
* @param envOverrides - Optional env vars to merge with (or replace) the base env
|
|
453
|
-
* @param replaceBase - If true, envOverrides replaces the base env entirely instead of merging
|
|
454
|
-
* @returns The object with only env templates rendered
|
|
455
|
-
*/
|
|
456
|
-
function renderEnvOnlyInObject(obj, envOverrides, replaceBase) {
|
|
457
|
-
if (getEnvBool("PROMPTFOO_DISABLE_TEMPLATING")) return obj;
|
|
458
|
-
if (typeof obj === "string") {
|
|
459
|
-
const nunjucks = getNunjucksEngine();
|
|
460
|
-
const baseEnvGlobals = nunjucks.getGlobal("env");
|
|
461
|
-
const envGlobals = replaceBase ? envOverrides ?? {} : envOverrides ? {
|
|
462
|
-
...baseEnvGlobals,
|
|
463
|
-
...envOverrides
|
|
464
|
-
} : baseEnvGlobals;
|
|
465
|
-
return obj.replace(/\{\{(?:[^}]|\}(?!\}))*\}\}/g, (match) => {
|
|
466
|
-
if (!match.match(/\benv\.|env\[/)) return match;
|
|
467
|
-
const varMatch = match.match(/env\.(\w+)|env\[['"]([^'"]+)['"]\]/);
|
|
468
|
-
const varName = varMatch?.[1] || varMatch?.[2];
|
|
469
|
-
if (match.includes("|") || varName && varName in envGlobals && envGlobals[varName] !== void 0) try {
|
|
470
|
-
return nunjucks.renderString(match, { env: envGlobals });
|
|
471
|
-
} catch (error) {
|
|
472
|
-
logger.debug(`Failed to render env template "${match}": ${error instanceof Error ? error.message : String(error)}`);
|
|
473
|
-
return match;
|
|
474
|
-
}
|
|
475
|
-
return match;
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
if (Array.isArray(obj)) return obj.map((item) => renderEnvOnlyInObject(item, envOverrides, replaceBase));
|
|
479
|
-
if (typeof obj === "object" && obj !== null) {
|
|
480
|
-
const result = {};
|
|
481
|
-
for (const key in obj) result[key] = renderEnvOnlyInObject(obj[key], envOverrides, replaceBase);
|
|
482
|
-
return result;
|
|
483
|
-
}
|
|
484
|
-
return obj;
|
|
485
|
-
}
|
|
486
|
-
function renderVarsInObject(obj, vars) {
|
|
487
|
-
if (!vars || getEnvBool("PROMPTFOO_DISABLE_TEMPLATING")) return obj;
|
|
488
|
-
if (typeof obj === "string") return getNunjucksEngine().renderString(obj, vars);
|
|
489
|
-
if (Array.isArray(obj)) return obj.map((item) => renderVarsInObject(item, vars));
|
|
490
|
-
if (typeof obj === "object" && obj !== null) {
|
|
491
|
-
const result = {};
|
|
492
|
-
for (const key in obj) result[key] = renderVarsInObject(obj[key], vars);
|
|
493
|
-
return result;
|
|
494
|
-
} else if (typeof obj === "function") return renderVarsInObject(obj({ vars }));
|
|
495
|
-
return obj;
|
|
496
|
-
}
|
|
497
|
-
//#endregion
|
|
498
375
|
//#region src/util/file.ts
|
|
499
376
|
/**
|
|
500
377
|
* Simple Nunjucks engine specifically for file paths
|
|
@@ -619,10 +496,10 @@ function getResolvedRelativePath(filePath, isCloudConfig) {
|
|
|
619
496
|
*/
|
|
620
497
|
function maybeLoadConfigFromExternalFile(config, context) {
|
|
621
498
|
if (Array.isArray(config)) return config.map((item) => maybeLoadConfigFromExternalFile(item, context));
|
|
622
|
-
if (
|
|
499
|
+
if (typeof config === "object" && config !== null) {
|
|
623
500
|
const result = {};
|
|
624
501
|
for (const key of Object.keys(config)) {
|
|
625
|
-
const childContext = key === "value" &&
|
|
502
|
+
const childContext = key === "value" && "type" in config && typeof config.type === "string" && (config.type === "python" || config.type === "javascript") ? "assertion" : key === "vars" ? "vars" : context;
|
|
626
503
|
result[key] = maybeLoadConfigFromExternalFile(config[key], childContext);
|
|
627
504
|
}
|
|
628
505
|
return result;
|
|
@@ -1422,6 +1299,6 @@ function printBorder() {
|
|
|
1422
1299
|
logger.info(border);
|
|
1423
1300
|
}
|
|
1424
1301
|
//#endregion
|
|
1425
|
-
export {
|
|
1302
|
+
export { getProviderDescription as A, deduplicateTestCases as C, resultIsForTestCase as D, getTestCaseDeduplicationKey as E, isGoogleProvider as M, isOpenAiProvider as N, checkProviderApiKeys as O, isProviderAllowed as P, setupEnv as S, filterRuntimeVars as T, parsePathOrGlob as _, ComparisonEvalNotFoundError as a, loadFunction as b, mergeComparisonTables as c, getResolvedRelativePath as d, maybeLoadConfigFromExternalFile as f, maybeLoadToolsFromExternalFile as g, maybeLoadResponseFormatFromExternalFile as h, writeOutput as i, isAnthropicProvider as j, doesProviderRefMatch as k, fetchCsvFromGoogleSheet as l, maybeLoadFromExternalFileWithVars as m, createOutputMetadata as n, evalTableToJson as o, maybeLoadFromExternalFile as p, writeMultipleOutputs as r, generateEvalCsv as s, printBorder as t, getNunjucksEngineForFilePath as u, readFilters as v, extractRuntimeVars as w, parseFileUrl as x, readOutput as y };
|
|
1426
1303
|
|
|
1427
|
-
//# sourceMappingURL=util-
|
|
1304
|
+
//# sourceMappingURL=util-DxWpWjhc.js.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as getEnvBool, a as logger, f as sanitizeObject, k as state } from "./logger-Ct2S6Yx-.js";
|
|
2
2
|
import { t as invariant } from "./invariant-Ddh24eXh.js";
|
|
3
|
-
import { o as safeResolve, r as importModule, t as getDirectory } from "./esm-
|
|
4
|
-
import { r as runPython } from "./pythonUtils-
|
|
3
|
+
import { o as safeResolve, r as importModule, t as getDirectory } from "./esm-C7PnfdF8.js";
|
|
4
|
+
import { r as runPython } from "./pythonUtils-C2UQ30Rz.js";
|
|
5
5
|
import { i as isJavascriptFile, t as JAVASCRIPT_EXTENSIONS } from "./fileExtensions-DnqA1y9x.js";
|
|
6
|
-
import { A as isApiProvider, g as ResultFailureReason, h as OutputFileExtension, j as isProviderOptions } from "./types-
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
6
|
+
import { A as isApiProvider, g as ResultFailureReason, h as OutputFileExtension, j as isProviderOptions } from "./types-BGQDAP8i.js";
|
|
7
|
+
import { a as getNunjucksEngine, n as renderVarsInObject } from "./render-CH-62LbA.js";
|
|
8
|
+
import { A as TERMINAL_MAX_WIDTH, F as VERSION, t as fetchWithProxy } from "./fetch-Di00EQrc.js";
|
|
9
|
+
import * as fs$2 from "fs";
|
|
9
10
|
import * as path$1 from "path";
|
|
10
11
|
import path from "path";
|
|
11
12
|
import yaml from "js-yaml";
|
|
@@ -310,7 +311,7 @@ function setupEnv(envPath) {
|
|
|
310
311
|
dotenv.config({ quiet: true });
|
|
311
312
|
return;
|
|
312
313
|
}
|
|
313
|
-
for (const p of paths) if (!fs$
|
|
314
|
+
for (const p of paths) if (!fs$2.existsSync(p)) throw new Error(`Environment file not found: ${p}`);
|
|
314
315
|
if (paths.length === 1) logger.info(`Loading environment variables from ${paths[0]}`);
|
|
315
316
|
else logger.info(`Loading environment variables from: ${paths.join(", ")}`);
|
|
316
317
|
const pathArg = paths.length === 1 ? paths[0] : paths;
|
|
@@ -370,130 +371,6 @@ function parseFileUrl(fileUrl) {
|
|
|
370
371
|
return { filePath: urlWithoutProtocol };
|
|
371
372
|
}
|
|
372
373
|
//#endregion
|
|
373
|
-
//#region src/util/templates.ts
|
|
374
|
-
/**
|
|
375
|
-
* Get a Nunjucks engine instance with optional filters and configuration.
|
|
376
|
-
* @param filters - Optional map of custom Nunjucks filters.
|
|
377
|
-
* @param throwOnUndefined - Whether to throw an error on undefined variables.
|
|
378
|
-
* @param isGrader - Whether this engine is being used in a grader context.
|
|
379
|
-
* Nunjucks is always enabled in grader mode.
|
|
380
|
-
* @returns A configured Nunjucks environment.
|
|
381
|
-
*/
|
|
382
|
-
function getNunjucksEngine(filters, throwOnUndefined = false, isGrader = false) {
|
|
383
|
-
if (!isGrader && getEnvBool("PROMPTFOO_DISABLE_TEMPLATING")) return { renderString: (template) => template };
|
|
384
|
-
const env = nunjucks.configure({
|
|
385
|
-
autoescape: false,
|
|
386
|
-
throwOnUndefined
|
|
387
|
-
});
|
|
388
|
-
const envGlobals = {
|
|
389
|
-
...getEnvBool("PROMPTFOO_DISABLE_TEMPLATE_ENV_VARS", getEnvBool("PROMPTFOO_SELF_HOSTED", false)) ? {} : process.env,
|
|
390
|
-
...state.config?.env
|
|
391
|
-
};
|
|
392
|
-
env.addGlobal("env", envGlobals);
|
|
393
|
-
env.addFilter("load", function(str) {
|
|
394
|
-
return JSON.parse(str);
|
|
395
|
-
});
|
|
396
|
-
if (filters) for (const [name, filter] of Object.entries(filters)) env.addFilter(name, filter);
|
|
397
|
-
return env;
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Parse Nunjucks template to extract variables.
|
|
401
|
-
* @param template - The Nunjucks template string.
|
|
402
|
-
* @returns An array of variables used in the template.
|
|
403
|
-
*/
|
|
404
|
-
function extractVariablesFromTemplate(template) {
|
|
405
|
-
const variableSet = /* @__PURE__ */ new Set();
|
|
406
|
-
const regex = /\{\{[\s]*([^{}\s|]+)[\s]*(?:\|[^}]+)?\}\}|\{%[\s]*(?:if|for)[\s]+([^{}\s]+)[\s]*.*?%\}/g;
|
|
407
|
-
template = template.replace(/\{#[\s\S]*?#\}/g, "");
|
|
408
|
-
let match;
|
|
409
|
-
while ((match = regex.exec(template)) !== null) {
|
|
410
|
-
const variable = match[1] || match[2];
|
|
411
|
-
if (variable) variableSet.add(variable);
|
|
412
|
-
}
|
|
413
|
-
const forLoopRegex = /\{%[\s]*for[\s]+(\w+)[\s]+in[\s]+(\w+)[\s]*%\}/g;
|
|
414
|
-
while ((match = forLoopRegex.exec(template)) !== null) {
|
|
415
|
-
variableSet.delete(match[1]);
|
|
416
|
-
variableSet.add(match[2]);
|
|
417
|
-
}
|
|
418
|
-
return Array.from(variableSet);
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Extract variables from multiple Nunjucks templates.
|
|
422
|
-
* @param templates - An array of Nunjucks template strings.
|
|
423
|
-
* @returns An array of variables used in the templates.
|
|
424
|
-
*/
|
|
425
|
-
function extractVariablesFromTemplates(templates) {
|
|
426
|
-
const variableSet = /* @__PURE__ */ new Set();
|
|
427
|
-
for (const template of templates) extractVariablesFromTemplate(template).forEach((variable) => variableSet.add(variable));
|
|
428
|
-
return Array.from(variableSet);
|
|
429
|
-
}
|
|
430
|
-
//#endregion
|
|
431
|
-
//#region src/util/render.ts
|
|
432
|
-
/**
|
|
433
|
-
* Renders ONLY environment variable templates in an object, leaving all other templates untouched.
|
|
434
|
-
* This allows env vars to be resolved at provider load time while preserving runtime var templates.
|
|
435
|
-
*
|
|
436
|
-
* Supports full Nunjucks syntax for env vars including filters and expressions:
|
|
437
|
-
* - {{ env.VAR_NAME }}
|
|
438
|
-
* - {{ env['VAR-NAME'] }}
|
|
439
|
-
* - {{ env["VAR-NAME"] }}
|
|
440
|
-
* - {{ env.VAR | default('fallback') }}
|
|
441
|
-
* - {{ env.VAR | upper }}
|
|
442
|
-
*
|
|
443
|
-
* Preserves non-env templates for runtime rendering:
|
|
444
|
-
* - {{ vars.x }} - preserved as literal
|
|
445
|
-
* - {{ prompt }} - preserved as literal
|
|
446
|
-
*
|
|
447
|
-
* Implementation: Uses regex to find env templates, delegates to Nunjucks for rendering.
|
|
448
|
-
* This ensures full Nunjucks feature support while preserving non-env templates.
|
|
449
|
-
*
|
|
450
|
-
* @param obj - The object to process
|
|
451
|
-
* @param envOverrides - Optional env vars to merge with (or replace) the base env
|
|
452
|
-
* @param replaceBase - If true, envOverrides replaces the base env entirely instead of merging
|
|
453
|
-
* @returns The object with only env templates rendered
|
|
454
|
-
*/
|
|
455
|
-
function renderEnvOnlyInObject(obj, envOverrides, replaceBase) {
|
|
456
|
-
if (getEnvBool("PROMPTFOO_DISABLE_TEMPLATING")) return obj;
|
|
457
|
-
if (typeof obj === "string") {
|
|
458
|
-
const nunjucks = getNunjucksEngine();
|
|
459
|
-
const baseEnvGlobals = nunjucks.getGlobal("env");
|
|
460
|
-
const envGlobals = replaceBase ? envOverrides ?? {} : envOverrides ? {
|
|
461
|
-
...baseEnvGlobals,
|
|
462
|
-
...envOverrides
|
|
463
|
-
} : baseEnvGlobals;
|
|
464
|
-
return obj.replace(/\{\{(?:[^}]|\}(?!\}))*\}\}/g, (match) => {
|
|
465
|
-
if (!match.match(/\benv\.|env\[/)) return match;
|
|
466
|
-
const varMatch = match.match(/env\.(\w+)|env\[['"]([^'"]+)['"]\]/);
|
|
467
|
-
const varName = varMatch?.[1] || varMatch?.[2];
|
|
468
|
-
if (match.includes("|") || varName && varName in envGlobals && envGlobals[varName] !== void 0) try {
|
|
469
|
-
return nunjucks.renderString(match, { env: envGlobals });
|
|
470
|
-
} catch (error) {
|
|
471
|
-
logger.debug(`Failed to render env template "${match}": ${error instanceof Error ? error.message : String(error)}`);
|
|
472
|
-
return match;
|
|
473
|
-
}
|
|
474
|
-
return match;
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
if (Array.isArray(obj)) return obj.map((item) => renderEnvOnlyInObject(item, envOverrides, replaceBase));
|
|
478
|
-
if (typeof obj === "object" && obj !== null) {
|
|
479
|
-
const result = {};
|
|
480
|
-
for (const key in obj) result[key] = renderEnvOnlyInObject(obj[key], envOverrides, replaceBase);
|
|
481
|
-
return result;
|
|
482
|
-
}
|
|
483
|
-
return obj;
|
|
484
|
-
}
|
|
485
|
-
function renderVarsInObject(obj, vars) {
|
|
486
|
-
if (!vars || getEnvBool("PROMPTFOO_DISABLE_TEMPLATING")) return obj;
|
|
487
|
-
if (typeof obj === "string") return getNunjucksEngine().renderString(obj, vars);
|
|
488
|
-
if (Array.isArray(obj)) return obj.map((item) => renderVarsInObject(item, vars));
|
|
489
|
-
if (typeof obj === "object" && obj !== null) {
|
|
490
|
-
const result = {};
|
|
491
|
-
for (const key in obj) result[key] = renderVarsInObject(obj[key], vars);
|
|
492
|
-
return result;
|
|
493
|
-
} else if (typeof obj === "function") return renderVarsInObject(obj({ vars }));
|
|
494
|
-
return obj;
|
|
495
|
-
}
|
|
496
|
-
//#endregion
|
|
497
374
|
//#region src/util/file.ts
|
|
498
375
|
/**
|
|
499
376
|
* Simple Nunjucks engine specifically for file paths
|
|
@@ -547,7 +424,7 @@ function maybeLoadFromExternalFile(filePath, context) {
|
|
|
547
424
|
for (const matchedFile of matchedFiles) {
|
|
548
425
|
let contents;
|
|
549
426
|
try {
|
|
550
|
-
contents = fs$
|
|
427
|
+
contents = fs$2.readFileSync(matchedFile, "utf8");
|
|
551
428
|
} catch (error) {
|
|
552
429
|
if (error.code === "ENOENT") {
|
|
553
430
|
logger.debug(`File disappeared during glob expansion: ${matchedFile}`);
|
|
@@ -575,7 +452,7 @@ function maybeLoadFromExternalFile(filePath, context) {
|
|
|
575
452
|
const finalPath = resolvedPath;
|
|
576
453
|
let contents;
|
|
577
454
|
try {
|
|
578
|
-
contents = fs$
|
|
455
|
+
contents = fs$2.readFileSync(finalPath, "utf8");
|
|
579
456
|
} catch (error) {
|
|
580
457
|
if (error.code === "ENOENT") throw new Error(`File does not exist: ${finalPath}`);
|
|
581
458
|
throw new Error(`Failed to read file ${finalPath}: ${error}`);
|
|
@@ -618,10 +495,10 @@ function getResolvedRelativePath(filePath, isCloudConfig) {
|
|
|
618
495
|
*/
|
|
619
496
|
function maybeLoadConfigFromExternalFile(config, context) {
|
|
620
497
|
if (Array.isArray(config)) return config.map((item) => maybeLoadConfigFromExternalFile(item, context));
|
|
621
|
-
if (
|
|
498
|
+
if (typeof config === "object" && config !== null) {
|
|
622
499
|
const result = {};
|
|
623
500
|
for (const key of Object.keys(config)) {
|
|
624
|
-
const childContext = key === "value" &&
|
|
501
|
+
const childContext = key === "value" && "type" in config && typeof config.type === "string" && (config.type === "python" || config.type === "javascript") ? "assertion" : key === "vars" ? "vars" : context;
|
|
625
502
|
result[key] = maybeLoadConfigFromExternalFile(config[key], childContext);
|
|
626
503
|
}
|
|
627
504
|
return result;
|
|
@@ -653,7 +530,7 @@ function parsePathOrGlob(basePath, promptPath) {
|
|
|
653
530
|
}
|
|
654
531
|
let stats;
|
|
655
532
|
try {
|
|
656
|
-
stats = fs$
|
|
533
|
+
stats = fs$2.statSync(path$1.join(basePath, filename));
|
|
657
534
|
} catch (err) {
|
|
658
535
|
if (getEnvBool("PROMPTFOO_STRICT_FILES")) throw err;
|
|
659
536
|
}
|
|
@@ -670,7 +547,7 @@ function parsePathOrGlob(basePath, promptPath) {
|
|
|
670
547
|
function readOutput(outputPath) {
|
|
671
548
|
const ext = path$1.parse(outputPath).ext.slice(1);
|
|
672
549
|
switch (ext) {
|
|
673
|
-
case "json": return JSON.parse(fs$
|
|
550
|
+
case "json": return JSON.parse(fs$2.readFileSync(outputPath, "utf-8"));
|
|
674
551
|
default: throw new Error(`Unsupported output file format: ${ext} currently only supports json`);
|
|
675
552
|
}
|
|
676
553
|
}
|
|
@@ -1296,6 +1173,6 @@ function printBorder() {
|
|
|
1296
1173
|
logger.info(border);
|
|
1297
1174
|
}
|
|
1298
1175
|
//#endregion
|
|
1299
|
-
export {
|
|
1176
|
+
export { checkProviderApiKeys as C, isGoogleProvider as D, isAnthropicProvider as E, isOpenAiProvider as O, resultIsForTestCase as S, getProviderDescription as T, setupEnv as _, getNunjucksEngineForFilePath as a, filterRuntimeVars as b, maybeLoadFromExternalFile as c, maybeLoadToolsFromExternalFile as d, parsePathOrGlob as f, parseFileUrl as g, loadFunction as h, fetchCsvFromGoogleSheet as i, isProviderAllowed as k, maybeLoadFromExternalFileWithVars as l, readOutput as m, writeMultipleOutputs as n, getResolvedRelativePath as o, readFilters as p, writeOutput as r, maybeLoadConfigFromExternalFile as s, printBorder as t, maybeLoadResponseFormatFromExternalFile as u, deduplicateTestCases as v, doesProviderRefMatch as w, getTestCaseDeduplicationKey as x, extractRuntimeVars as y };
|
|
1300
1177
|
|
|
1301
|
-
//# sourceMappingURL=util-
|
|
1178
|
+
//# sourceMappingURL=util-oGMLA7vc.js.map
|