vieval 0.0.7 → 0.0.9
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 +24 -2
- package/dist/bin/vieval.mjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/{cli-ImxGpoYQ.mjs → cli-Dao25VxV.mjs} +2 -2
- package/dist/cli-Dao25VxV.mjs.map +1 -0
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/core/assertions/index.d.mts +1 -1
- package/dist/core/inference-executors/index.d.mts +1 -1
- package/dist/core/inference-executors/index.mjs +10 -4
- package/dist/core/inference-executors/index.mjs.map +1 -1
- package/dist/core/processors/results/index.d.mts +1 -1
- package/dist/core/runner/index.d.mts +2 -2
- package/dist/core/runner/index.mjs +6 -40
- package/dist/core/runner/index.mjs.map +1 -1
- package/dist/{env-BeHv_5mo.d.mts → env-DfWZy_n4.d.mts} +14 -9
- package/dist/env-nV5rVErX.mjs +35 -0
- package/dist/env-nV5rVErX.mjs.map +1 -0
- package/dist/{index-5R1_k2nv.d.mts → index-BkjyCInx.d.mts} +12 -37
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/{models-DIGdOUpJ.mjs → models-pBSRUZhY.mjs} +1 -1
- package/dist/{models-DIGdOUpJ.mjs.map → models-pBSRUZhY.mjs.map} +1 -1
- package/dist/plugins/chat-models/index.d.mts +63 -6
- package/dist/plugins/chat-models/index.mjs +74 -18
- package/dist/plugins/chat-models/index.mjs.map +1 -1
- package/dist/registry-BHGMxjpA.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/cli-ImxGpoYQ.mjs.map +0 -1
- package/dist/env--94B0UtW.mjs +0 -41
- package/dist/env--94B0UtW.mjs.map +0 -1
|
@@ -495,15 +495,6 @@ interface ModelDefinition {
|
|
|
495
495
|
declare function resolveModelByName(models: readonly ModelDefinition[], name: string): ModelDefinition | undefined;
|
|
496
496
|
//#endregion
|
|
497
497
|
//#region src/core/runner/task-context.d.ts
|
|
498
|
-
/**
|
|
499
|
-
* Options for selecting a model from the execution context.
|
|
500
|
-
*/
|
|
501
|
-
interface TaskModelSelectionOptions {
|
|
502
|
-
/**
|
|
503
|
-
* Model id or alias name.
|
|
504
|
-
*/
|
|
505
|
-
name: string;
|
|
506
|
-
}
|
|
507
498
|
/**
|
|
508
499
|
* Task-scoped execution context exposed to runner executors.
|
|
509
500
|
*/
|
|
@@ -513,13 +504,9 @@ interface TaskExecutionContext {
|
|
|
513
504
|
*/
|
|
514
505
|
cache: TaskCacheRuntime;
|
|
515
506
|
/**
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
* Use when:
|
|
519
|
-
* - no arguments are provided to use the model selected by run matrix/inferenceExecutor
|
|
520
|
-
* - `name` is provided to resolve a specific model id or alias
|
|
507
|
+
* Configured model registrations available to model plugins.
|
|
521
508
|
*/
|
|
522
|
-
|
|
509
|
+
models: readonly ModelDefinition[];
|
|
523
510
|
}
|
|
524
511
|
/**
|
|
525
512
|
* Inputs used to build task execution context.
|
|
@@ -530,14 +517,13 @@ interface CreateTaskExecutionContextOptions {
|
|
|
530
517
|
task: ScheduledTask;
|
|
531
518
|
}
|
|
532
519
|
/**
|
|
533
|
-
* Creates task-scoped
|
|
520
|
+
* Creates task-scoped context data for runner execution.
|
|
534
521
|
*
|
|
535
522
|
* Call stack:
|
|
536
523
|
*
|
|
537
524
|
* {@link runScheduledTasks}
|
|
538
525
|
* -> {@link createTaskExecutionContext}
|
|
539
|
-
* ->
|
|
540
|
-
* -> `task.model()` / `task.model({ name })`
|
|
526
|
+
* -> `TaskExecutionContext`
|
|
541
527
|
*/
|
|
542
528
|
declare function createTaskExecutionContext(options: CreateTaskExecutionContextOptions): TaskExecutionContext;
|
|
543
529
|
//#endregion
|
|
@@ -581,7 +567,7 @@ interface RunScheduledTasksOptions {
|
|
|
581
567
|
* Creates per-task execution context.
|
|
582
568
|
*
|
|
583
569
|
* Use when:
|
|
584
|
-
* - executor code needs per-task
|
|
570
|
+
* - executor code needs per-task models, cache, or other task-scoped data
|
|
585
571
|
*/
|
|
586
572
|
createExecutionContext?: (task: ScheduledTask) => TaskExecutionContext;
|
|
587
573
|
/**
|
|
@@ -1035,24 +1021,13 @@ interface TaskRunContext {
|
|
|
1035
1021
|
*/
|
|
1036
1022
|
task: ScheduledTask;
|
|
1037
1023
|
/**
|
|
1038
|
-
*
|
|
1039
|
-
*
|
|
1040
|
-
* Runtime impact:
|
|
1041
|
-
* - `context.model()` uses `context.task.matrix.run.model` first when present
|
|
1042
|
-
* - then falls back to inferenceExecutor-id match
|
|
1043
|
-
* - then falls back to first configured model
|
|
1024
|
+
* Configured model registrations available to model plugins.
|
|
1044
1025
|
*
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1047
|
-
*
|
|
1048
|
-
* const defaultModel = context.model()
|
|
1049
|
-
* // resolves the configured model whose id/model/alias matches 'gpt-4.1-mini'
|
|
1050
|
-
*
|
|
1051
|
-
* const judgeModel = context.model({ name: 'judge-large' })
|
|
1052
|
-
* // explicit lookup bypasses matrix default
|
|
1053
|
-
* ```
|
|
1026
|
+
* Use when:
|
|
1027
|
+
* - a plugin owns model selection semantics and needs access to registered models
|
|
1028
|
+
* - eval code resolves matrix-selected model axes through plugin helpers
|
|
1054
1029
|
*/
|
|
1055
|
-
|
|
1030
|
+
models: TaskExecutionContext['models'];
|
|
1056
1031
|
/**
|
|
1057
1032
|
* Optional reporter lifecycle hooks for task-local case events.
|
|
1058
1033
|
*
|
|
@@ -1378,5 +1353,5 @@ interface ConfigHookPlugin<TConfig> {
|
|
|
1378
1353
|
configVievalResolved?: (config: TConfig) => void | Promise<void>;
|
|
1379
1354
|
}
|
|
1380
1355
|
//#endregion
|
|
1381
|
-
export {
|
|
1382
|
-
//# sourceMappingURL=index-
|
|
1356
|
+
export { InferenceExecutor as $, RunScheduledTasksOptions as A, asProjectRelativePath as B, TaskDefinition as C, TaskRunContext as D, TaskReporterHooks as E, CreateTaskExecutionContextOptions as F, AggregatedProviderSummary as G, CreateVievalRunnerRuntimeContextOptions as H, TaskExecutionContext as I, RunResult as J, AggregatedRunResults as K, createTaskExecutionContext as L, RunnerTaskState as M, ScheduledTaskExecutor as N, TaskRunOutput as O, runScheduledTasks as P, CreateRunnerScheduleOptions as Q, ModelDefinition as R, TaskConcurrencyConfig as S, TaskReporterEventPayload as T, RunnerRuntimeContext as U, collectEvalEntries as V, createRunnerRuntimeContext as W, RunScoreKind as X, RunScore as Y, aggregateRunResults as Z, ScopedMatrices as _, CliOpenTelemetryReportingConfig as a, ScheduledTaskMatrixMeta as at, TaskCaseReporterPayload as b, EvalDefinition as c, createFilesystemTaskCacheRuntime as ct, MatrixAxisValues as d, CacheFileOptions as dt, RunnerMatrixDefinition as et, MatrixDefinition as f, CacheNamespace as ft, MatrixValue as g, MatrixRow as h, Awaitable as i, ScheduledTaskMatrix as it, RunnerExecutionError as j, TelemetryAttributeValue as k, EvalModule as l, normalizeCacheFilePathSegments as lt, MatrixPrimitive as m, defineEval as n, RunnerMatrixSelection as nt, CliReportingConfig as o, createRunnerSchedule as ot, MatrixLayer as p, TaskCacheRuntime as pt, AggregatedRunSummary as q, defineTask as r, ScheduledTask as rt, CollectedEvalEntry as s, CreateFilesystemTaskCacheRuntimeOptions as st, ConfigHookPlugin as t, RunnerMatrixInput as tt, EvalModuleMap as u, CacheFileHandle as ut, TaskAutoRetryDelay as v, TaskExecutionPolicy as w, TaskCaseState as x, TaskCaseReporterEndPayload as y, resolveModelByName as z };
|
|
1357
|
+
//# sourceMappingURL=index-BkjyCInx.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as TaskRunContext, I as TaskExecutionContext,
|
|
2
|
-
import { a as requiredEnvFrom } from "./env-
|
|
1
|
+
import { $ as InferenceExecutor, D as TaskRunContext, I as TaskExecutionContext, J as RunResult, O as TaskRunOutput, R as ModelDefinition, S as TaskConcurrencyConfig, X as RunScoreKind, f as MatrixDefinition, k as TelemetryAttributeValue, o as CliReportingConfig, p as MatrixLayer, rt as ScheduledTask, t as ConfigHookPlugin, w as TaskExecutionPolicy } from "./index-BkjyCInx.mjs";
|
|
2
|
+
import { a as requiredEnvFrom } from "./env-DfWZy_n4.mjs";
|
|
3
3
|
import { expect } from "./expect.mjs";
|
|
4
4
|
import * as _$c12 from "c12";
|
|
5
5
|
|
|
@@ -137,7 +137,7 @@ interface CliProjectConfig {
|
|
|
137
137
|
* Model definitions available to project runtime execution.
|
|
138
138
|
*
|
|
139
139
|
* Inference executors control schedule fan-out, while models provide
|
|
140
|
-
* runtime lookup metadata for
|
|
140
|
+
* runtime lookup metadata for model plugin helpers during task execution.
|
|
141
141
|
*
|
|
142
142
|
* @default inherited from top-level config models
|
|
143
143
|
*/
|
|
@@ -253,11 +253,11 @@ interface CliComparisonConfig {
|
|
|
253
253
|
* Execution context exposed to project-level `executor` implementations.
|
|
254
254
|
*
|
|
255
255
|
* Use when:
|
|
256
|
-
* - a project executor needs
|
|
256
|
+
* - a project executor needs task-scoped models plus case reporter hooks
|
|
257
257
|
* - custom scheduling logic wants the same hook shape as `TaskRunContext`
|
|
258
258
|
*
|
|
259
259
|
* Expects:
|
|
260
|
-
* - `
|
|
260
|
+
* - `models` exposes configured model registrations for plugin helpers
|
|
261
261
|
* - `reporterHooks` follows `TaskRunContext['reporterHooks']`
|
|
262
262
|
* - `telemetry` follows `TaskRunContext['telemetry']`
|
|
263
263
|
* - `runtimeConcurrency` follows `TaskRunContext['runtimeConcurrency']`
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as registerEvalDefinition, l as loadEnv, o as createNoopTelemetryRuntime, s as defineConfig } from "./registry-BHGMxjpA.mjs";
|
|
2
2
|
import { t as createSchedulerQueue } from "./queue-DsZQkZO_.mjs";
|
|
3
|
-
import { n as requiredEnvFrom } from "./env
|
|
3
|
+
import { n as requiredEnvFrom } from "./env-nV5rVErX.mjs";
|
|
4
4
|
import { defineEval, defineTask } from "./config.mjs";
|
|
5
5
|
import { expect } from "./expect.mjs";
|
|
6
6
|
import { errorMessageFrom, sleep } from "@moeru/std";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models-
|
|
1
|
+
{"version":3,"file":"models-pBSRUZhY.mjs","names":[],"sources":["../src/config/models.ts"],"sourcesContent":["import type { TaskExecutionPolicy } from './types'\n\n/**\n * Canonical model definition consumed by vieval runtime and config.\n *\n * Use when:\n * - declaring models in `vieval.config.*`\n * - resolving task runtime models by id, alias, or concrete model name\n *\n * Expects:\n * - `id` to be stable and unique within one config\n * - `inferenceExecutorId` to match scheduler/executor identifiers\n *\n * Returns:\n * - one normalized model registration record\n */\nexport interface ModelDefinition {\n /**\n * Stable model id.\n */\n id: string\n /**\n * Inference-executor id used for matching and reporting.\n */\n inferenceExecutorId: string\n /**\n * Executor reference passed through config.\n *\n * `vieval` core treats this as opaque runtime metadata. Builder plugins can\n * narrow this field with plugin-specific executor input types.\n */\n inferenceExecutor: unknown\n /**\n * Concrete model name passed to the inference executor.\n */\n model: string\n /**\n * Alias names that can resolve this model.\n */\n aliases: string[]\n /**\n * Optional execution policy hints attached to this model.\n */\n executionPolicy?: TaskExecutionPolicy\n /**\n * Optional model-level call parameters.\n */\n parameters?: Record<string, unknown>\n}\n\n/**\n * Resolves one model by id, model name, or alias in registration order.\n *\n * Returns:\n * - the first matching model, or `undefined` when no match exists\n */\nexport function resolveModelByName(\n models: readonly ModelDefinition[],\n name: string,\n): ModelDefinition | undefined {\n return models.find(model => model.id === name || model.model === name || model.aliases.includes(name))\n}\n"],"mappings":";;;;;;;AAwDA,SAAgB,mBACd,QACA,MAC6B;AAC7B,QAAO,OAAO,MAAK,UAAS,MAAM,OAAO,QAAQ,MAAM,UAAU,QAAQ,MAAM,QAAQ,SAAS,KAAK,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as TaskRunContext, f as MatrixDefinition, t as ConfigHookPlugin, w as TaskExecutionPolicy
|
|
1
|
+
import { D as TaskRunContext, R as ModelDefinition, f as MatrixDefinition, t as ConfigHookPlugin, w as TaskExecutionPolicy } from "../../index-BkjyCInx.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugins/chat-models/runtime-config.d.ts
|
|
4
4
|
/**
|
|
@@ -80,7 +80,7 @@ type ChatModelRuntimeConfig = OpenAIChatModelRuntimeConfig | OllamaChatModelRunt
|
|
|
80
80
|
* Normalizes one configured chat model into runtime executor config.
|
|
81
81
|
*
|
|
82
82
|
* Use when:
|
|
83
|
-
* - eval code needs typed provider constructor options from
|
|
83
|
+
* - eval code needs typed provider constructor options from a resolved model
|
|
84
84
|
* - model parameters should be validated once with clear error messages
|
|
85
85
|
*
|
|
86
86
|
* Expects:
|
|
@@ -95,7 +95,7 @@ declare function toChatModelRuntimeConfig(model: ModelDefinition): ChatModelRunt
|
|
|
95
95
|
* Resolves OpenAI runtime config from one resolved run-context model.
|
|
96
96
|
*
|
|
97
97
|
* Use when:
|
|
98
|
-
* - task execution already has
|
|
98
|
+
* - task execution already has a model resolved through chat-model helpers
|
|
99
99
|
* - eval code wants typed OpenAI provider options with a concise helper name
|
|
100
100
|
*
|
|
101
101
|
* Expects:
|
|
@@ -109,7 +109,7 @@ declare function openaiFromRunContext(model: ModelDefinition): OpenAIChatModelRu
|
|
|
109
109
|
* Resolves Ollama runtime config from one resolved run-context model.
|
|
110
110
|
*
|
|
111
111
|
* Use when:
|
|
112
|
-
* - task execution already has
|
|
112
|
+
* - task execution already has a model resolved through chat-model helpers
|
|
113
113
|
* - eval code wants typed Ollama provider options with a concise helper name
|
|
114
114
|
*
|
|
115
115
|
* Expects:
|
|
@@ -123,7 +123,7 @@ declare function ollamaFromRunContext(model: ModelDefinition): OllamaChatModelRu
|
|
|
123
123
|
* Resolves OpenRouter runtime config from one resolved run-context model.
|
|
124
124
|
*
|
|
125
125
|
* Use when:
|
|
126
|
-
* - task execution already has
|
|
126
|
+
* - task execution already has a model resolved through chat-model helpers
|
|
127
127
|
* - eval code wants typed OpenRouter provider options with a concise helper name
|
|
128
128
|
*
|
|
129
129
|
* Expects:
|
|
@@ -540,6 +540,63 @@ interface ChatModelsPluginOptions {
|
|
|
540
540
|
*/
|
|
541
541
|
models: readonly ChatModelDefinition[];
|
|
542
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* Matrix scope that can carry a chat model selector.
|
|
545
|
+
*/
|
|
546
|
+
type MatrixModelScope = 'eval' | 'run';
|
|
547
|
+
/**
|
|
548
|
+
* Options for resolving a chat model from a matrix axis.
|
|
549
|
+
*/
|
|
550
|
+
interface ModelFromMatrixOptions {
|
|
551
|
+
/**
|
|
552
|
+
* Matrix axis whose selected value is a model id, model name, or alias.
|
|
553
|
+
*/
|
|
554
|
+
axis: string;
|
|
555
|
+
}
|
|
556
|
+
type MatrixModelContext = Pick<TaskRunContext, 'models' | 'task'>;
|
|
557
|
+
/**
|
|
558
|
+
* Resolves a configured chat model from one scoped matrix axis.
|
|
559
|
+
*
|
|
560
|
+
* Use when:
|
|
561
|
+
* - a matrix axis selects the agent, judge, or another chat model role
|
|
562
|
+
* - eval code should keep model lookup semantics inside the chat-models plugin
|
|
563
|
+
*
|
|
564
|
+
* Expects:
|
|
565
|
+
* - `scope` to identify `context.task.matrix.run` or `context.task.matrix.eval`
|
|
566
|
+
* - `options.axis` to exist and contain a model id, model name, or alias
|
|
567
|
+
*
|
|
568
|
+
* Returns:
|
|
569
|
+
* - the configured model matching the selected matrix value
|
|
570
|
+
*/
|
|
571
|
+
declare function modelFromMatrix(context: MatrixModelContext, scope: MatrixModelScope, options: ModelFromMatrixOptions): ModelDefinition;
|
|
572
|
+
/**
|
|
573
|
+
* Resolves a configured chat model from one run-matrix axis.
|
|
574
|
+
*
|
|
575
|
+
* Use when:
|
|
576
|
+
* - run matrix selects the model used by the system under evaluation
|
|
577
|
+
* - callers want the scoped helper instead of passing `scope: 'run'`
|
|
578
|
+
*
|
|
579
|
+
* Expects:
|
|
580
|
+
* - `options.axis` to exist in `context.task.matrix.run`
|
|
581
|
+
*
|
|
582
|
+
* Returns:
|
|
583
|
+
* - the configured model matching the selected run-matrix value
|
|
584
|
+
*/
|
|
585
|
+
declare function modelFromRun(context: MatrixModelContext, options: ModelFromMatrixOptions): ModelDefinition;
|
|
586
|
+
/**
|
|
587
|
+
* Resolves a configured chat model from one eval-matrix axis.
|
|
588
|
+
*
|
|
589
|
+
* Use when:
|
|
590
|
+
* - eval matrix selects a judge, rubric, or evaluator model
|
|
591
|
+
* - callers want the scoped helper instead of passing `scope: 'eval'`
|
|
592
|
+
*
|
|
593
|
+
* Expects:
|
|
594
|
+
* - `options.axis` to exist in `context.task.matrix.eval`
|
|
595
|
+
*
|
|
596
|
+
* Returns:
|
|
597
|
+
* - the configured model matching the selected eval-matrix value
|
|
598
|
+
*/
|
|
599
|
+
declare function modelFromEval(context: MatrixModelContext, options: ModelFromMatrixOptions): ModelDefinition;
|
|
543
600
|
/**
|
|
544
601
|
* Creates a run-matrix `model` axis from configured chat model names.
|
|
545
602
|
*
|
|
@@ -571,5 +628,5 @@ declare function ChatProviders(options: ChatProvidersPluginOptions): Plugin;
|
|
|
571
628
|
*/
|
|
572
629
|
declare function ChatModels(options: ChatModelsPluginOptions): Plugin;
|
|
573
630
|
//#endregion
|
|
574
|
-
export { ChatModelDefinition, ChatModelExecutorInput, ChatModelExecutorLike, ChatModelFromBaseOptions, ChatModelFromOptions, ChatModelHeaders, ChatModelInferenceExecutor, ChatModelResolverContext, ChatModelResolverValue, ChatModelRuntimeConfig, ChatModelTelemetryProvider, ChatModelToolCall, ChatModels, ChatModelsPluginOptions, ChatProviderDefinition, ChatProviderFromOptions, ChatProviders, ChatProvidersPluginOptions, EmitChatModelErrorTelemetryOptions, EmitChatModelRequestTelemetryOptions, EmitChatModelResponseTelemetryOptions, GenericChatModelInferenceExecutor, OllamaChatModelInferenceExecutor, OllamaChatModelRuntimeConfig, OpenAIChatModelInferenceExecutor, OpenAIChatModelRuntimeConfig, OpenRouterChatModelInferenceExecutor, OpenRouterChatModelRuntimeConfig, OptionalProviderEnvMap, Plugin, PluginConfig, RequiredProviderEnvMap, chatModelFrom, chatModelMatrix, chatProviderFrom, emitChatModelErrorTelemetry, emitChatModelRequestTelemetry, emitChatModelResponseTelemetry, extractChatModelToolCalls, extractMeteringDimensions, ollamaFromRunContext, openaiFromRunContext, openrouterFromRunContext, toChatModelRuntimeConfig };
|
|
631
|
+
export { ChatModelDefinition, ChatModelExecutorInput, ChatModelExecutorLike, ChatModelFromBaseOptions, ChatModelFromOptions, ChatModelHeaders, ChatModelInferenceExecutor, ChatModelResolverContext, ChatModelResolverValue, ChatModelRuntimeConfig, ChatModelTelemetryProvider, ChatModelToolCall, ChatModels, ChatModelsPluginOptions, ChatProviderDefinition, ChatProviderFromOptions, ChatProviders, ChatProvidersPluginOptions, EmitChatModelErrorTelemetryOptions, EmitChatModelRequestTelemetryOptions, EmitChatModelResponseTelemetryOptions, GenericChatModelInferenceExecutor, MatrixModelScope, ModelFromMatrixOptions, OllamaChatModelInferenceExecutor, OllamaChatModelRuntimeConfig, OpenAIChatModelInferenceExecutor, OpenAIChatModelRuntimeConfig, OpenRouterChatModelInferenceExecutor, OpenRouterChatModelRuntimeConfig, OptionalProviderEnvMap, Plugin, PluginConfig, RequiredProviderEnvMap, chatModelFrom, chatModelMatrix, chatProviderFrom, emitChatModelErrorTelemetry, emitChatModelRequestTelemetry, emitChatModelResponseTelemetry, extractChatModelToolCalls, extractMeteringDimensions, modelFromEval, modelFromMatrix, modelFromRun, ollamaFromRunContext, openaiFromRunContext, openrouterFromRunContext, toChatModelRuntimeConfig };
|
|
575
632
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { n as requiredEnvFrom, t as envFrom } from "../../env
|
|
1
|
+
import { n as requiredEnvFrom, t as envFrom } from "../../env-nV5rVErX.mjs";
|
|
2
|
+
import { t as resolveModelByName } from "../../models-pBSRUZhY.mjs";
|
|
2
3
|
import process from "node:process";
|
|
3
4
|
import { errorMessageFrom } from "@moeru/std";
|
|
4
5
|
//#region src/plugins/chat-models/runtime-config.ts
|
|
@@ -7,15 +8,19 @@ function getParameters(model) {
|
|
|
7
8
|
}
|
|
8
9
|
function parseOptionalStringParameter(parameters, key, modelId) {
|
|
9
10
|
const value = parameters[key];
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const normalized = value == null ? void 0 : String(value);
|
|
12
|
+
const name = `${modelId}.parameters.${key}`;
|
|
13
|
+
return envFrom({ [name]: normalized }, {
|
|
14
|
+
name,
|
|
12
15
|
type: "string"
|
|
13
16
|
});
|
|
14
17
|
}
|
|
15
18
|
function parseRequiredStringParameter(parameters, key, modelId) {
|
|
16
19
|
const value = parameters[key];
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
const normalized = value == null ? void 0 : String(value);
|
|
21
|
+
const name = `${modelId}.parameters.${key}`;
|
|
22
|
+
return requiredEnvFrom({ [name]: normalized }, {
|
|
23
|
+
name,
|
|
19
24
|
type: "string"
|
|
20
25
|
});
|
|
21
26
|
}
|
|
@@ -41,7 +46,7 @@ function parseHeadersParameter(parameters, modelId) {
|
|
|
41
46
|
* Normalizes one configured chat model into runtime executor config.
|
|
42
47
|
*
|
|
43
48
|
* Use when:
|
|
44
|
-
* - eval code needs typed provider constructor options from
|
|
49
|
+
* - eval code needs typed provider constructor options from a resolved model
|
|
45
50
|
* - model parameters should be validated once with clear error messages
|
|
46
51
|
*
|
|
47
52
|
* Expects:
|
|
@@ -79,7 +84,7 @@ function toChatModelRuntimeConfig(model) {
|
|
|
79
84
|
* Resolves OpenAI runtime config from one resolved run-context model.
|
|
80
85
|
*
|
|
81
86
|
* Use when:
|
|
82
|
-
* - task execution already has
|
|
87
|
+
* - task execution already has a model resolved through chat-model helpers
|
|
83
88
|
* - eval code wants typed OpenAI provider options with a concise helper name
|
|
84
89
|
*
|
|
85
90
|
* Expects:
|
|
@@ -97,7 +102,7 @@ function openaiFromRunContext(model) {
|
|
|
97
102
|
* Resolves Ollama runtime config from one resolved run-context model.
|
|
98
103
|
*
|
|
99
104
|
* Use when:
|
|
100
|
-
* - task execution already has
|
|
105
|
+
* - task execution already has a model resolved through chat-model helpers
|
|
101
106
|
* - eval code wants typed Ollama provider options with a concise helper name
|
|
102
107
|
*
|
|
103
108
|
* Expects:
|
|
@@ -115,7 +120,7 @@ function ollamaFromRunContext(model) {
|
|
|
115
120
|
* Resolves OpenRouter runtime config from one resolved run-context model.
|
|
116
121
|
*
|
|
117
122
|
* Use when:
|
|
118
|
-
* - task execution already has
|
|
123
|
+
* - task execution already has a model resolved through chat-model helpers
|
|
119
124
|
* - eval code wants typed OpenRouter provider options with a concise helper name
|
|
120
125
|
*
|
|
121
126
|
* Expects:
|
|
@@ -332,30 +337,28 @@ async function resolveChatModelResolverValue(value, context) {
|
|
|
332
337
|
return value;
|
|
333
338
|
}
|
|
334
339
|
function resolveRequiredStringValue(value, name) {
|
|
335
|
-
return requiredEnvFrom(value, {
|
|
340
|
+
return requiredEnvFrom({ [name]: value }, {
|
|
336
341
|
name,
|
|
337
342
|
type: "string"
|
|
338
343
|
});
|
|
339
344
|
}
|
|
340
345
|
function resolveOptionalStringValue(value, name) {
|
|
341
|
-
return envFrom(value, {
|
|
346
|
+
return envFrom({ [name]: value }, {
|
|
342
347
|
name,
|
|
343
348
|
type: "string"
|
|
344
349
|
});
|
|
345
350
|
}
|
|
346
351
|
function resolveOptionalEnvValue(env, envKey) {
|
|
347
|
-
|
|
352
|
+
return envFrom(env, {
|
|
348
353
|
name: envKey,
|
|
349
354
|
type: "string"
|
|
350
|
-
};
|
|
351
|
-
return envFrom(env[envKey], options);
|
|
355
|
+
});
|
|
352
356
|
}
|
|
353
357
|
function resolveRequiredEnvValue(env, envKey) {
|
|
354
|
-
|
|
358
|
+
return requiredEnvFrom(env, {
|
|
355
359
|
name: envKey,
|
|
356
360
|
type: "string"
|
|
357
|
-
};
|
|
358
|
-
return requiredEnvFrom(env[envKey], options);
|
|
361
|
+
});
|
|
359
362
|
}
|
|
360
363
|
function resolveProviderParameters(provider, env) {
|
|
361
364
|
const parameters = { ...provider.parameters };
|
|
@@ -479,6 +482,59 @@ function chatProviderFrom(options) {
|
|
|
479
482
|
};
|
|
480
483
|
}
|
|
481
484
|
/**
|
|
485
|
+
* Resolves a configured chat model from one scoped matrix axis.
|
|
486
|
+
*
|
|
487
|
+
* Use when:
|
|
488
|
+
* - a matrix axis selects the agent, judge, or another chat model role
|
|
489
|
+
* - eval code should keep model lookup semantics inside the chat-models plugin
|
|
490
|
+
*
|
|
491
|
+
* Expects:
|
|
492
|
+
* - `scope` to identify `context.task.matrix.run` or `context.task.matrix.eval`
|
|
493
|
+
* - `options.axis` to exist and contain a model id, model name, or alias
|
|
494
|
+
*
|
|
495
|
+
* Returns:
|
|
496
|
+
* - the configured model matching the selected matrix value
|
|
497
|
+
*/
|
|
498
|
+
function modelFromMatrix(context, scope, options) {
|
|
499
|
+
const selectedModelName = context.task.matrix[scope][options.axis];
|
|
500
|
+
if (selectedModelName == null) throw new Error(`Missing ${scope} matrix axis "${options.axis}".`);
|
|
501
|
+
const model = resolveModelByName(context.models, selectedModelName);
|
|
502
|
+
if (model == null) throw new Error(`Unknown configured chat model "${selectedModelName}" from ${scope} matrix axis "${options.axis}".`);
|
|
503
|
+
return model;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Resolves a configured chat model from one run-matrix axis.
|
|
507
|
+
*
|
|
508
|
+
* Use when:
|
|
509
|
+
* - run matrix selects the model used by the system under evaluation
|
|
510
|
+
* - callers want the scoped helper instead of passing `scope: 'run'`
|
|
511
|
+
*
|
|
512
|
+
* Expects:
|
|
513
|
+
* - `options.axis` to exist in `context.task.matrix.run`
|
|
514
|
+
*
|
|
515
|
+
* Returns:
|
|
516
|
+
* - the configured model matching the selected run-matrix value
|
|
517
|
+
*/
|
|
518
|
+
function modelFromRun(context, options) {
|
|
519
|
+
return modelFromMatrix(context, "run", options);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Resolves a configured chat model from one eval-matrix axis.
|
|
523
|
+
*
|
|
524
|
+
* Use when:
|
|
525
|
+
* - eval matrix selects a judge, rubric, or evaluator model
|
|
526
|
+
* - callers want the scoped helper instead of passing `scope: 'eval'`
|
|
527
|
+
*
|
|
528
|
+
* Expects:
|
|
529
|
+
* - `options.axis` to exist in `context.task.matrix.eval`
|
|
530
|
+
*
|
|
531
|
+
* Returns:
|
|
532
|
+
* - the configured model matching the selected eval-matrix value
|
|
533
|
+
*/
|
|
534
|
+
function modelFromEval(context, options) {
|
|
535
|
+
return modelFromMatrix(context, "eval", options);
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
482
538
|
* Creates a run-matrix `model` axis from configured chat model names.
|
|
483
539
|
*
|
|
484
540
|
* Use when:
|
|
@@ -534,6 +590,6 @@ function ChatModels(options) {
|
|
|
534
590
|
};
|
|
535
591
|
}
|
|
536
592
|
//#endregion
|
|
537
|
-
export { ChatModels, ChatProviders, chatModelFrom, chatModelMatrix, chatProviderFrom, emitChatModelErrorTelemetry, emitChatModelRequestTelemetry, emitChatModelResponseTelemetry, extractChatModelToolCalls, extractMeteringDimensions, ollamaFromRunContext, openaiFromRunContext, openrouterFromRunContext, toChatModelRuntimeConfig };
|
|
593
|
+
export { ChatModels, ChatProviders, chatModelFrom, chatModelMatrix, chatProviderFrom, emitChatModelErrorTelemetry, emitChatModelRequestTelemetry, emitChatModelResponseTelemetry, extractChatModelToolCalls, extractMeteringDimensions, modelFromEval, modelFromMatrix, modelFromRun, ollamaFromRunContext, openaiFromRunContext, openrouterFromRunContext, toChatModelRuntimeConfig };
|
|
538
594
|
|
|
539
595
|
//# sourceMappingURL=index.mjs.map
|