peerbench 0.0.1 → 0.0.2-alpha-dev.0
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 +332 -2
- package/dist/abstract-Dec9Sc5O.d.ts +12 -0
- package/dist/aggregators/index.d.ts +67 -0
- package/dist/aggregators/index.js +46 -0
- package/dist/aggregators/index.js.map +1 -0
- package/dist/benchmarks/index.d.ts +1041 -0
- package/dist/benchmarks/index.js +458 -0
- package/dist/benchmarks/index.js.map +1 -0
- package/dist/chunk-4UBK6452.js +128 -0
- package/dist/chunk-4UBK6452.js.map +1 -0
- package/dist/chunk-ERALDEZY.js +112 -0
- package/dist/chunk-ERALDEZY.js.map +1 -0
- package/dist/chunk-HMQYGCKI.js +11 -0
- package/dist/chunk-HMQYGCKI.js.map +1 -0
- package/dist/chunk-NUEOE3K5.js +8 -0
- package/dist/chunk-NUEOE3K5.js.map +1 -0
- package/dist/chunk-OQE6TQXZ.js +42 -0
- package/dist/chunk-OQE6TQXZ.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-Q6GSOHOP.js +44 -0
- package/dist/chunk-Q6GSOHOP.js.map +1 -0
- package/dist/chunk-QY5MPNNB.js +28 -0
- package/dist/chunk-QY5MPNNB.js.map +1 -0
- package/dist/chunk-R76XA2K6.js +229 -0
- package/dist/chunk-R76XA2K6.js.map +1 -0
- package/dist/chunk-TRNCF2BG.js +35 -0
- package/dist/chunk-TRNCF2BG.js.map +1 -0
- package/dist/chunk-UHHHSYVE.js +11 -0
- package/dist/chunk-UHHHSYVE.js.map +1 -0
- package/dist/chunk-YY33MNMV.js +65 -0
- package/dist/chunk-YY33MNMV.js.map +1 -0
- package/dist/chunk-ZEWI24CV.js +365 -0
- package/dist/chunk-ZEWI24CV.js.map +1 -0
- package/dist/index-BAioQhp2.d.ts +27 -0
- package/dist/index.d.ts +59 -3841
- package/dist/index.js +31 -3545
- package/dist/index.js.map +1 -1
- package/dist/json-file-ZwzLUbje.d.ts +73 -0
- package/dist/llm-DNj_tp2T.d.ts +22 -0
- package/dist/llm-judge-QThCZ9TQ.d.ts +67 -0
- package/dist/provider-BDjGp2y-.d.ts +10 -0
- package/dist/providers/index.d.ts +69 -0
- package/dist/providers/index.js +18 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/rate-limiter-CSmVIRsM.d.ts +60 -0
- package/dist/schemas/extensions/index.d.ts +28 -0
- package/dist/schemas/extensions/index.js +19 -0
- package/dist/schemas/extensions/index.js.map +1 -0
- package/dist/schemas/index.d.ts +200 -0
- package/dist/schemas/index.js +24 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/llm/index.d.ts +116 -0
- package/dist/schemas/llm/index.js +15 -0
- package/dist/schemas/llm/index.js.map +1 -0
- package/dist/scorers/index.d.ts +64 -0
- package/dist/scorers/index.js +16 -0
- package/dist/scorers/index.js.map +1 -0
- package/dist/storages/index.d.ts +69 -0
- package/dist/storages/index.js +98 -0
- package/dist/storages/index.js.map +1 -0
- package/package.json +46 -22
- package/LICENSE +0 -21
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { FileHandle } from 'node:fs/promises';
|
|
2
|
+
import z__default from 'zod';
|
|
3
|
+
|
|
4
|
+
declare abstract class AbstractStorage<TObject> {
|
|
5
|
+
abstract init(params?: unknown): Promise<void>;
|
|
6
|
+
abstract read(key: string, params?: unknown): Promise<TObject | null>;
|
|
7
|
+
abstract readAll(params?: unknown): Promise<TObject[]>;
|
|
8
|
+
abstract write(key: string, value: TObject, params?: unknown): Promise<unknown>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare class FileStorage<TObject> extends AbstractStorage<TObject> {
|
|
12
|
+
protected path: string;
|
|
13
|
+
protected codec: AbstractFileStorageCodec<TObject>;
|
|
14
|
+
protected fileHandle: FileHandle | undefined;
|
|
15
|
+
constructor(config: {
|
|
16
|
+
path: string;
|
|
17
|
+
codec: AbstractFileStorageCodec<TObject>;
|
|
18
|
+
});
|
|
19
|
+
init(): Promise<void>;
|
|
20
|
+
read(_key: string, _params?: unknown): Promise<TObject | null>;
|
|
21
|
+
readAll(_params?: unknown): Promise<TObject[]>;
|
|
22
|
+
write(_key: string, _value: TObject, _params?: unknown): Promise<unknown>;
|
|
23
|
+
protected readChunks(params: {
|
|
24
|
+
startOffset?: number;
|
|
25
|
+
chunkSize: number;
|
|
26
|
+
}): AsyncIterable<{
|
|
27
|
+
offset: number;
|
|
28
|
+
bytes: Uint8Array;
|
|
29
|
+
}>;
|
|
30
|
+
protected size(): Promise<number>;
|
|
31
|
+
protected readAt(offset: number, length: number): Promise<Uint8Array>;
|
|
32
|
+
protected assertInitialized(): asserts this is this & {
|
|
33
|
+
fileHandle: FileHandle;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
type FileStorageFileHandle = {
|
|
37
|
+
size(): Promise<number>;
|
|
38
|
+
readAt(offset: number, length: number): Promise<Uint8Array>;
|
|
39
|
+
readChunks(params: {
|
|
40
|
+
startOffset?: number;
|
|
41
|
+
chunkSize: number;
|
|
42
|
+
}): AsyncIterable<{
|
|
43
|
+
offset: number;
|
|
44
|
+
bytes: Uint8Array;
|
|
45
|
+
}>;
|
|
46
|
+
};
|
|
47
|
+
declare abstract class AbstractFileStorageCodec<TObject> {
|
|
48
|
+
abstract readAll(params: {
|
|
49
|
+
fileHandle: FileStorageFileHandle;
|
|
50
|
+
}): Promise<TObject[]>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare class JSONFileStorage<TObject> extends FileStorage<TObject> {
|
|
54
|
+
codec: JSONFileStorageCodec<TObject>;
|
|
55
|
+
constructor(config: {
|
|
56
|
+
path: string;
|
|
57
|
+
chunkSize?: number;
|
|
58
|
+
schema: z__default.ZodType<TObject>;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
declare class JSONFileStorageCodec<TObject> extends AbstractFileStorageCodec<TObject> {
|
|
62
|
+
private chunkSize;
|
|
63
|
+
private schema;
|
|
64
|
+
constructor(config: {
|
|
65
|
+
chunkSize?: number;
|
|
66
|
+
schema: z__default.ZodType<TObject>;
|
|
67
|
+
});
|
|
68
|
+
readAll(params: {
|
|
69
|
+
fileHandle: FileStorageFileHandle;
|
|
70
|
+
}): Promise<TObject[]>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { AbstractStorage as A, FileStorage as F, JSONFileStorage as J, JSONFileStorageCodec as a, type FileStorageFileHandle as b, AbstractFileStorageCodec as c };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { A as AbstractProvider, P as ProviderResponse } from './provider-BDjGp2y-.js';
|
|
2
|
+
import { ResponseFormatText, ResponseFormatJSONSchema, ResponseFormatJSONObject } from 'openai/resources/shared';
|
|
3
|
+
import { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
|
|
4
|
+
|
|
5
|
+
declare abstract class AbstractLLMProvider extends AbstractProvider {
|
|
6
|
+
abstract forward(args: LLMProviderForwardArgs): Promise<ChatResponse>;
|
|
7
|
+
}
|
|
8
|
+
type LLMProviderForwardArgs = {
|
|
9
|
+
messages: ChatCompletionMessageParam[];
|
|
10
|
+
model: string;
|
|
11
|
+
abortSignal?: AbortSignal;
|
|
12
|
+
temperature?: number;
|
|
13
|
+
responseFormat?: ResponseFormatText | ResponseFormatJSONSchema | ResponseFormatJSONObject;
|
|
14
|
+
};
|
|
15
|
+
type ChatResponse = ProviderResponse<string> & {
|
|
16
|
+
inputTokensUsed?: number;
|
|
17
|
+
outputTokensUsed?: number;
|
|
18
|
+
inputCost?: string;
|
|
19
|
+
outputCost?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { AbstractLLMProvider as A, type ChatResponse as C, type LLMProviderForwardArgs as L };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { A as AbstractScorer, B as BaseScorerResult } from './abstract-Dec9Sc5O.js';
|
|
2
|
+
import { A as AbstractLLMProvider } from './llm-DNj_tp2T.js';
|
|
3
|
+
import { R as RateLimiter } from './rate-limiter-CSmVIRsM.js';
|
|
4
|
+
import z__default from 'zod';
|
|
5
|
+
|
|
6
|
+
type MCQScorerParams = {
|
|
7
|
+
response: string;
|
|
8
|
+
choices: Record<string, string>;
|
|
9
|
+
correctAnswers: string[];
|
|
10
|
+
};
|
|
11
|
+
declare class MCQScorer extends AbstractScorer {
|
|
12
|
+
readonly kind: "peerbench.ai/mcq";
|
|
13
|
+
private regexScorer;
|
|
14
|
+
score(params: MCQScorerParams): Promise<BaseScorerResult & {
|
|
15
|
+
extractedAnswers: string[];
|
|
16
|
+
}>;
|
|
17
|
+
private buildPatternsForAnswer;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare class LLMAsAJudgeScorer extends AbstractScorer {
|
|
21
|
+
readonly kind: "peerbench.ai/llm-as-a-judge";
|
|
22
|
+
private provider;
|
|
23
|
+
constructor(config: {
|
|
24
|
+
provider: AbstractLLMProvider;
|
|
25
|
+
rateLimiter?: RateLimiter;
|
|
26
|
+
});
|
|
27
|
+
score<T extends z__default.ZodRawShape>(params: LLMAsAJudgeScoreParams & {
|
|
28
|
+
fieldsToExtract: T;
|
|
29
|
+
}): Promise<ScorerResultWithExtractedFields<T> | null>;
|
|
30
|
+
score(params: LLMAsAJudgeScoreParams & {
|
|
31
|
+
fieldsToExtract?: never;
|
|
32
|
+
}): Promise<ScorerResultWithoutExtractedFields | null>;
|
|
33
|
+
}
|
|
34
|
+
type LLMAsAJudgeCriterion = {
|
|
35
|
+
id: string;
|
|
36
|
+
description: string;
|
|
37
|
+
weight: number;
|
|
38
|
+
scale?: {
|
|
39
|
+
min: number;
|
|
40
|
+
max: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
type LLMAsAJudgeScoreParams = {
|
|
44
|
+
model: string;
|
|
45
|
+
response: string;
|
|
46
|
+
rubric: string;
|
|
47
|
+
criteria: LLMAsAJudgeCriterion[];
|
|
48
|
+
systemPrompt?: string;
|
|
49
|
+
maxExplanationLength?: number;
|
|
50
|
+
};
|
|
51
|
+
type ScorerResultWithoutExtractedFields = BaseScorerResult & {
|
|
52
|
+
results: {
|
|
53
|
+
id: string;
|
|
54
|
+
score: number;
|
|
55
|
+
explanation: string;
|
|
56
|
+
}[];
|
|
57
|
+
provider: string;
|
|
58
|
+
inputTokensUsed?: number;
|
|
59
|
+
outputTokensUsed?: number;
|
|
60
|
+
inputCost?: string;
|
|
61
|
+
outputCost?: string;
|
|
62
|
+
};
|
|
63
|
+
type ScorerResultWithExtractedFields<T extends z__default.ZodRawShape> = ScorerResultWithoutExtractedFields & {
|
|
64
|
+
extractedFields: z__default.infer<z__default.ZodObject<T>>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { LLMAsAJudgeScorer as L, type MCQScorerParams as M, MCQScorer as a, type LLMAsAJudgeCriterion as b, type LLMAsAJudgeScoreParams as c };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { A as AbstractLLMProvider, L as LLMProviderForwardArgs, C as ChatResponse } from '../llm-DNj_tp2T.js';
|
|
2
|
+
export { A as AbstractProvider, P as ProviderResponse } from '../provider-BDjGp2y-.js';
|
|
3
|
+
import { MastraClient } from '@mastra/client-js';
|
|
4
|
+
import { R as RateLimiter } from '../rate-limiter-CSmVIRsM.js';
|
|
5
|
+
import { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
|
|
6
|
+
import { ResponseFormatText, ResponseFormatJSONSchema, ResponseFormatJSONObject } from 'openai/resources/shared';
|
|
7
|
+
|
|
8
|
+
declare class MastraProvider extends AbstractLLMProvider {
|
|
9
|
+
readonly kind = "mastra";
|
|
10
|
+
private readonly endpoint;
|
|
11
|
+
private readonly authToken?;
|
|
12
|
+
private client;
|
|
13
|
+
private warnedAboutSystemMessages;
|
|
14
|
+
private warnedAboutResponseFormat;
|
|
15
|
+
constructor(params: {
|
|
16
|
+
endpoint: string;
|
|
17
|
+
authToken?: string;
|
|
18
|
+
});
|
|
19
|
+
forward(args: LLMProviderForwardArgs & {
|
|
20
|
+
memory?: AgentMemoryOption;
|
|
21
|
+
}): Promise<ChatResponse>;
|
|
22
|
+
}
|
|
23
|
+
type AgentMemoryOption = Parameters<Parameters<MastraClient["getAgent"]>["0"] extends string ? ReturnType<MastraClient["getAgent"]>["generate"] : never>[0] extends {
|
|
24
|
+
memory?: infer M;
|
|
25
|
+
} ? M : never;
|
|
26
|
+
|
|
27
|
+
declare class OpenAIProvider extends AbstractLLMProvider {
|
|
28
|
+
readonly kind: "peerbench.ai/llm/openai";
|
|
29
|
+
private client;
|
|
30
|
+
private rateLimiter;
|
|
31
|
+
private maxRetries;
|
|
32
|
+
constructor(config: {
|
|
33
|
+
apiKey: string;
|
|
34
|
+
baseURL: string;
|
|
35
|
+
maxRetries?: number;
|
|
36
|
+
timeout?: number;
|
|
37
|
+
rateLimiter?: RateLimiter;
|
|
38
|
+
});
|
|
39
|
+
forward(args: {
|
|
40
|
+
messages: ChatCompletionMessageParam[];
|
|
41
|
+
model: string;
|
|
42
|
+
abortSignal?: AbortSignal;
|
|
43
|
+
temperature?: number;
|
|
44
|
+
responseFormat?: ResponseFormatText | ResponseFormatJSONSchema | ResponseFormatJSONObject;
|
|
45
|
+
}): Promise<ChatResponse>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare class OpenRouterProvider extends AbstractLLMProvider {
|
|
49
|
+
readonly kind: "peerbench.ai/llm/openrouter.ai";
|
|
50
|
+
private models;
|
|
51
|
+
private modelsCachePromise;
|
|
52
|
+
private modelsUpdatedAt;
|
|
53
|
+
private openAIProvider;
|
|
54
|
+
constructor(config: {
|
|
55
|
+
apiKey: string;
|
|
56
|
+
maxRetries?: number;
|
|
57
|
+
timeout?: number;
|
|
58
|
+
rateLimiter?: RateLimiter;
|
|
59
|
+
});
|
|
60
|
+
forward(args: LLMProviderForwardArgs): Promise<ChatResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Updates the cache that holds information about OpenRouter models
|
|
63
|
+
* including pricing information. It will be valid for 24 hours as
|
|
64
|
+
* long as the instance of this Provider object is alive.
|
|
65
|
+
*/
|
|
66
|
+
private updateModelsCache;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { AbstractLLMProvider, type AgentMemoryOption, ChatResponse, LLMProviderForwardArgs, MastraProvider, OpenAIProvider, OpenRouterProvider };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbstractLLMProvider,
|
|
3
|
+
AbstractProvider,
|
|
4
|
+
MastraProvider,
|
|
5
|
+
OpenAIProvider,
|
|
6
|
+
OpenRouterProvider
|
|
7
|
+
} from "../chunk-R76XA2K6.js";
|
|
8
|
+
import "../chunk-UHHHSYVE.js";
|
|
9
|
+
import "../chunk-4UBK6452.js";
|
|
10
|
+
import "../chunk-PZ5AY32C.js";
|
|
11
|
+
export {
|
|
12
|
+
AbstractLLMProvider,
|
|
13
|
+
AbstractProvider,
|
|
14
|
+
MastraProvider,
|
|
15
|
+
OpenAIProvider,
|
|
16
|
+
OpenRouterProvider
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
interface RateLimiterOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Maximum weight of calls allowed within a time window. Each call has a weight of 1 by default.
|
|
4
|
+
* Rate limiting is disabled when this is 0 or negative.
|
|
5
|
+
* @default 25
|
|
6
|
+
*/
|
|
7
|
+
maxWeight?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Time window in milliseconds for rate limiting
|
|
10
|
+
* @default 1000
|
|
11
|
+
*/
|
|
12
|
+
timeWindow?: number;
|
|
13
|
+
}
|
|
14
|
+
interface RateLimiterCallOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Weight of the call. Rate limiting is applied based on the total weight of the calls.
|
|
17
|
+
* @default 1
|
|
18
|
+
*/
|
|
19
|
+
weight?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Abort signal for cancellation
|
|
22
|
+
*/
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generic rate limiter. It can be used to limit async function calls
|
|
27
|
+
* by a given number of calls within a time window.
|
|
28
|
+
*/
|
|
29
|
+
declare class RateLimiter {
|
|
30
|
+
maxWeight: number;
|
|
31
|
+
timeWindow: number;
|
|
32
|
+
private timestamps;
|
|
33
|
+
constructor(options?: RateLimiterOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Checks if rate limiting is disabled
|
|
36
|
+
*/
|
|
37
|
+
isDisabled(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Disables rate limiting. Set `maxWeight` to re-enable it.
|
|
40
|
+
*/
|
|
41
|
+
disable(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Returns how many weight of calls are there in the current time window
|
|
44
|
+
*/
|
|
45
|
+
getCurrentCalls(): number;
|
|
46
|
+
/**
|
|
47
|
+
* Executes the given function with rate limiting applied
|
|
48
|
+
*/
|
|
49
|
+
execute<T = unknown>(func: () => Promise<T>, { weight, signal }?: RateLimiterCallOptions): Promise<T>;
|
|
50
|
+
/**
|
|
51
|
+
* Waits until rate limit allows the specified weight of calls
|
|
52
|
+
*/
|
|
53
|
+
private waitForRateLimit;
|
|
54
|
+
/**
|
|
55
|
+
* Resets the rate limited weight of calls
|
|
56
|
+
*/
|
|
57
|
+
reset(): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { RateLimiter as R, type RateLimiterOptions as a, type RateLimiterCallOptions as b };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const ScoreExtensions: {
|
|
4
|
+
ExtensionLLMAsAJudgeScoreFieldsV1: {
|
|
5
|
+
scorerAISystemPrompt: z.ZodOptional<z.ZodString>;
|
|
6
|
+
scorerAISystemPromptId: z.ZodOptional<z.ZodString>;
|
|
7
|
+
scorerAIProvider: z.ZodOptional<z.ZodString>;
|
|
8
|
+
scorerAIModelSlug: z.ZodOptional<z.ZodString>;
|
|
9
|
+
scorerAIInputTokensUsed: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
scorerAIOutputTokensUsed: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
scorerAIInputCost: z.ZodOptional<z.ZodString>;
|
|
12
|
+
scorerAIOutputCost: z.ZodOptional<z.ZodString>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare const ResponseExtensions: {
|
|
16
|
+
ExtensionLLMResponseFieldsV1: {
|
|
17
|
+
data: z.ZodString;
|
|
18
|
+
modelSlug: z.ZodString;
|
|
19
|
+
provider: z.ZodString;
|
|
20
|
+
systemPromptId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
inputTokensUsed: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
outputTokensUsed: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
inputCost: z.ZodOptional<z.ZodString>;
|
|
24
|
+
outputCost: z.ZodOptional<z.ZodString>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { ResponseExtensions, ScoreExtensions };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ExtensionLLMAsAJudgeScoreFieldsV1,
|
|
3
|
+
ExtensionLLMResponseFieldsV1
|
|
4
|
+
} from "../../chunk-TRNCF2BG.js";
|
|
5
|
+
import "../../chunk-NUEOE3K5.js";
|
|
6
|
+
import "../../chunk-PZ5AY32C.js";
|
|
7
|
+
|
|
8
|
+
// src/schemas/extensions/index.ts
|
|
9
|
+
var ScoreExtensions = {
|
|
10
|
+
ExtensionLLMAsAJudgeScoreFieldsV1
|
|
11
|
+
};
|
|
12
|
+
var ResponseExtensions = {
|
|
13
|
+
ExtensionLLMResponseFieldsV1
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
ResponseExtensions,
|
|
17
|
+
ScoreExtensions
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/schemas/extensions/index.ts"],"sourcesContent":["import { ExtensionLLMResponseFieldsV1 } from \"./response/llm\";\nimport { ExtensionLLMAsAJudgeScoreFieldsV1 } from \"./score/llm-as-a-judge-scorer\";\n\nexport const ScoreExtensions = {\n ExtensionLLMAsAJudgeScoreFieldsV1,\n};\n\nexport const ResponseExtensions = {\n ExtensionLLMResponseFieldsV1,\n};\n"],"mappings":";;;;;;;;AAGO,IAAM,kBAAkB;AAAA,EAC7B;AACF;AAEO,IAAM,qBAAqB;AAAA,EAChC;AACF;","names":[]}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { W as WidenZodObject, I as IdGenerator } from '../index-BAioQhp2.js';
|
|
2
|
+
export { d as IdSchema } from '../index-BAioQhp2.js';
|
|
3
|
+
import z__default, { z } from 'zod';
|
|
4
|
+
import '../provider-BDjGp2y-.js';
|
|
5
|
+
import '../abstract-Dec9Sc5O.js';
|
|
6
|
+
|
|
7
|
+
declare const BaseResponseSchemaV1: z__default.ZodObject<{
|
|
8
|
+
id: z__default.ZodString;
|
|
9
|
+
namespace: z__default.ZodString;
|
|
10
|
+
schemaVersion: z__default.ZodNumber;
|
|
11
|
+
kind: z__default.ZodString;
|
|
12
|
+
startedAt: z__default.ZodNumber;
|
|
13
|
+
completedAt: z__default.ZodNumber;
|
|
14
|
+
testCaseId: z__default.ZodString;
|
|
15
|
+
metadata: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>;
|
|
16
|
+
}, z__default.core.$strip>;
|
|
17
|
+
type BaseResponseV1 = z__default.infer<typeof BaseResponseSchemaV1>;
|
|
18
|
+
declare const defineResponseSchema: <TBaseSchema extends WidenZodObject<z__default.ZodObject<{
|
|
19
|
+
id: z__default.ZodString;
|
|
20
|
+
namespace: z__default.ZodString;
|
|
21
|
+
schemaVersion: z__default.ZodNumber;
|
|
22
|
+
kind: z__default.ZodString;
|
|
23
|
+
startedAt: z__default.ZodNumber;
|
|
24
|
+
completedAt: z__default.ZodNumber;
|
|
25
|
+
testCaseId: z__default.ZodString;
|
|
26
|
+
metadata: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>;
|
|
27
|
+
}, z__default.core.$strip>>, TNamespace extends string | undefined = undefined, TKind extends string | undefined = undefined, TSchemaVersion extends number | undefined = undefined, TFields extends Readonly<{
|
|
28
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
29
|
+
}> = {}>(config: {
|
|
30
|
+
baseSchema: TBaseSchema;
|
|
31
|
+
namespace?: TNamespace | undefined;
|
|
32
|
+
kind?: TKind | undefined;
|
|
33
|
+
schemaVersion?: TSchemaVersion | undefined;
|
|
34
|
+
fields?: TFields | undefined;
|
|
35
|
+
}) => (TBaseSchema extends z__default.ZodObject<infer U extends Readonly<{
|
|
36
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
37
|
+
}>, z__default.core.$strip> ? z__default.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
38
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z__default.ZodLiteral<TNamespace>;
|
|
39
|
+
kind: TKind extends undefined ? U["kind"] : z__default.ZodLiteral<`${TKind}.rs`>;
|
|
40
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z__default.ZodLiteral<TSchemaVersion>;
|
|
41
|
+
}, z__default.core.$strip> : never) & {
|
|
42
|
+
new: (input: Omit<z__default.core.output<TBaseSchema extends z__default.ZodObject<infer U extends Readonly<{
|
|
43
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
44
|
+
}>, z__default.core.$strip> ? z__default.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
45
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z__default.ZodLiteral<TNamespace>;
|
|
46
|
+
kind: TKind extends undefined ? U["kind"] : z__default.ZodLiteral<`${TKind}.rs`>;
|
|
47
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z__default.ZodLiteral<TSchemaVersion>;
|
|
48
|
+
}, z__default.core.$strip> : never>, "kind" | "namespace" | "schemaVersion">) => z__default.core.output<TBaseSchema extends z__default.ZodObject<infer U extends Readonly<{
|
|
49
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
50
|
+
}>, z__default.core.$strip> ? z__default.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
51
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z__default.ZodLiteral<TNamespace>;
|
|
52
|
+
kind: TKind extends undefined ? U["kind"] : z__default.ZodLiteral<`${TKind}.rs`>;
|
|
53
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z__default.ZodLiteral<TSchemaVersion>;
|
|
54
|
+
}, z__default.core.$strip> : never>;
|
|
55
|
+
newWithId(input: Omit<z__default.core.output<TBaseSchema extends z__default.ZodObject<infer U extends Readonly<{
|
|
56
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
57
|
+
}>, z__default.core.$strip> ? z__default.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
58
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z__default.ZodLiteral<TNamespace>;
|
|
59
|
+
kind: TKind extends undefined ? U["kind"] : z__default.ZodLiteral<`${TKind}.rs`>;
|
|
60
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z__default.ZodLiteral<TSchemaVersion>;
|
|
61
|
+
}, z__default.core.$strip> : never>, "id" | "kind" | "namespace" | "schemaVersion">, generator: IdGenerator): Promise<z__default.core.output<TBaseSchema extends z__default.ZodObject<infer U extends Readonly<{
|
|
62
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
63
|
+
}>, z__default.core.$strip> ? z__default.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
64
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z__default.ZodLiteral<TNamespace>;
|
|
65
|
+
kind: TKind extends undefined ? U["kind"] : z__default.ZodLiteral<`${TKind}.rs`>;
|
|
66
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z__default.ZodLiteral<TSchemaVersion>;
|
|
67
|
+
}, z__default.core.$strip> : never>>;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
declare const BaseTestCaseSchemaV1: z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
namespace: z.ZodString;
|
|
73
|
+
schemaVersion: z.ZodNumber;
|
|
74
|
+
kind: z.ZodString;
|
|
75
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
type BaseTestCaseV1 = z.infer<typeof BaseTestCaseSchemaV1>;
|
|
78
|
+
declare const defineTestCaseSchema: <TBaseSchema extends WidenZodObject<z.ZodObject<{
|
|
79
|
+
id: z.ZodString;
|
|
80
|
+
namespace: z.ZodString;
|
|
81
|
+
schemaVersion: z.ZodNumber;
|
|
82
|
+
kind: z.ZodString;
|
|
83
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
84
|
+
}, z.core.$strip>>, TNamespace extends string | undefined = undefined, TKind extends string | undefined = undefined, TSchemaVersion extends number | undefined = undefined, TFields extends Readonly<{
|
|
85
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
86
|
+
}> = {}>(config: {
|
|
87
|
+
baseSchema: TBaseSchema;
|
|
88
|
+
namespace?: TNamespace | undefined;
|
|
89
|
+
kind?: TKind | undefined;
|
|
90
|
+
schemaVersion?: TSchemaVersion | undefined;
|
|
91
|
+
fields?: TFields | undefined;
|
|
92
|
+
}) => (TBaseSchema extends z.ZodObject<infer U extends Readonly<{
|
|
93
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
94
|
+
}>, z.core.$strip> ? z.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
95
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z.ZodLiteral<TNamespace>;
|
|
96
|
+
kind: TKind extends undefined ? U["kind"] : z.ZodLiteral<`${TKind}.tc`>;
|
|
97
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z.ZodLiteral<TSchemaVersion>;
|
|
98
|
+
}, z.core.$strip> : never) & {
|
|
99
|
+
new: (input: Omit<z.core.output<TBaseSchema extends z.ZodObject<infer U extends Readonly<{
|
|
100
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
101
|
+
}>, z.core.$strip> ? z.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
102
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z.ZodLiteral<TNamespace>;
|
|
103
|
+
kind: TKind extends undefined ? U["kind"] : z.ZodLiteral<`${TKind}.tc`>;
|
|
104
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z.ZodLiteral<TSchemaVersion>;
|
|
105
|
+
}, z.core.$strip> : never>, "kind" | "namespace" | "schemaVersion">) => z.core.output<TBaseSchema extends z.ZodObject<infer U extends Readonly<{
|
|
106
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
107
|
+
}>, z.core.$strip> ? z.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
108
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z.ZodLiteral<TNamespace>;
|
|
109
|
+
kind: TKind extends undefined ? U["kind"] : z.ZodLiteral<`${TKind}.tc`>;
|
|
110
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z.ZodLiteral<TSchemaVersion>;
|
|
111
|
+
}, z.core.$strip> : never>;
|
|
112
|
+
newWithId(input: Omit<z.core.output<TBaseSchema extends z.ZodObject<infer U extends Readonly<{
|
|
113
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
114
|
+
}>, z.core.$strip> ? z.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
115
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z.ZodLiteral<TNamespace>;
|
|
116
|
+
kind: TKind extends undefined ? U["kind"] : z.ZodLiteral<`${TKind}.tc`>;
|
|
117
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z.ZodLiteral<TSchemaVersion>;
|
|
118
|
+
}, z.core.$strip> : never>, "id" | "kind" | "namespace" | "schemaVersion">, generator: IdGenerator): Promise<z.core.output<TBaseSchema extends z.ZodObject<infer U extends Readonly<{
|
|
119
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
120
|
+
}>, z.core.$strip> ? z.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
121
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z.ZodLiteral<TNamespace>;
|
|
122
|
+
kind: TKind extends undefined ? U["kind"] : z.ZodLiteral<`${TKind}.tc`>;
|
|
123
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z.ZodLiteral<TSchemaVersion>;
|
|
124
|
+
}, z.core.$strip> : never>>;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
declare const BaseScoreSchemaV1: z__default.ZodObject<{
|
|
128
|
+
id: z__default.ZodString;
|
|
129
|
+
namespace: z__default.ZodString;
|
|
130
|
+
kind: z__default.ZodString;
|
|
131
|
+
schemaVersion: z__default.ZodNumber;
|
|
132
|
+
value: z__default.ZodNumber;
|
|
133
|
+
responseId: z__default.ZodString;
|
|
134
|
+
explanation: z__default.ZodOptional<z__default.ZodString>;
|
|
135
|
+
metadata: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>;
|
|
136
|
+
scoringMethod: z__default.ZodEnum<{
|
|
137
|
+
readonly ai: "ai";
|
|
138
|
+
readonly human: "human";
|
|
139
|
+
readonly algo: "algo";
|
|
140
|
+
}>;
|
|
141
|
+
}, z__default.core.$strip>;
|
|
142
|
+
type BaseScoreV1 = z__default.infer<typeof BaseScoreSchemaV1>;
|
|
143
|
+
declare const defineScoreSchema: <TBaseSchema extends WidenZodObject<z__default.ZodObject<{
|
|
144
|
+
id: z__default.ZodString;
|
|
145
|
+
namespace: z__default.ZodString;
|
|
146
|
+
kind: z__default.ZodString;
|
|
147
|
+
schemaVersion: z__default.ZodNumber;
|
|
148
|
+
value: z__default.ZodNumber;
|
|
149
|
+
responseId: z__default.ZodString;
|
|
150
|
+
explanation: z__default.ZodOptional<z__default.ZodString>;
|
|
151
|
+
metadata: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodUnknown>>;
|
|
152
|
+
scoringMethod: z__default.ZodEnum<{
|
|
153
|
+
readonly ai: "ai";
|
|
154
|
+
readonly human: "human";
|
|
155
|
+
readonly algo: "algo";
|
|
156
|
+
}>;
|
|
157
|
+
}, z__default.core.$strip>>, TNamespace extends string | undefined = undefined, TKind extends string | undefined = undefined, TSchemaVersion extends number | undefined = undefined, TFields extends Readonly<{
|
|
158
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
159
|
+
}> = {}>(config: {
|
|
160
|
+
baseSchema: TBaseSchema;
|
|
161
|
+
namespace?: TNamespace | undefined;
|
|
162
|
+
kind?: TKind | undefined;
|
|
163
|
+
schemaVersion?: TSchemaVersion | undefined;
|
|
164
|
+
fields?: TFields | undefined;
|
|
165
|
+
}) => (TBaseSchema extends z__default.ZodObject<infer U extends Readonly<{
|
|
166
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
167
|
+
}>, z__default.core.$strip> ? z__default.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
168
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z__default.ZodLiteral<TNamespace>;
|
|
169
|
+
kind: TKind extends undefined ? U["kind"] : z__default.ZodLiteral<`${TKind}.sc`>;
|
|
170
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z__default.ZodLiteral<TSchemaVersion>;
|
|
171
|
+
}, z__default.core.$strip> : never) & {
|
|
172
|
+
new: (input: Omit<z__default.core.output<TBaseSchema extends z__default.ZodObject<infer U extends Readonly<{
|
|
173
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
174
|
+
}>, z__default.core.$strip> ? z__default.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
175
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z__default.ZodLiteral<TNamespace>;
|
|
176
|
+
kind: TKind extends undefined ? U["kind"] : z__default.ZodLiteral<`${TKind}.sc`>;
|
|
177
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z__default.ZodLiteral<TSchemaVersion>;
|
|
178
|
+
}, z__default.core.$strip> : never>, "kind" | "namespace" | "schemaVersion">) => z__default.core.output<TBaseSchema extends z__default.ZodObject<infer U extends Readonly<{
|
|
179
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
180
|
+
}>, z__default.core.$strip> ? z__default.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
181
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z__default.ZodLiteral<TNamespace>;
|
|
182
|
+
kind: TKind extends undefined ? U["kind"] : z__default.ZodLiteral<`${TKind}.sc`>;
|
|
183
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z__default.ZodLiteral<TSchemaVersion>;
|
|
184
|
+
}, z__default.core.$strip> : never>;
|
|
185
|
+
newWithId(input: Omit<z__default.core.output<TBaseSchema extends z__default.ZodObject<infer U extends Readonly<{
|
|
186
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
187
|
+
}>, z__default.core.$strip> ? z__default.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
188
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z__default.ZodLiteral<TNamespace>;
|
|
189
|
+
kind: TKind extends undefined ? U["kind"] : z__default.ZodLiteral<`${TKind}.sc`>;
|
|
190
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z__default.ZodLiteral<TSchemaVersion>;
|
|
191
|
+
}, z__default.core.$strip> : never>, "id" | "kind" | "namespace" | "schemaVersion">, generator: IdGenerator): Promise<z__default.core.output<TBaseSchema extends z__default.ZodObject<infer U extends Readonly<{
|
|
192
|
+
[k: string]: z__default.core.$ZodType<unknown, unknown, z__default.core.$ZodTypeInternals<unknown, unknown>>;
|
|
193
|
+
}>, z__default.core.$strip> ? z__default.ZodObject<Omit<U, "kind" | "namespace" | "schemaVersion"> & TFields & {
|
|
194
|
+
namespace: TNamespace extends undefined ? U["namespace"] : z__default.ZodLiteral<TNamespace>;
|
|
195
|
+
kind: TKind extends undefined ? U["kind"] : z__default.ZodLiteral<`${TKind}.sc`>;
|
|
196
|
+
schemaVersion: TSchemaVersion extends undefined ? U["schemaVersion"] : z__default.ZodLiteral<TSchemaVersion>;
|
|
197
|
+
}, z__default.core.$strip> : never>>;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export { BaseResponseSchemaV1, type BaseResponseV1, BaseScoreSchemaV1, type BaseScoreV1, BaseTestCaseSchemaV1, type BaseTestCaseV1, defineResponseSchema, defineScoreSchema, defineTestCaseSchema };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseResponseSchemaV1,
|
|
3
|
+
BaseScoreSchemaV1,
|
|
4
|
+
BaseTestCaseSchemaV1,
|
|
5
|
+
defineResponseSchema,
|
|
6
|
+
defineScoreSchema,
|
|
7
|
+
defineTestCaseSchema
|
|
8
|
+
} from "../chunk-YY33MNMV.js";
|
|
9
|
+
import "../chunk-OQE6TQXZ.js";
|
|
10
|
+
import "../chunk-HMQYGCKI.js";
|
|
11
|
+
import {
|
|
12
|
+
IdSchema
|
|
13
|
+
} from "../chunk-NUEOE3K5.js";
|
|
14
|
+
import "../chunk-PZ5AY32C.js";
|
|
15
|
+
export {
|
|
16
|
+
BaseResponseSchemaV1,
|
|
17
|
+
BaseScoreSchemaV1,
|
|
18
|
+
BaseTestCaseSchemaV1,
|
|
19
|
+
IdSchema,
|
|
20
|
+
defineResponseSchema,
|
|
21
|
+
defineScoreSchema,
|
|
22
|
+
defineTestCaseSchema
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|