ai-capability-framework 1.0.3 → 1.1.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 +42 -0
- package/README.md +38 -30
- package/ROADMAP.md +14 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +32 -1
- package/dist/discovery/bindings.d.ts +7 -0
- package/dist/discovery/bindings.d.ts.map +1 -0
- package/dist/discovery/bindings.js +24 -0
- package/dist/discovery/budget.d.ts +17 -0
- package/dist/discovery/budget.d.ts.map +1 -0
- package/dist/discovery/budget.js +77 -0
- package/dist/discovery/configuration.d.ts +10 -0
- package/dist/discovery/configuration.d.ts.map +1 -0
- package/dist/discovery/configuration.js +63 -0
- package/dist/discovery/corpus.d.ts +8 -0
- package/dist/discovery/corpus.d.ts.map +1 -0
- package/dist/discovery/corpus.js +64 -0
- package/dist/discovery/diagnostics.d.ts +15 -0
- package/dist/discovery/diagnostics.d.ts.map +1 -0
- package/dist/discovery/diagnostics.js +11 -0
- package/dist/discovery/discoverer.d.ts +23 -0
- package/dist/discovery/discoverer.d.ts.map +1 -0
- package/dist/discovery/discoverer.js +261 -0
- package/dist/discovery/embedding-configuration.d.ts +12 -0
- package/dist/discovery/embedding-configuration.d.ts.map +1 -0
- package/dist/discovery/embedding-configuration.js +81 -0
- package/dist/discovery/embedding-types.d.ts +75 -0
- package/dist/discovery/embedding-types.d.ts.map +1 -0
- package/dist/discovery/embedding-types.js +1 -0
- package/dist/discovery/embeddings.d.ts +38 -0
- package/dist/discovery/embeddings.d.ts.map +1 -0
- package/dist/discovery/embeddings.js +71 -0
- package/dist/discovery/evaluation-validation.d.ts +8 -0
- package/dist/discovery/evaluation-validation.d.ts.map +1 -0
- package/dist/discovery/evaluation-validation.js +19 -0
- package/dist/discovery/evaluation.d.ts +84 -0
- package/dist/discovery/evaluation.d.ts.map +1 -0
- package/dist/discovery/evaluation.js +310 -0
- package/dist/discovery/export.d.ts +14 -0
- package/dist/discovery/export.d.ts.map +1 -0
- package/dist/discovery/export.js +81 -0
- package/dist/discovery/facade.d.ts +82 -0
- package/dist/discovery/facade.d.ts.map +1 -0
- package/dist/discovery/facade.js +266 -0
- package/dist/discovery/fingerprint.d.ts +71 -0
- package/dist/discovery/fingerprint.d.ts.map +1 -0
- package/dist/discovery/fingerprint.js +67 -0
- package/dist/discovery/index-builder.d.ts +3 -0
- package/dist/discovery/index-builder.d.ts.map +1 -0
- package/dist/discovery/index-builder.js +129 -0
- package/dist/discovery/index-validation.d.ts +12 -0
- package/dist/discovery/index-validation.d.ts.map +1 -0
- package/dist/discovery/index-validation.js +117 -0
- package/dist/discovery/index.d.ts +32 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +18 -0
- package/dist/discovery/json-snapshot.d.ts +3 -0
- package/dist/discovery/json-snapshot.d.ts.map +1 -0
- package/dist/discovery/json-snapshot.js +11 -0
- package/dist/discovery/lexical.d.ts +12 -0
- package/dist/discovery/lexical.d.ts.map +1 -0
- package/dist/discovery/lexical.js +26 -0
- package/dist/discovery/metadata.d.ts +4 -0
- package/dist/discovery/metadata.d.ts.map +1 -0
- package/dist/discovery/metadata.js +33 -0
- package/dist/discovery/ranking.d.ts +7 -0
- package/dist/discovery/ranking.d.ts.map +1 -0
- package/dist/discovery/ranking.js +68 -0
- package/dist/discovery/replay.d.ts +50 -0
- package/dist/discovery/replay.d.ts.map +1 -0
- package/dist/discovery/replay.js +175 -0
- package/dist/discovery/retrieval-policy.d.ts +5 -0
- package/dist/discovery/retrieval-policy.d.ts.map +1 -0
- package/dist/discovery/retrieval-policy.js +10 -0
- package/dist/discovery/router.d.ts +39 -0
- package/dist/discovery/router.d.ts.map +1 -0
- package/dist/discovery/router.js +98 -0
- package/dist/discovery/selection-attempt.d.ts +20 -0
- package/dist/discovery/selection-attempt.d.ts.map +1 -0
- package/dist/discovery/selection-attempt.js +39 -0
- package/dist/discovery/selection-cards.d.ts +12 -0
- package/dist/discovery/selection-cards.d.ts.map +1 -0
- package/dist/discovery/selection-cards.js +79 -0
- package/dist/discovery/selection-configuration.d.ts +18 -0
- package/dist/discovery/selection-configuration.d.ts.map +1 -0
- package/dist/discovery/selection-configuration.js +71 -0
- package/dist/discovery/selection-response.d.ts +13 -0
- package/dist/discovery/selection-response.d.ts.map +1 -0
- package/dist/discovery/selection-response.js +47 -0
- package/dist/discovery/selection-types.d.ts +18 -0
- package/dist/discovery/selection-types.d.ts.map +1 -0
- package/dist/discovery/selection-types.js +1 -0
- package/dist/discovery/selection.d.ts +6 -0
- package/dist/discovery/selection.d.ts.map +1 -0
- package/dist/discovery/selection.js +145 -0
- package/dist/discovery/types.d.ts +291 -0
- package/dist/discovery/types.d.ts.map +1 -0
- package/dist/discovery/types.js +1 -0
- package/dist/discovery/usage.d.ts +2 -0
- package/dist/discovery/usage.d.ts.map +1 -0
- package/dist/discovery/usage.js +1 -0
- package/dist/discovery/vectors.d.ts +5 -0
- package/dist/discovery/vectors.d.ts.map +1 -0
- package/dist/discovery/vectors.js +43 -0
- package/dist/discovery/versions.d.ts +37 -0
- package/dist/discovery/versions.d.ts.map +1 -0
- package/dist/discovery/versions.js +36 -0
- package/dist/evals-live/live-eval-runner.d.ts +1 -0
- package/dist/evals-live/live-eval-runner.d.ts.map +1 -1
- package/dist/evals-live/live-eval-runner.js +12 -1
- package/dist/evals-live/types.d.ts +3 -0
- package/dist/evals-live/types.d.ts.map +1 -1
- package/dist/generated/manifest-types.d.ts +3655 -0
- package/dist/generated/manifest-types.d.ts.map +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +8 -0
- package/dist/mcp-server/server.d.ts.map +1 -1
- package/dist/mcp-server/server.js +11 -2
- package/dist/mcp-server/types.d.ts +4 -0
- package/dist/mcp-server/types.d.ts.map +1 -1
- package/dist/observability/redaction.d.ts.map +1 -1
- package/dist/observability/redaction.js +6 -2
- package/dist/observability/types.d.ts +1 -1
- package/dist/observability/types.d.ts.map +1 -1
- package/dist/openai/index.d.ts +2 -0
- package/dist/openai/index.d.ts.map +1 -1
- package/dist/openai/index.js +1 -0
- package/dist/openai/responses-runner.d.ts +1 -1
- package/dist/openai/responses-runner.d.ts.map +1 -1
- package/dist/openai/responses-runner.js +134 -7
- package/dist/openai/selection-client.d.ts +28 -0
- package/dist/openai/selection-client.d.ts.map +1 -0
- package/dist/openai/selection-client.js +95 -0
- package/dist/openai/tool-loop.js +1 -1
- package/dist/openai/types.d.ts +19 -2
- package/dist/openai/types.d.ts.map +1 -1
- package/dist/replay/discovery-snapshot.d.ts +10 -0
- package/dist/replay/discovery-snapshot.d.ts.map +1 -0
- package/dist/replay/discovery-snapshot.js +17 -0
- package/dist/replay/recorder.d.ts.map +1 -1
- package/dist/replay/recorder.js +4 -0
- package/dist/replay/redaction.js +5 -1
- package/dist/replay/replayer.d.ts.map +1 -1
- package/dist/replay/replayer.js +14 -1
- package/dist/replay/types.d.ts +3 -0
- package/dist/replay/types.d.ts.map +1 -1
- package/dist/replay/validation.d.ts.map +1 -1
- package/dist/replay/validation.js +6 -0
- package/dist/runtime/bounded-json.d.ts +4 -0
- package/dist/runtime/bounded-json.d.ts.map +1 -0
- package/dist/runtime/bounded-json.js +74 -0
- package/dist/runtime/eligibility.d.ts +4 -0
- package/dist/runtime/eligibility.d.ts.map +1 -0
- package/dist/runtime/eligibility.js +128 -0
- package/dist/runtime/index.d.ts +5 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/provider-attempt.d.ts +11 -0
- package/dist/runtime/provider-attempt.d.ts.map +1 -0
- package/dist/runtime/provider-attempt.js +221 -0
- package/dist/runtime/provider-run.d.ts +10 -0
- package/dist/runtime/provider-run.d.ts.map +1 -0
- package/dist/runtime/provider-run.js +123 -0
- package/dist/runtime/provider-stop.d.ts +9 -0
- package/dist/runtime/provider-stop.d.ts.map +1 -0
- package/dist/runtime/provider-stop.js +28 -0
- package/dist/runtime/provider-types.d.ts +189 -0
- package/dist/runtime/provider-types.d.ts.map +1 -0
- package/dist/runtime/provider-types.js +1 -0
- package/dist/runtime/provider-usage.d.ts +9 -0
- package/dist/runtime/provider-usage.d.ts.map +1 -0
- package/dist/runtime/provider-usage.js +69 -0
- package/dist/runtime/router.d.ts.map +1 -1
- package/dist/runtime/router.js +3 -118
- package/dist/runtime/types.d.ts +9 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/validator.d.ts +3 -0
- package/dist/validator.d.ts.map +1 -1
- package/dist/validator.js +32 -0
- package/docs/api/public-api-policy.md +10 -0
- package/docs/api/stable-workflow.md +58 -0
- package/docs/api.md +7 -0
- package/docs/capability-manifests.md +24 -0
- package/docs/development.md +22 -0
- package/docs/discovery.md +186 -0
- package/docs/evals/discovery-live.md +199 -0
- package/docs/evals/discovery-qualification.md +158 -0
- package/docs/evals/overview.md +9 -0
- package/docs/getting-started/installation.md +11 -12
- package/docs/getting-started/openai-quickstart.md +16 -5
- package/docs/getting-started/provider-neutral-quickstart.md +247 -88
- package/docs/getting-started/quickstart.md +8 -30
- package/docs/index.md +10 -0
- package/docs/release.md +29 -5
- package/docs/runtime.md +27 -0
- package/docs/start-here.md +23 -134
- package/examples/12-capability-discovery-selection/README.md +346 -0
- package/examples/12-capability-discovery-selection/customer-cases.mjs +52 -0
- package/examples/12-capability-discovery-selection/customer-harness.mjs +91 -0
- package/examples/12-capability-discovery-selection/customer-request-example.mjs +320 -0
- package/examples/12-capability-discovery-selection/discovery-example.mjs +175 -0
- package/examples/12-capability-discovery-selection/discovery-fixtures/three-domains.suite.json +7887 -0
- package/examples/12-capability-discovery-selection/discovery-fixtures/three-domains.v2.suite.json +8167 -0
- package/examples/12-capability-discovery-selection/discovery-fixtures/three-domains.v3.suite.json +8342 -0
- package/examples/12-capability-discovery-selection/evaluation/application.mjs +305 -0
- package/examples/12-capability-discovery-selection/evaluation/campaign.mjs +248 -0
- package/examples/12-capability-discovery-selection/evaluation/clients.mjs +433 -0
- package/examples/12-capability-discovery-selection/evaluation/continuation.mjs +208 -0
- package/examples/12-capability-discovery-selection/evaluation/durable-budget.mjs +420 -0
- package/examples/12-capability-discovery-selection/evaluation/freeze.mjs +9 -0
- package/examples/12-capability-discovery-selection/evaluation/harness.mjs +618 -0
- package/examples/12-capability-discovery-selection/evaluation/mock-host.mjs +260 -0
- package/examples/12-capability-discovery-selection/evaluation/preflight.mjs +115 -0
- package/examples/12-capability-discovery-selection/evaluation/qualification-workflows.mjs +87 -0
- package/examples/12-capability-discovery-selection/evaluation/regrade.mjs +281 -0
- package/examples/12-capability-discovery-selection/evaluation/report.mjs +517 -0
- package/examples/12-capability-discovery-selection/evaluation/runner.mjs +613 -0
- package/examples/12-capability-discovery-selection/evaluation/saved-campaign.mjs +385 -0
- package/examples/12-capability-discovery-selection/evaluation/wording.mjs +115 -0
- package/examples/12-capability-discovery-selection/evaluation/workflow-application.mjs +378 -0
- package/examples/12-capability-discovery-selection/evaluation/workflow-cases.mjs +90 -0
- package/examples/12-capability-discovery-selection/evaluation-example.mjs +154 -0
- package/examples/12-capability-discovery-selection/hybrid-example.mjs +174 -0
- package/examples/12-capability-discovery-selection/mock-embeddings.mjs +101 -0
- package/examples/12-capability-discovery-selection/mock-selection.mjs +78 -0
- package/examples/12-capability-discovery-selection/pipeline-example.mjs +496 -0
- package/examples/12-capability-discovery-selection/retrieval-cases.mjs +31 -0
- package/examples/12-capability-discovery-selection/run-campaign-mock.mjs +40 -0
- package/examples/12-capability-discovery-selection/run-customer-mock.mjs +15 -0
- package/examples/12-capability-discovery-selection/run-evaluation-live.mjs +10 -0
- package/examples/12-capability-discovery-selection/run-evaluation-mock.mjs +3 -0
- package/examples/12-capability-discovery-selection/run-evaluation-regrade.mjs +71 -0
- package/examples/12-capability-discovery-selection/run-hybrid-mock.mjs +3 -0
- package/examples/12-capability-discovery-selection/run-mock.mjs +3 -0
- package/examples/12-capability-discovery-selection/run-pipeline-mock.mjs +2 -0
- package/examples/12-capability-discovery-selection/run-selector-mock.mjs +3 -0
- package/examples/12-capability-discovery-selection/selection-example.mjs +88 -0
- package/package.json +17 -4
- package/schemas/discovery/embedding-index.schema.json +71 -0
- package/schemas/discovery/eval-observations.schema.json +409 -0
- package/schemas/discovery/eval-suite.schema.json +375 -0
- package/schemas/discovery/metadata.schema.json +30 -0
- package/schemas/discovery/selection-response.schema.json +47 -0
- package/schemas/replay/discovery-snapshot.schema.json +335 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createCapabilityDiscovery,
|
|
3
|
+
createInMemoryDiscoveryBudget,
|
|
4
|
+
aggregateDiscoveryUsage
|
|
5
|
+
} from "ai-capability-framework/discovery";
|
|
6
|
+
import { createDiscoveryExample } from "./discovery-example.mjs";
|
|
7
|
+
import {
|
|
8
|
+
MockSelectionClient,
|
|
9
|
+
selectorCases,
|
|
10
|
+
selectionResponse,
|
|
11
|
+
selectedDecision,
|
|
12
|
+
abstainedDecision
|
|
13
|
+
} from "./mock-selection.mjs";
|
|
14
|
+
|
|
15
|
+
export async function runSelectionExample() {
|
|
16
|
+
const harness = await createDiscoveryExample();
|
|
17
|
+
const discovery = createCapabilityDiscovery({ registry: harness.registry });
|
|
18
|
+
const results = await discovery.search({
|
|
19
|
+
tasks: selectorCases.map(({ id, text }) => ({ id, text })),
|
|
20
|
+
runtimeContext: harness.runtimeContext
|
|
21
|
+
});
|
|
22
|
+
const budget = createInMemoryDiscoveryBudget({
|
|
23
|
+
runId: harness.runtimeContext.runId,
|
|
24
|
+
maxProviderCalls: 3,
|
|
25
|
+
maxInputTokens: 12_000
|
|
26
|
+
});
|
|
27
|
+
const client = new MockSelectionClient([
|
|
28
|
+
selectionResponse(
|
|
29
|
+
selectedDecision("competition", "support.ticket.get"),
|
|
30
|
+
abstainedDecision("single")
|
|
31
|
+
)
|
|
32
|
+
]);
|
|
33
|
+
const initial = await discovery.select({
|
|
34
|
+
results,
|
|
35
|
+
client,
|
|
36
|
+
budget,
|
|
37
|
+
maxInputTokens: 4000,
|
|
38
|
+
maxOutputTokens: 1000
|
|
39
|
+
});
|
|
40
|
+
const repairClient = new MockSelectionClient([
|
|
41
|
+
selectionResponse(selectedDecision("competition", "support.foreign")),
|
|
42
|
+
selectionResponse(selectedDecision("competition", "support.ticket.get"))
|
|
43
|
+
]);
|
|
44
|
+
const repaired = await discovery.select({
|
|
45
|
+
results: [results[0]],
|
|
46
|
+
client: repairClient,
|
|
47
|
+
budget,
|
|
48
|
+
maxInputTokens: 4000,
|
|
49
|
+
maxOutputTokens: 1000,
|
|
50
|
+
limits: { maxAttempts: 2 }
|
|
51
|
+
});
|
|
52
|
+
if (
|
|
53
|
+
initial.outcomes[0]?.status !== "selected" ||
|
|
54
|
+
initial.outcomes[1]?.status !== "abstained" ||
|
|
55
|
+
initial.outcomes.length !== 2 ||
|
|
56
|
+
initial.discovery[2].status !== "no_match" ||
|
|
57
|
+
repaired.outcomes[0]?.status !== "selected"
|
|
58
|
+
) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
"The mock selector must choose, abstain, skip and repair as specified."
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
for (const batch of [initial, repaired])
|
|
64
|
+
for (const outcome of batch.outcomes) {
|
|
65
|
+
const fixture = selectorCases.find((entry) => entry.id === outcome.queryId);
|
|
66
|
+
if (
|
|
67
|
+
outcome.status === "selected" &&
|
|
68
|
+
(!fixture.compatibleIds.includes(outcome.capabilityId) ||
|
|
69
|
+
fixture.forbiddenIds.includes(outcome.capabilityId))
|
|
70
|
+
) {
|
|
71
|
+
throw new Error(
|
|
72
|
+
"The selected capability must be compatible and not forbidden."
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
mock: true,
|
|
78
|
+
initial,
|
|
79
|
+
repaired,
|
|
80
|
+
mockSelectionAttempts: client.calls.length + repairClient.calls.length,
|
|
81
|
+
toolCalls: harness.readCalls.length,
|
|
82
|
+
embeddingAttempts: 0,
|
|
83
|
+
usage: aggregateDiscoveryUsage(
|
|
84
|
+
[...initial.usage.stages, ...repaired.usage.stages],
|
|
85
|
+
initial.usage.totals.elapsedMs + repaired.usage.totals.elapsedMs
|
|
86
|
+
)
|
|
87
|
+
};
|
|
88
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-capability-framework",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provider-agnostic AI capability contracts, runtime controls, evals, and model/provider adapters.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -198,7 +198,17 @@
|
|
|
198
198
|
"./schemas/security-packs/promptfoo-red-team-config.schema.json": "./schemas/security-packs/promptfoo-red-team-config.schema.json",
|
|
199
199
|
"./schemas/security-packs/security-case-suite.schema.json": "./schemas/security-packs/security-case-suite.schema.json",
|
|
200
200
|
"./schemas/security-packs/security-pack.schema.json": "./schemas/security-packs/security-pack.schema.json",
|
|
201
|
-
"./package.json": "./package.json"
|
|
201
|
+
"./package.json": "./package.json",
|
|
202
|
+
"./discovery": {
|
|
203
|
+
"types": "./dist/discovery/index.d.ts",
|
|
204
|
+
"import": "./dist/discovery/index.js"
|
|
205
|
+
},
|
|
206
|
+
"./schemas/discovery/metadata.schema.json": "./schemas/discovery/metadata.schema.json",
|
|
207
|
+
"./schemas/discovery/embedding-index.schema.json": "./schemas/discovery/embedding-index.schema.json",
|
|
208
|
+
"./schemas/discovery/selection-response.schema.json": "./schemas/discovery/selection-response.schema.json",
|
|
209
|
+
"./schemas/discovery/eval-suite.schema.json": "./schemas/discovery/eval-suite.schema.json",
|
|
210
|
+
"./schemas/discovery/eval-observations.schema.json": "./schemas/discovery/eval-observations.schema.json",
|
|
211
|
+
"./schemas/replay/discovery-snapshot.schema.json": "./schemas/replay/discovery-snapshot.schema.json"
|
|
202
212
|
},
|
|
203
213
|
"publishConfig": {
|
|
204
214
|
"access": "public"
|
|
@@ -223,7 +233,7 @@
|
|
|
223
233
|
"archive:source": "node scripts/create-source-archive.mjs",
|
|
224
234
|
"build": "tsc -p tsconfig.json",
|
|
225
235
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
226
|
-
"check": "npm run check:generated && npm run build && npm run typecheck && npm run lint && npm test && npm run validate && npm run conformance && npm run format:check && npm run check:readability && npm run gate:examples && npm run docs:build && npm run check:package && npm run check:workspace-public",
|
|
236
|
+
"check": "npm run check:generated && npm run build && npm run typecheck && npm run lint && npm test && npm run validate && npm run conformance && npm run eval:discovery:mock && npm run format:check && npm run check:readability && npm run gate:examples && npm run docs:build && npm run check:package && npm run check:workspace-public",
|
|
227
237
|
"check:docs": "node scripts/check-docs.mjs",
|
|
228
238
|
"check:generated": "node scripts/check-generated.mjs",
|
|
229
239
|
"check:readability": "node scripts/check-public-readability.mjs",
|
|
@@ -296,7 +306,10 @@
|
|
|
296
306
|
"validate": "npm run build --silent && node dist/cli.js validate examples",
|
|
297
307
|
"skills:ci": "npm --prefix agent-skills ci",
|
|
298
308
|
"skills:pack:dry": "npm --prefix agent-skills run pack:dry",
|
|
299
|
-
"skills:publish:dry": "npm publish ./agent-skills --dry-run --access public"
|
|
309
|
+
"skills:publish:dry": "npm publish ./agent-skills --dry-run --access public",
|
|
310
|
+
"eval:discovery:mock": "npm run build --silent && node examples/12-capability-discovery-selection/run-evaluation-mock.mjs",
|
|
311
|
+
"eval:discovery:live": "npm run build --silent && node examples/12-capability-discovery-selection/run-evaluation-live.mjs",
|
|
312
|
+
"eval:discovery:campaign:mock": "npm run build --silent && node examples/12-capability-discovery-selection/run-campaign-mock.mjs"
|
|
300
313
|
},
|
|
301
314
|
"engines": {
|
|
302
315
|
"node": ">=20"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/xennon101/ai-capability-framework/main/schemas/discovery/embedding-index.schema.json",
|
|
4
|
+
"title": "CapabilityEmbeddingIndexArtifact",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schemaVersion",
|
|
9
|
+
"projectionVersion",
|
|
10
|
+
"registrySourceFingerprint",
|
|
11
|
+
"corpusFingerprint",
|
|
12
|
+
"embedding",
|
|
13
|
+
"embeddingConfigurationFingerprint",
|
|
14
|
+
"mock",
|
|
15
|
+
"vectorDimension",
|
|
16
|
+
"entries",
|
|
17
|
+
"indexFingerprint",
|
|
18
|
+
"builtAt"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"schemaVersion": { "const": "1.0" },
|
|
22
|
+
"projectionVersion": { "type": "string", "minLength": 1 },
|
|
23
|
+
"registrySourceFingerprint": { "$ref": "#/$defs/hash" },
|
|
24
|
+
"corpusFingerprint": { "$ref": "#/$defs/hash" },
|
|
25
|
+
"embeddingConfigurationFingerprint": { "$ref": "#/$defs/hash" },
|
|
26
|
+
"indexFingerprint": { "$ref": "#/$defs/hash" },
|
|
27
|
+
"mock": { "type": "boolean" },
|
|
28
|
+
"vectorDimension": { "type": "integer", "minimum": 1 },
|
|
29
|
+
"builtAt": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
32
|
+
},
|
|
33
|
+
"embedding": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"required": ["provider", "model", "configurationId"],
|
|
37
|
+
"properties": {
|
|
38
|
+
"provider": { "$ref": "#/$defs/nonblank" },
|
|
39
|
+
"model": { "$ref": "#/$defs/nonblank" },
|
|
40
|
+
"configurationId": { "$ref": "#/$defs/nonblank" },
|
|
41
|
+
"revision": { "$ref": "#/$defs/nonblank" },
|
|
42
|
+
"dimensions": { "type": "integer", "minimum": 1 }
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"entries": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"required": [
|
|
51
|
+
"capabilityId",
|
|
52
|
+
"capabilityVersion",
|
|
53
|
+
"documentHash",
|
|
54
|
+
"vector",
|
|
55
|
+
"vectorHash"
|
|
56
|
+
],
|
|
57
|
+
"properties": {
|
|
58
|
+
"capabilityId": { "$ref": "#/$defs/nonblank" },
|
|
59
|
+
"capabilityVersion": { "$ref": "#/$defs/nonblank" },
|
|
60
|
+
"documentHash": { "$ref": "#/$defs/hash" },
|
|
61
|
+
"vectorHash": { "$ref": "#/$defs/hash" },
|
|
62
|
+
"vector": { "type": "array", "minItems": 1, "items": { "type": "number" } }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"$defs": {
|
|
68
|
+
"nonblank": { "type": "string", "minLength": 1, "pattern": "\\S" },
|
|
69
|
+
"hash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/xennon101/ai-capability-framework/main/schemas/discovery/eval-observations.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": [
|
|
7
|
+
"schema_version",
|
|
8
|
+
"suite_id",
|
|
9
|
+
"suite_fingerprint",
|
|
10
|
+
"registry_source_fingerprint",
|
|
11
|
+
"corpus_fingerprint",
|
|
12
|
+
"retrieval_policy_fingerprint",
|
|
13
|
+
"configuration",
|
|
14
|
+
"usage_complete",
|
|
15
|
+
"attempts",
|
|
16
|
+
"cases"
|
|
17
|
+
],
|
|
18
|
+
"properties": {
|
|
19
|
+
"schema_version": {
|
|
20
|
+
"const": "1.0"
|
|
21
|
+
},
|
|
22
|
+
"suite_id": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"minLength": 1,
|
|
25
|
+
"maxLength": 200
|
|
26
|
+
},
|
|
27
|
+
"suite_fingerprint": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
30
|
+
},
|
|
31
|
+
"registry_source_fingerprint": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
34
|
+
},
|
|
35
|
+
"corpus_fingerprint": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
38
|
+
},
|
|
39
|
+
"retrieval_policy_fingerprint": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
42
|
+
},
|
|
43
|
+
"configuration": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"required": [
|
|
47
|
+
"mode",
|
|
48
|
+
"policyVersion",
|
|
49
|
+
"limits",
|
|
50
|
+
"aliasWeight",
|
|
51
|
+
"minRetrievalScore"
|
|
52
|
+
],
|
|
53
|
+
"properties": {
|
|
54
|
+
"mode": {
|
|
55
|
+
"enum": ["lexical", "hybrid"]
|
|
56
|
+
},
|
|
57
|
+
"policyVersion": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"minLength": 1,
|
|
60
|
+
"maxLength": 200
|
|
61
|
+
},
|
|
62
|
+
"limits": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"additionalProperties": false,
|
|
65
|
+
"required": [
|
|
66
|
+
"maxQueries",
|
|
67
|
+
"maxFragmentsPerQuery",
|
|
68
|
+
"maxQueryCharacters",
|
|
69
|
+
"maxCandidates",
|
|
70
|
+
"aliasDiversitySlots"
|
|
71
|
+
],
|
|
72
|
+
"properties": {
|
|
73
|
+
"maxQueries": {
|
|
74
|
+
"type": "integer",
|
|
75
|
+
"minimum": 1,
|
|
76
|
+
"maximum": 32
|
|
77
|
+
},
|
|
78
|
+
"maxFragmentsPerQuery": {
|
|
79
|
+
"type": "integer",
|
|
80
|
+
"minimum": 1,
|
|
81
|
+
"maximum": 32
|
|
82
|
+
},
|
|
83
|
+
"maxQueryCharacters": {
|
|
84
|
+
"type": "integer",
|
|
85
|
+
"minimum": 1,
|
|
86
|
+
"maximum": 16000
|
|
87
|
+
},
|
|
88
|
+
"maxCandidates": {
|
|
89
|
+
"type": "integer",
|
|
90
|
+
"minimum": 1,
|
|
91
|
+
"maximum": 20
|
|
92
|
+
},
|
|
93
|
+
"aliasDiversitySlots": {
|
|
94
|
+
"enum": [0, 1]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"aliasWeight": {
|
|
99
|
+
"type": "number",
|
|
100
|
+
"minimum": 0,
|
|
101
|
+
"maximum": 1
|
|
102
|
+
},
|
|
103
|
+
"minRetrievalScore": {
|
|
104
|
+
"type": "number",
|
|
105
|
+
"minimum": 0,
|
|
106
|
+
"maximum": 1
|
|
107
|
+
},
|
|
108
|
+
"weights": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"additionalProperties": false,
|
|
111
|
+
"required": ["semantic", "lexical"],
|
|
112
|
+
"properties": {
|
|
113
|
+
"semantic": {
|
|
114
|
+
"type": "number",
|
|
115
|
+
"minimum": 0,
|
|
116
|
+
"maximum": 1
|
|
117
|
+
},
|
|
118
|
+
"lexical": {
|
|
119
|
+
"type": "number",
|
|
120
|
+
"minimum": 0,
|
|
121
|
+
"maximum": 1
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"failurePolicy": {
|
|
126
|
+
"enum": ["unavailable", "lexical_fallback"]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"custom_ranker_version": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"minLength": 1,
|
|
133
|
+
"maxLength": 200
|
|
134
|
+
},
|
|
135
|
+
"usage_complete": {
|
|
136
|
+
"type": "boolean"
|
|
137
|
+
},
|
|
138
|
+
"attempts": {
|
|
139
|
+
"type": "array",
|
|
140
|
+
"maxItems": 100000,
|
|
141
|
+
"items": {
|
|
142
|
+
"type": "object",
|
|
143
|
+
"additionalProperties": false,
|
|
144
|
+
"required": [
|
|
145
|
+
"run_id",
|
|
146
|
+
"attempt_id",
|
|
147
|
+
"stage",
|
|
148
|
+
"configuration",
|
|
149
|
+
"mock",
|
|
150
|
+
"provider_attempts",
|
|
151
|
+
"completed_responses",
|
|
152
|
+
"retry_attempts",
|
|
153
|
+
"repair_attempts",
|
|
154
|
+
"usage",
|
|
155
|
+
"elapsed_ms",
|
|
156
|
+
"pending",
|
|
157
|
+
"outcome"
|
|
158
|
+
],
|
|
159
|
+
"properties": {
|
|
160
|
+
"run_id": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"minLength": 1,
|
|
163
|
+
"maxLength": 200
|
|
164
|
+
},
|
|
165
|
+
"attempt_id": {
|
|
166
|
+
"type": "string",
|
|
167
|
+
"minLength": 1,
|
|
168
|
+
"maxLength": 200
|
|
169
|
+
},
|
|
170
|
+
"stage": {
|
|
171
|
+
"enum": [
|
|
172
|
+
"embedding_build",
|
|
173
|
+
"query_embedding",
|
|
174
|
+
"selection",
|
|
175
|
+
"selection_repair",
|
|
176
|
+
"model_tool_loop",
|
|
177
|
+
"planning",
|
|
178
|
+
"response_assembly"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
"configuration": {
|
|
182
|
+
"type": "object",
|
|
183
|
+
"additionalProperties": false,
|
|
184
|
+
"required": ["provider", "model", "configurationId"],
|
|
185
|
+
"properties": {
|
|
186
|
+
"provider": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"minLength": 1,
|
|
189
|
+
"maxLength": 200
|
|
190
|
+
},
|
|
191
|
+
"model": {
|
|
192
|
+
"type": "string",
|
|
193
|
+
"minLength": 1,
|
|
194
|
+
"maxLength": 200
|
|
195
|
+
},
|
|
196
|
+
"configurationId": {
|
|
197
|
+
"type": "string",
|
|
198
|
+
"minLength": 1,
|
|
199
|
+
"maxLength": 200
|
|
200
|
+
},
|
|
201
|
+
"revision": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"minLength": 1,
|
|
204
|
+
"maxLength": 200
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"mock": {
|
|
209
|
+
"type": "boolean"
|
|
210
|
+
},
|
|
211
|
+
"provider_attempts": {
|
|
212
|
+
"type": "integer",
|
|
213
|
+
"minimum": 0
|
|
214
|
+
},
|
|
215
|
+
"completed_responses": {
|
|
216
|
+
"type": "integer",
|
|
217
|
+
"minimum": 0
|
|
218
|
+
},
|
|
219
|
+
"retry_attempts": {
|
|
220
|
+
"type": "integer",
|
|
221
|
+
"minimum": 0
|
|
222
|
+
},
|
|
223
|
+
"repair_attempts": {
|
|
224
|
+
"type": "integer",
|
|
225
|
+
"minimum": 0
|
|
226
|
+
},
|
|
227
|
+
"usage": {
|
|
228
|
+
"type": "object",
|
|
229
|
+
"additionalProperties": false,
|
|
230
|
+
"required": [],
|
|
231
|
+
"properties": {
|
|
232
|
+
"inputTokens": {
|
|
233
|
+
"type": "integer",
|
|
234
|
+
"minimum": 0
|
|
235
|
+
},
|
|
236
|
+
"outputTokens": {
|
|
237
|
+
"type": "integer",
|
|
238
|
+
"minimum": 0
|
|
239
|
+
},
|
|
240
|
+
"totalTokens": {
|
|
241
|
+
"type": "integer",
|
|
242
|
+
"minimum": 0
|
|
243
|
+
},
|
|
244
|
+
"cachedInputTokens": {
|
|
245
|
+
"type": "integer",
|
|
246
|
+
"minimum": 0
|
|
247
|
+
},
|
|
248
|
+
"reasoningTokens": {
|
|
249
|
+
"type": "integer",
|
|
250
|
+
"minimum": 0
|
|
251
|
+
},
|
|
252
|
+
"estimatedCost": {
|
|
253
|
+
"type": "number",
|
|
254
|
+
"minimum": 0
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"elapsed_ms": {
|
|
259
|
+
"type": "number",
|
|
260
|
+
"minimum": 0
|
|
261
|
+
},
|
|
262
|
+
"pending": {
|
|
263
|
+
"type": "boolean"
|
|
264
|
+
},
|
|
265
|
+
"outcome": {
|
|
266
|
+
"enum": ["completed", "failed", "cancelled", "discarded"]
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"cases": {
|
|
272
|
+
"type": "array",
|
|
273
|
+
"maxItems": 10000,
|
|
274
|
+
"items": {
|
|
275
|
+
"type": "object",
|
|
276
|
+
"additionalProperties": false,
|
|
277
|
+
"required": [
|
|
278
|
+
"case_id",
|
|
279
|
+
"status",
|
|
280
|
+
"actual_mode",
|
|
281
|
+
"eligibility_fingerprint",
|
|
282
|
+
"candidates",
|
|
283
|
+
"latency_ms"
|
|
284
|
+
],
|
|
285
|
+
"properties": {
|
|
286
|
+
"case_id": {
|
|
287
|
+
"type": "string",
|
|
288
|
+
"minLength": 1,
|
|
289
|
+
"maxLength": 200
|
|
290
|
+
},
|
|
291
|
+
"status": {
|
|
292
|
+
"enum": ["matched", "no_match", "unavailable", "cancelled"]
|
|
293
|
+
},
|
|
294
|
+
"actual_mode": {
|
|
295
|
+
"enum": ["lexical", "hybrid", null]
|
|
296
|
+
},
|
|
297
|
+
"eligibility_fingerprint": {
|
|
298
|
+
"type": "string",
|
|
299
|
+
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
300
|
+
},
|
|
301
|
+
"index_fingerprint": {
|
|
302
|
+
"type": "string",
|
|
303
|
+
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
304
|
+
},
|
|
305
|
+
"candidates": {
|
|
306
|
+
"type": "array",
|
|
307
|
+
"maxItems": 20,
|
|
308
|
+
"items": {
|
|
309
|
+
"type": "object",
|
|
310
|
+
"additionalProperties": false,
|
|
311
|
+
"required": ["capability_id", "capability_version", "score"],
|
|
312
|
+
"properties": {
|
|
313
|
+
"capability_id": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"minLength": 1,
|
|
316
|
+
"maxLength": 200
|
|
317
|
+
},
|
|
318
|
+
"capability_version": {
|
|
319
|
+
"type": "string",
|
|
320
|
+
"minLength": 1,
|
|
321
|
+
"maxLength": 200
|
|
322
|
+
},
|
|
323
|
+
"score": {
|
|
324
|
+
"type": "number",
|
|
325
|
+
"exclusiveMinimum": 0,
|
|
326
|
+
"maximum": 1
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
"latency_ms": {
|
|
332
|
+
"type": "number",
|
|
333
|
+
"minimum": 0
|
|
334
|
+
},
|
|
335
|
+
"selection": {
|
|
336
|
+
"anyOf": [
|
|
337
|
+
{
|
|
338
|
+
"type": "object",
|
|
339
|
+
"additionalProperties": false,
|
|
340
|
+
"required": [
|
|
341
|
+
"mode",
|
|
342
|
+
"status",
|
|
343
|
+
"capability_id",
|
|
344
|
+
"capability_version",
|
|
345
|
+
"operation"
|
|
346
|
+
],
|
|
347
|
+
"properties": {
|
|
348
|
+
"mode": {
|
|
349
|
+
"enum": ["native", "dedicated"]
|
|
350
|
+
},
|
|
351
|
+
"status": {
|
|
352
|
+
"const": "selected"
|
|
353
|
+
},
|
|
354
|
+
"capability_id": {
|
|
355
|
+
"type": "string",
|
|
356
|
+
"minLength": 1,
|
|
357
|
+
"maxLength": 200
|
|
358
|
+
},
|
|
359
|
+
"capability_version": {
|
|
360
|
+
"type": "string",
|
|
361
|
+
"minLength": 1,
|
|
362
|
+
"maxLength": 200
|
|
363
|
+
},
|
|
364
|
+
"operation": {
|
|
365
|
+
"enum": ["read", "prepare", "commit"]
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"type": "object",
|
|
371
|
+
"additionalProperties": false,
|
|
372
|
+
"required": [
|
|
373
|
+
"mode",
|
|
374
|
+
"status",
|
|
375
|
+
"capability_id",
|
|
376
|
+
"capability_version",
|
|
377
|
+
"operation"
|
|
378
|
+
],
|
|
379
|
+
"properties": {
|
|
380
|
+
"mode": {
|
|
381
|
+
"enum": ["native", "dedicated"]
|
|
382
|
+
},
|
|
383
|
+
"status": {
|
|
384
|
+
"enum": [
|
|
385
|
+
"abstained",
|
|
386
|
+
"unavailable",
|
|
387
|
+
"invalid_output",
|
|
388
|
+
"cancelled",
|
|
389
|
+
"not_performed"
|
|
390
|
+
]
|
|
391
|
+
},
|
|
392
|
+
"capability_id": {
|
|
393
|
+
"type": "null"
|
|
394
|
+
},
|
|
395
|
+
"capability_version": {
|
|
396
|
+
"type": "null"
|
|
397
|
+
},
|
|
398
|
+
"operation": {
|
|
399
|
+
"type": "null"
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|