@aid-framework/runtime 0.0.0 → 0.1.39
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/LICENSE +201 -0
- package/README.md +53 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/agents/deep_agents.d.ts +78 -0
- package/dist/agents/deep_agents.d.ts.map +1 -0
- package/dist/agents/deep_agents.js +477 -0
- package/dist/agents/deep_agents.js.map +1 -0
- package/dist/agents/engine.d.ts +85 -0
- package/dist/agents/engine.d.ts.map +1 -0
- package/dist/agents/engine.js +129 -0
- package/dist/agents/engine.js.map +1 -0
- package/dist/agents/gateway_chat_model.d.ts +151 -0
- package/dist/agents/gateway_chat_model.d.ts.map +1 -0
- package/dist/agents/gateway_chat_model.js +350 -0
- package/dist/agents/gateway_chat_model.js.map +1 -0
- package/dist/agents/guardrail_middleware.d.ts +57 -0
- package/dist/agents/guardrail_middleware.d.ts.map +1 -0
- package/dist/agents/guardrail_middleware.js +85 -0
- package/dist/agents/guardrail_middleware.js.map +1 -0
- package/dist/agents/guardrails.d.ts +124 -0
- package/dist/agents/guardrails.d.ts.map +1 -0
- package/dist/agents/guardrails.js +336 -0
- package/dist/agents/guardrails.js.map +1 -0
- package/dist/agents/index.d.ts +15 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +15 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/ir.d.ts +144 -0
- package/dist/agents/ir.d.ts.map +1 -0
- package/dist/agents/ir.js +513 -0
- package/dist/agents/ir.js.map +1 -0
- package/dist/agents/loop.d.ts +145 -0
- package/dist/agents/loop.d.ts.map +1 -0
- package/dist/agents/loop.js +1025 -0
- package/dist/agents/loop.js.map +1 -0
- package/dist/agents/memory.d.ts +115 -0
- package/dist/agents/memory.d.ts.map +1 -0
- package/dist/agents/memory.js +258 -0
- package/dist/agents/memory.js.map +1 -0
- package/dist/agents/state.d.ts +137 -0
- package/dist/agents/state.d.ts.map +1 -0
- package/dist/agents/state.js +255 -0
- package/dist/agents/state.js.map +1 -0
- package/dist/concurrency.d.ts +36 -0
- package/dist/concurrency.d.ts.map +1 -0
- package/dist/concurrency.js +86 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/control.d.ts +116 -0
- package/dist/control.d.ts.map +1 -0
- package/dist/control.js +281 -0
- package/dist/control.js.map +1 -0
- package/dist/cost.d.ts +95 -0
- package/dist/cost.d.ts.map +1 -0
- package/dist/cost.js +161 -0
- package/dist/cost.js.map +1 -0
- package/dist/errors.d.ts +213 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +316 -0
- package/dist/errors.js.map +1 -0
- package/dist/evals/dataset.d.ts +45 -0
- package/dist/evals/dataset.d.ts.map +1 -0
- package/dist/evals/dataset.js +147 -0
- package/dist/evals/dataset.js.map +1 -0
- package/dist/evals/gate.d.ts +236 -0
- package/dist/evals/gate.d.ts.map +1 -0
- package/dist/evals/gate.js +572 -0
- package/dist/evals/gate.js.map +1 -0
- package/dist/evals/metrics.d.ts +141 -0
- package/dist/evals/metrics.d.ts.map +1 -0
- package/dist/evals/metrics.js +364 -0
- package/dist/evals/metrics.js.map +1 -0
- package/dist/evals/predicate.d.ts +79 -0
- package/dist/evals/predicate.d.ts.map +1 -0
- package/dist/evals/predicate.js +178 -0
- package/dist/evals/predicate.js.map +1 -0
- package/dist/evals/runner.d.ts +94 -0
- package/dist/evals/runner.d.ts.map +1 -0
- package/dist/evals/runner.js +202 -0
- package/dist/evals/runner.js.map +1 -0
- package/dist/gateway.d.ts +118 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +250 -0
- package/dist/gateway.js.map +1 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/json.d.ts +44 -0
- package/dist/internal/json.d.ts.map +1 -0
- package/dist/internal/json.js +90 -0
- package/dist/internal/json.js.map +1 -0
- package/dist/internal/text.d.ts +17 -0
- package/dist/internal/text.d.ts.map +1 -0
- package/dist/internal/text.js +22 -0
- package/dist/internal/text.js.map +1 -0
- package/dist/pipeline.d.ts +80 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +159 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/policy.d.ts +52 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +199 -0
- package/dist/policy.js.map +1 -0
- package/dist/prompts.d.ts +86 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +337 -0
- package/dist/prompts.js.map +1 -0
- package/dist/providers/base.d.ts +19 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +13 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/fake.d.ts +98 -0
- package/dist/providers/fake.d.ts.map +1 -0
- package/dist/providers/fake.js +181 -0
- package/dist/providers/fake.js.map +1 -0
- package/dist/providers/http.d.ts +62 -0
- package/dist/providers/http.d.ts.map +1 -0
- package/dist/providers/http.js +245 -0
- package/dist/providers/http.js.map +1 -0
- package/dist/retrieval/chunking.d.ts +88 -0
- package/dist/retrieval/chunking.d.ts.map +1 -0
- package/dist/retrieval/chunking.js +188 -0
- package/dist/retrieval/chunking.js.map +1 -0
- package/dist/retrieval/citations.d.ts +98 -0
- package/dist/retrieval/citations.d.ts.map +1 -0
- package/dist/retrieval/citations.js +134 -0
- package/dist/retrieval/citations.js.map +1 -0
- package/dist/retrieval/connectors.d.ts +74 -0
- package/dist/retrieval/connectors.d.ts.map +1 -0
- package/dist/retrieval/connectors.js +218 -0
- package/dist/retrieval/connectors.js.map +1 -0
- package/dist/retrieval/embedding.d.ts +116 -0
- package/dist/retrieval/embedding.d.ts.map +1 -0
- package/dist/retrieval/embedding.js +282 -0
- package/dist/retrieval/embedding.js.map +1 -0
- package/dist/retrieval/gate.d.ts +52 -0
- package/dist/retrieval/gate.d.ts.map +1 -0
- package/dist/retrieval/gate.js +91 -0
- package/dist/retrieval/gate.js.map +1 -0
- package/dist/retrieval/hybrid.d.ts +76 -0
- package/dist/retrieval/hybrid.d.ts.map +1 -0
- package/dist/retrieval/hybrid.js +150 -0
- package/dist/retrieval/hybrid.js.map +1 -0
- package/dist/retrieval/metrics.d.ts +126 -0
- package/dist/retrieval/metrics.d.ts.map +1 -0
- package/dist/retrieval/metrics.js +200 -0
- package/dist/retrieval/metrics.js.map +1 -0
- package/dist/retrieval/pgvector.d.ts +62 -0
- package/dist/retrieval/pgvector.d.ts.map +1 -0
- package/dist/retrieval/pgvector.js +262 -0
- package/dist/retrieval/pgvector.js.map +1 -0
- package/dist/retrieval/rerank.d.ts +61 -0
- package/dist/retrieval/rerank.d.ts.map +1 -0
- package/dist/retrieval/rerank.js +105 -0
- package/dist/retrieval/rerank.js.map +1 -0
- package/dist/retrieval/retriever.d.ts +125 -0
- package/dist/retrieval/retriever.d.ts.map +1 -0
- package/dist/retrieval/retriever.js +281 -0
- package/dist/retrieval/retriever.js.map +1 -0
- package/dist/retrieval/stores.d.ts +106 -0
- package/dist/retrieval/stores.d.ts.map +1 -0
- package/dist/retrieval/stores.js +142 -0
- package/dist/retrieval/stores.js.map +1 -0
- package/dist/retrieval/types.d.ts +314 -0
- package/dist/retrieval/types.d.ts.map +1 -0
- package/dist/retrieval/types.js +388 -0
- package/dist/retrieval/types.js.map +1 -0
- package/dist/steps.d.ts +156 -0
- package/dist/steps.d.ts.map +1 -0
- package/dist/steps.js +199 -0
- package/dist/steps.js.map +1 -0
- package/dist/structured.d.ts +91 -0
- package/dist/structured.d.ts.map +1 -0
- package/dist/structured.js +155 -0
- package/dist/structured.js.map +1 -0
- package/dist/tools.d.ts +100 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +201 -0
- package/dist/tools.js.map +1 -0
- package/dist/tracing.d.ts +104 -0
- package/dist/tracing.d.ts.map +1 -0
- package/dist/tracing.js +155 -0
- package/dist/tracing.js.map +1 -0
- package/dist/types.d.ts +240 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +357 -0
- package/dist/types.js.map +1 -0
- package/package.json +80 -14
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where vectors live and how they are searched.
|
|
3
|
+
*
|
|
4
|
+
* Two adapters behind one protocol: in-memory and pgvector. The in-memory store is
|
|
5
|
+
* not a stand-in for a "real" one -- it is the adapter every gate runs against, so it
|
|
6
|
+
* is the one whose behaviour is the contract. The pgvector adapter is covered by the
|
|
7
|
+
* same expectations and by nothing else: it is locally provisioned, and no required
|
|
8
|
+
* gate touches a database.
|
|
9
|
+
*
|
|
10
|
+
* Similarity is always reported as *higher is better*, including for L2, where the
|
|
11
|
+
* raw quantity is a distance. A store that inverted its sign for one metric would
|
|
12
|
+
* make every caller responsible for remembering which metric it asked for, and fusion
|
|
13
|
+
* and reranking downstream would silently rank backwards.
|
|
14
|
+
*
|
|
15
|
+
* Lexical search is deliberately absent from the store. The store owns the vector
|
|
16
|
+
* index; BM25 lives in `hybrid.ts` and reads the corpus through
|
|
17
|
+
* {@link VectorStore.corpus}. That keeps one lexical implementation instead of one
|
|
18
|
+
* per backend, at the cost of fetching the corpus per query -- a Phase 1
|
|
19
|
+
* simplification, correct at test scale and worth revisiting when a corpus outgrows
|
|
20
|
+
* memory.
|
|
21
|
+
*/
|
|
22
|
+
import { ConfigurationError, FeatureDeferredError } from '../errors.js';
|
|
23
|
+
import { repr } from '../internal/json.js';
|
|
24
|
+
import { PgVectorStore } from './pgvector.js';
|
|
25
|
+
/** One chunk and its vector, exactly as it is written to a store. */
|
|
26
|
+
export class StoreRecord {
|
|
27
|
+
chunk;
|
|
28
|
+
vector;
|
|
29
|
+
constructor(init) {
|
|
30
|
+
this.chunk = init.chunk;
|
|
31
|
+
this.vector = [...init.vector];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** A record and its similarity to the query, higher being better. */
|
|
35
|
+
export class SearchHit {
|
|
36
|
+
record;
|
|
37
|
+
score;
|
|
38
|
+
constructor(init) {
|
|
39
|
+
this.record = init.record;
|
|
40
|
+
this.score = init.score;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Similarity of two equal-length vectors under `metric`.
|
|
45
|
+
*
|
|
46
|
+
* Always oriented so that a larger number means a better match.
|
|
47
|
+
*/
|
|
48
|
+
export function similarity(left, right, init) {
|
|
49
|
+
if (left.length !== right.length) {
|
|
50
|
+
throw new ConfigurationError(`cannot compare vectors of ${left.length} and ${right.length} dimensions; the query ` +
|
|
51
|
+
"and the stored vectors must share the embedding's pinned width");
|
|
52
|
+
}
|
|
53
|
+
let dot = 0;
|
|
54
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
55
|
+
dot += left[index] * right[index];
|
|
56
|
+
}
|
|
57
|
+
if (init.metric === 'dot') {
|
|
58
|
+
return dot;
|
|
59
|
+
}
|
|
60
|
+
if (init.metric === 'l2') {
|
|
61
|
+
let squares = 0;
|
|
62
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
63
|
+
const difference = left[index] - right[index];
|
|
64
|
+
squares += difference * difference;
|
|
65
|
+
}
|
|
66
|
+
return -Math.sqrt(squares);
|
|
67
|
+
}
|
|
68
|
+
const leftNorm = Math.sqrt(left.reduce((total, value) => total + value * value, 0));
|
|
69
|
+
const rightNorm = Math.sqrt(right.reduce((total, value) => total + value * value, 0));
|
|
70
|
+
if (leftNorm === 0.0 || rightNorm === 0.0) {
|
|
71
|
+
// A zero vector has no direction, so cosine similarity is undefined rather than
|
|
72
|
+
// zero; returning 0.0 keeps it last without inventing a ranking.
|
|
73
|
+
return 0.0;
|
|
74
|
+
}
|
|
75
|
+
return dot / (leftNorm * rightNorm);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A map keyed by `chunkId`.
|
|
79
|
+
*
|
|
80
|
+
* The key choice is what makes ingest idempotent: re-ingesting identical input
|
|
81
|
+
* recomputes identical ids and overwrites in place, so the store's contents are a
|
|
82
|
+
* function of the input rather than of how many times it was ingested.
|
|
83
|
+
*/
|
|
84
|
+
export class InMemoryVectorStore {
|
|
85
|
+
_kind;
|
|
86
|
+
_records = new Map();
|
|
87
|
+
constructor(init = {}) {
|
|
88
|
+
this._kind = init.kind ?? 'memory';
|
|
89
|
+
}
|
|
90
|
+
get kind() {
|
|
91
|
+
return this._kind;
|
|
92
|
+
}
|
|
93
|
+
async upsert(records) {
|
|
94
|
+
for (const record of records) {
|
|
95
|
+
this._records.set(record.chunk.chunkId, record);
|
|
96
|
+
}
|
|
97
|
+
return records.length;
|
|
98
|
+
}
|
|
99
|
+
async search(vector, init) {
|
|
100
|
+
if (init.topK < 1) {
|
|
101
|
+
throw new ConfigurationError('top_k must be at least 1');
|
|
102
|
+
}
|
|
103
|
+
const hits = [...this._records.values()].map((record) => new SearchHit({ record, score: similarity(vector, record.vector, init) }));
|
|
104
|
+
// Ties break on chunk id, never on insertion order: two runs that ingest the same
|
|
105
|
+
// corpus in a different order must produce the same ranking.
|
|
106
|
+
hits.sort((left, right) => left.score !== right.score
|
|
107
|
+
? right.score - left.score
|
|
108
|
+
: left.record.chunk.chunkId < right.record.chunk.chunkId
|
|
109
|
+
? -1
|
|
110
|
+
: 1);
|
|
111
|
+
return hits.slice(0, init.topK);
|
|
112
|
+
}
|
|
113
|
+
async corpus() {
|
|
114
|
+
return [...this._records.keys()]
|
|
115
|
+
.sort((left, right) => (left < right ? -1 : 1))
|
|
116
|
+
.map((chunkId) => this._records.get(chunkId));
|
|
117
|
+
}
|
|
118
|
+
async close() {
|
|
119
|
+
// The in-memory store owns no external resource, so there is nothing to release.
|
|
120
|
+
return Promise.resolve();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Select a store adapter.
|
|
125
|
+
*
|
|
126
|
+
* `pgvector.ts` is imported statically but loads its database driver lazily on first
|
|
127
|
+
* connect, so importing this module still pulls in no driver: the optional-extra
|
|
128
|
+
* property the Python adapter preserves at import time is preserved here at connect
|
|
129
|
+
* time instead. It keeps `createStore` synchronous, which is what the retriever's
|
|
130
|
+
* constructor needs.
|
|
131
|
+
*/
|
|
132
|
+
export function createStore(kind, init = {}) {
|
|
133
|
+
if (kind === 'memory') {
|
|
134
|
+
return new InMemoryVectorStore();
|
|
135
|
+
}
|
|
136
|
+
if (kind === 'pgvector') {
|
|
137
|
+
return new PgVectorStore({ uri: init.uri ?? null, dimensions: init.dimensions ?? null });
|
|
138
|
+
}
|
|
139
|
+
throw new FeatureDeferredError(`vector store kind ${repr(kind)} is declared in the IR but has no adapter in this ` +
|
|
140
|
+
"runtime; Phase 1 ships 'memory' and 'pgvector'");
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=stores.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stores.js","sourceRoot":"","sources":["../../src/retrieval/stores.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,qEAAqE;AACrE,MAAM,OAAO,WAAW;IACb,KAAK,CAAQ;IACb,MAAM,CAAoB;IAEnC,YAAY,IAAmE;QAC7E,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;CACF;AAED,qEAAqE;AACrE,MAAM,OAAO,SAAS;IACX,MAAM,CAAc;IACpB,KAAK,CAAS;IAEvB,YAAY,IAA8D;QACxE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC1B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,U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AI,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC,CAAC;IAC3F,CAAC;IACD,MAAM,IAAI,oBAAoB,CAC5B,qBAAqB,IAAI,CAAC,IAAI,CAAC,oDAAoD;QACjF,gDAAgD,CACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shapes the retrieval runtime shares across its modules.
|
|
3
|
+
*
|
|
4
|
+
* Two families live here and the split is deliberate.
|
|
5
|
+
*
|
|
6
|
+
* * The **IR mirror** models (`SourceSpec`, `ChunkingSpec`, `IndexSpec`,
|
|
7
|
+
* `RerankSpec`, `RefreshSpec`, `RetrieverSpec`, `EmbeddingSpec`,
|
|
8
|
+
* `VectorStoreSpec`) reproduce the L1 IR's `retrievers` / `embeddings` /
|
|
9
|
+
* `stores` entries field for field. The IR spells these in camelCase
|
|
10
|
+
* (`keepMetadata`, `embedModel`, `topK`, `inputPerMTok`, ...) and so does this
|
|
11
|
+
* file, because in TypeScript the IR's own spelling *is* the natural one: there
|
|
12
|
+
* is no second vocabulary to translate from. Enum values are the IR's own
|
|
13
|
+
* strings (`recursive`, `pgvector`, `cosine`) and are never re-spelled.
|
|
14
|
+
* * The **resolved** models (`PinnedEmbedding`, `RetrieverBinding`) are what
|
|
15
|
+
* generated code binds with literals. They carry the exact embedding model id
|
|
16
|
+
* rather than an alias, so a run is reproducible from the generated source
|
|
17
|
+
* alone and nothing is resolved at run time.
|
|
18
|
+
*/
|
|
19
|
+
import { CostProfile } from '../types.js';
|
|
20
|
+
/** `retriever.index.metric`. */
|
|
21
|
+
export type DistanceMetric = 'cosine' | 'dot' | 'l2';
|
|
22
|
+
export declare const DISTANCE_METRICS: readonly DistanceMetric[];
|
|
23
|
+
/**
|
|
24
|
+
* `retriever.source.kind`.
|
|
25
|
+
*
|
|
26
|
+
* `file` is the only kind the Phase 1 connector implements; the rest are part of
|
|
27
|
+
* the IR contract and fail loudly rather than silently indexing nothing.
|
|
28
|
+
*/
|
|
29
|
+
export type SourceKind = 'file' | 's3' | 'http' | 'db' | 'mcp';
|
|
30
|
+
/** `retriever.chunking.strategy`. */
|
|
31
|
+
export type ChunkingStrategy = 'fixed' | 'recursive' | 'semantic' | 'code';
|
|
32
|
+
/** `vectorStore.kind`. */
|
|
33
|
+
export type StoreKind = 'memory' | 'pgvector' | 'qdrant' | 'pinecone' | 'weaviate' | 'custom';
|
|
34
|
+
/** `retriever.refresh.mode`. Only `full` is implemented. */
|
|
35
|
+
export type RefreshMode = 'full' | 'incremental';
|
|
36
|
+
/** `retriever.source`. */
|
|
37
|
+
export declare class SourceSpec {
|
|
38
|
+
readonly kind: SourceKind;
|
|
39
|
+
readonly uri: string;
|
|
40
|
+
readonly glob: string | null;
|
|
41
|
+
constructor(init: {
|
|
42
|
+
readonly kind: SourceKind;
|
|
43
|
+
readonly uri: string;
|
|
44
|
+
readonly glob?: string | null;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** `retriever.chunking`. */
|
|
48
|
+
export declare class ChunkingSpec {
|
|
49
|
+
readonly strategy: ChunkingStrategy;
|
|
50
|
+
readonly size: number;
|
|
51
|
+
readonly overlap: number;
|
|
52
|
+
readonly keepMetadata: readonly string[];
|
|
53
|
+
constructor(init: {
|
|
54
|
+
readonly strategy: ChunkingStrategy;
|
|
55
|
+
readonly size: number;
|
|
56
|
+
readonly overlap: number;
|
|
57
|
+
readonly keepMetadata?: readonly string[];
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** `retriever.index`. */
|
|
61
|
+
export declare class IndexSpec {
|
|
62
|
+
readonly metric: DistanceMetric;
|
|
63
|
+
readonly hybrid: boolean;
|
|
64
|
+
readonly params: Readonly<Record<string, unknown>> | null;
|
|
65
|
+
constructor(init: {
|
|
66
|
+
readonly metric: DistanceMetric;
|
|
67
|
+
readonly hybrid: boolean;
|
|
68
|
+
readonly params?: Readonly<Record<string, unknown>> | null;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** `retriever.rerank`. */
|
|
72
|
+
export declare class RerankSpec {
|
|
73
|
+
readonly model: string;
|
|
74
|
+
readonly topN: number;
|
|
75
|
+
constructor(init: {
|
|
76
|
+
readonly model: string;
|
|
77
|
+
readonly topN: number;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/** `retriever.refresh`. */
|
|
81
|
+
export declare class RefreshSpec {
|
|
82
|
+
readonly mode: RefreshMode;
|
|
83
|
+
readonly schedule: string | null;
|
|
84
|
+
constructor(init: {
|
|
85
|
+
readonly mode: RefreshMode;
|
|
86
|
+
readonly schedule?: string | null;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/** One entry of the IR's `retrievers` map. */
|
|
90
|
+
export declare class RetrieverSpec {
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly source: SourceSpec;
|
|
93
|
+
readonly chunking: ChunkingSpec;
|
|
94
|
+
readonly embedModel: string;
|
|
95
|
+
readonly store: string;
|
|
96
|
+
readonly index: IndexSpec;
|
|
97
|
+
readonly topK: number;
|
|
98
|
+
readonly rerank: RerankSpec | null;
|
|
99
|
+
readonly filters: readonly string[] | null;
|
|
100
|
+
readonly refresh: RefreshSpec;
|
|
101
|
+
readonly traits: readonly string[];
|
|
102
|
+
constructor(init: {
|
|
103
|
+
readonly id: string;
|
|
104
|
+
readonly source: SourceSpec;
|
|
105
|
+
readonly chunking: ChunkingSpec;
|
|
106
|
+
readonly embedModel: string;
|
|
107
|
+
readonly store: string;
|
|
108
|
+
readonly index: IndexSpec;
|
|
109
|
+
readonly topK: number;
|
|
110
|
+
readonly rerank?: RerankSpec | null;
|
|
111
|
+
readonly filters?: readonly string[] | null;
|
|
112
|
+
readonly refresh: RefreshSpec;
|
|
113
|
+
readonly traits?: readonly string[];
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* `embedding.costProfile` -- USD per **million** tokens.
|
|
118
|
+
*
|
|
119
|
+
* Not interchangeable with {@link CostProfile}, which prices per *thousand*
|
|
120
|
+
* tokens because it predates the IR. {@link pinnedEmbedding} is the single place
|
|
121
|
+
* the two are converted, so the factor of 1000 is stated once rather than assumed
|
|
122
|
+
* at every call site.
|
|
123
|
+
*/
|
|
124
|
+
export declare class EmbeddingCostProfile {
|
|
125
|
+
readonly inputPerMTok: number;
|
|
126
|
+
readonly outputPerMTok: number;
|
|
127
|
+
constructor(init: {
|
|
128
|
+
readonly inputPerMTok: number;
|
|
129
|
+
readonly outputPerMTok: number;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* One entry of the IR's `embeddings` map.
|
|
134
|
+
*
|
|
135
|
+
* `id` is the *alias* a retriever's `embedModel` names -- the resolution the
|
|
136
|
+
* runtime must never repeat at run time.
|
|
137
|
+
*/
|
|
138
|
+
export declare class EmbeddingSpec {
|
|
139
|
+
readonly id: string;
|
|
140
|
+
readonly provider: string;
|
|
141
|
+
readonly modelId: string;
|
|
142
|
+
readonly dimensions: number | null;
|
|
143
|
+
readonly costProfile: EmbeddingCostProfile | null;
|
|
144
|
+
readonly traits: readonly string[];
|
|
145
|
+
constructor(init: {
|
|
146
|
+
readonly id: string;
|
|
147
|
+
readonly provider: string;
|
|
148
|
+
readonly modelId: string;
|
|
149
|
+
readonly dimensions?: number | null;
|
|
150
|
+
readonly costProfile?: EmbeddingCostProfile | null;
|
|
151
|
+
readonly traits?: readonly string[];
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/** One entry of the IR's `stores` map. */
|
|
155
|
+
export declare class VectorStoreSpec {
|
|
156
|
+
readonly id: string;
|
|
157
|
+
readonly kind: StoreKind;
|
|
158
|
+
readonly uri: string | null;
|
|
159
|
+
readonly dimensions: number | null;
|
|
160
|
+
readonly traits: readonly string[];
|
|
161
|
+
constructor(init: {
|
|
162
|
+
readonly id: string;
|
|
163
|
+
readonly kind: StoreKind;
|
|
164
|
+
readonly uri?: string | null;
|
|
165
|
+
readonly dimensions?: number | null;
|
|
166
|
+
readonly traits?: readonly string[];
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/** The IR's `retrieval` metric variant: `{kind, expectDocs, k}`. */
|
|
170
|
+
export declare class RetrievalMetricSpec {
|
|
171
|
+
readonly kind: 'retrieval';
|
|
172
|
+
readonly expectDocs: readonly string[];
|
|
173
|
+
readonly k: number;
|
|
174
|
+
constructor(init: {
|
|
175
|
+
readonly expectDocs: readonly string[];
|
|
176
|
+
readonly k: number;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* An `embedModel` alias already resolved to an exact embedding model.
|
|
181
|
+
*
|
|
182
|
+
* The same contract as `PinnedModel`: a baseline recorded against
|
|
183
|
+
* `text-embedding-3-small` means nothing if the alias floats to another
|
|
184
|
+
* revision, so the resolved id, the dimensions and the price are all *recorded
|
|
185
|
+
* inputs* rather than lookups a run performs.
|
|
186
|
+
*/
|
|
187
|
+
export declare class PinnedEmbedding {
|
|
188
|
+
readonly alias: string;
|
|
189
|
+
readonly provider: string;
|
|
190
|
+
readonly modelId: string;
|
|
191
|
+
readonly dimensions: number;
|
|
192
|
+
readonly cost: CostProfile;
|
|
193
|
+
constructor(init: {
|
|
194
|
+
readonly alias: string;
|
|
195
|
+
readonly provider: string;
|
|
196
|
+
readonly modelId: string;
|
|
197
|
+
readonly dimensions: number;
|
|
198
|
+
readonly cost: CostProfile;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A retriever as generated code binds it, with every alias resolved.
|
|
203
|
+
*
|
|
204
|
+
* `embedModel` keeps the declared alias purely so cost can be attributed to the
|
|
205
|
+
* name the spec used; `embedding` is the resolved model actually called.
|
|
206
|
+
* `storeKind` is resolved from the store entry, because a run must not discover
|
|
207
|
+
* at search time which backend it wrote to.
|
|
208
|
+
*
|
|
209
|
+
* `storeUri` is deliberately kept *unresolved*: a hosted store's location is a
|
|
210
|
+
* deployment secret, which is why the IR writes `env:PGVECTOR_URL` rather than a
|
|
211
|
+
* DSN. The name is pinned in code; the value is read from the environment at run
|
|
212
|
+
* time, and an environment variable is not an alias.
|
|
213
|
+
*/
|
|
214
|
+
export declare class RetrieverBinding {
|
|
215
|
+
readonly retrieverId: string;
|
|
216
|
+
readonly source: SourceSpec;
|
|
217
|
+
readonly chunking: ChunkingSpec;
|
|
218
|
+
readonly embedModel: string;
|
|
219
|
+
readonly embedding: PinnedEmbedding;
|
|
220
|
+
readonly store: string;
|
|
221
|
+
readonly storeKind: StoreKind;
|
|
222
|
+
readonly storeUri: string | null;
|
|
223
|
+
readonly index: IndexSpec;
|
|
224
|
+
readonly topK: number;
|
|
225
|
+
readonly rerank: RerankSpec | null;
|
|
226
|
+
readonly refreshMode: RefreshMode;
|
|
227
|
+
readonly traits: readonly string[];
|
|
228
|
+
constructor(init: {
|
|
229
|
+
readonly retrieverId: string;
|
|
230
|
+
readonly source: SourceSpec;
|
|
231
|
+
readonly chunking: ChunkingSpec;
|
|
232
|
+
readonly embedModel: string;
|
|
233
|
+
readonly embedding: PinnedEmbedding;
|
|
234
|
+
readonly store: string;
|
|
235
|
+
readonly storeKind: StoreKind;
|
|
236
|
+
readonly storeUri?: string | null;
|
|
237
|
+
readonly index: IndexSpec;
|
|
238
|
+
readonly topK: number;
|
|
239
|
+
readonly rerank?: RerankSpec | null;
|
|
240
|
+
readonly refreshMode?: RefreshMode;
|
|
241
|
+
readonly traits?: readonly string[];
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* One indexed passage.
|
|
246
|
+
*
|
|
247
|
+
* `chunkId` hashes the document id, the chunk's position *and* its text. That is
|
|
248
|
+
* what makes ingest idempotent: identical input re-chunks to identical ids, so a
|
|
249
|
+
* second ingest replaces rather than duplicates. Position is part of the hash on
|
|
250
|
+
* purpose -- two byte-identical paragraphs in one document must stay two chunks
|
|
251
|
+
* instead of colliding into one.
|
|
252
|
+
*/
|
|
253
|
+
export declare class Chunk {
|
|
254
|
+
readonly chunkId: string;
|
|
255
|
+
readonly docId: string;
|
|
256
|
+
readonly uri: string;
|
|
257
|
+
readonly index: number;
|
|
258
|
+
readonly start: number;
|
|
259
|
+
readonly end: number;
|
|
260
|
+
readonly text: string;
|
|
261
|
+
readonly metadata: Readonly<Record<string, string>>;
|
|
262
|
+
constructor(init: {
|
|
263
|
+
readonly chunkId: string;
|
|
264
|
+
readonly docId: string;
|
|
265
|
+
readonly uri?: string;
|
|
266
|
+
readonly index: number;
|
|
267
|
+
readonly start: number;
|
|
268
|
+
readonly end: number;
|
|
269
|
+
readonly text: string;
|
|
270
|
+
readonly metadata?: Readonly<Record<string, string>>;
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/** A chunk with the score that ranked it. */
|
|
274
|
+
export declare class ScoredChunk {
|
|
275
|
+
readonly chunk: Chunk;
|
|
276
|
+
readonly score: number;
|
|
277
|
+
constructor(init: {
|
|
278
|
+
readonly chunk: Chunk;
|
|
279
|
+
readonly score: number;
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* The content hash that identifies a chunk.
|
|
284
|
+
*
|
|
285
|
+
* Shared by every chunker so the id scheme cannot differ between strategies; a
|
|
286
|
+
* strategy that changed the id scheme would silently duplicate a corpus on
|
|
287
|
+
* re-ingest instead of replacing it.
|
|
288
|
+
*/
|
|
289
|
+
export declare function chunkIdFor(docId: string, index: number, text: string): string;
|
|
290
|
+
/**
|
|
291
|
+
* Resolve an IR embedding entry into the pinned form generated code carries.
|
|
292
|
+
*
|
|
293
|
+
* `dimensions` may be supplied when the IR entry omits it (the schema makes it
|
|
294
|
+
* optional); it is an error to have neither, because an unpinned width would let a
|
|
295
|
+
* store accept vectors a later run cannot compare against.
|
|
296
|
+
*/
|
|
297
|
+
export declare function pinnedEmbedding(spec: EmbeddingSpec, init: {
|
|
298
|
+
readonly alias: string;
|
|
299
|
+
readonly dimensions?: number | null;
|
|
300
|
+
}): PinnedEmbedding;
|
|
301
|
+
/**
|
|
302
|
+
* Bind one IR retriever entry to the embedding and store it names.
|
|
303
|
+
*
|
|
304
|
+
* `embedModel` names an *embeddings entry id*, not a provider model, and `store`
|
|
305
|
+
* names a *stores entry id*. Both are checked here rather than trusted, because a
|
|
306
|
+
* mistyped reference in generated code would otherwise surface as an empty or
|
|
307
|
+
* mis-scored corpus far from its cause.
|
|
308
|
+
*/
|
|
309
|
+
export declare function bindingFromSpec(spec: RetrieverSpec, init: {
|
|
310
|
+
readonly embedding: EmbeddingSpec;
|
|
311
|
+
readonly store: VectorStoreSpec;
|
|
312
|
+
readonly dimensions?: number | null;
|
|
313
|
+
}): RetrieverBinding;
|
|
314
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/retrieval/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,gCAAgC;AAChC,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,KAAK,GAAG,IAAI,CAAC;AAErD,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAA4B,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;AAE/D,qCAAqC;AACrC,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;AAE3E,0BAA0B;AAC1B,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE9F,4DAA4D;AAC5D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,aAAa,CAAC;AAuBjD,0BAA0B;AAC1B,qBAAa,UAAU;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