@grackle-ai/knowledge 0.56.3 → 0.57.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/dist/chunker.d.ts +20 -0
- package/dist/chunker.d.ts.map +1 -0
- package/dist/chunker.js +7 -0
- package/dist/chunker.js.map +1 -0
- package/dist/embedder.d.ts +35 -0
- package/dist/embedder.d.ts.map +1 -0
- package/dist/embedder.js +7 -0
- package/dist/embedder.js.map +1 -0
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/ingest.d.ts +23 -0
- package/dist/ingest.d.ts.map +1 -0
- package/dist/ingest.js +27 -0
- package/dist/ingest.js.map +1 -0
- package/dist/local-embedder.d.ts +25 -0
- package/dist/local-embedder.d.ts.map +1 -0
- package/dist/local-embedder.js +88 -0
- package/dist/local-embedder.js.map +1 -0
- package/dist/pass-through-chunker.d.ts +16 -0
- package/dist/pass-through-chunker.d.ts.map +1 -0
- package/dist/pass-through-chunker.js +21 -0
- package/dist/pass-through-chunker.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pluggable chunker interface for splitting content into embeddable pieces.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** A chunk of content produced by a {@link Chunker}. */
|
|
7
|
+
export interface Chunk {
|
|
8
|
+
/** The text content of this chunk. */
|
|
9
|
+
text: string;
|
|
10
|
+
/** Zero-based index of this chunk within the source content. */
|
|
11
|
+
index: number;
|
|
12
|
+
/** Optional metadata carried through from the source or added by the chunker. */
|
|
13
|
+
metadata?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
/** Splits content into chunks suitable for embedding. */
|
|
16
|
+
export interface Chunker {
|
|
17
|
+
/** Split content into one or more chunks. */
|
|
18
|
+
chunk(content: string, metadata?: Record<string, unknown>): Chunk[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=chunker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunker.d.ts","sourceRoot":"","sources":["../src/chunker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wDAAwD;AACxD,MAAM,WAAW,KAAK;IACpB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,yDAAyD;AACzD,MAAM,WAAW,OAAO;IACtB,6CAA6C;IAC7C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,EAAE,CAAC;CACrE"}
|
package/dist/chunker.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunker.js","sourceRoot":"","sources":["../src/chunker.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pluggable embedder interface for converting text into vector embeddings.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** A single embedding result pairing input text with its vector. */
|
|
7
|
+
export interface EmbeddingResult {
|
|
8
|
+
/** The input text that was embedded. */
|
|
9
|
+
text: string;
|
|
10
|
+
/** The embedding vector (array of floats). */
|
|
11
|
+
vector: number[];
|
|
12
|
+
}
|
|
13
|
+
/** Configuration for creating an {@link Embedder}. */
|
|
14
|
+
export interface EmbedderOptions {
|
|
15
|
+
/** HuggingFace model ID (e.g., `"Xenova/all-MiniLM-L6-v2"`). */
|
|
16
|
+
modelId?: string;
|
|
17
|
+
/** Expected embedding dimensions. Used for validation when set. */
|
|
18
|
+
dimensions?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Converts text into embedding vectors for semantic search and similarity. */
|
|
21
|
+
export interface Embedder {
|
|
22
|
+
/** Embed a single text string. */
|
|
23
|
+
embed(text: string): Promise<EmbeddingResult>;
|
|
24
|
+
/** Embed multiple texts in batch. */
|
|
25
|
+
embedBatch(texts: string[]): Promise<EmbeddingResult[]>;
|
|
26
|
+
/**
|
|
27
|
+
* The dimensionality of vectors produced by this embedder.
|
|
28
|
+
*
|
|
29
|
+
* When using a custom model without specifying `dimensions` in options,
|
|
30
|
+
* this value is `0` until the first embedding is computed. A value of `0`
|
|
31
|
+
* means the true dimensions are not yet known.
|
|
32
|
+
*/
|
|
33
|
+
readonly dimensions: number;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=embedder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedder.d.ts","sourceRoot":"","sources":["../src/embedder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oEAAoE;AACpE,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,+EAA+E;AAC/E,MAAM,WAAW,QAAQ;IACvB,kCAAkC;IAClC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9C,qCAAqC;IACrC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IACxD;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B"}
|
package/dist/embedder.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedder.js","sourceRoot":"","sources":["../src/embedder.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
export {};
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* Knowledge graph subsystem for Grackle.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* sessions.
|
|
8
|
-
* implementations that build on this package.
|
|
4
|
+
* Provides pluggable text embedding, content chunking, and an ingestion
|
|
5
|
+
* pipeline so that agents can share and reuse contextual information
|
|
6
|
+
* across sessions.
|
|
9
7
|
*
|
|
10
8
|
* @packageDocumentation
|
|
11
9
|
*/
|
|
10
|
+
export type { Embedder, EmbedderOptions, EmbeddingResult } from "./embedder.js";
|
|
11
|
+
export { createLocalEmbedder } from "./local-embedder.js";
|
|
12
|
+
export type { Chunk, Chunker } from "./chunker.js";
|
|
13
|
+
export { createPassThroughChunker } from "./pass-through-chunker.js";
|
|
14
|
+
export type { EmbeddedChunk } from "./ingest.js";
|
|
15
|
+
export { ingest } from "./ingest.js";
|
|
12
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export {};
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* Knowledge graph subsystem for Grackle.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* sessions.
|
|
8
|
-
* implementations that build on this package.
|
|
4
|
+
* Provides pluggable text embedding, content chunking, and an ingestion
|
|
5
|
+
* pipeline so that agents can share and reuse contextual information
|
|
6
|
+
* across sessions.
|
|
9
7
|
*
|
|
10
8
|
* @packageDocumentation
|
|
11
9
|
*/
|
|
10
|
+
export { createLocalEmbedder } from "./local-embedder.js";
|
|
11
|
+
export { createPassThroughChunker } from "./pass-through-chunker.js";
|
|
12
|
+
export { ingest } from "./ingest.js";
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/ingest.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ingestion pipeline that chunks content and embeds each chunk.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { Chunk, Chunker } from "./chunker.js";
|
|
7
|
+
import type { Embedder } from "./embedder.js";
|
|
8
|
+
/** A chunk with its embedding vector attached. */
|
|
9
|
+
export interface EmbeddedChunk extends Chunk {
|
|
10
|
+
/** The embedding vector for this chunk's text. */
|
|
11
|
+
vector: number[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Chunk content and embed each chunk in a single pipeline.
|
|
15
|
+
*
|
|
16
|
+
* @param content - The raw text content to ingest.
|
|
17
|
+
* @param chunker - Splits the content into chunks.
|
|
18
|
+
* @param embedder - Produces embedding vectors for each chunk.
|
|
19
|
+
* @param metadata - Optional metadata passed through to the chunker.
|
|
20
|
+
* @returns An array of chunks with embedding vectors attached.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ingest(content: string, chunker: Chunker, embedder: Embedder, metadata?: Record<string, unknown>): Promise<EmbeddedChunk[]>;
|
|
23
|
+
//# sourceMappingURL=ingest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../src/ingest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,kDAAkD;AAClD,MAAM,WAAW,aAAc,SAAQ,KAAK;IAC1C,kDAAkD;IAClD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,aAAa,EAAE,CAAC,CAc1B"}
|
package/dist/ingest.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ingestion pipeline that chunks content and embeds each chunk.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Chunk content and embed each chunk in a single pipeline.
|
|
8
|
+
*
|
|
9
|
+
* @param content - The raw text content to ingest.
|
|
10
|
+
* @param chunker - Splits the content into chunks.
|
|
11
|
+
* @param embedder - Produces embedding vectors for each chunk.
|
|
12
|
+
* @param metadata - Optional metadata passed through to the chunker.
|
|
13
|
+
* @returns An array of chunks with embedding vectors attached.
|
|
14
|
+
*/
|
|
15
|
+
export async function ingest(content, chunker, embedder, metadata) {
|
|
16
|
+
const chunks = chunker.chunk(content, metadata);
|
|
17
|
+
if (chunks.length === 0) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const texts = chunks.map((c) => c.text);
|
|
21
|
+
const embeddings = await embedder.embedBatch(texts);
|
|
22
|
+
return chunks.map((chunk, i) => ({
|
|
23
|
+
...chunk,
|
|
24
|
+
vector: embeddings[i].vector,
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ingest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../src/ingest.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,OAAe,EACf,OAAgB,EAChB,QAAkB,EAClB,QAAkC;IAElC,MAAM,MAAM,GAAY,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEzD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAa,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAEpD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/B,GAAG,KAAK;QACR,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM;KAC7B,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local ONNX-based embedder using `@huggingface/transformers`.
|
|
3
|
+
*
|
|
4
|
+
* Downloads and caches a HuggingFace model on first use, then runs
|
|
5
|
+
* inference locally on CPU — no API keys or external services required.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { Embedder, EmbedderOptions } from "./embedder.js";
|
|
10
|
+
/**
|
|
11
|
+
* Create a local embedder that runs ONNX inference via `@huggingface/transformers`.
|
|
12
|
+
*
|
|
13
|
+
* The underlying pipeline is lazily initialized on the first call to
|
|
14
|
+
* {@link Embedder.embed | embed()} or {@link Embedder.embedBatch | embedBatch()}.
|
|
15
|
+
* This avoids blocking construction with a model download.
|
|
16
|
+
*
|
|
17
|
+
* When using the default model, dimensions are known upfront (384). When using
|
|
18
|
+
* a custom model without specifying dimensions, the value is inferred from the
|
|
19
|
+
* first embedding result.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Optional configuration for model selection and dimensions.
|
|
22
|
+
* @returns An {@link Embedder} instance backed by local ONNX inference.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createLocalEmbedder(options?: EmbedderOptions): Embedder;
|
|
25
|
+
//# sourceMappingURL=local-embedder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-embedder.d.ts","sourceRoot":"","sources":["../src/local-embedder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAmB,MAAM,eAAe,CAAC;AAQhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,QAAQ,CA6DvE"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local ONNX-based embedder using `@huggingface/transformers`.
|
|
3
|
+
*
|
|
4
|
+
* Downloads and caches a HuggingFace model on first use, then runs
|
|
5
|
+
* inference locally on CPU — no API keys or external services required.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/** Default model: small, fast, good general-purpose English embeddings. */
|
|
10
|
+
const DEFAULT_MODEL_ID = "Xenova/all-MiniLM-L6-v2";
|
|
11
|
+
/** Default embedding dimensions for the default model. */
|
|
12
|
+
const DEFAULT_DIMENSIONS = 384;
|
|
13
|
+
/**
|
|
14
|
+
* Create a local embedder that runs ONNX inference via `@huggingface/transformers`.
|
|
15
|
+
*
|
|
16
|
+
* The underlying pipeline is lazily initialized on the first call to
|
|
17
|
+
* {@link Embedder.embed | embed()} or {@link Embedder.embedBatch | embedBatch()}.
|
|
18
|
+
* This avoids blocking construction with a model download.
|
|
19
|
+
*
|
|
20
|
+
* When using the default model, dimensions are known upfront (384). When using
|
|
21
|
+
* a custom model without specifying dimensions, the value is inferred from the
|
|
22
|
+
* first embedding result.
|
|
23
|
+
*
|
|
24
|
+
* @param options - Optional configuration for model selection and dimensions.
|
|
25
|
+
* @returns An {@link Embedder} instance backed by local ONNX inference.
|
|
26
|
+
*/
|
|
27
|
+
export function createLocalEmbedder(options) {
|
|
28
|
+
const modelId = options?.modelId ?? DEFAULT_MODEL_ID;
|
|
29
|
+
let resolvedDimensions = options?.dimensions ?? (modelId === DEFAULT_MODEL_ID ? DEFAULT_DIMENSIONS : 0);
|
|
30
|
+
let pipelinePromise;
|
|
31
|
+
/**
|
|
32
|
+
* Lazily initialise the feature-extraction pipeline.
|
|
33
|
+
* Concurrent calls share the same promise so the model is loaded once.
|
|
34
|
+
* If initialisation fails, the cached promise is cleared so future calls can retry.
|
|
35
|
+
*/
|
|
36
|
+
function getPipeline() {
|
|
37
|
+
if (!pipelinePromise) {
|
|
38
|
+
pipelinePromise = initPipeline(modelId).catch((error) => {
|
|
39
|
+
pipelinePromise = undefined;
|
|
40
|
+
throw error;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return pipelinePromise;
|
|
44
|
+
}
|
|
45
|
+
/** Run inference for a single text and return its vector. */
|
|
46
|
+
async function embedOne(pipe, text) {
|
|
47
|
+
const output = await pipe(text, { pooling: "mean", normalize: true });
|
|
48
|
+
const vector = Array.from(output.data);
|
|
49
|
+
if (resolvedDimensions === 0) {
|
|
50
|
+
resolvedDimensions = vector.length;
|
|
51
|
+
}
|
|
52
|
+
else if (vector.length !== resolvedDimensions) {
|
|
53
|
+
throw new Error(`Dimension mismatch: expected ${resolvedDimensions}, got ${vector.length}. ` +
|
|
54
|
+
`Check that the model "${modelId}" produces ${resolvedDimensions}-dim vectors.`);
|
|
55
|
+
}
|
|
56
|
+
return { text, vector };
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
get dimensions() {
|
|
60
|
+
return resolvedDimensions;
|
|
61
|
+
},
|
|
62
|
+
async embed(text) {
|
|
63
|
+
const pipe = await getPipeline();
|
|
64
|
+
return embedOne(pipe, text);
|
|
65
|
+
},
|
|
66
|
+
async embedBatch(texts) {
|
|
67
|
+
if (texts.length === 0) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
const pipe = await getPipeline();
|
|
71
|
+
const results = [];
|
|
72
|
+
for (const text of texts) {
|
|
73
|
+
results.push(await embedOne(pipe, text));
|
|
74
|
+
}
|
|
75
|
+
return results;
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Dynamically import `@huggingface/transformers` and create the pipeline.
|
|
81
|
+
*
|
|
82
|
+
* Uses dynamic import so the heavy ONNX runtime is only loaded when needed.
|
|
83
|
+
*/
|
|
84
|
+
async function initPipeline(modelId) {
|
|
85
|
+
const { pipeline } = await import("@huggingface/transformers");
|
|
86
|
+
return pipeline("feature-extraction", modelId, { dtype: "fp32" });
|
|
87
|
+
}
|
|
88
|
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decisions, and insights
|
|
5
|
+
* that do not need to be split before embedding.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { Chunker } from "./chunker.js";
|
|
10
|
+
/**
|
|
11
|
+
* Create a chunker that returns the input as a single chunk unchanged.
|
|
12
|
+
*
|
|
13
|
+
* @returns A {@link Chunker} that produces exactly one chunk per input.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createPassThroughChunker(): Chunker;
|
|
16
|
+
//# sourceMappingURL=pass-through-chunker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pass-through-chunker.d.ts","sourceRoot":"","sources":["../src/pass-through-chunker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAS,MAAM,cAAc,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAMlD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pass-through chunker that returns the entire input as a single chunk.
|
|
3
|
+
*
|
|
4
|
+
* Suitable for short content such as findings, decisions, and insights
|
|
5
|
+
* that do not need to be split before embedding.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Create a chunker that returns the input as a single chunk unchanged.
|
|
11
|
+
*
|
|
12
|
+
* @returns A {@link Chunker} that produces exactly one chunk per input.
|
|
13
|
+
*/
|
|
14
|
+
export function createPassThroughChunker() {
|
|
15
|
+
return {
|
|
16
|
+
chunk(content, metadata) {
|
|
17
|
+
return [{ text: content, index: 0, metadata }];
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=pass-through-chunker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pass-through-chunker.js","sourceRoot":"","sources":["../src/pass-through-chunker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;GAIG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO;QACL,KAAK,CAAC,OAAe,EAAE,QAAkC;YACvD,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QACjD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grackle-ai/knowledge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
4
4
|
"description": "Scaffold for the Knowledge Graph subsystem for Grackle",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"dist/"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@
|
|
27
|
+
"@huggingface/transformers": "^3.4.0",
|
|
28
|
+
"@grackle-ai/common": "0.57.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@rushstack/heft": "1.2.4",
|