@anvia/core 1.1.2 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +226 -0
- package/dist/agent/agent-stream.js +7 -0
- package/dist/agent/agent-stream.js.map +1 -0
- package/dist/agent/agent-tool.js +24 -0
- package/dist/agent/agent-tool.js.map +1 -0
- package/dist/agent/agent.js +89 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/errors.js +17 -0
- package/dist/agent/errors.js.map +1 -0
- package/dist/agent/ids.js +7 -0
- package/dist/agent/ids.js.map +1 -0
- package/dist/agent/index.d.ts +127 -9
- package/dist/agent/index.js +103 -21
- package/dist/agent/interactions/index.js +2 -2
- package/dist/agent/interactions.js +22 -0
- package/dist/agent/interactions.js.map +1 -0
- package/dist/agent/lifecycle.js +9 -0
- package/dist/agent/lifecycle.js.map +1 -0
- package/dist/agent/output-schema.js +10 -0
- package/dist/agent/output-schema.js.map +1 -0
- package/dist/agent/resolve-options.js +46 -0
- package/dist/agent/resolve-options.js.map +1 -0
- package/dist/agent/resolved-agent.js +92 -0
- package/dist/agent/resolved-agent.js.map +1 -0
- package/dist/agent/run-types.js +1 -0
- package/dist/agent/run-types.js.map +1 -0
- package/dist/agent/snapshot.js +17 -0
- package/dist/agent/snapshot.js.map +1 -0
- package/dist/agent/team/agent-team.js +98 -0
- package/dist/agent/team/agent-team.js.map +1 -0
- package/dist/agent/team/errors.js +9 -0
- package/dist/agent/team/errors.js.map +1 -0
- package/dist/agent/team/index.js +104 -0
- package/dist/agent/team/index.js.map +1 -0
- package/dist/agent/team/types.js +1 -0
- package/dist/agent/team/types.js.map +1 -0
- package/dist/agent/tool-catalog.js +37 -0
- package/dist/agent/tool-catalog.js.map +1 -0
- package/dist/agent/tool-state.js +11 -0
- package/dist/agent/tool-state.js.map +1 -0
- package/dist/agent/types.js +1 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/agent/vector-context.js +10 -0
- package/dist/agent/vector-context.js.map +1 -0
- package/dist/{agent-DTmzs1Qr.d.ts → agent-C9VhENdj.d.ts} +2 -3
- package/dist/{chunk-I3Q7XSBB.js → chunk-23LRXKQX.js} +6 -4
- package/dist/{chunk-I3Q7XSBB.js.map → chunk-23LRXKQX.js.map} +1 -1
- package/dist/{chunk-YK4WAAS4.js → chunk-2NLINXRF.js} +1 -1
- package/dist/{chunk-SPD4XVR7.js → chunk-2XSMGVBG.js} +1 -1
- package/dist/chunk-3J2CSVPR.js +1 -0
- package/dist/chunk-3J2CSVPR.js.map +1 -0
- package/dist/chunk-3P3YVJ7V.js +1 -0
- package/dist/chunk-3P3YVJ7V.js.map +1 -0
- package/dist/chunk-3TAQXJBC.js +107 -0
- package/dist/chunk-3TAQXJBC.js.map +1 -0
- package/dist/chunk-47NTHIVB.js +76 -0
- package/dist/chunk-47NTHIVB.js.map +1 -0
- package/dist/chunk-4AW2633B.js +9 -0
- package/dist/chunk-4AW2633B.js.map +1 -0
- package/dist/{chunk-3XQGVDU5.js → chunk-4C7AXYOM.js} +1 -1
- package/dist/{chunk-IZNOP6JG.js → chunk-4FIVU53H.js} +1 -1
- package/dist/chunk-4ITAV7YA.js +1 -0
- package/dist/chunk-4ITAV7YA.js.map +1 -0
- package/dist/{chunk-7JLAIN6E.js → chunk-4ONUNWGC.js} +2 -2
- package/dist/chunk-4S4OECPW.js +158 -0
- package/dist/chunk-4S4OECPW.js.map +1 -0
- package/dist/chunk-4UUIGAIX.js +1 -0
- package/dist/chunk-4UUIGAIX.js.map +1 -0
- package/dist/chunk-53TPAXYR.js +1 -0
- package/dist/chunk-53TPAXYR.js.map +1 -0
- package/dist/chunk-54ZZJRP2.js +57 -0
- package/dist/chunk-54ZZJRP2.js.map +1 -0
- package/dist/chunk-5FCZ64HM.js +112 -0
- package/dist/chunk-5FCZ64HM.js.map +1 -0
- package/dist/chunk-5I2NVRHC.js +146 -0
- package/dist/chunk-5I2NVRHC.js.map +1 -0
- package/dist/chunk-5IURMWFN.js +53 -0
- package/dist/chunk-5IURMWFN.js.map +1 -0
- package/dist/chunk-5M6GTA3T.js +1 -0
- package/dist/chunk-5M6GTA3T.js.map +1 -0
- package/dist/chunk-5N5W7CX7.js +18 -0
- package/dist/chunk-5N5W7CX7.js.map +1 -0
- package/dist/chunk-5S7T2URX.js +1 -0
- package/dist/chunk-5S7T2URX.js.map +1 -0
- package/dist/chunk-5V533R7F.js +19 -0
- package/dist/chunk-5V533R7F.js.map +1 -0
- package/dist/chunk-5WLIHNNJ.js +56 -0
- package/dist/chunk-5WLIHNNJ.js.map +1 -0
- package/dist/chunk-6BTJC3ES.js +37 -0
- package/dist/chunk-6BTJC3ES.js.map +1 -0
- package/dist/chunk-6N4ENZO4.js +24 -0
- package/dist/chunk-6N4ENZO4.js.map +1 -0
- package/dist/{chunk-4UQALF5Y.js → chunk-6RQYWZI3.js} +2 -36
- package/dist/chunk-6RQYWZI3.js.map +1 -0
- package/dist/chunk-6TAWRKFK.js +86 -0
- package/dist/chunk-6TAWRKFK.js.map +1 -0
- package/dist/chunk-72LBHKYP.js +236 -0
- package/dist/chunk-72LBHKYP.js.map +1 -0
- package/dist/chunk-7F53DOML.js +53 -0
- package/dist/chunk-7F53DOML.js.map +1 -0
- package/dist/chunk-7LBPRXZP.js +1 -0
- package/dist/chunk-7LBPRXZP.js.map +1 -0
- package/dist/chunk-A7BXVZXZ.js +25 -0
- package/dist/chunk-A7BXVZXZ.js.map +1 -0
- package/dist/chunk-AOG6KSV4.js +107 -0
- package/dist/chunk-AOG6KSV4.js.map +1 -0
- package/dist/chunk-B47EXUHL.js +67 -0
- package/dist/chunk-B47EXUHL.js.map +1 -0
- package/dist/chunk-B5JQDR33.js +14 -0
- package/dist/chunk-B5JQDR33.js.map +1 -0
- package/dist/chunk-BDDC72GF.js +189 -0
- package/dist/chunk-BDDC72GF.js.map +1 -0
- package/dist/chunk-BDKFFFVX.js +342 -0
- package/dist/chunk-BDKFFFVX.js.map +1 -0
- package/dist/{chunk-QGX73TSQ.js → chunk-BONQTXRQ.js} +3 -12
- package/dist/chunk-BONQTXRQ.js.map +1 -0
- package/dist/chunk-BUPC72Y2.js +1007 -0
- package/dist/chunk-BUPC72Y2.js.map +1 -0
- package/dist/chunk-CKKNO4XB.js +70 -0
- package/dist/chunk-CKKNO4XB.js.map +1 -0
- package/dist/chunk-CX7ZVTO5.js +22 -0
- package/dist/chunk-CX7ZVTO5.js.map +1 -0
- package/dist/chunk-DU4WA6LQ.js +1 -0
- package/dist/chunk-DU4WA6LQ.js.map +1 -0
- package/dist/chunk-EJR6VVB3.js +63 -0
- package/dist/chunk-EJR6VVB3.js.map +1 -0
- package/dist/chunk-EKZRAWBP.js +110 -0
- package/dist/chunk-EKZRAWBP.js.map +1 -0
- package/dist/chunk-ENZ2XX27.js +26 -0
- package/dist/chunk-ENZ2XX27.js.map +1 -0
- package/dist/chunk-EOAJBBII.js +1 -0
- package/dist/chunk-EOAJBBII.js.map +1 -0
- package/dist/chunk-ERN7P6Q4.js +1 -0
- package/dist/chunk-ERN7P6Q4.js.map +1 -0
- package/dist/chunk-ESOFEAYK.js +57 -0
- package/dist/chunk-ESOFEAYK.js.map +1 -0
- package/dist/chunk-ETYB5JO6.js +175 -0
- package/dist/chunk-ETYB5JO6.js.map +1 -0
- package/dist/chunk-EZR5AV3J.js +74 -0
- package/dist/chunk-EZR5AV3J.js.map +1 -0
- package/dist/chunk-F2OKLHGB.js +9 -0
- package/dist/chunk-F2OKLHGB.js.map +1 -0
- package/dist/chunk-F3E2RLC7.js +342 -0
- package/dist/chunk-F3E2RLC7.js.map +1 -0
- package/dist/chunk-FAPIZJS2.js +54 -0
- package/dist/chunk-FAPIZJS2.js.map +1 -0
- package/dist/{chunk-2QZJTG2E.js → chunk-G336L2IE.js} +11 -71
- package/dist/chunk-G336L2IE.js.map +1 -0
- package/dist/chunk-GDJNOZ47.js +1 -0
- package/dist/chunk-GDJNOZ47.js.map +1 -0
- package/dist/chunk-GDY2Z2SZ.js +83 -0
- package/dist/chunk-GDY2Z2SZ.js.map +1 -0
- package/dist/chunk-GLMYZ6OA.js +20 -0
- package/dist/chunk-GLMYZ6OA.js.map +1 -0
- package/dist/{chunk-XEVOC433.js → chunk-GPVXCY5I.js} +2 -73
- package/dist/chunk-GPVXCY5I.js.map +1 -0
- package/dist/{chunk-KSKST3KP.js → chunk-H3H74RWJ.js} +1 -1
- package/dist/chunk-HAAGSIZH.js +89 -0
- package/dist/chunk-HAAGSIZH.js.map +1 -0
- package/dist/{chunk-K5L7R7XM.js → chunk-HHMLE3TZ.js} +6 -54
- package/dist/chunk-HHMLE3TZ.js.map +1 -0
- package/dist/{chunk-JLJMVRRE.js → chunk-HP34GRQX.js} +10 -83
- package/dist/chunk-HP34GRQX.js.map +1 -0
- package/dist/chunk-HTI343NP.js +1 -0
- package/dist/chunk-HTI343NP.js.map +1 -0
- package/dist/{chunk-T2C3CGDQ.js → chunk-HTI7DZJM.js} +6 -4
- package/dist/{chunk-T2C3CGDQ.js.map → chunk-HTI7DZJM.js.map} +1 -1
- package/dist/chunk-IDNL6IH4.js +294 -0
- package/dist/chunk-IDNL6IH4.js.map +1 -0
- package/dist/chunk-IV6YQTY2.js +47 -0
- package/dist/chunk-IV6YQTY2.js.map +1 -0
- package/dist/chunk-J4SINPUA.js +939 -0
- package/dist/chunk-J4SINPUA.js.map +1 -0
- package/dist/chunk-J6S6MT7O.js +32 -0
- package/dist/chunk-J6S6MT7O.js.map +1 -0
- package/dist/chunk-JBQNCUXA.js +34 -0
- package/dist/chunk-JBQNCUXA.js.map +1 -0
- package/dist/chunk-JMJFK3A4.js +1 -0
- package/dist/chunk-JMJFK3A4.js.map +1 -0
- package/dist/chunk-JMMZICU7.js +74 -0
- package/dist/chunk-JMMZICU7.js.map +1 -0
- package/dist/chunk-K4IBS7VB.js +55 -0
- package/dist/chunk-K4IBS7VB.js.map +1 -0
- package/dist/chunk-KBBQSP4M.js +16 -0
- package/dist/chunk-KBBQSP4M.js.map +1 -0
- package/dist/chunk-KFAVEL5F.js +68 -0
- package/dist/chunk-KFAVEL5F.js.map +1 -0
- package/dist/chunk-KITX3HDN.js +17 -0
- package/dist/chunk-KITX3HDN.js.map +1 -0
- package/dist/chunk-KO5NMTAM.js +1 -0
- package/dist/chunk-KO5NMTAM.js.map +1 -0
- package/dist/chunk-KY4VXIN2.js +118 -0
- package/dist/chunk-KY4VXIN2.js.map +1 -0
- package/dist/chunk-KZGSXJKU.js +29 -0
- package/dist/chunk-KZGSXJKU.js.map +1 -0
- package/dist/chunk-LAIATEUB.js +24 -0
- package/dist/chunk-LAIATEUB.js.map +1 -0
- package/dist/{chunk-OJBFDBLG.js → chunk-LBYJPMHC.js} +2 -2
- package/dist/chunk-LKIABZNR.js +49 -0
- package/dist/chunk-LKIABZNR.js.map +1 -0
- package/dist/chunk-LQJ4KHMY.js +23 -0
- package/dist/chunk-LQJ4KHMY.js.map +1 -0
- package/dist/chunk-MEN4AFDZ.js +1 -0
- package/dist/chunk-MEN4AFDZ.js.map +1 -0
- package/dist/chunk-MHOJJYDK.js +93 -0
- package/dist/chunk-MHOJJYDK.js.map +1 -0
- package/dist/chunk-MJCMKZFP.js +30 -0
- package/dist/chunk-MJCMKZFP.js.map +1 -0
- package/dist/chunk-MNYMLWWA.js +168 -0
- package/dist/chunk-MNYMLWWA.js.map +1 -0
- package/dist/chunk-MT3BLVYN.js +31 -0
- package/dist/chunk-MT3BLVYN.js.map +1 -0
- package/dist/chunk-NF6WBPFG.js +37 -0
- package/dist/chunk-NF6WBPFG.js.map +1 -0
- package/dist/chunk-NNEKBZSM.js +66 -0
- package/dist/chunk-NNEKBZSM.js.map +1 -0
- package/dist/chunk-NPJ2T3L5.js +19 -0
- package/dist/chunk-NPJ2T3L5.js.map +1 -0
- package/dist/chunk-NVALGVQG.js +150 -0
- package/dist/chunk-NVALGVQG.js.map +1 -0
- package/dist/chunk-O6DTOCBM.js +355 -0
- package/dist/chunk-O6DTOCBM.js.map +1 -0
- package/dist/chunk-OJF67RNM.js +1 -0
- package/dist/chunk-OJF67RNM.js.map +1 -0
- package/dist/chunk-PHLGGRHC.js +89 -0
- package/dist/chunk-PHLGGRHC.js.map +1 -0
- package/dist/chunk-PIMD4DYG.js +104 -0
- package/dist/chunk-PIMD4DYG.js.map +1 -0
- package/dist/chunk-PJNE75WC.js +1 -0
- package/dist/chunk-PJNE75WC.js.map +1 -0
- package/dist/{chunk-J6LVLV6P.js → chunk-PLDJCCVL.js} +1 -1
- package/dist/{chunk-3RWESPUG.js → chunk-POXHJF3H.js} +6 -51
- package/dist/chunk-POXHJF3H.js.map +1 -0
- package/dist/chunk-PPJ7SYQL.js +81 -0
- package/dist/chunk-PPJ7SYQL.js.map +1 -0
- package/dist/chunk-QHGYCYV6.js +91 -0
- package/dist/chunk-QHGYCYV6.js.map +1 -0
- package/dist/chunk-QUS6S2NB.js +663 -0
- package/dist/chunk-QUS6S2NB.js.map +1 -0
- package/dist/chunk-R6722CIU.js +28 -0
- package/dist/chunk-R6722CIU.js.map +1 -0
- package/dist/chunk-RA4YVN43.js +1 -0
- package/dist/chunk-RA4YVN43.js.map +1 -0
- package/dist/chunk-RT5LUEO3.js +2339 -0
- package/dist/chunk-RT5LUEO3.js.map +1 -0
- package/dist/chunk-SC4SUIEY.js +1 -0
- package/dist/chunk-SC4SUIEY.js.map +1 -0
- package/dist/chunk-SIYZDPVH.js +613 -0
- package/dist/chunk-SIYZDPVH.js.map +1 -0
- package/dist/chunk-SQAAVYJG.js +12 -0
- package/dist/chunk-SQAAVYJG.js.map +1 -0
- package/dist/chunk-SXE4J43E.js +59 -0
- package/dist/chunk-SXE4J43E.js.map +1 -0
- package/dist/{chunk-EFLT7XZD.js → chunk-SYULMZGL.js} +6 -4
- package/dist/{chunk-EFLT7XZD.js.map → chunk-SYULMZGL.js.map} +1 -1
- package/dist/chunk-T4IAJJUU.js +48 -0
- package/dist/chunk-T4IAJJUU.js.map +1 -0
- package/dist/chunk-T4KS577P.js +58 -0
- package/dist/chunk-T4KS577P.js.map +1 -0
- package/dist/chunk-TFIOU6UR.js +78 -0
- package/dist/chunk-TFIOU6UR.js.map +1 -0
- package/dist/chunk-TIZGADU4.js +375 -0
- package/dist/chunk-TIZGADU4.js.map +1 -0
- package/dist/chunk-TP3MCUXS.js +1 -0
- package/dist/chunk-TP3MCUXS.js.map +1 -0
- package/dist/{chunk-JTJU56ZV.js → chunk-UOGM62JL.js} +11 -7
- package/dist/{chunk-JTJU56ZV.js.map → chunk-UOGM62JL.js.map} +1 -1
- package/dist/chunk-USRKPEQN.js +55 -0
- package/dist/chunk-USRKPEQN.js.map +1 -0
- package/dist/chunk-UTAB3XQI.js +667 -0
- package/dist/chunk-UTAB3XQI.js.map +1 -0
- package/dist/chunk-V3FFZWF3.js +182 -0
- package/dist/chunk-V3FFZWF3.js.map +1 -0
- package/dist/chunk-V4OZ7ISA.js +9 -0
- package/dist/chunk-V4OZ7ISA.js.map +1 -0
- package/dist/chunk-VZ5ZZBNX.js +139 -0
- package/dist/chunk-VZ5ZZBNX.js.map +1 -0
- package/dist/{chunk-AHLKV6KP.js → chunk-WN6AVBO4.js} +1 -1
- package/dist/chunk-WXR5CWSC.js +1 -0
- package/dist/chunk-WXR5CWSC.js.map +1 -0
- package/dist/chunk-X6WS3XWL.js +36 -0
- package/dist/chunk-X6WS3XWL.js.map +1 -0
- package/dist/{chunk-Q5BCNYED.js → chunk-XJRNBTIV.js} +7 -4
- package/dist/chunk-XQV3XNVT.js +225 -0
- package/dist/chunk-XQV3XNVT.js.map +1 -0
- package/dist/chunk-XV3DH5GC.js +58 -0
- package/dist/chunk-XV3DH5GC.js.map +1 -0
- package/dist/chunk-Y7JTHNCU.js +318 -0
- package/dist/chunk-Y7JTHNCU.js.map +1 -0
- package/dist/chunk-YWRXOPHC.js +43 -0
- package/dist/chunk-YWRXOPHC.js.map +1 -0
- package/dist/chunk-YZVFIW5D.js +27 -0
- package/dist/chunk-YZVFIW5D.js.map +1 -0
- package/dist/chunk-ZHC5CD6J.js +33 -0
- package/dist/chunk-ZHC5CD6J.js.map +1 -0
- package/dist/chunk-ZPJFXRQZ.js +23 -0
- package/dist/chunk-ZPJFXRQZ.js.map +1 -0
- package/dist/chunk-ZPXOBQDS.js +57 -0
- package/dist/chunk-ZPXOBQDS.js.map +1 -0
- package/dist/chunk-ZUFS6R7L.js +155 -0
- package/dist/chunk-ZUFS6R7L.js.map +1 -0
- package/dist/chunk-ZXLCTQUX.js +62 -0
- package/dist/chunk-ZXLCTQUX.js.map +1 -0
- package/dist/chunk-ZYXMWEL4.js +59 -0
- package/dist/chunk-ZYXMWEL4.js.map +1 -0
- package/dist/completion/controls.js +11 -0
- package/dist/completion/controls.js.map +1 -0
- package/dist/completion/documents.js +9 -0
- package/dist/completion/documents.js.map +1 -0
- package/dist/completion/generate-completion.js +23 -0
- package/dist/completion/generate-completion.js.map +1 -0
- package/dist/completion/index.js +23 -12
- package/dist/completion/json.js +7 -0
- package/dist/completion/json.js.map +1 -0
- package/dist/completion/message-schema.js +18 -0
- package/dist/completion/message-schema.js.map +1 -0
- package/dist/completion/provider-output-error.js +12 -0
- package/dist/completion/provider-output-error.js.map +1 -0
- package/dist/completion/stream-accumulator.js +10 -0
- package/dist/completion/stream-accumulator.js.map +1 -0
- package/dist/completion/types.js +28 -0
- package/dist/completion/types.js.map +1 -0
- package/dist/documents/chunk-text.js +7 -0
- package/dist/documents/chunk-text.js.map +1 -0
- package/dist/documents/index.js +5 -2
- package/dist/documents/text-document.js +8 -0
- package/dist/documents/text-document.js.map +1 -0
- package/dist/embeddings/distance.js +17 -0
- package/dist/embeddings/distance.js.map +1 -0
- package/dist/embeddings/embed.js +18 -0
- package/dist/embeddings/embed.js.map +1 -0
- package/dist/embeddings/index.js +11 -6
- package/dist/embeddings/types.js +2 -0
- package/dist/embeddings/types.js.map +1 -0
- package/dist/evals/advanced-metrics.js +46 -0
- package/dist/evals/advanced-metrics.js.map +1 -0
- package/dist/evals/agent-target.js +10 -0
- package/dist/evals/agent-target.js.map +1 -0
- package/dist/evals/cli.js +40 -0
- package/dist/evals/cli.js.map +1 -0
- package/dist/evals/execution.js +15 -0
- package/dist/evals/execution.js.map +1 -0
- package/dist/evals/format.js +13 -0
- package/dist/evals/format.js.map +1 -0
- package/dist/evals/index.d.ts +4 -4
- package/dist/evals/index.js +87 -2660
- package/dist/evals/index.js.map +1 -1
- package/dist/evals/judge.js +27 -0
- package/dist/evals/judge.js.map +1 -0
- package/dist/evals/metric.js +7 -0
- package/dist/evals/metric.js.map +1 -0
- package/dist/evals/metrics.js +53 -0
- package/dist/evals/metrics.js.map +1 -0
- package/dist/evals/outcome.js +7 -0
- package/dist/evals/outcome.js.map +1 -0
- package/dist/evals/reporting.js +11 -0
- package/dist/evals/reporting.js.map +1 -0
- package/dist/evals/runner.js +29 -0
- package/dist/evals/runner.js.map +1 -0
- package/dist/evals/selectors.js +18 -0
- package/dist/evals/selectors.js.map +1 -0
- package/dist/evals/suite.js +11 -0
- package/dist/evals/suite.js.map +1 -0
- package/dist/evals/types.js +1 -0
- package/dist/evals/types.js.map +1 -0
- package/dist/extractor/extractor.js +23 -0
- package/dist/extractor/extractor.js.map +1 -0
- package/dist/extractor/index.js +16 -7
- package/dist/guardrails/actions.js +13 -0
- package/dist/guardrails/actions.js.map +1 -0
- package/dist/guardrails/index.d.ts +3 -4
- package/dist/guardrails/index.js +15 -7
- package/dist/guardrails/message.js +9 -0
- package/dist/guardrails/message.js.map +1 -0
- package/dist/guardrails/policy.js +17 -0
- package/dist/guardrails/policy.js.map +1 -0
- package/dist/guardrails/runtime.js +11 -0
- package/dist/guardrails/runtime.js.map +1 -0
- package/dist/guardrails/text.js +9 -0
- package/dist/guardrails/text.js.map +1 -0
- package/dist/guardrails/types.js +1 -0
- package/dist/guardrails/types.js.map +1 -0
- package/dist/hooks/control.js +17 -0
- package/dist/hooks/control.js.map +1 -0
- package/dist/hooks/index.js +19 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/types.js +2 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/image-generation/generate-image.js +11 -0
- package/dist/image-generation/generate-image.js.map +1 -0
- package/dist/image-generation/index.js +7 -4
- package/dist/image-generation/types.js +2 -0
- package/dist/image-generation/types.js.map +1 -0
- package/dist/index.d.ts +5 -7
- package/dist/index.js +163 -57
- package/dist/internal/abort.js +13 -0
- package/dist/internal/abort.js.map +1 -0
- package/dist/internal/agent-runtime/agent-run.js +81 -0
- package/dist/internal/agent-runtime/agent-run.js.map +1 -0
- package/dist/internal/agent-runtime/approval-request.js +1 -0
- package/dist/internal/agent-runtime/approval-request.js.map +1 -0
- package/dist/internal/agent-runtime/approval-requirement.js +9 -0
- package/dist/internal/agent-runtime/approval-requirement.js.map +1 -0
- package/dist/internal/agent-runtime/continuation-state.js +26 -0
- package/dist/internal/agent-runtime/continuation-state.js.map +1 -0
- package/dist/internal/agent-runtime/interaction-suspension.js +25 -0
- package/dist/internal/agent-runtime/interaction-suspension.js.map +1 -0
- package/dist/internal/agent-runtime/memory-scope.js +8 -0
- package/dist/internal/agent-runtime/memory-scope.js.map +1 -0
- package/dist/internal/agent-runtime/memory.js +24 -0
- package/dist/internal/agent-runtime/memory.js.map +1 -0
- package/dist/internal/agent-runtime/prepared-tool-call.js +19 -0
- package/dist/internal/agent-runtime/prepared-tool-call.js.map +1 -0
- package/dist/internal/agent-runtime/retrieval.js +35 -0
- package/dist/internal/agent-runtime/retrieval.js.map +1 -0
- package/dist/internal/agent-runtime/run-options.js +9 -0
- package/dist/internal/agent-runtime/run-options.js.map +1 -0
- package/dist/internal/agent-runtime/run-validation.js +9 -0
- package/dist/internal/agent-runtime/run-validation.js.map +1 -0
- package/dist/internal/agent-runtime/stream-events.js +11 -0
- package/dist/internal/agent-runtime/stream-events.js.map +1 -0
- package/dist/internal/agent-runtime/structured-output.js +13 -0
- package/dist/internal/agent-runtime/structured-output.js.map +1 -0
- package/dist/internal/agent-runtime/tool-execution.js +55 -0
- package/dist/internal/agent-runtime/tool-execution.js.map +1 -0
- package/dist/internal/agent.d.ts +5 -5
- package/dist/internal/agent.js +93 -57
- package/dist/internal/agent.js.map +1 -1
- package/dist/internal/async-queue.js +7 -0
- package/dist/internal/async-queue.js.map +1 -0
- package/dist/internal/completion-request.js +11 -0
- package/dist/internal/completion-request.js.map +1 -0
- package/dist/internal/concurrency.js +7 -0
- package/dist/internal/concurrency.js.map +1 -0
- package/dist/internal/json-object.js +8 -0
- package/dist/internal/json-object.js.map +1 -0
- package/dist/internal/rag-text.js +7 -0
- package/dist/internal/rag-text.js.map +1 -0
- package/dist/internal/record.js +7 -0
- package/dist/internal/record.js.map +1 -0
- package/dist/internal/team-runtime/coordination.js +12 -0
- package/dist/internal/team-runtime/coordination.js.map +1 -0
- package/dist/internal/team-runtime/member.js +26 -0
- package/dist/internal/team-runtime/member.js.map +1 -0
- package/dist/internal/team-runtime/policy.js +7 -0
- package/dist/internal/team-runtime/policy.js.map +1 -0
- package/dist/internal/team-runtime/run.js +95 -0
- package/dist/internal/team-runtime/run.js.map +1 -0
- package/dist/internal/team-runtime/stream.js +9 -0
- package/dist/internal/team-runtime/stream.js.map +1 -0
- package/dist/internal/team-runtime/tools.js +17 -0
- package/dist/internal/team-runtime/tools.js.map +1 -0
- package/dist/internal/type-utils.js +1 -0
- package/dist/internal/type-utils.js.map +1 -0
- package/dist/internal/vector-search-options.js +9 -0
- package/dist/internal/vector-search-options.js.map +1 -0
- package/dist/mcp/index.js +3 -1
- package/dist/mcp/tool.js +7 -0
- package/dist/mcp/tool.js.map +1 -0
- package/dist/mcp/types.js +2 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/memory/assert.js +11 -0
- package/dist/memory/assert.js.map +1 -0
- package/dist/memory/compaction.js +26 -0
- package/dist/memory/compaction.js.map +1 -0
- package/dist/memory/errors.js +9 -0
- package/dist/memory/errors.js.map +1 -0
- package/dist/memory/index.js +23 -10
- package/dist/memory/options.js +10 -0
- package/dist/memory/options.js.map +1 -0
- package/dist/memory/scope-key.js +7 -0
- package/dist/memory/scope-key.js.map +1 -0
- package/dist/memory/types.js +2 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/{types-CRda8x7p.d.ts → middleware-CWjnMbiH.d.ts} +64 -5
- package/dist/model-call-options.js +1 -0
- package/dist/model-call-options.js.map +1 -0
- package/dist/model-listing/errors.js +7 -0
- package/dist/model-listing/errors.js.map +1 -0
- package/dist/model-listing/index.js +4 -13
- package/dist/model-listing/index.js.map +1 -1
- package/dist/model-listing/types.js +2 -0
- package/dist/model-listing/types.js.map +1 -0
- package/dist/observability/group.js +30 -0
- package/dist/observability/group.js.map +1 -0
- package/dist/observability/index.d.ts +4 -6
- package/dist/observability/index.js +16 -8
- package/dist/observability/snapshot.js +7 -0
- package/dist/observability/snapshot.js.map +1 -0
- package/dist/observability/types.js +1 -0
- package/dist/observability/types.js.map +1 -0
- package/dist/pipeline/errors.js +9 -0
- package/dist/pipeline/errors.js.map +1 -0
- package/dist/pipeline/graph.js +21 -0
- package/dist/pipeline/graph.js.map +1 -0
- package/dist/pipeline/index.d.ts +4 -6
- package/dist/pipeline/index.js +27 -805
- package/dist/pipeline/index.js.map +1 -1
- package/dist/pipeline/observability.js +15 -0
- package/dist/pipeline/observability.js.map +1 -0
- package/dist/pipeline/pipeline.js +30 -0
- package/dist/pipeline/pipeline.js.map +1 -0
- package/dist/pipeline/runtime.js +17 -0
- package/dist/pipeline/runtime.js.map +1 -0
- package/dist/pipeline/types.js +1 -0
- package/dist/pipeline/types.js.map +1 -0
- package/dist/retry.js +20 -0
- package/dist/retry.js.map +1 -0
- package/dist/schema/index.js +1 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/zod-schema.js +7 -0
- package/dist/schema/zod-schema.js.map +1 -0
- package/dist/skills/index.js +41 -12
- package/dist/skills/instructions.js +7 -0
- package/dist/skills/instructions.js.map +1 -0
- package/dist/skills/load.js +39 -0
- package/dist/skills/load.js.map +1 -0
- package/dist/skills/local.js +9 -0
- package/dist/skills/local.js.map +1 -0
- package/dist/skills/tools.js +37 -0
- package/dist/skills/tools.js.map +1 -0
- package/dist/skills/types.js +7 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/speech-generation/generate-speech.js +11 -0
- package/dist/speech-generation/generate-speech.js.map +1 -0
- package/dist/speech-generation/index.js +7 -4
- package/dist/speech-generation/types.js +2 -0
- package/dist/speech-generation/types.js.map +1 -0
- package/dist/streaming/index.js +4 -37
- package/dist/streaming/index.js.map +1 -1
- package/dist/streaming/readable-stream.js +8 -0
- package/dist/streaming/readable-stream.js.map +1 -0
- package/dist/{text-CmjXxakS.d.ts → text-GbW4WYMg.d.ts} +1 -1
- package/dist/tool/create-tool.js +14 -0
- package/dist/tool/create-tool.js.map +1 -0
- package/dist/tool/dynamic-tools.js +35 -0
- package/dist/tool/dynamic-tools.js.map +1 -0
- package/dist/tool/errors.js +11 -0
- package/dist/tool/errors.js.map +1 -0
- package/dist/tool/index.d.ts +3 -2
- package/dist/tool/index.js +41 -15
- package/dist/tool/middleware.js +7 -0
- package/dist/tool/middleware.js.map +1 -0
- package/dist/tool/question-tool.js +17 -0
- package/dist/tool/question-tool.js.map +1 -0
- package/dist/tool/skill-tool-marker.js +9 -0
- package/dist/tool/skill-tool-marker.js.map +1 -0
- package/dist/tool/think-tool.js +15 -0
- package/dist/tool/think-tool.js.map +1 -0
- package/dist/tool/tool.js +17 -0
- package/dist/tool/tool.js.map +1 -0
- package/dist/transcription/index.js +7 -4
- package/dist/transcription/transcribe.js +11 -0
- package/dist/transcription/transcribe.js.map +1 -0
- package/dist/transcription/types.js +2 -0
- package/dist/transcription/types.js.map +1 -0
- package/dist/{types-h0EL6Xn0.d.ts → types-Bqw0AuFl.d.ts} +6 -2
- package/dist/vector-store/filter.js +9 -0
- package/dist/vector-store/filter.js.map +1 -0
- package/dist/vector-store/index.js +31 -11
- package/dist/vector-store/ingest.js +19 -0
- package/dist/vector-store/ingest.js.map +1 -0
- package/dist/vector-store/lsh.js +7 -0
- package/dist/vector-store/lsh.js.map +1 -0
- package/dist/vector-store/retrieve.js +15 -0
- package/dist/vector-store/retrieve.js.map +1 -0
- package/dist/vector-store/types.js +1 -0
- package/dist/vector-store/types.js.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-2QZJTG2E.js.map +0 -1
- package/dist/chunk-3RWESPUG.js.map +0 -1
- package/dist/chunk-4UQALF5Y.js.map +0 -1
- package/dist/chunk-AZB6N7P4.js +0 -320
- package/dist/chunk-AZB6N7P4.js.map +0 -1
- package/dist/chunk-JLJMVRRE.js.map +0 -1
- package/dist/chunk-K5L7R7XM.js.map +0 -1
- package/dist/chunk-OI3LSMJG.js +0 -1545
- package/dist/chunk-OI3LSMJG.js.map +0 -1
- package/dist/chunk-QGX73TSQ.js.map +0 -1
- package/dist/chunk-XC3LVC4K.js +0 -753
- package/dist/chunk-XC3LVC4K.js.map +0 -1
- package/dist/chunk-XEVOC433.js.map +0 -1
- package/dist/chunk-XSV5C4R5.js +0 -400
- package/dist/chunk-XSV5C4R5.js.map +0 -1
- package/dist/chunk-XU54PLSD.js +0 -4786
- package/dist/chunk-XU54PLSD.js.map +0 -1
- package/dist/middleware-mY_lpjDp.d.ts +0 -59
- package/dist/type-utils-CtHVDRn_.d.ts +0 -6
- /package/dist/{chunk-YK4WAAS4.js.map → chunk-2NLINXRF.js.map} +0 -0
- /package/dist/{chunk-SPD4XVR7.js.map → chunk-2XSMGVBG.js.map} +0 -0
- /package/dist/{chunk-3XQGVDU5.js.map → chunk-4C7AXYOM.js.map} +0 -0
- /package/dist/{chunk-IZNOP6JG.js.map → chunk-4FIVU53H.js.map} +0 -0
- /package/dist/{chunk-7JLAIN6E.js.map → chunk-4ONUNWGC.js.map} +0 -0
- /package/dist/{chunk-KSKST3KP.js.map → chunk-H3H74RWJ.js.map} +0 -0
- /package/dist/{chunk-OJBFDBLG.js.map → chunk-LBYJPMHC.js.map} +0 -0
- /package/dist/{chunk-J6LVLV6P.js.map → chunk-PLDJCCVL.js.map} +0 -0
- /package/dist/{chunk-AHLKV6KP.js.map → chunk-WN6AVBO4.js.map} +0 -0
- /package/dist/{chunk-Q5BCNYED.js.map → chunk-XJRNBTIV.js.map} +0 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isJsonValue
|
|
3
|
+
} from "./chunk-4C7AXYOM.js";
|
|
4
|
+
|
|
5
|
+
// src/completion/provider-output-error.ts
|
|
6
|
+
var COMPLETION_PROVIDER_OUTPUT_ERROR_CODE = "ANVIA_COMPLETION_PROVIDER_OUTPUT";
|
|
7
|
+
var PROVIDER_OUTPUT_ERROR_KINDS = /* @__PURE__ */ new Set([
|
|
8
|
+
"malformed-tool-arguments",
|
|
9
|
+
"invalid-tool-arguments",
|
|
10
|
+
"invalid-stream-event",
|
|
11
|
+
"invalid-response",
|
|
12
|
+
"incomplete-stream",
|
|
13
|
+
"incomplete-tool-call",
|
|
14
|
+
"invalid-tool-call",
|
|
15
|
+
"truncated-tool-call",
|
|
16
|
+
"filtered-tool-call"
|
|
17
|
+
]);
|
|
18
|
+
var CompletionProviderOutputError = class extends Error {
|
|
19
|
+
code = COMPLETION_PROVIDER_OUTPUT_ERROR_CODE;
|
|
20
|
+
kind;
|
|
21
|
+
toolCallId;
|
|
22
|
+
finishReason;
|
|
23
|
+
usage;
|
|
24
|
+
constructor(options) {
|
|
25
|
+
assertProviderOutputErrorOptions(options);
|
|
26
|
+
super(providerOutputErrorMessage(options.kind, options.toolCallId));
|
|
27
|
+
this.name = "CompletionProviderOutputError";
|
|
28
|
+
this.kind = options.kind;
|
|
29
|
+
this.toolCallId = options.toolCallId;
|
|
30
|
+
this.finishReason = options.finishReason;
|
|
31
|
+
this.usage = options.usage === void 0 ? void 0 : copyUsage(options.usage);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
function assertCompletionResponseIntegrity(options) {
|
|
35
|
+
const { response } = options;
|
|
36
|
+
const toolCalls = response.choice.filter(
|
|
37
|
+
(content) => content.type === "tool-call"
|
|
38
|
+
);
|
|
39
|
+
if (toolCalls.length > 0) {
|
|
40
|
+
if (response.finishReason !== void 0 && !isCompletionFinishReason(response.finishReason)) {
|
|
41
|
+
throw new CompletionProviderOutputError({
|
|
42
|
+
kind: "invalid-tool-call",
|
|
43
|
+
usage: response.usage
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (response.finishReason === "length") {
|
|
47
|
+
throw new CompletionProviderOutputError({
|
|
48
|
+
kind: "truncated-tool-call",
|
|
49
|
+
finishReason: response.finishReason,
|
|
50
|
+
usage: response.usage
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (response.finishReason === "content-filter") {
|
|
54
|
+
throw new CompletionProviderOutputError({
|
|
55
|
+
kind: "filtered-tool-call",
|
|
56
|
+
finishReason: response.finishReason,
|
|
57
|
+
usage: response.usage
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (response.finishReason === "other") {
|
|
61
|
+
throw new CompletionProviderOutputError({
|
|
62
|
+
kind: "invalid-tool-call",
|
|
63
|
+
finishReason: response.finishReason,
|
|
64
|
+
usage: response.usage
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
} else if (response.finishReason === "tool-calls") {
|
|
68
|
+
throw new CompletionProviderOutputError({
|
|
69
|
+
kind: "invalid-tool-call",
|
|
70
|
+
finishReason: response.finishReason,
|
|
71
|
+
usage: response.usage
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const toolCallIds = /* @__PURE__ */ new Set();
|
|
75
|
+
const callIds = /* @__PURE__ */ new Set();
|
|
76
|
+
for (const toolCall of toolCalls) {
|
|
77
|
+
if (!isNonblankString(toolCall.toolCallId) || !isNonblankString(toolCall.toolName)) {
|
|
78
|
+
throw invalidToolCall(toolCall.toolCallId, response.usage);
|
|
79
|
+
}
|
|
80
|
+
if (toolCall.callId !== void 0 && !isNonblankString(toolCall.callId)) {
|
|
81
|
+
throw invalidToolCall(toolCall.toolCallId, response.usage);
|
|
82
|
+
}
|
|
83
|
+
if (toolCallIds.has(toolCall.toolCallId)) {
|
|
84
|
+
throw invalidToolCall(toolCall.toolCallId, response.usage);
|
|
85
|
+
}
|
|
86
|
+
toolCallIds.add(toolCall.toolCallId);
|
|
87
|
+
if (toolCall.callId !== void 0) {
|
|
88
|
+
if (callIds.has(toolCall.callId)) {
|
|
89
|
+
throw invalidToolCall(toolCall.toolCallId, response.usage);
|
|
90
|
+
}
|
|
91
|
+
callIds.add(toolCall.callId);
|
|
92
|
+
}
|
|
93
|
+
if (!isJsonValue(toolCall.input)) {
|
|
94
|
+
throw new CompletionProviderOutputError({
|
|
95
|
+
kind: "invalid-tool-arguments",
|
|
96
|
+
toolCallId: toolCall.toolCallId,
|
|
97
|
+
usage: response.usage
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function invalidToolCall(toolCallId, usage) {
|
|
103
|
+
return new CompletionProviderOutputError({
|
|
104
|
+
kind: "invalid-tool-call",
|
|
105
|
+
toolCallId: isNonblankString(toolCallId) ? toolCallId : void 0,
|
|
106
|
+
usage
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function assertProviderOutputErrorOptions(options) {
|
|
110
|
+
if (typeof options !== "object" || options === null) {
|
|
111
|
+
throw new TypeError("CompletionProviderOutputError options must be an object.");
|
|
112
|
+
}
|
|
113
|
+
if (!PROVIDER_OUTPUT_ERROR_KINDS.has(options.kind)) {
|
|
114
|
+
throw new TypeError("CompletionProviderOutputError kind is invalid.");
|
|
115
|
+
}
|
|
116
|
+
if (options.toolCallId !== void 0 && !isNonblankString(options.toolCallId)) {
|
|
117
|
+
throw new TypeError("CompletionProviderOutputError toolCallId must be a non-empty string.");
|
|
118
|
+
}
|
|
119
|
+
if (options.finishReason !== void 0 && !isCompletionFinishReason(options.finishReason)) {
|
|
120
|
+
throw new TypeError("CompletionProviderOutputError finishReason is invalid.");
|
|
121
|
+
}
|
|
122
|
+
if (options.kind === "truncated-tool-call" && options.finishReason !== "length") {
|
|
123
|
+
throw new TypeError('CompletionProviderOutputError truncated-tool-call requires "length".');
|
|
124
|
+
}
|
|
125
|
+
if (options.kind === "filtered-tool-call" && options.finishReason !== "content-filter") {
|
|
126
|
+
throw new TypeError(
|
|
127
|
+
'CompletionProviderOutputError filtered-tool-call requires "content-filter".'
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
if (options.finishReason === "length" && options.kind !== "truncated-tool-call") {
|
|
131
|
+
throw new TypeError(
|
|
132
|
+
'CompletionProviderOutputError finishReason "length" requires truncated-tool-call.'
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
if (options.finishReason === "content-filter" && options.kind !== "filtered-tool-call") {
|
|
136
|
+
throw new TypeError(
|
|
137
|
+
'CompletionProviderOutputError finishReason "content-filter" requires filtered-tool-call.'
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
if (options.usage !== void 0) {
|
|
141
|
+
assertUsage(options.usage);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function providerOutputErrorMessage(kind, toolCallId) {
|
|
145
|
+
const toolCall = toolCallId === void 0 ? "tool call" : `tool call ${JSON.stringify(displayId(toolCallId))}`;
|
|
146
|
+
if (kind === "malformed-tool-arguments") {
|
|
147
|
+
return `Completion provider returned ${toolCall} with malformed JSON arguments.`;
|
|
148
|
+
}
|
|
149
|
+
if (kind === "invalid-tool-arguments") {
|
|
150
|
+
return `Completion provider returned ${toolCall} with arguments that are not a JSON value.`;
|
|
151
|
+
}
|
|
152
|
+
if (kind === "invalid-stream-event") {
|
|
153
|
+
return "Completion provider returned an invalid stream event.";
|
|
154
|
+
}
|
|
155
|
+
if (kind === "invalid-response") {
|
|
156
|
+
return "Completion provider returned a response that cannot be consumed safely.";
|
|
157
|
+
}
|
|
158
|
+
if (kind === "incomplete-tool-call") {
|
|
159
|
+
return "Completion provider stream ended before its tool call was complete.";
|
|
160
|
+
}
|
|
161
|
+
if (kind === "incomplete-stream") {
|
|
162
|
+
return "Completion provider stream ended without a terminal response.";
|
|
163
|
+
}
|
|
164
|
+
if (kind === "truncated-tool-call") {
|
|
165
|
+
return "Completion provider stopped at its output limit before a tool call could be consumed safely.";
|
|
166
|
+
}
|
|
167
|
+
if (kind === "filtered-tool-call") {
|
|
168
|
+
return "Completion provider content filtering prevented a tool call from being consumed safely.";
|
|
169
|
+
}
|
|
170
|
+
return `Completion provider returned an invalid ${toolCall}.`;
|
|
171
|
+
}
|
|
172
|
+
function displayId(value) {
|
|
173
|
+
let sanitized = "";
|
|
174
|
+
for (const character of value) {
|
|
175
|
+
const code = character.charCodeAt(0);
|
|
176
|
+
sanitized += code <= 31 || code === 127 ? "\uFFFD" : character;
|
|
177
|
+
}
|
|
178
|
+
return sanitized.length <= 128 ? sanitized : `${sanitized.slice(0, 127)}\u2026`;
|
|
179
|
+
}
|
|
180
|
+
function isNonblankString(value) {
|
|
181
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
182
|
+
}
|
|
183
|
+
function isCompletionFinishReason(value) {
|
|
184
|
+
return value === "stop" || value === "length" || value === "content-filter" || value === "tool-calls" || value === "other";
|
|
185
|
+
}
|
|
186
|
+
function assertUsage(usage) {
|
|
187
|
+
for (const value of [
|
|
188
|
+
usage.inputTokens,
|
|
189
|
+
usage.outputTokens,
|
|
190
|
+
usage.totalTokens,
|
|
191
|
+
usage.cachedInputTokens,
|
|
192
|
+
usage.cacheCreationInputTokens
|
|
193
|
+
]) {
|
|
194
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
195
|
+
throw new TypeError("CompletionProviderOutputError usage must contain finite token counts.");
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (usage.details !== void 0) {
|
|
199
|
+
for (const value of Object.values(usage.details)) {
|
|
200
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
201
|
+
throw new TypeError(
|
|
202
|
+
"CompletionProviderOutputError usage details must contain finite token counts."
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function copyUsage(usage) {
|
|
209
|
+
const copied = {
|
|
210
|
+
inputTokens: usage.inputTokens,
|
|
211
|
+
outputTokens: usage.outputTokens,
|
|
212
|
+
totalTokens: usage.totalTokens,
|
|
213
|
+
cachedInputTokens: usage.cachedInputTokens,
|
|
214
|
+
cacheCreationInputTokens: usage.cacheCreationInputTokens
|
|
215
|
+
};
|
|
216
|
+
if (usage.details !== void 0) copied.details = { ...usage.details };
|
|
217
|
+
return copied;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export {
|
|
221
|
+
COMPLETION_PROVIDER_OUTPUT_ERROR_CODE,
|
|
222
|
+
CompletionProviderOutputError,
|
|
223
|
+
assertCompletionResponseIntegrity
|
|
224
|
+
};
|
|
225
|
+
//# sourceMappingURL=chunk-XQV3XNVT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/completion/provider-output-error.ts"],"sourcesContent":["import { isJsonValue } from \"./json\";\nimport type { CompletionFinishReason, CompletionResponse, ToolCallPart, Usage } from \"./types\";\n\nexport const COMPLETION_PROVIDER_OUTPUT_ERROR_CODE = \"ANVIA_COMPLETION_PROVIDER_OUTPUT\" as const;\n\nexport type CompletionProviderOutputErrorKind =\n | \"malformed-tool-arguments\"\n | \"invalid-tool-arguments\"\n | \"invalid-stream-event\"\n | \"invalid-response\"\n | \"incomplete-stream\"\n | \"incomplete-tool-call\"\n | \"invalid-tool-call\"\n | \"truncated-tool-call\"\n | \"filtered-tool-call\";\n\ntype CompletionProviderOutputErrorBaseOptions = Readonly<{\n toolCallId?: string | undefined;\n usage?: Usage | undefined;\n}>;\n\nexport type CompletionProviderOutputErrorOptions =\n | Readonly<\n CompletionProviderOutputErrorBaseOptions & {\n kind: \"truncated-tool-call\";\n finishReason: \"length\";\n }\n >\n | Readonly<\n CompletionProviderOutputErrorBaseOptions & {\n kind: \"filtered-tool-call\";\n finishReason: \"content-filter\";\n }\n >\n | Readonly<\n CompletionProviderOutputErrorBaseOptions & {\n kind: Exclude<\n CompletionProviderOutputErrorKind,\n \"truncated-tool-call\" | \"filtered-tool-call\"\n >;\n finishReason?: Exclude<CompletionFinishReason, \"length\" | \"content-filter\"> | undefined;\n }\n >;\n\nconst PROVIDER_OUTPUT_ERROR_KINDS = new Set<CompletionProviderOutputErrorKind>([\n \"malformed-tool-arguments\",\n \"invalid-tool-arguments\",\n \"invalid-stream-event\",\n \"invalid-response\",\n \"incomplete-stream\",\n \"incomplete-tool-call\",\n \"invalid-tool-call\",\n \"truncated-tool-call\",\n \"filtered-tool-call\",\n]);\n\n/**\n * A provider returned incomplete output or a tool call that cannot be consumed safely.\n *\n * The error intentionally excludes raw model arguments. Provider output can contain\n * credentials or other sensitive values and must not become log metadata by default.\n */\nexport class CompletionProviderOutputError extends Error {\n readonly code = COMPLETION_PROVIDER_OUTPUT_ERROR_CODE;\n readonly kind: CompletionProviderOutputErrorKind;\n readonly toolCallId: string | undefined;\n readonly finishReason: CompletionFinishReason | undefined;\n readonly usage: Usage | undefined;\n\n constructor(options: CompletionProviderOutputErrorOptions) {\n assertProviderOutputErrorOptions(options);\n super(providerOutputErrorMessage(options.kind, options.toolCallId));\n this.name = \"CompletionProviderOutputError\";\n this.kind = options.kind;\n this.toolCallId = options.toolCallId;\n this.finishReason = options.finishReason;\n this.usage = options.usage === undefined ? undefined : copyUsage(options.usage);\n }\n}\n\nexport function assertCompletionResponseIntegrity(\n options: Readonly<{ response: CompletionResponse }>,\n): void {\n const { response } = options;\n const toolCalls = response.choice.filter(\n (content): content is ToolCallPart => content.type === \"tool-call\",\n );\n\n if (toolCalls.length > 0) {\n if (response.finishReason !== undefined && !isCompletionFinishReason(response.finishReason)) {\n throw new CompletionProviderOutputError({\n kind: \"invalid-tool-call\",\n usage: response.usage,\n });\n }\n if (response.finishReason === \"length\") {\n throw new CompletionProviderOutputError({\n kind: \"truncated-tool-call\",\n finishReason: response.finishReason,\n usage: response.usage,\n });\n }\n if (response.finishReason === \"content-filter\") {\n throw new CompletionProviderOutputError({\n kind: \"filtered-tool-call\",\n finishReason: response.finishReason,\n usage: response.usage,\n });\n }\n if (response.finishReason === \"other\") {\n throw new CompletionProviderOutputError({\n kind: \"invalid-tool-call\",\n finishReason: response.finishReason,\n usage: response.usage,\n });\n }\n } else if (response.finishReason === \"tool-calls\") {\n throw new CompletionProviderOutputError({\n kind: \"invalid-tool-call\",\n finishReason: response.finishReason,\n usage: response.usage,\n });\n }\n\n const toolCallIds = new Set<string>();\n const callIds = new Set<string>();\n for (const toolCall of toolCalls) {\n if (!isNonblankString(toolCall.toolCallId) || !isNonblankString(toolCall.toolName)) {\n throw invalidToolCall(toolCall.toolCallId, response.usage);\n }\n if (toolCall.callId !== undefined && !isNonblankString(toolCall.callId)) {\n throw invalidToolCall(toolCall.toolCallId, response.usage);\n }\n if (toolCallIds.has(toolCall.toolCallId)) {\n throw invalidToolCall(toolCall.toolCallId, response.usage);\n }\n toolCallIds.add(toolCall.toolCallId);\n if (toolCall.callId !== undefined) {\n if (callIds.has(toolCall.callId)) {\n throw invalidToolCall(toolCall.toolCallId, response.usage);\n }\n callIds.add(toolCall.callId);\n }\n if (!isJsonValue(toolCall.input)) {\n throw new CompletionProviderOutputError({\n kind: \"invalid-tool-arguments\",\n toolCallId: toolCall.toolCallId,\n usage: response.usage,\n });\n }\n }\n}\n\nfunction invalidToolCall(toolCallId: unknown, usage: Usage): CompletionProviderOutputError {\n return new CompletionProviderOutputError({\n kind: \"invalid-tool-call\",\n toolCallId: isNonblankString(toolCallId) ? toolCallId : undefined,\n usage,\n });\n}\n\nfunction assertProviderOutputErrorOptions(options: CompletionProviderOutputErrorOptions): void {\n if (typeof options !== \"object\" || options === null) {\n throw new TypeError(\"CompletionProviderOutputError options must be an object.\");\n }\n if (!PROVIDER_OUTPUT_ERROR_KINDS.has(options.kind)) {\n throw new TypeError(\"CompletionProviderOutputError kind is invalid.\");\n }\n if (options.toolCallId !== undefined && !isNonblankString(options.toolCallId)) {\n throw new TypeError(\"CompletionProviderOutputError toolCallId must be a non-empty string.\");\n }\n if (options.finishReason !== undefined && !isCompletionFinishReason(options.finishReason)) {\n throw new TypeError(\"CompletionProviderOutputError finishReason is invalid.\");\n }\n if (options.kind === \"truncated-tool-call\" && options.finishReason !== \"length\") {\n throw new TypeError('CompletionProviderOutputError truncated-tool-call requires \"length\".');\n }\n if (options.kind === \"filtered-tool-call\" && options.finishReason !== \"content-filter\") {\n throw new TypeError(\n 'CompletionProviderOutputError filtered-tool-call requires \"content-filter\".',\n );\n }\n if (options.finishReason === \"length\" && options.kind !== \"truncated-tool-call\") {\n throw new TypeError(\n 'CompletionProviderOutputError finishReason \"length\" requires truncated-tool-call.',\n );\n }\n if (options.finishReason === \"content-filter\" && options.kind !== \"filtered-tool-call\") {\n throw new TypeError(\n 'CompletionProviderOutputError finishReason \"content-filter\" requires filtered-tool-call.',\n );\n }\n if (options.usage !== undefined) {\n assertUsage(options.usage);\n }\n}\n\nfunction providerOutputErrorMessage(\n kind: CompletionProviderOutputErrorKind,\n toolCallId: string | undefined,\n): string {\n const toolCall =\n toolCallId === undefined ? \"tool call\" : `tool call ${JSON.stringify(displayId(toolCallId))}`;\n if (kind === \"malformed-tool-arguments\") {\n return `Completion provider returned ${toolCall} with malformed JSON arguments.`;\n }\n if (kind === \"invalid-tool-arguments\") {\n return `Completion provider returned ${toolCall} with arguments that are not a JSON value.`;\n }\n if (kind === \"invalid-stream-event\") {\n return \"Completion provider returned an invalid stream event.\";\n }\n if (kind === \"invalid-response\") {\n return \"Completion provider returned a response that cannot be consumed safely.\";\n }\n if (kind === \"incomplete-tool-call\") {\n return \"Completion provider stream ended before its tool call was complete.\";\n }\n if (kind === \"incomplete-stream\") {\n return \"Completion provider stream ended without a terminal response.\";\n }\n if (kind === \"truncated-tool-call\") {\n return \"Completion provider stopped at its output limit before a tool call could be consumed safely.\";\n }\n if (kind === \"filtered-tool-call\") {\n return \"Completion provider content filtering prevented a tool call from being consumed safely.\";\n }\n return `Completion provider returned an invalid ${toolCall}.`;\n}\n\nfunction displayId(value: string): string {\n let sanitized = \"\";\n for (const character of value) {\n const code = character.charCodeAt(0);\n sanitized += code <= 31 || code === 127 ? \"�\" : character;\n }\n return sanitized.length <= 128 ? sanitized : `${sanitized.slice(0, 127)}…`;\n}\n\nfunction isNonblankString(value: unknown): value is string {\n return typeof value === \"string\" && value.trim().length > 0;\n}\n\nfunction isCompletionFinishReason(value: unknown): value is CompletionFinishReason {\n return (\n value === \"stop\" ||\n value === \"length\" ||\n value === \"content-filter\" ||\n value === \"tool-calls\" ||\n value === \"other\"\n );\n}\n\nfunction assertUsage(usage: Usage): void {\n for (const value of [\n usage.inputTokens,\n usage.outputTokens,\n usage.totalTokens,\n usage.cachedInputTokens,\n usage.cacheCreationInputTokens,\n ]) {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) {\n throw new TypeError(\"CompletionProviderOutputError usage must contain finite token counts.\");\n }\n }\n if (usage.details !== undefined) {\n for (const value of Object.values(usage.details)) {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) {\n throw new TypeError(\n \"CompletionProviderOutputError usage details must contain finite token counts.\",\n );\n }\n }\n }\n}\n\nfunction copyUsage(usage: Usage): Usage {\n const copied: Usage = {\n inputTokens: usage.inputTokens,\n outputTokens: usage.outputTokens,\n totalTokens: usage.totalTokens,\n cachedInputTokens: usage.cachedInputTokens,\n cacheCreationInputTokens: usage.cacheCreationInputTokens,\n };\n if (usage.details !== undefined) copied.details = { ...usage.details };\n return copied;\n}\n"],"mappings":";;;;;AAGO,IAAM,wCAAwC;AAyCrD,IAAM,8BAA8B,oBAAI,IAAuC;AAAA,EAC7E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,IAAM,gCAAN,cAA4C,MAAM;AAAA,EAC9C,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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|
+
assertToolApprovalRequirement
|
|
3
|
+
} from "./chunk-YZVFIW5D.js";
|
|
4
|
+
import {
|
|
5
|
+
attachPreparedToolOwner,
|
|
6
|
+
preparedToolInput,
|
|
7
|
+
withoutPreparedToolInput
|
|
8
|
+
} from "./chunk-MHOJJYDK.js";
|
|
9
|
+
import {
|
|
10
|
+
toProviderJsonSchema
|
|
11
|
+
} from "./chunk-SQAAVYJG.js";
|
|
12
|
+
|
|
13
|
+
// src/tool/create-tool.ts
|
|
14
|
+
function createTool(options) {
|
|
15
|
+
const { name, description, inputSchema, outputSchema, execute } = options;
|
|
16
|
+
const requiresApproval = snapshotApprovalRequirement(options.requiresApproval);
|
|
17
|
+
if (requiresApproval !== void 0) {
|
|
18
|
+
assertToolApprovalRequirement(requiresApproval, { allowFunction: true });
|
|
19
|
+
}
|
|
20
|
+
const parameters = toProviderJsonSchema(inputSchema);
|
|
21
|
+
const preparedInputOwner = {};
|
|
22
|
+
const definition = () => ({
|
|
23
|
+
name,
|
|
24
|
+
description,
|
|
25
|
+
parameters: globalThis.structuredClone(parameters)
|
|
26
|
+
});
|
|
27
|
+
const call = async (args, context = {}) => {
|
|
28
|
+
const prepared = preparedToolInput(context, preparedInputOwner);
|
|
29
|
+
const parsedArgs = prepared === void 0 ? inputSchema.parse(args) : prepared.input;
|
|
30
|
+
const executionContext = prepared === void 0 ? context : withoutPreparedToolInput(context);
|
|
31
|
+
const result = await execute(parsedArgs, executionContext);
|
|
32
|
+
return outputSchema === void 0 ? result : outputSchema.parse(result);
|
|
33
|
+
};
|
|
34
|
+
const parseInput = (args) => inputSchema.parse(args);
|
|
35
|
+
const tool = {
|
|
36
|
+
name,
|
|
37
|
+
definition,
|
|
38
|
+
call,
|
|
39
|
+
parseInput
|
|
40
|
+
};
|
|
41
|
+
if (requiresApproval !== void 0) {
|
|
42
|
+
Object.defineProperty(tool, "requiresApproval", {
|
|
43
|
+
configurable: false,
|
|
44
|
+
enumerable: true,
|
|
45
|
+
value: requiresApproval,
|
|
46
|
+
writable: false
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return attachPreparedToolOwner(tool, preparedInputOwner);
|
|
50
|
+
}
|
|
51
|
+
function snapshotApprovalRequirement(requirement) {
|
|
52
|
+
return typeof requirement === "object" && requirement !== null ? Object.freeze({ ...requirement }) : requirement;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
createTool
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=chunk-XV3DH5GC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tool/create-tool.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport { assertToolApprovalRequirement } from \"../internal/agent-runtime/approval-requirement\";\nimport {\n attachPreparedToolOwner,\n preparedToolInput,\n withoutPreparedToolInput,\n} from \"../internal/agent-runtime/prepared-tool-call\";\nimport { toProviderJsonSchema, type ZodSchema } from \"../schema/zod-schema\";\nimport type { Tool, ToolCallContext, ToolRequiresApproval } from \"./tool\";\n\nexport type CreateToolOptions<\n InputSchema extends ZodSchema,\n OutputSchema extends ZodSchema | undefined = undefined,\n Output = unknown,\n> = {\n name: string;\n description: string;\n inputSchema: InputSchema;\n outputSchema?: OutputSchema;\n requiresApproval?: ToolRequiresApproval<z.output<InputSchema>>;\n execute(\n args: z.output<InputSchema>,\n context: ToolCallContext,\n ): OutputSchema extends ZodSchema\n ? z.input<OutputSchema> | Promise<z.input<OutputSchema>>\n : Output | Promise<Output>;\n};\n\ntype CreateToolOutput<\n OutputSchema extends ZodSchema | undefined,\n Output,\n> = OutputSchema extends ZodSchema ? z.output<OutputSchema> : Output;\n\nexport function createTool<InputSchema extends ZodSchema, Output = unknown>(\n options: CreateToolOptions<InputSchema, undefined, Output> & { outputSchema?: undefined },\n): Tool<z.output<InputSchema>, Output>;\n\nexport function createTool<InputSchema extends ZodSchema, OutputSchema extends ZodSchema>(\n options: CreateToolOptions<InputSchema, OutputSchema>,\n): Tool<z.output<InputSchema>, z.output<OutputSchema>>;\n\nexport function createTool<\n InputSchema extends ZodSchema,\n OutputSchema extends ZodSchema | undefined = undefined,\n Output = unknown,\n>(\n options: CreateToolOptions<InputSchema, OutputSchema, Output>,\n): Tool<z.output<InputSchema>, CreateToolOutput<OutputSchema, Output>> {\n const { name, description, inputSchema, outputSchema, execute } = options;\n const requiresApproval = snapshotApprovalRequirement(options.requiresApproval);\n if (requiresApproval !== undefined) {\n assertToolApprovalRequirement(requiresApproval, { allowFunction: true });\n }\n const parameters = toProviderJsonSchema(inputSchema);\n const preparedInputOwner = {};\n const definition = () => ({\n name,\n description,\n parameters: globalThis.structuredClone(parameters),\n });\n const call = async (\n args: z.output<InputSchema>,\n context: ToolCallContext = {},\n ): Promise<CreateToolOutput<OutputSchema, Output>> => {\n const prepared = preparedToolInput(context, preparedInputOwner);\n const parsedArgs =\n prepared === undefined ? inputSchema.parse(args) : (prepared.input as z.output<InputSchema>);\n const executionContext = prepared === undefined ? context : withoutPreparedToolInput(context);\n const result = await execute(parsedArgs, executionContext);\n return (outputSchema === undefined ? result : outputSchema.parse(result)) as CreateToolOutput<\n OutputSchema,\n Output\n >;\n };\n const parseInput = (args: unknown): z.output<InputSchema> => inputSchema.parse(args);\n\n const tool: Tool<z.output<InputSchema>, CreateToolOutput<OutputSchema, Output>> = {\n name,\n definition,\n call,\n parseInput,\n };\n if (requiresApproval !== undefined) {\n Object.defineProperty(tool, \"requiresApproval\", {\n configurable: false,\n enumerable: true,\n value: requiresApproval,\n writable: false,\n });\n }\n return attachPreparedToolOwner(tool, preparedInputOwner);\n}\n\nfunction snapshotApprovalRequirement<Args>(\n requirement: ToolRequiresApproval<Args> | undefined,\n): ToolRequiresApproval<Args> | undefined {\n return typeof requirement === \"object\" && requirement !== null\n ? Object.freeze({ ...requirement })\n : requirement;\n}\n"],"mappings":";;;;;;;;;;;;;AAyCO,SAAS,WAKd,SACqE;AACrE,QAAM,EAAE,MAAM,aAAa,aAAa,cAAc,QAAQ,IA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import {
|
|
8
|
+
extract
|
|
9
|
+
} from "./chunk-UOGM62JL.js";
|
|
10
|
+
import {
|
|
11
|
+
evalValuesEqual,
|
|
12
|
+
formatValue
|
|
13
|
+
} from "./chunk-ZYXMWEL4.js";
|
|
14
|
+
import {
|
|
15
|
+
EvalOutcome
|
|
16
|
+
} from "./chunk-EJR6VVB3.js";
|
|
17
|
+
import {
|
|
18
|
+
cosineSimilarity
|
|
19
|
+
} from "./chunk-7F53DOML.js";
|
|
20
|
+
import {
|
|
21
|
+
embedText
|
|
22
|
+
} from "./chunk-HHMLE3TZ.js";
|
|
23
|
+
|
|
24
|
+
// src/evals/metrics.ts
|
|
25
|
+
import { z } from "zod";
|
|
26
|
+
function exactMatch(options = {}) {
|
|
27
|
+
return {
|
|
28
|
+
name: options.name ?? "exact_match",
|
|
29
|
+
required: options.required ?? true,
|
|
30
|
+
dataType: "BOOLEAN",
|
|
31
|
+
direction: "higher_is_better",
|
|
32
|
+
threshold: 1,
|
|
33
|
+
async evaluate(args) {
|
|
34
|
+
const actual = await resolveActual(options.actual, args);
|
|
35
|
+
const expected = await resolveExpected(options.expected, args);
|
|
36
|
+
if (expected === void 0) {
|
|
37
|
+
return EvalOutcome.invalid("No expected value provided for exact match.");
|
|
38
|
+
}
|
|
39
|
+
const passed = evalValuesEqual(actual, expected);
|
|
40
|
+
return passed ? EvalOutcome.pass(true) : EvalOutcome.fail(false, { comment: `Expected ${formatValue(expected)}.` });
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function contains(options = {}) {
|
|
45
|
+
return {
|
|
46
|
+
name: options.name ?? "contains",
|
|
47
|
+
required: options.required ?? true,
|
|
48
|
+
dataType: "BOOLEAN",
|
|
49
|
+
direction: "higher_is_better",
|
|
50
|
+
threshold: 1,
|
|
51
|
+
async evaluate(args) {
|
|
52
|
+
const actual = await resolveActualText(options.actual, args);
|
|
53
|
+
const expected = await resolveExpected(options.expected, args);
|
|
54
|
+
if (expected === void 0) {
|
|
55
|
+
return EvalOutcome.invalid("No expected value provided for contains.");
|
|
56
|
+
}
|
|
57
|
+
if (typeof expected !== "string" && !(expected instanceof RegExp)) {
|
|
58
|
+
return EvalOutcome.invalid("Contains expected value must be a string or RegExp.");
|
|
59
|
+
}
|
|
60
|
+
const passed = expected instanceof RegExp ? regexMatches(expected, actual) : actual.includes(expected);
|
|
61
|
+
return passed ? EvalOutcome.pass(true) : EvalOutcome.fail(false, { comment: `Output did not contain ${String(expected)}.` });
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function notContains(options = {}) {
|
|
66
|
+
return {
|
|
67
|
+
name: options.name ?? "not_contains",
|
|
68
|
+
required: options.required ?? true,
|
|
69
|
+
dataType: "BOOLEAN",
|
|
70
|
+
direction: "higher_is_better",
|
|
71
|
+
threshold: 1,
|
|
72
|
+
async evaluate(args) {
|
|
73
|
+
const actual = await resolveActualText(options.actual, args);
|
|
74
|
+
const expected = await resolveExpected(options.expected, args);
|
|
75
|
+
if (expected === void 0) {
|
|
76
|
+
return EvalOutcome.invalid("No expected value provided for notContains.");
|
|
77
|
+
}
|
|
78
|
+
if (typeof expected !== "string" && !(expected instanceof RegExp)) {
|
|
79
|
+
return EvalOutcome.invalid("notContains expected value must be a string or RegExp.");
|
|
80
|
+
}
|
|
81
|
+
const found = textExpectationMatches(expected, actual);
|
|
82
|
+
return found ? EvalOutcome.fail(false, {
|
|
83
|
+
comment: `Output contained forbidden value ${String(expected)}.`
|
|
84
|
+
}) : EvalOutcome.pass(true);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function containsAll(options) {
|
|
89
|
+
return containsListMetric("contains_all", "all", options);
|
|
90
|
+
}
|
|
91
|
+
function containsAny(options) {
|
|
92
|
+
return containsListMetric("contains_any", "any", options);
|
|
93
|
+
}
|
|
94
|
+
function containsListMetric(defaultName, mode, options) {
|
|
95
|
+
return {
|
|
96
|
+
name: options.name ?? defaultName,
|
|
97
|
+
required: options.required ?? true,
|
|
98
|
+
dataType: "BOOLEAN",
|
|
99
|
+
direction: "higher_is_better",
|
|
100
|
+
threshold: 1,
|
|
101
|
+
async evaluate(args) {
|
|
102
|
+
const actual = await resolveActualText(options.actual, args);
|
|
103
|
+
const expected = await resolveExpected(options.expected, args);
|
|
104
|
+
if (!Array.isArray(expected) || expected.length === 0) {
|
|
105
|
+
return EvalOutcome.invalid(`${defaultName} expected value must be a non-empty array.`);
|
|
106
|
+
}
|
|
107
|
+
if (expected.some((value) => typeof value !== "string" && !(value instanceof RegExp))) {
|
|
108
|
+
return EvalOutcome.invalid(`${defaultName} expected values must be strings or RegExp.`);
|
|
109
|
+
}
|
|
110
|
+
const matches2 = expected.map((value) => textExpectationMatches(value, actual));
|
|
111
|
+
const passed = mode === "all" ? matches2.every(Boolean) : matches2.some(Boolean);
|
|
112
|
+
if (passed) return EvalOutcome.pass(true);
|
|
113
|
+
const missing = expected.filter((_, index) => !matches2[index]).map(String);
|
|
114
|
+
const comment = mode === "all" ? `Output was missing: ${missing.join(", ")}.` : `Output matched none of: ${expected.map(String).join(", ")}.`;
|
|
115
|
+
return EvalOutcome.fail(false, { comment });
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function matches(options) {
|
|
120
|
+
return regexMetric("matches", false, options);
|
|
121
|
+
}
|
|
122
|
+
function doesNotMatch(options) {
|
|
123
|
+
return regexMetric("does_not_match", true, options);
|
|
124
|
+
}
|
|
125
|
+
function regexMetric(defaultName, negate, options) {
|
|
126
|
+
return {
|
|
127
|
+
name: options.name ?? defaultName,
|
|
128
|
+
required: options.required ?? true,
|
|
129
|
+
dataType: "BOOLEAN",
|
|
130
|
+
direction: "higher_is_better",
|
|
131
|
+
threshold: 1,
|
|
132
|
+
async evaluate(args) {
|
|
133
|
+
const actual = await resolveActualText(options.actual, args);
|
|
134
|
+
const expected = await resolveExpected(options.expected, args);
|
|
135
|
+
if (!(expected instanceof RegExp)) {
|
|
136
|
+
return EvalOutcome.invalid(`${defaultName} expected value must be a RegExp.`);
|
|
137
|
+
}
|
|
138
|
+
const matched = regexMatches(expected, actual);
|
|
139
|
+
const passed = negate ? !matched : matched;
|
|
140
|
+
return passed ? EvalOutcome.pass(true) : EvalOutcome.fail(false, {
|
|
141
|
+
comment: negate ? `Output matched forbidden pattern ${String(expected)}.` : `Output did not match ${String(expected)}.`
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function maxLength(options) {
|
|
147
|
+
return {
|
|
148
|
+
name: options.name ?? "max_length",
|
|
149
|
+
required: options.required ?? true,
|
|
150
|
+
dataType: "BOOLEAN",
|
|
151
|
+
direction: "higher_is_better",
|
|
152
|
+
threshold: 1,
|
|
153
|
+
async evaluate(args) {
|
|
154
|
+
const actual = await resolveActualText(options.actual, args);
|
|
155
|
+
const max = await resolveOption(options.max, args);
|
|
156
|
+
if (!Number.isInteger(max) || max < 0) {
|
|
157
|
+
return EvalOutcome.invalid("maxLength max must be a non-negative integer.");
|
|
158
|
+
}
|
|
159
|
+
const length = Array.from(actual).length;
|
|
160
|
+
return length <= max ? EvalOutcome.pass(true) : EvalOutcome.fail(false, { comment: `Output length ${length} exceeded maximum ${max}.` });
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function requiredFields(options) {
|
|
165
|
+
return {
|
|
166
|
+
name: options.name ?? "required_fields",
|
|
167
|
+
required: options.required ?? true,
|
|
168
|
+
dataType: "BOOLEAN",
|
|
169
|
+
direction: "higher_is_better",
|
|
170
|
+
threshold: 1,
|
|
171
|
+
async evaluate(args) {
|
|
172
|
+
const actual = await resolveActual(options.actual, args);
|
|
173
|
+
const expected = await resolveOption(options.expected, args);
|
|
174
|
+
if (!Array.isArray(expected) || expected.length === 0 || expected.some((field) => typeof field !== "string" || field.length === 0)) {
|
|
175
|
+
return EvalOutcome.invalid(
|
|
176
|
+
"requiredFields expected value must be a non-empty string array."
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
if (typeof actual !== "object" || actual === null || Array.isArray(actual)) {
|
|
180
|
+
return EvalOutcome.invalid("requiredFields actual value must be an object.");
|
|
181
|
+
}
|
|
182
|
+
const missing = expected.filter((field) => !Object.hasOwn(actual, field));
|
|
183
|
+
return missing.length === 0 ? EvalOutcome.pass(true) : EvalOutcome.fail(false, { comment: `Missing required fields: ${missing.join(", ")}.` });
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function regexMatches(pattern, text) {
|
|
188
|
+
pattern.lastIndex = 0;
|
|
189
|
+
const matched = pattern.test(text);
|
|
190
|
+
pattern.lastIndex = 0;
|
|
191
|
+
return matched;
|
|
192
|
+
}
|
|
193
|
+
function textExpectationMatches(expected, actual) {
|
|
194
|
+
return expected instanceof RegExp ? regexMatches(expected, actual) : actual.includes(expected);
|
|
195
|
+
}
|
|
196
|
+
async function resolveOption(value, args) {
|
|
197
|
+
return typeof value === "function" ? value(args) : value;
|
|
198
|
+
}
|
|
199
|
+
function semanticSimilarity(options) {
|
|
200
|
+
const threshold = unitInterval(options.threshold, "semanticSimilarity threshold");
|
|
201
|
+
return {
|
|
202
|
+
name: options.name ?? "semantic_similarity",
|
|
203
|
+
required: options.required ?? true,
|
|
204
|
+
dataType: "NUMERIC",
|
|
205
|
+
direction: "higher_is_better",
|
|
206
|
+
threshold,
|
|
207
|
+
async evaluate(args) {
|
|
208
|
+
const actual = await resolveActualText(options.actual, args);
|
|
209
|
+
const expected = await resolveExpected(options.expected, args);
|
|
210
|
+
if (expected === void 0) {
|
|
211
|
+
return EvalOutcome.invalid("No expected value provided for semantic similarity.");
|
|
212
|
+
}
|
|
213
|
+
if (typeof expected !== "string") {
|
|
214
|
+
return EvalOutcome.invalid("Semantic similarity expected value must be a string.");
|
|
215
|
+
}
|
|
216
|
+
const [{ embedding: actualEmbedding }, { embedding: expectedEmbedding }] = await Promise.all([
|
|
217
|
+
embedText({ model: options.model, text: actual }),
|
|
218
|
+
embedText({ model: options.model, text: expected })
|
|
219
|
+
]);
|
|
220
|
+
const score = cosineSimilarity(actualEmbedding.vector, expectedEmbedding.vector);
|
|
221
|
+
return score >= threshold ? EvalOutcome.pass(score) : EvalOutcome.fail(score, { comment: `Similarity below threshold ${threshold}.` });
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function llmJudge(options) {
|
|
226
|
+
const retries = extractionRetries(options.retries);
|
|
227
|
+
return {
|
|
228
|
+
name: options.name ?? "llm_judge",
|
|
229
|
+
required: options.required ?? true,
|
|
230
|
+
async evaluate(args) {
|
|
231
|
+
try {
|
|
232
|
+
const result = await extract({
|
|
233
|
+
model: options.model,
|
|
234
|
+
outputSchema: options.schema,
|
|
235
|
+
instructions: options.instructions ?? "Judge the eval case by the requested schema. Submit the judgment using the schema.",
|
|
236
|
+
text: await resolveJudgePrompt(options.prompt, args),
|
|
237
|
+
retries
|
|
238
|
+
});
|
|
239
|
+
return options.passes(result.output) ? EvalOutcome.pass(result.output, { usage: result.usage }) : EvalOutcome.fail(result.output, { usage: result.usage });
|
|
240
|
+
} catch (error) {
|
|
241
|
+
return EvalOutcome.fromError(error);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function llmScore(options) {
|
|
247
|
+
const criteria = Array.isArray(options.criteria) ? options.criteria.join("\n") : options.criteria;
|
|
248
|
+
if (criteria.trim().length === 0) throw new TypeError("llmScore criteria must not be empty.");
|
|
249
|
+
const threshold = unitInterval(options.threshold, "llmScore threshold");
|
|
250
|
+
const retries = extractionRetries(options.retries);
|
|
251
|
+
return {
|
|
252
|
+
name: options.name ?? "llm_score",
|
|
253
|
+
required: options.required ?? true,
|
|
254
|
+
dataType: "NUMERIC",
|
|
255
|
+
projectScore: (score) => score.score,
|
|
256
|
+
direction: "higher_is_better",
|
|
257
|
+
threshold,
|
|
258
|
+
async evaluate(args) {
|
|
259
|
+
try {
|
|
260
|
+
const result = await extract({
|
|
261
|
+
model: options.model,
|
|
262
|
+
outputSchema: z.object({
|
|
263
|
+
score: z.number(),
|
|
264
|
+
feedback: z.string()
|
|
265
|
+
}),
|
|
266
|
+
instructions: options.instructions ?? `Score the eval case against these criteria:
|
|
267
|
+
${criteria}
|
|
268
|
+
|
|
269
|
+
Return a score between 0 and 1 and brief feedback.`,
|
|
270
|
+
text: await resolveJudgePrompt(options.prompt, args),
|
|
271
|
+
retries
|
|
272
|
+
});
|
|
273
|
+
const score = result.output;
|
|
274
|
+
if (score.score < 0 || score.score > 1) {
|
|
275
|
+
return EvalOutcome.invalid(`Score ${score.score} outside valid range [0, 1].`, {
|
|
276
|
+
score,
|
|
277
|
+
usage: result.usage
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
return score.score >= threshold ? EvalOutcome.pass(score, { comment: score.feedback, usage: result.usage }) : EvalOutcome.fail(score, { comment: score.feedback, usage: result.usage });
|
|
281
|
+
} catch (error) {
|
|
282
|
+
return EvalOutcome.fromError(error);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function extractionRetries(retries) {
|
|
288
|
+
const retryCount = retries ?? 0;
|
|
289
|
+
if (!Number.isInteger(retryCount) || retryCount < 0) {
|
|
290
|
+
throw new RangeError("Eval metric retries must be a non-negative integer.");
|
|
291
|
+
}
|
|
292
|
+
if (retryCount === 0) {
|
|
293
|
+
return void 0;
|
|
294
|
+
}
|
|
295
|
+
return { maxAttempts: retryCount + 1 };
|
|
296
|
+
}
|
|
297
|
+
function unitInterval(value, label) {
|
|
298
|
+
if (!Number.isFinite(value) || value < 0 || value > 1) {
|
|
299
|
+
throw new RangeError(`${label} must be between 0 and 1.`);
|
|
300
|
+
}
|
|
301
|
+
return value;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export {
|
|
305
|
+
exactMatch,
|
|
306
|
+
contains,
|
|
307
|
+
notContains,
|
|
308
|
+
containsAll,
|
|
309
|
+
containsAny,
|
|
310
|
+
matches,
|
|
311
|
+
doesNotMatch,
|
|
312
|
+
maxLength,
|
|
313
|
+
requiredFields,
|
|
314
|
+
semanticSimilarity,
|
|
315
|
+
llmJudge,
|
|
316
|
+
llmScore
|
|
317
|
+
};
|
|
318
|
+
//# sourceMappingURL=chunk-Y7JTHNCU.js.map
|