@scalvert/eval-core 0.5.0 → 0.5.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/dist/index.js +7 -2
- package/package.json +10 -2
package/dist/index.js
CHANGED
|
@@ -87,7 +87,6 @@ async function runEval(options) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// src/judge.ts
|
|
90
|
-
import Anthropic from "@anthropic-ai/sdk";
|
|
91
90
|
import { z as z2 } from "zod";
|
|
92
91
|
var JudgeResponseSchema = z2.object({
|
|
93
92
|
pass: z2.boolean(),
|
|
@@ -95,8 +94,14 @@ var JudgeResponseSchema = z2.object({
|
|
|
95
94
|
reasoning: z2.string()
|
|
96
95
|
});
|
|
97
96
|
function createAnthropicJudge(config) {
|
|
98
|
-
|
|
97
|
+
let clientPromise;
|
|
99
98
|
return async ({ input, response, rubric }) => {
|
|
99
|
+
if (!clientPromise) {
|
|
100
|
+
clientPromise = import("@anthropic-ai/sdk").then(
|
|
101
|
+
(mod) => new mod.default({ apiKey: config.apiKey })
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
const client = await clientPromise;
|
|
100
105
|
const message = await client.messages.create({
|
|
101
106
|
model: config.model,
|
|
102
107
|
max_tokens: 1024,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalvert/eval-core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "General-purpose LLM evaluation primitives",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"llm",
|
|
@@ -43,10 +43,18 @@
|
|
|
43
43
|
"typecheck": "tsc --noEmit"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@anthropic-ai/sdk": "^0.39.0",
|
|
47
46
|
"zod": "^3.22.0"
|
|
48
47
|
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@anthropic-ai/sdk": ">=0.80.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"@anthropic-ai/sdk": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
49
56
|
"devDependencies": {
|
|
57
|
+
"@anthropic-ai/sdk": "^0.80.0",
|
|
50
58
|
"@eslint/js": "^9.24.0",
|
|
51
59
|
"@release-it-plugins/lerna-changelog": "^5.0.0",
|
|
52
60
|
"@types/node": "^22.0.0",
|