Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix: do not fail eval queue on LLM Api errors (#3939)

Max Deichmannf87adc209ae6
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c6b336abf7..204170751b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -101,7 +101,7 @@ importers:
'@vercel/style-guide':
specifier: ^6.0.0
eslint-config-next:
specifier: ^14.2.15
@@ -569,7 +569,7 @@ importers:
version: 0.27.4
langchain:
specifier: ^0.3.2
lodash:
specifier: ^4.17.21
version: 4.17.21
@@ -685,7 +685,7 @@ importers:
'@testing-library/jest-dom':
specifier: ^6.4.6
'@testing-library/react':
specifier: ^15.0.7
@@ -848,6 +848,9 @@ importers:
dotenv:
specifier: ^16.4.5
version: 16.4.5
+ exponential-backoff:
+ specifier: ^3.1.1
+ version: 3.1.1
express:
specifier: ^4.21.0
version: 4.21.0
@@ -11697,7 +11700,7 @@ snapshots:
'@aws-sdk/client-sso-oidc': 3.675.0(@aws-sdk/[email protected])
'@aws-sdk/client-sts': 3.675.0
'@aws-sdk/core': 3.667.0
- '@aws-sdk/credential-provider-node': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-node': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@aws-sdk/middleware-bucket-endpoint': 3.667.0
'@aws-sdk/middleware-expect-continue': 3.667.0
'@aws-sdk/middleware-flexible-checksums': 3.669.0
@@ -11803,7 +11806,7 @@ snapshots:
'@aws-crypto/sha256-js': 5.2.0
'@aws-sdk/client-sts': 3.675.0
'@aws-sdk/core': 3.667.0
- '@aws-sdk/credential-provider-node': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-node': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@aws-sdk/middleware-host-header': 3.667.0
'@aws-sdk/middleware-logger': 3.667.0
'@aws-sdk/middleware-recursion-detection': 3.667.0
@@ -12093,7 +12096,7 @@ snapshots:
'@aws-sdk/credential-provider-env': 3.667.0
'@aws-sdk/credential-provider-http': 3.667.0
'@aws-sdk/credential-provider-process': 3.667.0
- '@aws-sdk/credential-provider-sso': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/credential-provider-sso': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
'@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
'@aws-sdk/types': 3.667.0
'@smithy/credential-provider-imds': 3.2.4
@@ -12105,14 +12108,14 @@ snapshots:
- '@aws-sdk/client-sso-oidc'
- aws-crt
dependencies:
'@aws-sdk/client-sts': 3.675.0
'@aws-sdk/core': 3.667.0
'@aws-sdk/credential-provider-env': 3.667.0
'@aws-sdk/credential-provider-http': 3.667.0
'@aws-sdk/credential-provider-process': 3.667.0
- '@aws-sdk/credential-provider-sso': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/credential-provider-sso': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
'@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
'@aws-sdk/types': 3.667.0
'@smithy/credential-provider-imds': 3.2.4
@@ -12123,17 +12126,15 @@ snapshots:
transitivePeerDependencies:
- '@aws-sdk/client-sso-oidc'
- aws-crt
- optional: true
+ '@aws-sdk/[email protected]':
dependencies:
- '@aws-sdk/client-sts': 3.675.0
- '@aws-sdk/core': 3.667.0
'@aws-sdk/credential-provider-env': 3.667.0
'@aws-sdk/credential-provider-http': 3.667.0
+ '@aws-sdk/credential-provider-ini': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@aws-sdk/credential-provider-process': 3.667.0
- '@aws-sdk/credential-provider-sso': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
- '@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-sso': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
'@aws-sdk/types': 3.667.0
'@smithy/credential-provider-imds': 3.2.4
'@smithy/property-provider': 3.1.7
@@ -12142,7 +12143,9 @@ snapshots:
tslib: 2.6.3
transitivePeerDependencies:
- '@aws-sdk/client-sso-oidc'
+ - '@aws-sdk/client-sts'
- aws-crt
+ optional: true
dependencies:
@@ -12169,7 +12172,7 @@ snapshots:
'@aws-sdk/credential-provider-http': 3.667.0
'@aws-sdk/credential-provider-ini': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@aws-sdk/credential-provider-process': 3.667.0
- '@aws-sdk/credential-provider-sso': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/credential-provider-sso': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
'@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
'@aws-sdk/types': 3.667.0
'@smithy/credential-provider-imds': 3.2.4
@@ -12182,33 +12185,13 @@ snapshots:
- '@aws-sdk/client-sts'
- aws-crt
- dependencies:
- '@aws-sdk/credential-provider-env': 3.667.0
- '@aws-sdk/credential-provider-http': 3.667.0
- '@aws-sdk/credential-provider-ini': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
- '@aws-sdk/credential-provider-process': 3.667.0
- '@aws-sdk/credential-provider-sso': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
- '@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
- '@aws-sdk/types': 3.667.0
- '@smithy/credential-provider-imds': 3.2.4
- '@smithy/property-provider': 3.1.7
- '@smithy/shared-ini-file-loader': 3.1.8
- '@smithy/types': 3.5.0
- tslib: 2.6.3
- transitivePeerDependencies:
- - '@aws-sdk/client-sso-oidc'
- - '@aws-sdk/client-sts'
- - aws-crt
- optional: true
-
dependencies:
'@aws-sdk/credential-provider-env': 3.667.0
'@aws-sdk/credential-provider-http': 3.667.0
- '@aws-sdk/credential-provider-ini': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-ini': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@aws-sdk/credential-provider-process': 3.667.0
- '@aws-sdk/credential-provider-sso': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/credential-provider-sso': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
'@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
'@aws-sdk/types': 3.667.0
'@smithy/credential-provider-imds': 3.2.4
@@ -12225,9 +12208,9 @@ snapshots:
dependencies:
'@aws-sdk/credential-provider-env': 3.667.0
'@aws-sdk/credential-provider-http': 3.667.0
- '@aws-sdk/credential-provider-ini': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-ini': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
'@aws-sdk/credential-provider-process': 3.667.0
- '@aws-sdk/credential-provider-sso': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/credential-provider-sso': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
'@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
'@aws-sdk/types': 3.667.0
'@smithy/credential-provider-imds': 3.2.4
@@ -12263,11 +12246,11 @@ snapshots:
- '@aws-sdk/client-sso-oidc'
- aws-crt
- '@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected]))':
+ '@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected]))':
dependencies:
'@aws-sdk/client-sso': 3.668.0
'@aws-sdk/core': 3.667.0
- '@aws-sdk/token-providers': 3.667.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/token-providers': 3.667.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
'@aws-sdk/types': 3.667.0
'@smithy/property-provider': 3.1.7
'@smithy/shared-ini-file-loader': 3.1.8
@@ -12277,11 +12260,11 @@ snapshots:
- '@aws-sdk/client-sso-oidc'
- aws-crt
- '@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected]))':
+ '@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected]))':
dependencies:
'@aws-sdk/client-sso': 3.675.0
'@aws-sdk/core': 3.667.0
- '@aws-sdk/token-providers': 3.667.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/token-providers': 3.667.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
'@aws-sdk/types': 3.667.0
'@smithy/property-provider': 3.1.7
'@smithy/shared-ini-file-loader': 3.1.8
@@ -12484,7 +12467,7 @@ snapshots:
'@smithy/types': 3.5.0
tslib: 2.6.3
- '@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected]))':
+ '@aws-sdk/[email protected](@aws-sdk/[email protected](@aws-sdk/[email protected]))':
dependencies:
'@aws-sdk/client-sso-oidc': 3.675.0(@aws-sdk/[email protected])
'@aws-sdk/types': 3.667.0
@@ -13501,6 +13484,42 @@ snapshots:
jest-util: 29.7.0
slash: 3.0.0
+ dependencies:
+ '@jest/console': 29.7.0
+ '@jest/reporters': 29.7.0
+ '@jest/test-result': 29.7.0
+ '@jest/transform': 29.7.0
+ '@jest/types': 29.6.3
+ '@types/node': 20.14.8
+ ansi-escapes: 4.3.2
+ chalk: 4.1.2
+ ci-info: 3.9.0
+ exit: 0.1.2
+ graceful-fs: 4.2.11
+ jest-changed-files: 29.7.0
+ jest-config: 29.7.0(@types/[email protected])
+ jest-haste-map: 29.7.0
+ jest-message-util: 29.7.0
+ jest-regex-util: 29.6.3
+ jest-resolve: 29.7.0
+ jest-resolve-dependencies: 29.7.0
+ jest-runner: 29.7.0
+ jest-runtime: 29.7.0
+ jest-snapshot: 29.7.0
+ jest-util: 29.7.0
+ jest-validate: 29.7.0
+ jest-watcher: 29.7.0
+ micromatch: 4.0.8
+ pretty-format: 29.7.0
+ slash: 3.0.0
+ strip-ansi: 6.0.1
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - supports-color
+ - ts-node
+ optional: true
+
dependencies:
'@jest/console': 29.7.0
@@ -13715,12 +13734,12 @@ snapshots:
- '@aws-sdk/client-sts'
- aws-crt
dependencies:
'@aws-sdk/client-bedrock-agent-runtime': 3.668.0
'@aws-sdk/client-bedrock-runtime': 3.668.0
'@aws-sdk/client-kendra': 3.668.0
- '@aws-sdk/credential-provider-node': 3.668.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-node': 3.668.0
'@langchain/core': 0.3.9([email protected]([email protected]))
zod: 3.23.8
zod-to-json-schema: 3.23.5([email protected])
@@ -16354,7 +16373,7 @@ snapshots:
lz-string: 1.5.0
pretty-format: 27.5.1
dependencies:
'@adobe/css-tools': 4.4.0
'@babel/runtime': 7.24.7
@@ -16368,7 +16387,7 @@ snapshots:
'@jest/globals': 29.7.0
'@types/jest': 29.5.12
+ vitest: 2.1.2(@types/[email protected])
dependencies:
@@ -17020,7 +17039,7 @@ snapshots:
'@ungap/[email protected]': {}
dependencies:
'@babel/core': 7.24.3
'@babel/eslint-parser': 7.24.1(@babel/[email protected])([email protected])
@@ -17029,18 +17048,18 @@ snapshots:
'@typescript-eslint/parser': 7.12.0([email protected])([email protected])
eslint-config-prettier: 9.1.0([email protected])
+ eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
eslint-plugin-eslint-comments: 3.2.0([email protected])
eslint-plugin-jsx-a11y: 6.8.0([email protected])
eslint-plugin-react: 7.34.1([email protected])
eslint-plugin-react-hooks: 4.6.0([email protected])
eslint-plugin-testing-library: 6.2.0([email protected])([email protected])
eslint-plugin-tsdoc: 0.2.17
eslint-plugin-unicorn: 51.0.1([email protected])
prettier-plugin-packagejson: 2.4.12([email protected])
optionalDependencies:
'@next/eslint-plugin-next': 14.2.15
@@ -17061,16 +17080,6 @@ snapshots:
chai: 5.1.1
tinyrainbow: 1.2.0
- dependencies:
- '@vitest/spy': 2.1.2
- estree-walker: 3.0.3
- magic-string: 0.30.11
- optionalDependencies:
- msw: 2.4.9([email protected])
- vite: 5.2.14(@types/[email protected])([email protected])
- optional: true
-
dependencies:
'@vitest/spy': 2.1.2
@@ -17080,14 +17089,13 @@ snapshots:
msw: 2.4.9([email protected])
vite: 5.2.14(@types/[email protected])([email protected])
dependencies:
'@vitest/spy': 2.1.2
estree-walker: 3.0.3
magic-string: 0.30.11
optionalDependencies:
- msw: 2.4.9([email protected])
- vite: 5.2.14(@types/[email protected])([email protected])
+ vite: 5.2.14(@types/[email protected])
optional: true
'@vitest/[email protected]':
@@ -18118,13 +18126,13 @@ snapshots:
crc-32: 1.2.2
readable-stream: 3.6.2
dependencies:
'@jest/types': 29.6.3
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
+ jest-config: 29.7.0(@types/[email protected])
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@@ -18132,14 +18140,15 @@ snapshots:
- babel-plugin-macros
- supports-color
- ts-node
+ optional: true
dependencies:
'@jest/types': 29.6.3
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@@ -18147,7 +18156,6 @@ snapshots:
- babel-plugin-macros
- supports-color
- ts-node
- optional: true
@@ -18911,7 +18919,7 @@ snapshots:
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])
eslint-plugin-jsx-a11y: 6.8.0([email protected])
eslint-plugin-react: 7.34.1([email protected])
eslint-plugin-react-hooks: 4.6.0([email protected])
@@ -18928,7 +18936,7 @@ snapshots:
dependencies:
eslint: 8.57.0
+ eslint-plugin-import: 2.29.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])
eslint-plugin-n: 16.6.2([email protected])
eslint-plugin-promise: 6.4.0([email protected])
@@ -18939,7 +18947,7 @@ snapshots:
dependencies:
dependencies:
@@ -18955,7 +18963,7 @@ snapshots:
enhanced-resolve: 5.17.1
eslint: 8.57.0
fast-glob: 3.3.2
get-tsconfig: 4.8.1
is-core-module: 2.15.1
@@ -18966,13 +18974,13 @@ snapshots:
- eslint-import-resolver-webpack
- supports-color
dependencies:
debug: 4.3.7([email protected])
enhanced-resolve: 5.17.1
eslint: 8.57.0
fast-glob: 3.3.2
get-tsconfig: 4.8.1
is-core-module: 2.15.1
@@ -18994,14 +19002,14 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 7.12.0([email protected])([email protected])
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
+ eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
transitivePeerDependencies:
- supports-color
@@ -19018,7 +19026,34 @@ snapshots:
eslint: 8.57.0
ignore: 5.3.1
+ dependencies:
+ array-includes: 3.1.7
+ array.prototype.findlastindex: 1.2.4
+ array.prototype.flat: 1.3.2
+ array.prototype.flatmap: 1.3.2
+ debug: 3.2.7
+ doctrine: 2.1.0
+ eslint: 8.57.0
+ eslint-import-resolver-node: 0.3.9
+ hasown: 2.0.2
+ is-core-module: 2.15.1
+ is-glob: 4.0.3
+ minimatch: 3.1.2
+ object.fromentries: 2.0.8
+ object.groupby: 1.0.3
+ object.values: 1.2.0
+ semver: 6.3.1
+ tsconfig-paths: 3.15.0
+ optionalDependencies:
+ '@typescript-eslint/parser': 7.12.0([email protected])([email protected])
+ transitivePeerDependencies:
+ - eslint-import-resolver-typescript
+ - eslint-import-resolver-webpack
+ - supports-color
+
dependencies:
array-includes: 3.1.7
array.prototype.findlastindex: 1.2.4
@@ -19028,7 +19063,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
hasown: 2.0.2
is-core-module: 2.15.1
is-glob: 4.0.3
@@ -19045,13 +19080,13 @@ snapshots:
- eslint-import-resolver-webpack
- supports-color
dependencies:
'@typescript-eslint/utils': 5.62.0([email protected])([email protected])
eslint: 8.57.0
optionalDependencies:
'@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
- jest: 29.7.0(@types/[email protected])([email protected])
+ jest: 29.7.0
transitivePeerDependencies:
- supports-color
- typescript
@@ -19093,12 +19128,12 @@ snapshots:
dependencies:
eslint: 8.57.0
globals: 13.24.0
optionalDependencies:
dependencies:
@@ -19180,13 +19215,13 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@typescript-eslint/utils': 7.3.1([email protected])([email protected])
eslint: 8.57.0
optionalDependencies:
'@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
transitivePeerDependencies:
- supports-color
- typescript
@@ -20406,16 +20441,16 @@ snapshots:
- babel-plugin-macros
- supports-color
dependencies:
+ '@jest/core': 29.7.0
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
+ create-jest: 29.7.0
exit: 0.1.2
import-local: 3.1.0
+ jest-config: 29.7.0(@types/[email protected])
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
@@ -20424,17 +20459,18 @@ snapshots:
- babel-plugin-macros
- supports-color
- ts-node
+ optional: true
dependencies:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
- create-jest: 29.7.0(@types/[email protected])([email protected])
exit: 0.1.2
import-local: 3.1.0
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
@@ -20443,7 +20479,6 @@ snapshots:
- babel-plugin-macros
- supports-color
- ts-node
- optional: true
dependencies:
@@ -20476,6 +20511,37 @@ snapshots:
- babel-plugin-macros
- supports-color
+ dependencies:
+ '@babel/core': 7.24.3
+ '@jest/test-sequencer': 29.7.0
+ '@jest/types': 29.6.3
+ babel-jest: 29.7.0(@babel/[email protected])
+ chalk: 4.1.2
+ ci-info: 3.9.0
+ deepmerge: 4.3.1
+ glob: 7.2.3
+ graceful-fs: 4.2.11
+ jest-circus: 29.7.0([email protected])
+ jest-environment-node: 29.7.0
+ jest-get-type: 29.6.3
+ jest-regex-util: 29.6.3
+ jest-resolve: 29.7.0
+ jest-runner: 29.7.0
+ jest-util: 29.7.0
+ jest-validate: 29.7.0
+ micromatch: 4.0.8
+ parse-json: 5.2.0
+ pretty-format: 29.7.0
+ slash: 3.0.0
+ strip-json-comments: 3.1.1
+ optionalDependencies:
+ '@types/node': 20.14.8
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - supports-color
+ optional: true
+
dependencies:
'@babel/core': 7.24.3
@@ -20743,30 +20809,30 @@ snapshots:
merge-stream: 2.0.0
supports-color: 8.1.1
dependencies:
+ '@jest/core': 29.7.0
'@jest/types': 29.6.3
import-local: 3.1.0
+ jest-cli: 29.7.0
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
- supports-color
- ts-node
+ optional: true
dependencies:
'@jest/types': 29.6.3
import-local: 3.1.0
- jest-cli: 29.7.0(@types/[email protected])([email protected])
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
- supports-color
- ts-node
- optional: true
@@ -20950,7 +21016,7 @@ snapshots:
- encoding
- openai
dependencies:
'@langchain/core': 0.3.9([email protected]([email protected]))
'@langchain/openai': 0.3.0(@langchain/[email protected]([email protected]([email protected])))
@@ -20967,7 +21033,7 @@ snapshots:
zod-to-json-schema: 3.23.5([email protected])
optionalDependencies:
'@langchain/anthropic': 0.3.1(@langchain/[email protected]([email protected]([email protected])))
- '@langchain/aws': 0.1.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])(@langchain/[email protected]([email protected]([email protected])))
+ '@langchain/aws': 0.1.0(@langchain/[email protected]([email protected]([email protected])))
axios: 1.7.7
handlebars: 4.7.8
transitivePeerDependencies:
@@ -24141,12 +24207,12 @@ snapshots:
d3-time: 3.1.0
d3-timer: 3.0.1
dependencies:
cac: 6.7.14
debug: 4.3.7([email protected])
pathe: 1.1.2
- vite: 5.2.14(@types/[email protected])([email protected])
+ vite: 5.2.14(@types/[email protected])
transitivePeerDependencies:
- '@types/node'
- less
@@ -24174,24 +24240,7 @@ snapshots:
- supports-color
- terser
- dependencies:
- cac: 6.7.14
- debug: 4.3.7([email protected])
- pathe: 1.1.2
- vite: 5.2.14(@types/[email protected])([email protected])
- transitivePeerDependencies:
- - '@types/node'
- - less
- - lightningcss
- - sass
- - stylus
- - sugarss
- - supports-color
- - terser
- optional: true
-
dependencies:
esbuild: 0.20.2
postcss: 8.4.47
@@ -24199,7 +24248,6 @@ snapshots:
optionalDependencies:
'@types/node': 20.10.5
fsevents: 2.3.3
- terser: 5.34.1
optional: true
@@ -24212,21 +24260,10 @@ snapshots:
fsevents: 2.3.3
terser: 5.34.1
- dependencies:
- esbuild: 0.20.2
- postcss: 8.4.47
- rollup: 4.13.0
- optionalDependencies:
- '@types/node': 20.14.8
- fsevents: 2.3.3
- terser: 5.34.1
- optional: true
-
dependencies:
'@vitest/expect': 2.1.2
+ '@vitest/mocker': 2.1.2(@vitest/[email protected])([email protected](@types/[email protected]))
'@vitest/pretty-format': 2.1.2
'@vitest/runner': 2.1.2
'@vitest/snapshot': 2.1.2
@@ -24241,12 +24278,11 @@ snapshots:
tinyexec: 0.3.0
tinypool: 1.0.1
tinyrainbow: 1.2.0
- vite: 5.2.14(@types/[email protected])([email protected])
- vite-node: 2.1.2(@types/[email protected])([email protected])
+ vite: 5.2.14(@types/[email protected])
+ vite-node: 2.1.2(@types/[email protected])
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 20.10.5
- jsdom: 20.0.3
transitivePeerDependencies:
- less
- lightningcss
@@ -24292,41 +24328,6 @@ snapshots:
- supports-color
- terser
- dependencies:
- '@vitest/expect': 2.1.2
- '@vitest/pretty-format': 2.1.2
- '@vitest/runner': 2.1.2
- '@vitest/snapshot': 2.1.2
- '@vitest/spy': 2.1.2
- '@vitest/utils': 2.1.2
- chai: 5.1.1
- debug: 4.3.7([email protected])
- magic-string: 0.30.11
- pathe: 1.1.2
- std-env: 3.7.0
- tinybench: 2.9.0
- tinyexec: 0.3.0
- tinypool: 1.0.1
- tinyrainbow: 1.2.0
- vite: 5.2.14(@types/[email protected])([email protected])
- vite-node: 2.1.2(@types/[email protected])([email protected])
- why-is-node-running: 2.3.0
- optionalDependencies:
- '@types/node': 20.14.8
- jsdom: 20.0.3
- transitivePeerDependencies:
- - less
- - lightningcss
- - msw
- - sass
- - stylus
- - sugarss
- - supports-color
- - terser
- optional: true
-
diff --git a/worker/package.json b/worker/package.json
index 5b0a0b42d4..09560ed5b3 100644
--- a/worker/package.json
+++ b/worker/package.json
@@ -41,6 +41,7 @@
"dd-trace": "^5.23.1",
"decimal.js": "^10.4.3",
"dotenv": "^16.4.5",
+ "exponential-backoff": "^3.1.1",
"express": "^4.21.0",
"handlebars": "^4.7.8",
"helmet": "^7.1.0",
diff --git a/worker/src/features/evaluation/evalService.ts b/worker/src/features/evaluation/evalService.ts
index 194c5e1a74..14e6cafbaa 100644
--- a/worker/src/features/evaluation/evalService.ts
+++ b/worker/src/features/evaluation/evalService.ts
@@ -22,12 +22,13 @@ import {
InvalidRequestError,
variableMappingList,
ZodModelConfig,
+ EvalTemplate,
} from "@langfuse/shared";
import { decrypt } from "@langfuse/shared/encryption";
import { kyselyPrisma, prisma } from "@langfuse/shared/src/db";
-
import { fetchLLMCompletion, logger } from "@langfuse/shared/src/server";
import { EvalExecutionQueue } from "../../queues/evalQueue";
+import { backOff } from "exponential-backoff";
// this function is used to determine which eval jobs to create for a given trace
// there might be multiple eval jobs to create for a single trace
@@ -48,7 +49,7 @@ export const createEvalJobs = async ({
return;
}
logger.info(
- `Creating eval jobs for trace ${event.traceId} on project ${event.projectId}`,
+ `Creating eval jobs for trace ${event.traceId} on project ${event.projectId}`
);
for (const config of configs) {
@@ -63,7 +64,7 @@ export const createEvalJobs = async ({
const condition = tableColumnsToSqlFilterAndPrefix(
validatedFilter,
evalTableCols,
- "traces",
+ "traces"
);
const joinedQuery = Prisma.sql`
@@ -87,7 +88,7 @@ export const createEvalJobs = async ({
// if we matched a trace, we might want to create a job
if (traces.length > 0) {
logger.info(
- `Eval job for config ${config.id} matched trace ids ${JSON.stringify(traces.map((t) => t.id))}`,
+ `Eval job for config ${config.id} matched trace ids ${JSON.stringify(traces.map((t) => t.id))}`
);
const jobExecutionId = randomUUID();
@@ -95,7 +96,7 @@ export const createEvalJobs = async ({
// deduplication: if a job exists already for a trace event, we do not create a new one.
if (existingJob.length > 0) {
logger.info(
- `Eval job for config ${config.id} and trace ${event.traceId} already exists`,
+ `Eval job for config ${config.id} and trace ${event.traceId} already exists`
);
continue;
}
@@ -107,14 +108,14 @@ export const createEvalJobs = async ({
const random = Math.random();
if (random > parseFloat(config.sampling)) {
logger.info(
- `Eval job for config ${config.id} and trace ${event.traceId} was sampled out`,
+ `Eval job for config ${config.id} and trace ${event.traceId} was sampled out`
);
continue;
}
}
logger.info(
- `Creating eval job for config ${config.id} and trace ${event.traceId}`,
+ `Creating eval job for config ${config.id} and trace ${event.traceId}`
);
await prisma.jobExecution.create({
@@ -150,7 +151,7 @@ export const createEvalJobs = async ({
delay: config.delay, // milliseconds
removeOnComplete: true,
removeOnFail: 1_000,
- },
+ }
);
} else {
// if we do not have a match, and execution exists, we mark the job as cancelled
@@ -158,7 +159,7 @@ export const createEvalJobs = async ({
logger.info(`Eval job for config ${config.id} did not match trace`);
if (existingJob.length > 0) {
logger.info(
- `Cancelling eval job for config ${config.id} and trace ${event.traceId}`,
+ `Cancelling eval job for config ${config.id} and trace ${event.traceId}`
);
await kyselyPrisma.$kysely
.updateTable("job_executions")
@@ -178,7 +179,7 @@ export const evaluate = async ({
event: z.infer<typeof EvalExecutionEvent>;
}) => {
logger.info(
- `Evaluating job ${event.jobExecutionId} for project ${event.projectId}`,
+ `Evaluating job ${event.jobExecutionId} for project ${event.projectId}`
);
// first, fetch all the context required for the evaluation
const job = await kyselyPrisma.$kysely
@@ -211,20 +212,29 @@ export const evaluate = async ({
.where("project_id", "=", event.projectId)
.executeTakeFirstOrThrow();
- const template = await kyselyPrisma.$kysely
- .selectFrom("eval_templates")
- .selectAll()
- .where("id", "=", config.eval_template_id)
- .where("project_id", "=", event.projectId)
- .executeTakeFirstOrThrow();
+ if (!config || !config.eval_template_id) {
+ logger.error(
+ `Eval template not found for config ${config.eval_template_id}`
+ );
+ throw new InvalidRequestError(
+ `Eval template not found for config ${config.eval_template_id}`
+ );
+ }
+
+ const template = await prisma.evalTemplate.findFirstOrThrow({
+ where: {
+ id: config.eval_template_id,
+ projectId: event.projectId,
+ },
+ });
logger.info(
- `Evaluating job ${job.id} for project ${event.projectId} with template ${template.id}. Searching for context...`,
+ `Evaluating job ${job.id} for project ${event.projectId} with template ${template.id}. Searching for context...`
);
// selectedcolumnid is not safe to use, needs validation in extractVariablesFromTrace()
const parsedVariableMapping = variableMappingList.parse(
- config.variable_mapping,
+ config.variable_mapping
);
// extract the variables which need to be inserted into the prompt
@@ -232,22 +242,22 @@ export const evaluate = async ({
event.projectId,
template.vars,
job.job_input_trace_id,
- parsedVariableMapping,
+ parsedVariableMapping
);
logger.debug(
- `Evaluating job ${event.jobExecutionId} extracted variables ${JSON.stringify(mappingResult)} `,
+ `Evaluating job ${event.jobExecutionId} extracted variables ${JSON.stringify(mappingResult)} `
);
// compile the prompt and send out the LLM request
const prompt = compileHandlebarString(template.prompt, {
...Object.fromEntries(
- mappingResult.map(({ var: key, value }) => [key, value]),
+ mappingResult.map(({ var: key, value }) => [key, value])
),
});
logger.debug(
- `Evaluating job ${event.jobExecutionId} compiled prompt ${prompt}`,
+ `Evaluating job ${event.jobExecutionId} compiled prompt ${prompt}`
);
const parsedOutputSchema = z
@@ -255,7 +265,7 @@ export const evaluate = async ({
score: z.string(),
reasoning: z.string(),
})
- .parse(template.output_schema);
+ .parse(template.outputSchema);
if (!parsedOutputSchema) {
throw new InvalidRequestError("Output schema not found");
@@ -266,7 +276,7 @@ export const evaluate = async ({
score: z.number().describe(parsedOutputSchema.score),
});
- const modelParams = ZodModelConfig.parse(template.model_params);
+ const modelParams = ZodModelConfig.parse(template.modelParams);
// the apiKey.secret_key must never be printed to the console or returned to the client.
const apiKey = await prisma.llmApiKeys.findFirst({
@@ -280,43 +290,30 @@ export const evaluate = async ({
if (!parsedKey.success) {
// this will fail the eval execution if a user deletes the API key.
logger.error(
- `Evaluating job ${event.jobExecutionId} did not find API key for provider ${template.provider} and project ${event.projectId}. Eval will fail. ${parsedKey.error}`,
+ `Evaluating job ${event.jobExecutionId} did not find API key for provider ${template.provider} and project ${event.projectId}. Eval will fail. ${parsedKey.error}`
);
throw new LangfuseNotFoundError(
- `API key for provider ${template.provider} and project ${event.projectId} not found.`,
+ `API key for provider ${template.provider} and project ${event.projectId} not found.`
);
}
- let completion: string;
- try {
- completion = await fetchLLMCompletion({
- streaming: false,
- apiKey: decrypt(parsedKey.data.secretKey), // decrypt the secret key
- baseURL: parsedKey.data.baseURL || undefined,
- messages: [
- {
- role: ChatMessageRole.System,
- content: "You are an expert at evaluating LLM outputs.",
- },
- { role: ChatMessageRole.User, content: prompt },
- ],
- modelParams: {
- provider: template.provider,
- model: template.model,
- adapter: parsedKey.data.adapter,
- ...modelParams,
- },
- structuredOutputSchema: evalScoreSchema,
- config: parsedKey.data.config,
- });
- } catch (e) {
- throw new ApiError(`Failed to fetch LLM completion: ${e}`);
- }
-
- const parsedLLMOutput = evalScoreSchema.parse(completion);
+ const parsedLLMOutput = await backOff(
+ () =>
+ callLLM(
+ event.jobExecutionId,
+ parsedKey.data,
+ prompt,
+ modelParams,
+ template,
+ evalScoreSchema
+ ),
+ {
+ numOfAttempts: 3,
+ }
+ );
logger.info(
- `Evaluating job ${event.jobExecutionId} Parsed LLM output ${JSON.stringify(parsedLLMOutput)}`,
+ `Evaluating job ${event.jobExecutionId} Parsed LLM output ${JSON.stringify(parsedLLMOutput)}`
);
// persist the score and update the job status
@@ -335,7 +332,7 @@ export const evaluate = async ({
});
logger.info(
- `Evaluating job ${event.jobExecutionId} persisted score ${scoreId} for trace ${job.job_input_trace_id}`,
+ `Evaluating job ${event.jobExecutionId} persisted score ${scoreId} for trace ${job.job_input_trace_id}`
);
await kyselyPrisma.$kysely
@@ -347,13 +344,56 @@ export const evaluate = async ({
.execute();
logger.info(
- `Eval job ${job.id} for project ${event.projectId} completed with score ${parsedLLMOutput.score}`,
+ `Eval job ${job.id} for project ${event.projectId} completed with score ${parsedLLMOutput.score}`
);
};
+async function callLLM(
+ jeId: string,
+ llmApiKey: z.infer<typeof LLMApiKeySchema>,
+ prompt: string,
+ modelParams: z.infer<typeof ZodModelConfig>,
+ template: EvalTemplate,
+ evalScoreSchema: z.ZodObject<{ score: z.ZodNumber; reasoning: z.ZodString }>
+): Promise<z.infer<typeof evalScoreSchema>> {
+ const completion = await fetchLLMCompletion({
+ streaming: false,
+ apiKey: decrypt(llmApiKey.secretKey), // decrypt the secret key
+ baseURL: llmApiKey.baseURL || undefined,
+ messages: [
+ {
+ role: ChatMessageRole.System,
+ content: "You are an expert at evaluating LLM outputs.",
+ },
+ { role: ChatMessageRole.User, content: prompt },
+ ],
+ modelParams: {
+ provider: template.provider,
+ model: template.model,
+ adapter: llmApiKey.adapter,
+ ...modelParams,
+ },
+ structuredOutputSchema: evalScoreSchema,
+ config: llmApiKey.config,
+ });
+ const parsedLLMOutput = evalScoreSchema.safeParse(completion);
+
+ if (!parsedLLMOutput.success) {
+ logger.error(
+ `Evaluating job ${jeId} failed to parse LLM output ${completion}. Eval will fail. ${parsedLLMOutput.error}`
+ );
+ // this is an API error as these are retried.
+ // Maybe a second call to the LLM will return a valid output.
+ throw new ApiError(
+ `Failed to parse LLM output: ${JSON.stringify(parsedLLMOutput.error)}`
+ );
+ }
+ return parsedLLMOutput.data;
+}
+
export function compileHandlebarString(
handlebarString: string,
- context: Record<string, any>,
+ context: Record<string, any>
): string {
const template = Handlebars.compile(handlebarString, { noEscape: true });
return template(context);
@@ -364,14 +404,14 @@ export async function extractVariablesFromTrace(
variables: string[],
traceId: string,
// this here are variables which were inserted by users. Need to validate before DB query.
- variableMapping: z.infer<typeof variableMappingList>,
+ variableMapping: z.infer<typeof variableMappingList>
) {
const mappingResult: { var: string; value: string }[] = [];
// find the context for each variable of the template
for (const variable of variables) {
const mapping = variableMapping.find(
- (m) => m.templateVariable === variable,
+ (m) => m.templateVariable === variable
);
if (!mapping) {
@@ -389,7 +429,7 @@ export async function extractVariablesFromTrace(
// if no column was found, we still process with an empty variable
if (!safeInternalColumn?.id) {
logger.error(
- `No column found for variable ${variable} and column ${mapping.selectedColumnId}`,
+ `No column found for variable ${variable} and column ${mapping.selectedColumnId}`
);
mappingResult.push({ var: variable, value: "" });
continue;
@@ -398,9 +438,7 @@ export async function extractVariablesFromTrace(
const trace = await kyselyPrisma.$kysely
.selectFrom("traces as t")
.select(
- sql`${sql.raw(safeInternalColumn.internal)}`.as(
- safeInternalColumn.id,
- ),
+ sql`${sql.raw(safeInternalColumn.internal)}`.as(safeInternalColumn.id)
) // query the internal column name raw
.where("id", "=", traceId)
.where("project_id", "=", projectId)
@@ -409,10 +447,10 @@ export async function extractVariablesFromTrace(
// user facing errors
if (!trace) {
logger.error(
- `Trace ${traceId} for project ${projectId} not found. Eval will succeed without trace input. Please ensure the mapped data on the trace exists and consider extending the job delay.`,
+ `Trace ${traceId} for project ${projectId} not found. Eval will succeed without trace input. Please ensure the mapped data on the trace exists and consider extending the job delay.`
);
throw new LangfuseNotFoundError(
- `Trace ${traceId} for project ${projectId} not found. Eval will succeed without trace input. Please ensure the mapped data on the trace exists and consider extending the job delay.`,
+ `Trace ${traceId} for project ${projectId} not found. Eval will succeed without trace input. Please ensure the mapped data on the trace exists and consider extending the job delay.`
);
}
@@ -428,7 +466,7 @@ export async function extractVariablesFromTrace(
if (!mapping.objectName) {
logger.info(
- `No object name found for variable ${variable} and object ${mapping.langfuseObject}`,
+ `No object name found for variable ${variable} and object ${mapping.langfuseObject}`
);
mappingResult.push({ var: variable, value: "" });
continue;
@@ -436,7 +474,7 @@ export async function extractVariablesFromTrace(
if (!safeInternalColumn?.id) {
logger.warn(
- `No column found for variable ${variable} and column ${mapping.selectedColumnId}`,
+ `No column found for variable ${variable} and column ${mapping.selectedColumnId}`
);
mappingResult.push({ var: variable, value: "" });
continue;
@@ -445,9 +483,7 @@ export async function extractVariablesFromTrace(
const observation = await kyselyPrisma.$kysely
.selectFrom("observations as o")
.select(
- sql`${sql.raw(safeInternalColumn.internal)}`.as(
- safeInternalColumn.id,
- ),
+ sql`${sql.raw(safeInternalColumn.internal)}`.as(safeInternalColumn.id)
) // query the internal column name raw
.where("trace_id", "=", traceId)
.where("project_id", "=", projectId)
@@ -458,10 +494,10 @@ export async function extractVariablesFromTrace(
// user facing errors
if (!observation) {
logger.error(
- `Observation ${mapping.objectName} for trace ${traceId} not found. Please ensure the mapped data exists and consider extending the job delay.`,
+ `Observation ${mapping.objectName} for trace ${traceId} not found. Please ensure the mapped data exists and consider extending the job delay.`
);
throw new LangfuseNotFoundError(
- `Observation ${mapping.objectName} for trace ${traceId} not found. Please ensure the mapped data exists and consider extending the job delay.`,
+ `Observation ${mapping.objectName} for trace ${traceId} not found. Please ensure the mapped data exists and consider extending the job delay.`
);
}
diff --git a/worker/src/queues/evalQueue.ts b/worker/src/queues/evalQueue.ts
index c3cad0dd69..5adf358fbf 100644
--- a/worker/src/queues/evalQueue.ts
+++ b/worker/src/queues/evalQueue.ts
@@ -98,7 +98,7 @@ export const evalJobExecutorQueueProcessor = async (
"Please ensure the mapped data exists and consider extending the job delay."
)
) &&
- !(e instanceof ApiError) // API errors are expected (e.g. wrong API key or rate limit)
+ !(e instanceof ApiError) // API errors are expected (e.g. wrong API key or rate limit or invalid return data)
) {
traceException(e);
logger.error(