@marinoscar/kvox-eval 0.0.0-bootstrap → 0.1.0-next.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/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/README.md +166 -0
- package/dist/ask/index.d.ts +6 -0
- package/dist/ask/index.js +28 -0
- package/dist/ask/question-schema.d.ts +121 -0
- package/dist/ask/question-schema.js +167 -0
- package/dist/ask/report.d.ts +88 -0
- package/dist/ask/report.js +170 -0
- package/dist/ask/scorer.d.ts +104 -0
- package/dist/ask/scorer.js +164 -0
- package/dist/ask-run/ask-command.d.ts +62 -0
- package/dist/ask-run/ask-command.js +254 -0
- package/dist/ask-run/host/app.d.ts +65 -0
- package/dist/ask-run/host/app.js +146 -0
- package/dist/ask-run/host/db.d.ts +38 -0
- package/dist/ask-run/host/db.js +126 -0
- package/dist/ask-run/host/ports.d.ts +35 -0
- package/dist/ask-run/host/ports.js +113 -0
- package/dist/ask-run/index.d.ts +13 -0
- package/dist/ask-run/index.js +35 -0
- package/dist/ask-run/replay.d.ts +128 -0
- package/dist/ask-run/replay.js +212 -0
- package/dist/ask-run/run-ask-eval.d.ts +125 -0
- package/dist/ask-run/run-ask-eval.js +193 -0
- package/dist/ask-run/seed-golden-graph.d.ts +64 -0
- package/dist/ask-run/seed-golden-graph.js +495 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/kg-command.d.ts +66 -0
- package/dist/cli/kg-command.js +238 -0
- package/dist/cli/main.d.ts +18 -0
- package/dist/cli/main.js +69 -0
- package/dist/fixtures/domains.d.ts +16 -0
- package/dist/fixtures/domains.js +33 -0
- package/dist/fixtures/fixture-schema.d.ts +323 -0
- package/dist/fixtures/fixture-schema.js +199 -0
- package/dist/fixtures/index.d.ts +16 -0
- package/dist/fixtures/index.js +40 -0
- package/dist/fixtures/load.d.ts +73 -0
- package/dist/fixtures/load.js +137 -0
- package/dist/fixtures/questions.d.ts +15 -0
- package/dist/fixtures/questions.js +26 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +36 -0
- package/dist/kg/gold-runner.d.ts +13 -0
- package/dist/kg/gold-runner.js +57 -0
- package/dist/kg/index.d.ts +17 -0
- package/dist/kg/index.js +65 -0
- package/dist/kg/internals.d.ts +7 -0
- package/dist/kg/internals.js +17 -0
- package/dist/kg/prediction-schema.d.ts +245 -0
- package/dist/kg/prediction-schema.js +102 -0
- package/dist/kg/predictions.d.ts +11 -0
- package/dist/kg/predictions.js +49 -0
- package/dist/kg/report.d.ts +84 -0
- package/dist/kg/report.js +125 -0
- package/dist/kg/run-kg-eval.d.ts +77 -0
- package/dist/kg/run-kg-eval.js +137 -0
- package/dist/kg/runner.d.ts +72 -0
- package/dist/kg/runner.js +51 -0
- package/dist/kg/runners/extract-resolve-runner.d.ts +40 -0
- package/dist/kg/runners/extract-resolve-runner.js +199 -0
- package/dist/kg/runners/extract-runner.d.ts +65 -0
- package/dist/kg/runners/extract-runner.js +243 -0
- package/dist/kg/scorer.d.ts +226 -0
- package/dist/kg/scorer.js +463 -0
- package/dist/kg/targets.d.ts +17 -0
- package/dist/kg/targets.js +16 -0
- package/dist/kg/text.d.ts +45 -0
- package/dist/kg/text.js +100 -0
- package/dist/live/adapters.d.ts +16 -0
- package/dist/live/adapters.js +58 -0
- package/dist/live/env.d.ts +39 -0
- package/dist/live/env.js +56 -0
- package/dist/live/index.d.ts +6 -0
- package/dist/live/index.js +16 -0
- package/dist/live/live-ai.d.ts +104 -0
- package/dist/live/live-ai.js +157 -0
- package/dist/parity/constants.d.ts +79 -0
- package/dist/parity/constants.js +104 -0
- package/dist/parity/index.d.ts +20 -0
- package/dist/parity/index.js +38 -0
- package/dist/parity/internals.d.ts +8 -0
- package/dist/parity/internals.js +16 -0
- package/dist/parity/scenario.d.ts +45 -0
- package/dist/parity/scenario.js +245 -0
- package/dist/parity/script.d.ts +44 -0
- package/dist/parity/script.js +136 -0
- package/dist/parity/snapshot.d.ts +43 -0
- package/dist/parity/snapshot.js +71 -0
- package/dist/real-data/index.d.ts +2 -0
- package/dist/real-data/index.js +12 -0
- package/dist/real-data/real-data.d.ts +76 -0
- package/dist/real-data/real-data.js +156 -0
- package/fixtures/kg-golden/README.md +136 -0
- package/fixtures/kg-golden/ask-questions.json +458 -0
- package/fixtures/kg-golden/meetings/m01-northwind-pilot-kickoff.json +792 -0
- package/fixtures/kg-golden/meetings/m02-halden-migration-planning.json +814 -0
- package/fixtures/kg-golden/meetings/m03-larkspur-weekly-sync.json +601 -0
- package/fixtures/kg-golden/meetings/m04-corvid-intake-discovery.json +690 -0
- package/fixtures/kg-golden/meetings/m05-hosting-vendor-selection.json +631 -0
- package/fixtures/kg-golden/meetings/m06-northwind-floor-data-review.json +649 -0
- package/fixtures/kg-golden/meetings/m07-gullwing-intro-notes.json +428 -0
- package/fixtures/kg-golden/meetings/m08-halden-migration-checkpoint.json +672 -0
- package/fixtures/kg-golden/meetings/m09-northwind-platform-org-update.json +711 -0
- package/fixtures/kg-golden/meetings/m10-corvid-prototype-review.json +623 -0
- package/fixtures/kg-golden/meetings/m11-solvane-grid-dashboard-scoping.json +689 -0
- package/fixtures/kg-golden/meetings/m12-northwind-pilot-replan.json +681 -0
- package/fixtures/kg-golden/meetings/m13-halden-cutover-go-no-go.json +721 -0
- package/fixtures/kg-golden/meetings/m14-gullwing-discovery-readout.json +719 -0
- package/fixtures/kg-golden/meetings/m15-halden-handover-ravi-leaving.json +716 -0
- package/fixtures/kg-golden/meetings/m16-varden-claims-portal-intro.json +704 -0
- package/fixtures/kg-golden/meetings/m17-corvid-usability-debrief.json +572 -0
- package/fixtures/kg-golden/meetings/m18-hosting-decision-revisited.json +655 -0
- package/fixtures/kg-golden/meetings/m19-solvane-integration-kickoff.json +726 -0
- package/fixtures/kg-golden/meetings/m20-northwind-go-live-retro.json +673 -0
- package/fixtures/kg-golden/meetings/m21-quarterly-account-review.json +449 -0
- package/fixtures/kg-golden/meetings/m22-halden-intro-call-2020.json +558 -0
- package/fixtures/kg-golden/meetings/m23-gullwing-model-review.json +702 -0
- package/fixtures/kg-golden/meetings/m24-varden-discovery-midpoint.json +643 -0
- package/fixtures/kg-golden/meetings/m25-corvid-rollout-planning.json +642 -0
- package/fixtures/kg-golden/meetings/m26-larkspur-engineering-prep.json +695 -0
- package/fixtures/kg-golden/meetings/m27-solvane-phase-one-demo.json +649 -0
- package/fixtures/kg-golden/meetings/m28-northwind-building-5-scoping.json +715 -0
- package/fixtures/kg-golden/meetings/m29-halden-southern-cutover-review.json +752 -0
- package/fixtures/kg-golden/meetings/m30-varden-portal-build-kickoff.json +697 -0
- package/fixtures/kg-golden/meetings/m31-gullwing-rollout-renewal.json +681 -0
- package/fixtures/kg-golden/meetings/m32-brambleway-weekly-sync.json +472 -0
- package/fixtures/kg-golden/meetings/m33-nina-oliver-one-on-one.json +342 -0
- package/fixtures/kg-golden/meetings/m34-coffee-with-dana.json +249 -0
- package/fixtures/kg-golden/meetings/m35-brambleway-june-sync.json +553 -0
- package/fixtures/kg-golden/meetings/m36-copenhagen-conference-planning.json +296 -0
- package/host/generated/client.d.ts +1 -0
- package/host/generated/client.js +5 -0
- package/host/generated/default.d.ts +1 -0
- package/host/generated/default.js +5 -0
- package/host/generated/edge.d.ts +1 -0
- package/host/generated/edge.js +1658 -0
- package/host/generated/index-browser.js +1684 -0
- package/host/generated/index.d.ts +192335 -0
- package/host/generated/index.js +1658 -0
- package/host/generated/package.json +139 -0
- package/host/generated/query_compiler_fast_bg.js +2 -0
- package/host/generated/query_compiler_fast_bg.wasm +0 -0
- package/host/generated/query_compiler_fast_bg.wasm-base64.js +2 -0
- package/host/generated/runtime/client.d.ts +3433 -0
- package/host/generated/runtime/client.js +110 -0
- package/host/generated/runtime/index-browser.d.ts +90 -0
- package/host/generated/runtime/index-browser.js +6 -0
- package/host/generated/runtime/wasm-compiler-edge.js +100 -0
- package/host/generated/schema.prisma +6312 -0
- package/host/generated/wasm-edge-light-loader.mjs +5 -0
- package/host/generated/wasm-worker-loader.mjs +5 -0
- package/host/prisma/fragments/kvox.ask.prisma +126 -0
- package/host/prisma/fragments/kvox.graph.prisma +1073 -0
- package/host/prisma/fragments/kvox.notes.prisma +787 -0
- package/host/prisma/fragments/kvox.search.prisma +211 -0
- package/host/prisma/fragments/kvox.transcripts.prisma +790 -0
- package/host/prisma/kvox.lock +101 -0
- package/host/prisma/migrations/20240101000000_initial/migration.sql +297 -0
- package/host/prisma/migrations/20240101000001_add_personal_access_tokens/migration.sql +31 -0
- package/host/prisma/migrations/20240101000002_add_credentials/migration.sql +20 -0
- package/host/prisma/migrations/20240101000003_add_notification_deliveries/migration.sql +27 -0
- package/host/prisma/migrations/20240101000004_drop_stale_uuid_defaults/migration.sql +35 -0
- package/host/prisma/migrations/20240101000005_add_notifications/migration.sql +22 -0
- package/host/prisma/migrations/20240101000006_add_push_subscriptions/migration.sql +25 -0
- package/host/prisma/migrations/20240101000007_add_jobs/migration.sql +110 -0
- package/host/prisma/migrations/20240101000008_add_worker_nodes/migration.sql +90 -0
- package/host/prisma/migrations/20240101000009_add_database_backup_runs/migration.sql +104 -0
- package/host/prisma/migrations/20240101000010_add_notification_broadcasts/migration.sql +57 -0
- package/host/prisma/migrations/20240101000011_add_backup_run_job_link/migration.sql +87 -0
- package/host/prisma/migrations/20240101000012_add_job_node_secrets/migration.sql +61 -0
- package/host/prisma/migrations/20240101000013_add_backup_run_pg_dump_version/migration.sql +26 -0
- package/host/prisma/migrations/20240101000014_add_job_claim_token/migration.sql +92 -0
- package/host/prisma/migrations/20240101000015_add_ai_platform/migration.sql +108 -0
- package/host/prisma/migrations/20240101000016_revoke_viewer_ai_use/migration.sql +32 -0
- package/host/prisma/migrations/20240101000017_add_user_credentials/migration.sql +29 -0
- package/host/prisma/migrations/20240101000018_add_device_session_credential_link/migration.sql +52 -0
- package/host/prisma/migrations/20240101000019_add_worker_node_vitals/migration.sql +3 -0
- package/host/prisma/migrations/20240101000020_add_job_trace_context/migration.sql +6 -0
- package/host/prisma/migrations/20240101000021_add_retention_created_at_indexes/migration.sql +13 -0
- package/host/prisma/migrations/20240101000022_add_organizations/migration.sql +142 -0
- package/host/prisma/migrations/20240101000023_split_system_org_roles/migration.sql +131 -0
- package/host/prisma/migrations/20240101000024_org_scoped_rls/migration.sql +215 -0
- package/host/prisma/migrations/20240101000025_add_groups/migration.sql +165 -0
- package/host/prisma/migrations/20240101000026_add_grants/migration.sql +117 -0
- package/host/prisma/migrations/20240101000027_add_org_settings/migration.sql +49 -0
- package/host/prisma/migrations/20240101000028_add_org_credentials/migration.sql +54 -0
- package/host/prisma/migrations/20240101000029_add_jobs_org_id/migration.sql +18 -0
- package/host/prisma/migrations/20240101000030_add_jobs_org_id_status_index/migration.sql +6 -0
- package/host/prisma/migrations/20240101000031_add_broadcast_target_org/migration.sql +21 -0
- package/host/prisma/migrations/20240101000032_add_android_app/migration.sql +60 -0
- package/host/prisma/migrations/20240101000033_open_job_reason/migration.sql +16 -0
- package/host/prisma/migrations/20240101000034_ai_usage_feature/migration.sql +37 -0
- package/host/prisma/migrations/20240101000035_add_app_metadata/migration.sql +49 -0
- package/host/prisma/migrations/20240101000036_open_sharing_vocabularies/migration.sql +97 -0
- package/host/prisma/migrations/20260914130000_kvox_add_transcripts/migration.sql +322 -0
- package/host/prisma/migrations/20260914140000_kvox_add_notes/migration.sql +311 -0
- package/host/prisma/migrations/20260915120000_kvox_add_search_vectors/migration.sql +150 -0
- package/host/prisma/migrations/20260915130000_kvox_add_search_embeddings/migration.sql +362 -0
- package/host/prisma/migrations/20260915210000_kvox_add_note_title_source/migration.sql +30 -0
- package/host/prisma/migrations/20260923120000_kvox_add_note_generation_context_snapshot/migration.sql +24 -0
- package/host/prisma/migrations/20260923130000_kvox_add_user_hidden_note_templates/migration.sql +35 -0
- package/host/prisma/migrations/20260923140000_kvox_add_transcript_speaker_identities/migration.sql +6 -0
- package/host/prisma/migrations/20260923150000_kvox_transcript_name_checks/migration.sql +95 -0
- package/host/prisma/migrations/20260923160000_kvox_add_note_body_format/migration.sql +27 -0
- package/host/prisma/migrations/20260923170000_kvox_add_note_version_body_format/migration.sql +23 -0
- package/host/prisma/migrations/20260926012548_kvox_add_knowledge_graph/migration.sql +680 -0
- package/host/prisma/migrations/20260926030000_kvox_fix_kg_relations_valid_precision_chk/migration.sql +29 -0
- package/host/prisma/migrations/20260926030100_kvox_add_transcript_recorded_at/migration.sql +9 -0
- package/host/prisma/migrations/20260926030200_kvox_kg_evidence_invariant/migration.sql +60 -0
- package/host/prisma/migrations/20260926040000_kvox_add_kg_graph_layouts/migration.sql +30 -0
- package/host/prisma/migrations/20260926050000_kvox_add_ask_conversations/migration.sql +99 -0
- package/host/prisma/migrations/20260926231512_kvox_add_kg_exports/migration.sql +52 -0
- package/host/prisma/migrations/20261016120000_kvox_transcripts_org_id/migration.sql +49 -0
- package/host/prisma/platform.lock +319 -0
- package/host/prisma/schema/app.kvox.ask.prisma +110 -0
- package/host/prisma/schema/app.kvox.graph.prisma +1030 -0
- package/host/prisma/schema/app.kvox.notes.prisma +746 -0
- package/host/prisma/schema/app.kvox.search.prisma +208 -0
- package/host/prisma/schema/app.kvox.transcripts.prisma +726 -0
- package/host/prisma/schema/platform.ai.prisma +419 -0
- package/host/prisma/schema/platform.android-app.prisma +46 -0
- package/host/prisma/schema/platform.base.prisma +15 -0
- package/host/prisma/schema/platform.credentials.prisma +156 -0
- package/host/prisma/schema/platform.db-backup.prisma +359 -0
- package/host/prisma/schema/platform.identity.prisma +638 -0
- package/host/prisma/schema/platform.jobs.prisma +824 -0
- package/host/prisma/schema/platform.notifications.prisma +641 -0
- package/host/prisma/schema/platform.settings.prisma +53 -0
- package/host/prisma/schema/platform.sharing.prisma +208 -0
- package/host/prisma/schema/platform.storage.prisma +118 -0
- package/package.json +112 -1
- package/parity/requests.ask.json +2681 -0
- package/parity/requests.m01.json +1554 -0
- package/parity/requests.m02.json +1554 -0
- package/parity/requests.m03.json +1554 -0
- package/parity/requests.m04.json +1554 -0
- package/parity/requests.m05.json +1554 -0
- package/parity/requests.m06.json +1554 -0
- package/parity/requests.m07.json +1554 -0
- package/parity/requests.m08.json +1554 -0
- package/parity/requests.m09.json +1554 -0
- package/parity/requests.m10.json +1554 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// The provider adapters a live run calls (issue #580)
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// The OpenAI and OpenAI-compatible adapters are the platform's
|
|
7
|
+
// (`@marinoscar/platform-api/ai`). Its public entry exports their Nest MODULES
|
|
8
|
+
// (`OpenAiProviderModule`, `OpenAiCompatibleProviderModule`), not the adapter
|
|
9
|
+
// classes, so the adapter is read off the module's own `exports` metadata and
|
|
10
|
+
// constructed by hand over a fresh `AiProviderRegistry` and the module's client
|
|
11
|
+
// factory (no Nest application is booted: the adapter registers itself only in
|
|
12
|
+
// `onModuleInit`, which is never called here).
|
|
13
|
+
//
|
|
14
|
+
// PLATFORM-ADOPTION-SHIM(#578): until the lean provider-adapter package exports
|
|
15
|
+
// the adapter classes (or factories), at which point this file becomes two
|
|
16
|
+
// `new` expressions.
|
|
17
|
+
// =============================================================================
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.platformAdapter = platformAdapter;
|
|
20
|
+
/** The platform module that carries each provider's adapter. */
|
|
21
|
+
const ADAPTER_MODULES = {
|
|
22
|
+
openai: 'OpenAiProviderModule',
|
|
23
|
+
'openai-compatible': 'OpenAiCompatibleProviderModule',
|
|
24
|
+
};
|
|
25
|
+
/** `Reflect.getMetadata`, installed by `reflect-metadata` (the platform's Nest import loads it). */
|
|
26
|
+
function metadata(key, target) {
|
|
27
|
+
const reflect = Reflect;
|
|
28
|
+
if (typeof reflect.getMetadata !== 'function')
|
|
29
|
+
throw new Error('reflect-metadata is not loaded');
|
|
30
|
+
return reflect.getMetadata(key, target);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The platform's adapter for a provider, constructed outside Nest.
|
|
34
|
+
*
|
|
35
|
+
* @param provider - `openai` or `openai-compatible`.
|
|
36
|
+
* @returns the adapter (`responses`, `embeddings`, ...).
|
|
37
|
+
* @throws Error when the installed platform no longer carries the adapter where this shim looks.
|
|
38
|
+
* @stability experimental
|
|
39
|
+
*/
|
|
40
|
+
function platformAdapter(provider) {
|
|
41
|
+
// Required lazily: the platform's AI entry loads Nest and the OpenAI SDK, which a
|
|
42
|
+
// scoring run (gold, a predictions directory) has no reason to load.
|
|
43
|
+
const ai = require('@marinoscar/platform-api/ai');
|
|
44
|
+
const moduleClass = ai[ADAPTER_MODULES[provider]];
|
|
45
|
+
if (moduleClass === undefined)
|
|
46
|
+
throw new Error(`@marinoscar/platform-api/ai has no ${ADAPTER_MODULES[provider]}`);
|
|
47
|
+
const exported = metadata('exports', moduleClass) ?? [];
|
|
48
|
+
const providers = metadata('providers', moduleClass) ?? [];
|
|
49
|
+
const Adapter = exported.find((c) => typeof c === 'function');
|
|
50
|
+
const Factory = providers.find((c) => typeof c === 'function' && c !== Adapter);
|
|
51
|
+
if (Adapter === undefined || Factory === undefined) {
|
|
52
|
+
throw new Error(`${ADAPTER_MODULES[provider]} does not carry an adapter and a client factory`);
|
|
53
|
+
}
|
|
54
|
+
const adapter = new Adapter(new ai.AiProviderRegistry(), new Factory());
|
|
55
|
+
if (adapter.id !== provider)
|
|
56
|
+
throw new Error(`${ADAPTER_MODULES[provider]} built '${adapter.id}', expected '${provider}'`);
|
|
57
|
+
return adapter;
|
|
58
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The environment variable a live run reads its API key from — never a flag.
|
|
3
|
+
*
|
|
4
|
+
* @stability experimental
|
|
5
|
+
*/
|
|
6
|
+
export declare const KVOX_EVAL_API_KEY_ENV = "KVOX_EVAL_OPENAI_API_KEY";
|
|
7
|
+
/**
|
|
8
|
+
* The former names of {@link KVOX_EVAL_API_KEY_ENV}, read for one release with a
|
|
9
|
+
* deprecation note.
|
|
10
|
+
*
|
|
11
|
+
* @stability deprecated
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEPRECATED_EVAL_API_KEY_ENVS: readonly string[];
|
|
14
|
+
/**
|
|
15
|
+
* Where a key was found.
|
|
16
|
+
*
|
|
17
|
+
* @stability experimental
|
|
18
|
+
*/
|
|
19
|
+
export interface EvalApiKey {
|
|
20
|
+
/** The key. ⚠ Secret: hand it to the runtime, never print it. */
|
|
21
|
+
apiKey: string;
|
|
22
|
+
/** The variable it was read from (safe to print). */
|
|
23
|
+
source: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The live run's API key from the environment, or `null` when none is set.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const key = readEvalApiKey(process.env, (line) => process.stderr.write(`${line}\n`));
|
|
31
|
+
* if (key === null) throw new Error(`set ${KVOX_EVAL_API_KEY_ENV}`);
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param env - the environment to read (`process.env`, or a test's own).
|
|
35
|
+
* @param warn - receives the one-line deprecation note when an old name supplied the key.
|
|
36
|
+
* @returns the key and the variable it came from, or `null`.
|
|
37
|
+
* @stability experimental
|
|
38
|
+
*/
|
|
39
|
+
export declare function readEvalApiKey(env: Readonly<Record<string, string | undefined>>, warn?: (line: string) => void): EvalApiKey | null;
|
package/dist/live/env.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// Where a live evaluation's API key comes from (issue #580)
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// ONE environment variable, `KVOX_EVAL_OPENAI_API_KEY`, for every live run (kg
|
|
7
|
+
// and Ask). The two names it replaces, `KG_EVAL_OPENAI_API_KEY` (#475) and
|
|
8
|
+
// `ASK_EVAL_OPENAI_API_KEY` (#382), are still read for one release, with a
|
|
9
|
+
// one-line deprecation note naming the variable — never its value.
|
|
10
|
+
//
|
|
11
|
+
// ⚠ The key is never a flag, never printed, never written into a report, a
|
|
12
|
+
// prediction or an error message. An empty variable counts as unset.
|
|
13
|
+
// =============================================================================
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DEPRECATED_EVAL_API_KEY_ENVS = exports.KVOX_EVAL_API_KEY_ENV = void 0;
|
|
16
|
+
exports.readEvalApiKey = readEvalApiKey;
|
|
17
|
+
/**
|
|
18
|
+
* The environment variable a live run reads its API key from — never a flag.
|
|
19
|
+
*
|
|
20
|
+
* @stability experimental
|
|
21
|
+
*/
|
|
22
|
+
exports.KVOX_EVAL_API_KEY_ENV = 'KVOX_EVAL_OPENAI_API_KEY';
|
|
23
|
+
/**
|
|
24
|
+
* The former names of {@link KVOX_EVAL_API_KEY_ENV}, read for one release with a
|
|
25
|
+
* deprecation note.
|
|
26
|
+
*
|
|
27
|
+
* @stability deprecated
|
|
28
|
+
*/
|
|
29
|
+
exports.DEPRECATED_EVAL_API_KEY_ENVS = Object.freeze(['KG_EVAL_OPENAI_API_KEY', 'ASK_EVAL_OPENAI_API_KEY']);
|
|
30
|
+
/**
|
|
31
|
+
* The live run's API key from the environment, or `null` when none is set.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const key = readEvalApiKey(process.env, (line) => process.stderr.write(`${line}\n`));
|
|
36
|
+
* if (key === null) throw new Error(`set ${KVOX_EVAL_API_KEY_ENV}`);
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param env - the environment to read (`process.env`, or a test's own).
|
|
40
|
+
* @param warn - receives the one-line deprecation note when an old name supplied the key.
|
|
41
|
+
* @returns the key and the variable it came from, or `null`.
|
|
42
|
+
* @stability experimental
|
|
43
|
+
*/
|
|
44
|
+
function readEvalApiKey(env, warn) {
|
|
45
|
+
const primary = env[exports.KVOX_EVAL_API_KEY_ENV];
|
|
46
|
+
if (primary)
|
|
47
|
+
return { apiKey: primary, source: exports.KVOX_EVAL_API_KEY_ENV };
|
|
48
|
+
for (const name of exports.DEPRECATED_EVAL_API_KEY_ENVS) {
|
|
49
|
+
const value = env[name];
|
|
50
|
+
if (value) {
|
|
51
|
+
warn?.(`kvox-eval: ${name} is deprecated and will stop being read in the next release; set ${exports.KVOX_EVAL_API_KEY_ENV} instead`);
|
|
52
|
+
return { apiKey: value, source: name };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { platformAdapter } from './adapters.js';
|
|
2
|
+
export type { PlatformAdapterProvider } from './adapters.js';
|
|
3
|
+
export { DEPRECATED_EVAL_API_KEY_ENVS, KVOX_EVAL_API_KEY_ENV, readEvalApiKey } from './env.js';
|
|
4
|
+
export type { EvalApiKey } from './env.js';
|
|
5
|
+
export { assertLiveProvider, createLiveKvoxAi, LIVE_PROVIDERS, LiveProviderError, staticTaskModelSource } from './live-ai.js';
|
|
6
|
+
export type { CreateLiveKvoxAiOptions, LiveCallFailure, LiveKvoxAi, LiveProvider } from './live-ai.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.staticTaskModelSource = exports.LiveProviderError = exports.LIVE_PROVIDERS = exports.createLiveKvoxAi = exports.assertLiveProvider = exports.readEvalApiKey = exports.KVOX_EVAL_API_KEY_ENV = exports.DEPRECATED_EVAL_API_KEY_ENVS = exports.platformAdapter = void 0;
|
|
4
|
+
// The live slice's public surface (re-exported by the package root).
|
|
5
|
+
var adapters_js_1 = require("./adapters.js");
|
|
6
|
+
Object.defineProperty(exports, "platformAdapter", { enumerable: true, get: function () { return adapters_js_1.platformAdapter; } });
|
|
7
|
+
var env_js_1 = require("./env.js");
|
|
8
|
+
Object.defineProperty(exports, "DEPRECATED_EVAL_API_KEY_ENVS", { enumerable: true, get: function () { return env_js_1.DEPRECATED_EVAL_API_KEY_ENVS; } });
|
|
9
|
+
Object.defineProperty(exports, "KVOX_EVAL_API_KEY_ENV", { enumerable: true, get: function () { return env_js_1.KVOX_EVAL_API_KEY_ENV; } });
|
|
10
|
+
Object.defineProperty(exports, "readEvalApiKey", { enumerable: true, get: function () { return env_js_1.readEvalApiKey; } });
|
|
11
|
+
var live_ai_js_1 = require("./live-ai.js");
|
|
12
|
+
Object.defineProperty(exports, "assertLiveProvider", { enumerable: true, get: function () { return live_ai_js_1.assertLiveProvider; } });
|
|
13
|
+
Object.defineProperty(exports, "createLiveKvoxAi", { enumerable: true, get: function () { return live_ai_js_1.createLiveKvoxAi; } });
|
|
14
|
+
Object.defineProperty(exports, "LIVE_PROVIDERS", { enumerable: true, get: function () { return live_ai_js_1.LIVE_PROVIDERS; } });
|
|
15
|
+
Object.defineProperty(exports, "LiveProviderError", { enumerable: true, get: function () { return live_ai_js_1.LiveProviderError; } });
|
|
16
|
+
Object.defineProperty(exports, "staticTaskModelSource", { enumerable: true, get: function () { return live_ai_js_1.staticTaskModelSource; } });
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type KvoxTaskModelSource } from '@marinoscar/kvox-ai';
|
|
2
|
+
import type { KvoxAiPort } from '@marinoscar/kvox-api/ports';
|
|
3
|
+
import type { AiProviderAdapter } from '@marinoscar/platform-api/ai';
|
|
4
|
+
import { type PlatformAdapterProvider } from './adapters.js';
|
|
5
|
+
/**
|
|
6
|
+
* The providers a live run may name. `copilot` is listed so it can be refused
|
|
7
|
+
* with a reason (its adapter arrives with #581).
|
|
8
|
+
*
|
|
9
|
+
* @stability experimental
|
|
10
|
+
*/
|
|
11
|
+
export declare const LIVE_PROVIDERS: readonly ["openai", "openai-compatible", "copilot"];
|
|
12
|
+
/**
|
|
13
|
+
* One of {@link LIVE_PROVIDERS}.
|
|
14
|
+
*
|
|
15
|
+
* @stability experimental
|
|
16
|
+
*/
|
|
17
|
+
export type LiveProvider = (typeof LIVE_PROVIDERS)[number];
|
|
18
|
+
/**
|
|
19
|
+
* A live run that cannot be set up as asked (an unknown or unavailable provider,
|
|
20
|
+
* a missing base URL or key). The CLI maps it to exit code 2.
|
|
21
|
+
*
|
|
22
|
+
* @stability experimental
|
|
23
|
+
*/
|
|
24
|
+
export declare class LiveProviderError extends Error {
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The code and HTTP status of one failed provider round trip: what a report may
|
|
28
|
+
* say about a failure (never a message body, which could echo a credential).
|
|
29
|
+
*
|
|
30
|
+
* @stability experimental
|
|
31
|
+
*/
|
|
32
|
+
export interface LiveCallFailure {
|
|
33
|
+
/** The platform's error code (`AI_KEY_INVALID`, `AI_RATE_LIMITED`, ...), or the error's name. */
|
|
34
|
+
code: string;
|
|
35
|
+
/** The HTTP status the code maps to, when the error carries one. */
|
|
36
|
+
status: number | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* What {@link createLiveKvoxAi} is built from.
|
|
40
|
+
*
|
|
41
|
+
* @stability experimental
|
|
42
|
+
*/
|
|
43
|
+
export interface CreateLiveKvoxAiOptions {
|
|
44
|
+
/** The provider every call goes to. */
|
|
45
|
+
provider: LiveProvider | string;
|
|
46
|
+
/** The model every call targets (the only enabled model). */
|
|
47
|
+
model: string;
|
|
48
|
+
/**
|
|
49
|
+
* The API key. ⚠ Secret. Required for `openai`; optional for an
|
|
50
|
+
* `openai-compatible` server that needs none (the platform's keyless marker is sent).
|
|
51
|
+
*/
|
|
52
|
+
apiKey: string | null;
|
|
53
|
+
/** The server's API root (`/v1` included). Required for `openai-compatible`; an override for `openai`. */
|
|
54
|
+
baseUrl?: string;
|
|
55
|
+
/** The adapters by provider id. Default: the platform's, built by `platformAdapter`. A test passes a fake. */
|
|
56
|
+
adapters?: Readonly<Record<string, AiProviderAdapter>>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The live port plus what the caller may report about its failures.
|
|
60
|
+
*
|
|
61
|
+
* @stability experimental
|
|
62
|
+
*/
|
|
63
|
+
export interface LiveKvoxAi {
|
|
64
|
+
/** The model port (`createKvoxAi` over the direct runtime). */
|
|
65
|
+
ai: KvoxAiPort;
|
|
66
|
+
/** Every failed round trip so far, code and status only. */
|
|
67
|
+
failures: LiveCallFailure[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Refuses a provider a live run cannot use today: `copilot` (its adapter arrives
|
|
71
|
+
* with #581) and any id that is not a {@link LIVE_PROVIDERS} entry.
|
|
72
|
+
*
|
|
73
|
+
* @param provider - the provider id a run names.
|
|
74
|
+
* @throws {@link LiveProviderError} with the reason.
|
|
75
|
+
* @stability experimental
|
|
76
|
+
*/
|
|
77
|
+
export declare function assertLiveProvider(provider: string): asserts provider is PlatformAdapterProvider;
|
|
78
|
+
/**
|
|
79
|
+
* The task-model state of a run on one provider and one model: AI on, the graph
|
|
80
|
+
* switch on, every task on that model, no reasoning parameter (`none`).
|
|
81
|
+
*
|
|
82
|
+
* @param provider - the provider id.
|
|
83
|
+
* @param model - the model id.
|
|
84
|
+
* @returns a source whose `load()` always answers that state.
|
|
85
|
+
* @stability experimental
|
|
86
|
+
*/
|
|
87
|
+
export declare function staticTaskModelSource(provider: string, model: string): KvoxTaskModelSource;
|
|
88
|
+
/**
|
|
89
|
+
* Builds the model port a live evaluation runs on.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const key = readEvalApiKey(process.env);
|
|
94
|
+
* const { ai } = createLiveKvoxAi({ provider: 'openai', model: 'gpt-5-mini', apiKey: key?.apiKey ?? null });
|
|
95
|
+
* const report = await runKgEval({ runner: 'extract', ai, model: 'gpt-5-mini' });
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @param options - provider, model, key and (optionally) the adapters.
|
|
99
|
+
* @returns the port and its failure log.
|
|
100
|
+
* @throws {@link LiveProviderError} for `copilot`, an unknown provider, an
|
|
101
|
+
* `openai` run without a key, or an `openai-compatible` run without a base URL.
|
|
102
|
+
* @stability experimental
|
|
103
|
+
*/
|
|
104
|
+
export declare function createLiveKvoxAi(options: CreateLiveKvoxAiOptions): LiveKvoxAi;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// createLiveKvoxAi: the model port a live evaluation runs on (issue #580)
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// An evaluation is a developer or CI tool: no signed-in user, no organization,
|
|
7
|
+
// no stored key, no platform AI service. So it binds the SAME port every host
|
|
8
|
+
// binds, `createKvoxAi` of `@marinoscar/kvox-ai`, over `createDirectRuntime`
|
|
9
|
+
// (the provider adapters, called directly) and a static task-model source that
|
|
10
|
+
// answers "this provider, this one model". The runners never see more than the
|
|
11
|
+
// port; nothing here is a second implementation of a provider call (#475's
|
|
12
|
+
// private OpenAI client is gone).
|
|
13
|
+
//
|
|
14
|
+
// THE KEY. Handed in by the caller (the CLI reads it with `readEvalApiKey`),
|
|
15
|
+
// given to the direct runtime's `keys()` callback, and from there to one adapter
|
|
16
|
+
// call at a time. It is never logged, never put in an error, never returned.
|
|
17
|
+
// A failed call surfaces as the port's `KvoxAiError` (scrubbed); `failures`
|
|
18
|
+
// records only the platform error CODE and HTTP status of each failed round
|
|
19
|
+
// trip, which is what the CLI prints.
|
|
20
|
+
//
|
|
21
|
+
// `copilot` is refused until the Copilot adapter exists (#581): no installed
|
|
22
|
+
// package carries one today.
|
|
23
|
+
// =============================================================================
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.LiveProviderError = exports.LIVE_PROVIDERS = void 0;
|
|
26
|
+
exports.assertLiveProvider = assertLiveProvider;
|
|
27
|
+
exports.staticTaskModelSource = staticTaskModelSource;
|
|
28
|
+
exports.createLiveKvoxAi = createLiveKvoxAi;
|
|
29
|
+
const kvox_ai_1 = require("@marinoscar/kvox-ai");
|
|
30
|
+
const adapters_js_1 = require("./adapters.js");
|
|
31
|
+
/**
|
|
32
|
+
* The providers a live run may name. `copilot` is listed so it can be refused
|
|
33
|
+
* with a reason (its adapter arrives with #581).
|
|
34
|
+
*
|
|
35
|
+
* @stability experimental
|
|
36
|
+
*/
|
|
37
|
+
exports.LIVE_PROVIDERS = Object.freeze(['openai', 'openai-compatible', 'copilot']);
|
|
38
|
+
/**
|
|
39
|
+
* A live run that cannot be set up as asked (an unknown or unavailable provider,
|
|
40
|
+
* a missing base URL or key). The CLI maps it to exit code 2.
|
|
41
|
+
*
|
|
42
|
+
* @stability experimental
|
|
43
|
+
*/
|
|
44
|
+
class LiveProviderError extends Error {
|
|
45
|
+
}
|
|
46
|
+
exports.LiveProviderError = LiveProviderError;
|
|
47
|
+
/**
|
|
48
|
+
* Refuses a provider a live run cannot use today: `copilot` (its adapter arrives
|
|
49
|
+
* with #581) and any id that is not a {@link LIVE_PROVIDERS} entry.
|
|
50
|
+
*
|
|
51
|
+
* @param provider - the provider id a run names.
|
|
52
|
+
* @throws {@link LiveProviderError} with the reason.
|
|
53
|
+
* @stability experimental
|
|
54
|
+
*/
|
|
55
|
+
function assertLiveProvider(provider) {
|
|
56
|
+
if (provider === 'copilot') {
|
|
57
|
+
throw new LiveProviderError("the 'copilot' provider is not available yet: it arrives with the Copilot adapter (#581). Use --provider openai or openai-compatible.");
|
|
58
|
+
}
|
|
59
|
+
if (provider !== 'openai' && provider !== 'openai-compatible') {
|
|
60
|
+
throw new LiveProviderError(`unknown provider '${provider}' (known: ${exports.LIVE_PROVIDERS.join(', ')})`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The task-model state of a run on one provider and one model: AI on, the graph
|
|
65
|
+
* switch on, every task on that model, no reasoning parameter (`none`).
|
|
66
|
+
*
|
|
67
|
+
* @param provider - the provider id.
|
|
68
|
+
* @param model - the model id.
|
|
69
|
+
* @returns a source whose `load()` always answers that state.
|
|
70
|
+
* @stability experimental
|
|
71
|
+
*/
|
|
72
|
+
function staticTaskModelSource(provider, model) {
|
|
73
|
+
const state = {
|
|
74
|
+
provider,
|
|
75
|
+
models: [{ id: model, label: model, structuredOutput: true, toolCalling: true, contextWindow: null, maxOutputTokens: null }],
|
|
76
|
+
policy: {
|
|
77
|
+
enabled: true,
|
|
78
|
+
provider,
|
|
79
|
+
defaultModel: model,
|
|
80
|
+
graphEnabled: true,
|
|
81
|
+
taskModels: {},
|
|
82
|
+
reasoningEffort: 'none',
|
|
83
|
+
maxInputTokens: null,
|
|
84
|
+
maxOutputTokens: null,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
return { load: async () => state };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Builds the model port a live evaluation runs on.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* const key = readEvalApiKey(process.env);
|
|
95
|
+
* const { ai } = createLiveKvoxAi({ provider: 'openai', model: 'gpt-5-mini', apiKey: key?.apiKey ?? null });
|
|
96
|
+
* const report = await runKgEval({ runner: 'extract', ai, model: 'gpt-5-mini' });
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @param options - provider, model, key and (optionally) the adapters.
|
|
100
|
+
* @returns the port and its failure log.
|
|
101
|
+
* @throws {@link LiveProviderError} for `copilot`, an unknown provider, an
|
|
102
|
+
* `openai` run without a key, or an `openai-compatible` run without a base URL.
|
|
103
|
+
* @stability experimental
|
|
104
|
+
*/
|
|
105
|
+
function createLiveKvoxAi(options) {
|
|
106
|
+
const { provider, model, apiKey, baseUrl } = options;
|
|
107
|
+
assertLiveProvider(provider);
|
|
108
|
+
if (provider === 'openai' && !apiKey)
|
|
109
|
+
throw new LiveProviderError('the openai provider needs an API key');
|
|
110
|
+
if (provider === 'openai-compatible' && !baseUrl)
|
|
111
|
+
throw new LiveProviderError('the openai-compatible provider needs --base-url <url>');
|
|
112
|
+
if (!model)
|
|
113
|
+
throw new LiveProviderError('a live run needs a model');
|
|
114
|
+
const adapters = options.adapters ?? { [provider]: (0, adapters_js_1.platformAdapter)(provider) };
|
|
115
|
+
// The platform's marker for a keyless OpenAI-compatible server: the client sends no Authorization header.
|
|
116
|
+
const KEYLESS = 'not-needed';
|
|
117
|
+
const key = apiKey || KEYLESS;
|
|
118
|
+
const failures = [];
|
|
119
|
+
const runtime = recordingFailures((0, kvox_ai_1.createDirectRuntime)({
|
|
120
|
+
adapters,
|
|
121
|
+
keys: async (p) => (p === provider ? { apiKey: key, ...(baseUrl ? { baseUrl } : {}) } : null),
|
|
122
|
+
}), failures);
|
|
123
|
+
return { ai: (0, kvox_ai_1.createKvoxAi)({ runtime, taskModels: staticTaskModelSource(provider, model) }), failures };
|
|
124
|
+
}
|
|
125
|
+
/** The code and status of a thrown value, never its message. */
|
|
126
|
+
function failureOf(error) {
|
|
127
|
+
const e = error;
|
|
128
|
+
const status = typeof e?.getStatus === 'function' ? e.getStatus() : e?.status;
|
|
129
|
+
return {
|
|
130
|
+
code: typeof e?.code === 'string' ? e.code : typeof e?.name === 'string' ? e.name : 'Error',
|
|
131
|
+
status: typeof status === 'number' ? status : null,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** The runtime, with each failed round trip's code and status appended to `failures`. */
|
|
135
|
+
function recordingFailures(runtime, failures) {
|
|
136
|
+
return {
|
|
137
|
+
...runtime,
|
|
138
|
+
async create(call, req) {
|
|
139
|
+
try {
|
|
140
|
+
return await runtime.create(call, req);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
failures.push(failureOf(error));
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
async *stream(call, req) {
|
|
148
|
+
try {
|
|
149
|
+
yield* runtime.stream(call, req);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
failures.push(failureOf(error));
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { KvoxAiModelState, KvoxTaskModelSource } from '@marinoscar/kvox-ai';
|
|
2
|
+
/**
|
|
3
|
+
* The provider both bindings run on.
|
|
4
|
+
*
|
|
5
|
+
* @stability experimental
|
|
6
|
+
*/
|
|
7
|
+
export declare const PARITY_PROVIDER = "openai";
|
|
8
|
+
/**
|
|
9
|
+
* One model of the parity state.
|
|
10
|
+
*
|
|
11
|
+
* @stability experimental
|
|
12
|
+
*/
|
|
13
|
+
export interface ParityModel {
|
|
14
|
+
/** The provider's model id. */
|
|
15
|
+
id: string;
|
|
16
|
+
/** The context window in tokens. */
|
|
17
|
+
contextWindow: number;
|
|
18
|
+
/** The output ceiling in tokens. */
|
|
19
|
+
maxOutputTokens: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The enabled models: all structured-output and tool-calling capable.
|
|
23
|
+
*
|
|
24
|
+
* @stability experimental
|
|
25
|
+
*/
|
|
26
|
+
export declare const PARITY_MODELS: readonly ParityModel[];
|
|
27
|
+
/**
|
|
28
|
+
* The deployment's default model and effort (notes generation runs on them).
|
|
29
|
+
*
|
|
30
|
+
* @stability experimental
|
|
31
|
+
*/
|
|
32
|
+
export declare const PARITY_DEFAULT_MODEL = "gpt-parity";
|
|
33
|
+
/**
|
|
34
|
+
* The deployment-wide reasoning effort.
|
|
35
|
+
*
|
|
36
|
+
* @stability experimental
|
|
37
|
+
*/
|
|
38
|
+
export declare const PARITY_DEFAULT_EFFORT: "low";
|
|
39
|
+
/**
|
|
40
|
+
* The per-task models and efforts (`ai.taskModels`).
|
|
41
|
+
*
|
|
42
|
+
* @stability experimental
|
|
43
|
+
*/
|
|
44
|
+
export declare const PARITY_TASK_MODELS: Readonly<{
|
|
45
|
+
readonly 'graph.extract': {
|
|
46
|
+
readonly model: "gpt-parity-extract";
|
|
47
|
+
readonly reasoningEffort: "medium";
|
|
48
|
+
};
|
|
49
|
+
readonly 'graph.adjudicate': {
|
|
50
|
+
readonly model: "gpt-parity-adjudicate";
|
|
51
|
+
readonly reasoningEffort: "high";
|
|
52
|
+
};
|
|
53
|
+
readonly 'graph.agent': {
|
|
54
|
+
readonly model: "gpt-parity-agent";
|
|
55
|
+
readonly reasoningEffort: "low";
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* The user every parity call is made for. Host-specific, never compared.
|
|
60
|
+
*
|
|
61
|
+
* @stability experimental
|
|
62
|
+
*/
|
|
63
|
+
export declare const PARITY_USER_ID = "11111111-1111-4111-8111-111111111111";
|
|
64
|
+
/**
|
|
65
|
+
* The task-model state of a parity run: AI on, the graph switch on, the models above, the tasks above.
|
|
66
|
+
*
|
|
67
|
+
* @param provider - the provider id the state names (the active provider and the policy's). Default {@link PARITY_PROVIDER}; `copilot` runs the same scenario over the GitHub Copilot adapter (#581).
|
|
68
|
+
* @returns a fresh state.
|
|
69
|
+
* @stability experimental
|
|
70
|
+
*/
|
|
71
|
+
export declare function parityModelState(provider?: string): KvoxAiModelState;
|
|
72
|
+
/**
|
|
73
|
+
* The same state as a static task-model source, for `createKvoxAi({ taskModels })` of the direct binding.
|
|
74
|
+
*
|
|
75
|
+
* @param provider - the provider id the state names. Default {@link PARITY_PROVIDER}.
|
|
76
|
+
* @returns a source whose `load()` always answers {@link parityModelState}.
|
|
77
|
+
* @stability experimental
|
|
78
|
+
*/
|
|
79
|
+
export declare function parityTaskModelSource(provider?: string): KvoxTaskModelSource;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PARITY_USER_ID = exports.PARITY_TASK_MODELS = exports.PARITY_DEFAULT_EFFORT = exports.PARITY_DEFAULT_MODEL = exports.PARITY_MODELS = exports.PARITY_PROVIDER = void 0;
|
|
4
|
+
exports.parityModelState = parityModelState;
|
|
5
|
+
exports.parityTaskModelSource = parityTaskModelSource;
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// What both bindings are configured with (issue #580, part 2)
|
|
8
|
+
// =============================================================================
|
|
9
|
+
//
|
|
10
|
+
// The harness-parity check builds the SAME task-model state twice: as a static
|
|
11
|
+
// `KvoxTaskModelSource` for the direct (Desktop-style) binding, and as the web
|
|
12
|
+
// edition's system-settings value plus `ai_models` rows. These constants are the
|
|
13
|
+
// single description both are built from, so a difference between the two
|
|
14
|
+
// bindings' requests can only come from a binding, never from the state.
|
|
15
|
+
//
|
|
16
|
+
// Different tasks run on different models and efforts ON PURPOSE: a binding that
|
|
17
|
+
// ignored `ai.taskModels` (or its per-task effort) would send the default model
|
|
18
|
+
// and fail the comparison.
|
|
19
|
+
// =============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* The provider both bindings run on.
|
|
22
|
+
*
|
|
23
|
+
* @stability experimental
|
|
24
|
+
*/
|
|
25
|
+
exports.PARITY_PROVIDER = 'openai';
|
|
26
|
+
/**
|
|
27
|
+
* The enabled models: all structured-output and tool-calling capable.
|
|
28
|
+
*
|
|
29
|
+
* @stability experimental
|
|
30
|
+
*/
|
|
31
|
+
exports.PARITY_MODELS = Object.freeze([
|
|
32
|
+
{ id: 'gpt-parity', contextWindow: 128_000, maxOutputTokens: 16_000 },
|
|
33
|
+
{ id: 'gpt-parity-extract', contextWindow: 200_000, maxOutputTokens: 32_000 },
|
|
34
|
+
{ id: 'gpt-parity-adjudicate', contextWindow: 64_000, maxOutputTokens: 8_000 },
|
|
35
|
+
{ id: 'gpt-parity-agent', contextWindow: 128_000, maxOutputTokens: 12_000 },
|
|
36
|
+
]);
|
|
37
|
+
/**
|
|
38
|
+
* The deployment's default model and effort (notes generation runs on them).
|
|
39
|
+
*
|
|
40
|
+
* @stability experimental
|
|
41
|
+
*/
|
|
42
|
+
exports.PARITY_DEFAULT_MODEL = 'gpt-parity';
|
|
43
|
+
/**
|
|
44
|
+
* The deployment-wide reasoning effort.
|
|
45
|
+
*
|
|
46
|
+
* @stability experimental
|
|
47
|
+
*/
|
|
48
|
+
exports.PARITY_DEFAULT_EFFORT = 'low';
|
|
49
|
+
/**
|
|
50
|
+
* The per-task models and efforts (`ai.taskModels`).
|
|
51
|
+
*
|
|
52
|
+
* @stability experimental
|
|
53
|
+
*/
|
|
54
|
+
exports.PARITY_TASK_MODELS = Object.freeze({
|
|
55
|
+
'graph.extract': { model: 'gpt-parity-extract', reasoningEffort: 'medium' },
|
|
56
|
+
'graph.adjudicate': { model: 'gpt-parity-adjudicate', reasoningEffort: 'high' },
|
|
57
|
+
'graph.agent': { model: 'gpt-parity-agent', reasoningEffort: 'low' },
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* The user every parity call is made for. Host-specific, never compared.
|
|
61
|
+
*
|
|
62
|
+
* @stability experimental
|
|
63
|
+
*/
|
|
64
|
+
exports.PARITY_USER_ID = '11111111-1111-4111-8111-111111111111';
|
|
65
|
+
/**
|
|
66
|
+
* The task-model state of a parity run: AI on, the graph switch on, the models above, the tasks above.
|
|
67
|
+
*
|
|
68
|
+
* @param provider - the provider id the state names (the active provider and the policy's). Default {@link PARITY_PROVIDER}; `copilot` runs the same scenario over the GitHub Copilot adapter (#581).
|
|
69
|
+
* @returns a fresh state.
|
|
70
|
+
* @stability experimental
|
|
71
|
+
*/
|
|
72
|
+
function parityModelState(provider = exports.PARITY_PROVIDER) {
|
|
73
|
+
return {
|
|
74
|
+
provider,
|
|
75
|
+
models: exports.PARITY_MODELS.map((m) => ({
|
|
76
|
+
id: m.id,
|
|
77
|
+
label: m.id,
|
|
78
|
+
structuredOutput: true,
|
|
79
|
+
toolCalling: true,
|
|
80
|
+
contextWindow: m.contextWindow,
|
|
81
|
+
maxOutputTokens: m.maxOutputTokens,
|
|
82
|
+
})),
|
|
83
|
+
policy: {
|
|
84
|
+
enabled: true,
|
|
85
|
+
provider,
|
|
86
|
+
defaultModel: exports.PARITY_DEFAULT_MODEL,
|
|
87
|
+
graphEnabled: true,
|
|
88
|
+
taskModels: { ...exports.PARITY_TASK_MODELS },
|
|
89
|
+
reasoningEffort: exports.PARITY_DEFAULT_EFFORT,
|
|
90
|
+
maxInputTokens: null,
|
|
91
|
+
maxOutputTokens: null,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The same state as a static task-model source, for `createKvoxAi({ taskModels })` of the direct binding.
|
|
97
|
+
*
|
|
98
|
+
* @param provider - the provider id the state names. Default {@link PARITY_PROVIDER}.
|
|
99
|
+
* @returns a source whose `load()` always answers {@link parityModelState}.
|
|
100
|
+
* @stability experimental
|
|
101
|
+
*/
|
|
102
|
+
function parityTaskModelSource(provider = exports.PARITY_PROVIDER) {
|
|
103
|
+
return { load: async () => parityModelState(provider) };
|
|
104
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@marinoscar/kvox-eval/parity`: the harness-parity scenario.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* For the same input, two bindings of the model port (the web edition's, KVox
|
|
6
|
+
* Desktop's) must build byte-identical provider requests: system prompt, user
|
|
7
|
+
* prompt or input, JSON Schema, tool definitions, model, reasoning effort and output
|
|
8
|
+
* ceiling. `runParityScenario` drives the product's own notes, extraction,
|
|
9
|
+
* adjudication and Ask code through a port; the committed snapshots
|
|
10
|
+
* (`parity/requests.*.json`) are what each binding's recording must equal.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
export { PARITY_DEFAULT_EFFORT, PARITY_DEFAULT_MODEL, PARITY_MODELS, PARITY_PROVIDER, PARITY_TASK_MODELS, PARITY_USER_ID, parityModelState, parityTaskModelSource, } from './constants.js';
|
|
15
|
+
export type { ParityModel } from './constants.js';
|
|
16
|
+
export { PARITY_FIXTURES, PARITY_QUESTIONS, runParityScenario } from './scenario.js';
|
|
17
|
+
export type { ParityScenarioOptions } from './scenario.js';
|
|
18
|
+
export { createParityScript, goldExtractionAnswer } from './script.js';
|
|
19
|
+
export type { ParityScript } from './script.js';
|
|
20
|
+
export { PARITY_ASK_SNAPSHOT, PARITY_SNAPSHOT_DIR, loadParitySnapshot, paritySnapshotPath, writeParitySnapshot, } from './snapshot.js';
|