@flowrag/core 1.5.0 → 1.6.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/index.d.mts +35 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,21 @@ interface Embedder {
|
|
|
10
10
|
embedBatch(texts: string[]): Promise<number[][]>;
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
|
+
//#region src/interfaces/evaluator.d.ts
|
|
14
|
+
/** Document passed to an evaluator */
|
|
15
|
+
interface EvalDocument {
|
|
16
|
+
content: string;
|
|
17
|
+
score: number;
|
|
18
|
+
}
|
|
19
|
+
/** Evaluation result with named scores */
|
|
20
|
+
interface EvalResult {
|
|
21
|
+
scores: Record<string, number>;
|
|
22
|
+
}
|
|
23
|
+
/** Pluggable evaluator for RAG quality metrics */
|
|
24
|
+
interface Evaluator {
|
|
25
|
+
evaluate(query: string, documents: EvalDocument[], reference?: string): Promise<EvalResult>;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
13
28
|
//#region src/schema.d.ts
|
|
14
29
|
/** Custom field definition */
|
|
15
30
|
interface FieldDefinition {
|
|
@@ -131,10 +146,17 @@ interface ExtractedRelation {
|
|
|
131
146
|
keywords: string[];
|
|
132
147
|
fields?: Record<string, unknown>;
|
|
133
148
|
}
|
|
149
|
+
/** Token usage from LLM/embedding calls */
|
|
150
|
+
interface TokenUsage {
|
|
151
|
+
promptTokens?: number;
|
|
152
|
+
completionTokens?: number;
|
|
153
|
+
totalTokens?: number;
|
|
154
|
+
}
|
|
134
155
|
/** Result of entity extraction */
|
|
135
156
|
interface ExtractionResult {
|
|
136
157
|
entities: ExtractedEntity[];
|
|
137
158
|
relations: ExtractedRelation[];
|
|
159
|
+
usage?: TokenUsage;
|
|
138
160
|
}
|
|
139
161
|
/** Query modes */
|
|
140
162
|
type QueryMode = "local" | "global" | "hybrid" | "naive";
|
|
@@ -145,6 +167,18 @@ interface LLMExtractor {
|
|
|
145
167
|
extractEntities(content: string, knownEntities: string[], schema: Schema): Promise<ExtractionResult>;
|
|
146
168
|
}
|
|
147
169
|
//#endregion
|
|
170
|
+
//#region src/interfaces/parser.d.ts
|
|
171
|
+
/** Parsed document output from a DocumentParser */
|
|
172
|
+
interface ParsedDocument {
|
|
173
|
+
content: string;
|
|
174
|
+
metadata: Record<string, unknown>;
|
|
175
|
+
}
|
|
176
|
+
/** Pluggable file parser for non-text documents (PDF, DOCX, images, etc.) */
|
|
177
|
+
interface DocumentParser {
|
|
178
|
+
readonly supportedExtensions: string[];
|
|
179
|
+
parse(filePath: string): Promise<ParsedDocument>;
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
148
182
|
//#region src/interfaces/reranker.d.ts
|
|
149
183
|
/**
|
|
150
184
|
* Reranker interface for FlowRAG
|
|
@@ -211,5 +245,5 @@ declare function withNamespace(storage: StorageSet, namespace: string): StorageS
|
|
|
211
245
|
*/
|
|
212
246
|
declare function buildExtractionPrompt(content: string, knownEntities: string[], schema: Schema): string;
|
|
213
247
|
//#endregion
|
|
214
|
-
export { Chunk, Document, DocumentMetadata, Embedder, Entity, EntityFilter, ExtractedEntity, ExtractedRelation, ExtractionResult, FieldDefinition, GraphStorage, Id, KVStorage, LLMExtractor, QueryMode, Relation, RelationDirection, RerankDocument, RerankResult, Reranker, Schema, SchemaConfig, SearchResult, StorageSet, VectorFilter, VectorRecord, VectorStorage, buildExtractionPrompt, defineSchema, withNamespace };
|
|
248
|
+
export { Chunk, Document, DocumentMetadata, DocumentParser, Embedder, Entity, EntityFilter, EvalDocument, EvalResult, Evaluator, ExtractedEntity, ExtractedRelation, ExtractionResult, FieldDefinition, GraphStorage, Id, KVStorage, LLMExtractor, ParsedDocument, QueryMode, Relation, RelationDirection, RerankDocument, RerankResult, Reranker, Schema, SchemaConfig, SearchResult, StorageSet, TokenUsage, VectorFilter, VectorRecord, VectorStorage, buildExtractionPrompt, defineSchema, withNamespace };
|
|
215
249
|
//# sourceMappingURL=index.d.mts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowrag/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "📐 The heart of FlowRAG. Defines all TypeScript interfaces (Storage, Embedder, LLMExtractor), the Zod-based schema system for defining entity/relation types, and the orchestration pipeline that coordinates indexing and querying. This package contains only contracts and types, no concrete implementations.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"interfaces",
|