@rws-framework/ai-tools 3.7.0 → 3.8.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/.bin/add-v.sh +0 -0
- package/docs/tutorial-style-rag.md +0 -0
- package/examples/test-recursive-chunker.ts +0 -0
- package/examples/tutorial-style-rag.ts +0 -0
- package/package.json +1 -1
- package/src/models/prompts/inc/execution-methods-handler.ts +0 -0
- package/src/models/prompts/inc/index.ts +0 -0
- package/src/models/prompts/inc/input-output-manager.ts +0 -0
- package/src/models/prompts/inc/model-execution-manager.ts +0 -0
- package/src/models/prompts/inc/tool-manager.ts +0 -0
- package/src/models/prompts/inc/types.ts +0 -0
- package/src/models/prompts/inc/variable-storage-manager.ts +0 -0
- package/src/services/LangChainEmbeddingService.ts +5 -5
- package/src/services/LangChainRAGService.ts +3 -2
- package/src/services/LangChainVectorStoreService.ts +0 -0
- package/src/services/OpenAIRateLimitingService.ts +0 -0
- package/src/services/OptimizedVectorSearchService.ts +0 -0
- package/src/services/TextChunker.ts +0 -0
- package/src/types/embedding.types.ts +0 -0
- package/src/types/index.ts +0 -0
- package/src/types/rag.types.ts +0 -0
- package/src/types/search.types.ts +0 -0
- package/src/types/vectorstore.types.ts +0 -0
package/.bin/add-v.sh
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -127,15 +127,15 @@ export class LangChainEmbeddingService {
|
|
|
127
127
|
/**
|
|
128
128
|
* Split text into chunks
|
|
129
129
|
*/
|
|
130
|
-
async chunkText(text: string): Promise<string[]> {
|
|
130
|
+
async chunkText(text: string, ragOverride?: IChunkConfig): Promise<string[]> {
|
|
131
131
|
this.ensureInitialized();
|
|
132
132
|
|
|
133
133
|
// Use our custom TextChunker instead of LangChain's splitter
|
|
134
134
|
// Use safe token limits - the TextChunker handles token estimation internally
|
|
135
|
-
const maxTokens = this.chunkConfig?.chunkSize || 450; // Safe token limit for embedding models
|
|
136
|
-
const overlap = this.chunkConfig?.chunkOverlap || 50; // Character overlap, not token
|
|
137
|
-
|
|
138
|
-
return TextChunker.chunkText(text, maxTokens, overlap);
|
|
135
|
+
const maxTokens = ragOverride ? ragOverride.chunkSize : (this.chunkConfig?.chunkSize || 450); // Safe token limit for embedding models
|
|
136
|
+
const overlap = ragOverride ? ragOverride.chunkOverlap : (this.chunkConfig?.chunkOverlap || 50); // Character overlap, not token
|
|
137
|
+
const separators = ragOverride?.separators || this.chunkConfig?.separators || TextChunker.DEFAULT_SEPARATORS; // Default separators
|
|
138
|
+
return TextChunker.chunkText(text, maxTokens, overlap, separators);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
/**
|
|
@@ -85,7 +85,8 @@ export class LangChainRAGService {
|
|
|
85
85
|
async indexKnowledge(
|
|
86
86
|
fileId: string | number,
|
|
87
87
|
content: string,
|
|
88
|
-
metadata: Record<string, any> = {}
|
|
88
|
+
metadata: Record<string, any> = {},
|
|
89
|
+
ragOverride?: IChunkConfig
|
|
89
90
|
): Promise<IRAGResponse<{ chunkIds: string[] }>> {
|
|
90
91
|
this.log('log', `[INDEXING] Starting indexKnowledge for fileId: ${fileId}`);
|
|
91
92
|
this.log('debug', `[INDEXING] Content length: ${content.length} characters`);
|
|
@@ -94,7 +95,7 @@ export class LangChainRAGService {
|
|
|
94
95
|
await this.ensureInitialized();
|
|
95
96
|
|
|
96
97
|
// Chunk the content using the embedding service
|
|
97
|
-
const chunks = await this.embeddingService.chunkText(content);
|
|
98
|
+
const chunks = await this.embeddingService.chunkText(content, ragOverride);
|
|
98
99
|
this.log('debug', `[INDEXING] Split content into ${chunks.length} chunks for file ${fileId}`);
|
|
99
100
|
|
|
100
101
|
// Generate embeddings for all chunks at once (batch processing for speed)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/types/index.ts
CHANGED
|
File without changes
|
package/src/types/rag.types.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|