@juspay/neurolink 11.23.0 → 11.23.1
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
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
## [11.23.
|
|
1
|
+
## [11.23.1](https://github.com/juspay/neurolink/compare/v11.23.0...v11.23.1) (2026-08-24)
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### Bug Fixes
|
|
4
4
|
|
|
5
|
-
- **(
|
|
5
|
+
- **(bench):** floor the usage-stats flush sample count ([10f8401](https://github.com/juspay/neurolink/commit/10f84017926fbf55a781eff977d817f12ee7e975))
|
|
6
|
+
- **(rag):** await registration before reading factory metadata ([9c41530](https://github.com/juspay/neurolink/commit/9c41530677845416d8adf67f8f4d3427d60df009)), closes [#1488](https://github.com/juspay/neurolink/issues/1488)
|
|
7
|
+
- **(scripts):** bound the last two unbounded subprocesses in the security check ([6749db0](https://github.com/juspay/neurolink/commit/6749db0e9d4237335d4ac9feebdd8c9a8f090b14)), closes [#1500](https://github.com/juspay/neurolink/issues/1500)
|
|
8
|
+
- **(test):** stop reporting crashed and unwritable-path cases as green ([ced2008](https://github.com/juspay/neurolink/commit/ced20088eb5402767ba6fe492288886ee74d2c4f))
|
|
6
9
|
|
|
7
10
|
## [11.2.3](https://github.com/juspay/neurolink/compare/v11.2.2...v11.2.3) (2026-08-19)
|
|
8
11
|
|
|
@@ -1733,7 +1733,7 @@ ${c}`;if(u.length>t){l.length>s.length&&a.push(l),a.push(u),l=s;continue}const d
|
|
|
1733
1733
|
`+o.content:(r.push(n),n={...o})}return n&&r.push(n),r}}}});async function nLt(e,t){return sLt.createChunker(e,t)}var ru,oLt,sLt,iLt=C({"src/lib/rag/ChunkerFactory.ts"(){"use strict";Yh(),V(),DC(),ru={character:{description:"Splits text into fixed-size character chunks with optional overlap",defaultConfig:{maxSize:1e3,overlap:100},supportedOptions:["maxSize","overlap","minSize"],useCases:["Simple text processing","Fixed-size chunks needed"],aliases:["char","fixed-size","fixed"]},recursive:{description:"Recursively splits text using ordered separators",defaultConfig:{maxSize:1e3,overlap:100,separators:[`
|
|
1734
1734
|
|
|
1735
1735
|
`,`
|
|
1736
|
-
`,". "," ",""]},supportedOptions:["maxSize","overlap","separators","keepSeparators"],useCases:["General text documents","Default choice"],aliases:["recursive-character","langchain-default"]},sentence:{description:"Splits text by sentence boundaries",defaultConfig:{maxSize:1e3,overlap:1},supportedOptions:["maxSize","overlap","boundaryDetection","maxSentences"],useCases:["Q&A applications","Sentence-level analysis"],aliases:["sent","sentence-based"]},token:{description:"Splits text by token count using a specific tokenizer",defaultConfig:{maxSize:512,overlap:50},supportedOptions:["maxSize","overlap","tokenizer","maxTokens"],useCases:["Token-aware splitting","Model-specific chunks"],aliases:["tok","tokenized"]},markdown:{description:"Splits markdown content by headers and structural elements",defaultConfig:{maxSize:1e3,overlap:50},supportedOptions:["maxSize","headerLevels","splitCodeBlocks"],useCases:["Documentation processing","README files"],aliases:["md","markdown-header"]},html:{description:"Splits HTML content by semantic tags",defaultConfig:{maxSize:1e3,overlap:0},supportedOptions:["maxSize","splitTags","stripTags","preserveAttributes"],useCases:["Web content processing","HTML documents"],aliases:["html-tag","web"]},json:{description:"Splits JSON documents by object boundaries",defaultConfig:{maxSize:1e3,overlap:0},supportedOptions:["maxSize","maxDepth","chunkKeys"],useCases:["API response processing","Structured data"],aliases:["json-object","structured"]},latex:{description:"Splits LaTeX documents by sections and environments",defaultConfig:{maxSize:1e3,overlap:0},supportedOptions:["maxSize","environments","splitMathBlocks"],useCases:["Academic papers","Scientific documents"],aliases:["tex","latex-section"]},semantic:{description:"Uses LLM to identify semantically meaningful split points",defaultConfig:{maxSize:1e3,overlap:100},supportedOptions:["maxSize","modelName","provider","similarityThreshold"],useCases:["Advanced semantic understanding","AI-enhanced chunking"],aliases:["llm","ai-semantic"]},"semantic-markdown":{description:"Combines markdown splitting with semantic similarity",defaultConfig:{maxSize:1e3,overlap:100},supportedOptions:["maxSize","similarityThreshold","maxMergeSize"],useCases:["Context-aware documentation","Knowledge bases"],aliases:["semantic-md","smart-markdown"]}},oLt=class rh extends v1{static instance=null;metadataMap=new Map;constructor(){super()}static getInstance(){return rh.instance||(rh.instance=new rh),rh.instance}static resetInstance(){rh.instance&&(rh.instance.clear(),rh.instance=null)}async registerAll(){this.registerChunker("character",async t=>{const{CharacterChunker:r}=await Promise.resolve().then(()=>(u6r(),FNt));return new r(t)},ru.character),this.registerChunker("recursive",async t=>{const{RecursiveChunker:r}=await Promise.resolve().then(()=>(zNt(),ate));return new r(t)},ru.recursive),this.registerChunker("sentence",async t=>{const{SentenceChunker:r}=await Promise.resolve().then(()=>(d6r(),jNt));return new r(t)},ru.sentence),this.registerChunker("token",async t=>{const{TokenChunker:r}=await Promise.resolve().then(()=>(p6r(),GNt));return new r(t)},ru.token),this.registerChunker("markdown",async t=>{const{MarkdownChunker:r}=await Promise.resolve().then(()=>(h6r(),VNt));return new r(t)},ru.markdown),this.registerChunker("html",async t=>{const{HTMLChunker:r}=await Promise.resolve().then(()=>(f6r(),JNt));return new r(t)},ru.html),this.registerChunker("json",async t=>{const{JSONChunker:r}=await Promise.resolve().then(()=>(g6r(),ZNt));return new r(t)},ru.json),this.registerChunker("latex",async t=>{const{LaTeXChunker:r}=await Promise.resolve().then(()=>(y6r(),QNt));return new r(t)},ru.latex),this.registerChunker("semantic",async t=>{const{RecursiveChunker:r}=await Promise.resolve().then(()=>(zNt(),ate));return new r(t)},ru.semantic),this.registerChunker("semantic-markdown",async t=>{const{SemanticMarkdownChunker:r}=await Promise.resolve().then(()=>(rLt(),tLt));return new r(t)},ru["semantic-markdown"]),f.debug(`[ChunkerFactory] Registered ${this.items.size} chunking strategies`)}registerChunker(t,r,n){this.metadataMap.set(t,n),this.register(t,r,n.aliases,{metadata:n}),f.debug(`[ChunkerFactory] Registered chunker '${t}' with aliases: ${n.aliases?.join(", ")??"none"}`)}async createChunker(t,r){await this.ensureInitialized();const n=this.resolveName(t);if(!this.has(n)){const o=this.getAvailable();throw new Vu(`Unknown chunking strategy: '${t}'. Available strategies: ${o.join(", ")}`,{code:Pr.CHUNKING_STRATEGY_NOT_FOUND,details:{requestedStrategy:t,availableStrategies:o}})}try{const o=await this.create(n,r);return f.debug(`[ChunkerFactory] Created chunker '${n}' with config:`,r),o}catch(o){throw new Vu(`Failed to create chunker '${n}': ${o instanceof Error?o.message:String(o)}`,{code:Pr.CHUNKING_ERROR,cause:o instanceof Error?o:void 0,details:{strategy:n,config:r}})}}getChunkerMetadata(t){const r=this.resolveName(t);return this.metadataMap.get(r)}getDefaultConfig(t){return this.getChunkerMetadata(t)?.defaultConfig}async getAvailableStrategies(){return await this.ensureInitialized(),this.getAvailable()}getStrategyAliases(){return this.getAliases()}hasStrategy(t){const r=this.resolveName(t);return this.has(r)}getChunkersForUseCase(t){const r=[],n=t.toLowerCase();for(const[o,s]of this.metadataMap)(s.useCases?.some(a=>a.toLowerCase().includes(n))??!1)&&r.push(o);return r}getAllMetadata(){return new Map(this.metadataMap)}clear(){super.clear(),this.metadataMap.clear()}},sLt=oLt.getInstance()}});async function OC(e,t,r,n){return gt({name:"neurolink.rag.rerank",tracer:He.rag,attributes:{"rag.reranker.input_count":e.length,"rag.reranker.top_k":n?.topK??3,"rag.reranker.query_length":t.length}},async o=>{const{queryEmbedding:s,topK:i=3,weights:a=Ca}=n||{};if(e.length===0)return o.setAttribute("rag.reranker.output_count",0),[];const l=(a.semantic||Ca.semantic)+(a.vector||Ca.vector)+(a.position||Ca.position);Math.abs(l-1)>.01&&f.warn("[Reranker] Weights do not sum to 1.0, normalizing",{original:a,total:l});const c={semantic:(a.semantic||Ca.semantic)/l,vector:(a.vector||Ca.vector)/l,position:(a.position||Ca.position)/l},u=[],d=5;for(let h=0;h<e.length;h+=d){const y=e.slice(h,h+d).map(async(w,b)=>{const T=h+b,x=w.score??0,k=1-T/e.length,I=await v6r(t,w.text||w.metadata?.text||"",r),R=c.semantic*I.score+c.vector*x+c.position*k;return{result:w,score:R,details:{semantic:I.score,vector:x,position:k,queryAnalysis:I.analysis}}}),v=await Promise.all(y);u.push(...v)}u.sort((h,g)=>g.score-h.score);const m=u.slice(0,i);return o.setAttribute("rag.reranker.output_count",m.length),m})}async function v6r(e,t,r){const n=`Rate the relevance of the following text to the query on a scale of 0 to 1.
|
|
1736
|
+
`,". "," ",""]},supportedOptions:["maxSize","overlap","separators","keepSeparators"],useCases:["General text documents","Default choice"],aliases:["recursive-character","langchain-default"]},sentence:{description:"Splits text by sentence boundaries",defaultConfig:{maxSize:1e3,overlap:1},supportedOptions:["maxSize","overlap","boundaryDetection","maxSentences"],useCases:["Q&A applications","Sentence-level analysis"],aliases:["sent","sentence-based"]},token:{description:"Splits text by token count using a specific tokenizer",defaultConfig:{maxSize:512,overlap:50},supportedOptions:["maxSize","overlap","tokenizer","maxTokens"],useCases:["Token-aware splitting","Model-specific chunks"],aliases:["tok","tokenized"]},markdown:{description:"Splits markdown content by headers and structural elements",defaultConfig:{maxSize:1e3,overlap:50},supportedOptions:["maxSize","headerLevels","splitCodeBlocks"],useCases:["Documentation processing","README files"],aliases:["md","markdown-header"]},html:{description:"Splits HTML content by semantic tags",defaultConfig:{maxSize:1e3,overlap:0},supportedOptions:["maxSize","splitTags","stripTags","preserveAttributes"],useCases:["Web content processing","HTML documents"],aliases:["html-tag","web"]},json:{description:"Splits JSON documents by object boundaries",defaultConfig:{maxSize:1e3,overlap:0},supportedOptions:["maxSize","maxDepth","chunkKeys"],useCases:["API response processing","Structured data"],aliases:["json-object","structured"]},latex:{description:"Splits LaTeX documents by sections and environments",defaultConfig:{maxSize:1e3,overlap:0},supportedOptions:["maxSize","environments","splitMathBlocks"],useCases:["Academic papers","Scientific documents"],aliases:["tex","latex-section"]},semantic:{description:"Uses LLM to identify semantically meaningful split points",defaultConfig:{maxSize:1e3,overlap:100},supportedOptions:["maxSize","modelName","provider","similarityThreshold"],useCases:["Advanced semantic understanding","AI-enhanced chunking"],aliases:["llm","ai-semantic"]},"semantic-markdown":{description:"Combines markdown splitting with semantic similarity",defaultConfig:{maxSize:1e3,overlap:100},supportedOptions:["maxSize","similarityThreshold","maxMergeSize"],useCases:["Context-aware documentation","Knowledge bases"],aliases:["semantic-md","smart-markdown"]}},oLt=class rh extends v1{static instance=null;metadataMap=new Map;constructor(){super()}static getInstance(){return rh.instance||(rh.instance=new rh),rh.instance}static resetInstance(){rh.instance&&(rh.instance.clear(),rh.instance=null)}async registerAll(){this.registerChunker("character",async t=>{const{CharacterChunker:r}=await Promise.resolve().then(()=>(u6r(),FNt));return new r(t)},ru.character),this.registerChunker("recursive",async t=>{const{RecursiveChunker:r}=await Promise.resolve().then(()=>(zNt(),ate));return new r(t)},ru.recursive),this.registerChunker("sentence",async t=>{const{SentenceChunker:r}=await Promise.resolve().then(()=>(d6r(),jNt));return new r(t)},ru.sentence),this.registerChunker("token",async t=>{const{TokenChunker:r}=await Promise.resolve().then(()=>(p6r(),GNt));return new r(t)},ru.token),this.registerChunker("markdown",async t=>{const{MarkdownChunker:r}=await Promise.resolve().then(()=>(h6r(),VNt));return new r(t)},ru.markdown),this.registerChunker("html",async t=>{const{HTMLChunker:r}=await Promise.resolve().then(()=>(f6r(),JNt));return new r(t)},ru.html),this.registerChunker("json",async t=>{const{JSONChunker:r}=await Promise.resolve().then(()=>(g6r(),ZNt));return new r(t)},ru.json),this.registerChunker("latex",async t=>{const{LaTeXChunker:r}=await Promise.resolve().then(()=>(y6r(),QNt));return new r(t)},ru.latex),this.registerChunker("semantic",async t=>{const{RecursiveChunker:r}=await Promise.resolve().then(()=>(zNt(),ate));return new r(t)},ru.semantic),this.registerChunker("semantic-markdown",async t=>{const{SemanticMarkdownChunker:r}=await Promise.resolve().then(()=>(rLt(),tLt));return new r(t)},ru["semantic-markdown"]),f.debug(`[ChunkerFactory] Registered ${this.items.size} chunking strategies`)}registerChunker(t,r,n){this.metadataMap.set(t,n),this.register(t,r,n.aliases,{metadata:n}),f.debug(`[ChunkerFactory] Registered chunker '${t}' with aliases: ${n.aliases?.join(", ")??"none"}`)}async createChunker(t,r){await this.ensureInitialized();const n=this.resolveName(t);if(!this.has(n)){const o=this.getAvailable();throw new Vu(`Unknown chunking strategy: '${t}'. Available strategies: ${o.join(", ")}`,{code:Pr.CHUNKING_STRATEGY_NOT_FOUND,details:{requestedStrategy:t,availableStrategies:o}})}try{const o=await this.create(n,r);return f.debug(`[ChunkerFactory] Created chunker '${n}' with config:`,r),o}catch(o){throw new Vu(`Failed to create chunker '${n}': ${o instanceof Error?o.message:String(o)}`,{code:Pr.CHUNKING_ERROR,cause:o instanceof Error?o:void 0,details:{strategy:n,config:r}})}}async getChunkerMetadata(t){await this.ensureInitialized();const r=this.resolveName(t);return this.metadataMap.get(r)}async getDefaultConfig(t){return(await this.getChunkerMetadata(t))?.defaultConfig}async getAvailableStrategies(){return await this.ensureInitialized(),this.getAvailable()}async getStrategyAliases(){return await this.ensureInitialized(),this.getAliases()}async hasStrategy(t){await this.ensureInitialized();const r=this.resolveName(t);return this.has(r)}async getChunkersForUseCase(t){await this.ensureInitialized();const r=[],n=t.toLowerCase();for(const[o,s]of this.metadataMap)(s.useCases?.some(a=>a.toLowerCase().includes(n))??!1)&&r.push(o);return r}async getAllMetadata(){return await this.ensureInitialized(),new Map(this.metadataMap)}clear(){super.clear(),this.metadataMap.clear()}},sLt=oLt.getInstance()}});async function OC(e,t,r,n){return gt({name:"neurolink.rag.rerank",tracer:He.rag,attributes:{"rag.reranker.input_count":e.length,"rag.reranker.top_k":n?.topK??3,"rag.reranker.query_length":t.length}},async o=>{const{queryEmbedding:s,topK:i=3,weights:a=Ca}=n||{};if(e.length===0)return o.setAttribute("rag.reranker.output_count",0),[];const l=(a.semantic||Ca.semantic)+(a.vector||Ca.vector)+(a.position||Ca.position);Math.abs(l-1)>.01&&f.warn("[Reranker] Weights do not sum to 1.0, normalizing",{original:a,total:l});const c={semantic:(a.semantic||Ca.semantic)/l,vector:(a.vector||Ca.vector)/l,position:(a.position||Ca.position)/l},u=[],d=5;for(let h=0;h<e.length;h+=d){const y=e.slice(h,h+d).map(async(w,b)=>{const T=h+b,x=w.score??0,k=1-T/e.length,I=await v6r(t,w.text||w.metadata?.text||"",r),R=c.semantic*I.score+c.vector*x+c.position*k;return{result:w,score:R,details:{semantic:I.score,vector:x,position:k,queryAnalysis:I.analysis}}}),v=await Promise.all(y);u.push(...v)}u.sort((h,g)=>g.score-h.score);const m=u.slice(0,i);return o.setAttribute("rag.reranker.output_count",m.length),m})}async function v6r(e,t,r){const n=`Rate the relevance of the following text to the query on a scale of 0 to 1.
|
|
1737
1737
|
|
|
1738
1738
|
Query: ${e}
|
|
1739
1739
|
|
|
@@ -37,13 +37,23 @@ export declare class ChunkerFactory extends BaseFactory<Chunker, ChunkerConfig>
|
|
|
37
37
|
*/
|
|
38
38
|
createChunker(strategyOrAlias: string, config?: ChunkerConfig): Promise<Chunker>;
|
|
39
39
|
/**
|
|
40
|
-
* Get metadata for a chunker
|
|
40
|
+
* Get metadata for a chunker.
|
|
41
|
+
*
|
|
42
|
+
* Awaits registration first. `metadataMap` and the alias map are populated by
|
|
43
|
+
* `registerAll()`, which only runs via the async `ensureInitialized()` — and
|
|
44
|
+
* the only place that awaited it was `create()`. So on a fresh process this
|
|
45
|
+
* returned `undefined` for every strategy until something happened to build a
|
|
46
|
+
* chunker first, and returned real metadata after. Order-dependent, silent,
|
|
47
|
+
* and `undefined` rather than a throw.
|
|
48
|
+
*
|
|
49
|
+
* `createChunker()` and `getAvailableStrategies()` were already async for
|
|
50
|
+
* exactly this reason; these readers were the ones that had not caught up.
|
|
41
51
|
*/
|
|
42
|
-
getChunkerMetadata(strategyOrAlias: string): ChunkerMetadata | undefined
|
|
52
|
+
getChunkerMetadata(strategyOrAlias: string): Promise<ChunkerMetadata | undefined>;
|
|
43
53
|
/**
|
|
44
54
|
* Get default configuration for a chunker
|
|
45
55
|
*/
|
|
46
|
-
getDefaultConfig(strategyOrAlias: string): ChunkerConfig | undefined
|
|
56
|
+
getDefaultConfig(strategyOrAlias: string): Promise<ChunkerConfig | undefined>;
|
|
47
57
|
/**
|
|
48
58
|
* Get available chunking strategies (not including aliases)
|
|
49
59
|
*/
|
|
@@ -51,19 +61,19 @@ export declare class ChunkerFactory extends BaseFactory<Chunker, ChunkerConfig>
|
|
|
51
61
|
/**
|
|
52
62
|
* Get all aliases mapped to their strategies
|
|
53
63
|
*/
|
|
54
|
-
getStrategyAliases(): Map<string, string
|
|
64
|
+
getStrategyAliases(): Promise<Map<string, string>>;
|
|
55
65
|
/**
|
|
56
66
|
* Check if a strategy exists
|
|
57
67
|
*/
|
|
58
|
-
hasStrategy(strategyOrAlias: string): boolean
|
|
68
|
+
hasStrategy(strategyOrAlias: string): Promise<boolean>;
|
|
59
69
|
/**
|
|
60
70
|
* Get chunkers suitable for a use case
|
|
61
71
|
*/
|
|
62
|
-
getChunkersForUseCase(useCase: string): ChunkingStrategy[]
|
|
72
|
+
getChunkersForUseCase(useCase: string): Promise<ChunkingStrategy[]>;
|
|
63
73
|
/**
|
|
64
74
|
* Get all chunker metadata
|
|
65
75
|
*/
|
|
66
|
-
getAllMetadata(): Map<string, ChunkerMetadata
|
|
76
|
+
getAllMetadata(): Promise<Map<string, ChunkerMetadata>>;
|
|
67
77
|
/**
|
|
68
78
|
* Clear factory and metadata
|
|
69
79
|
*/
|
|
@@ -84,8 +94,8 @@ export declare function getAvailableStrategies(): Promise<ChunkingStrategy[]>;
|
|
|
84
94
|
/**
|
|
85
95
|
* Convenience function to get chunker metadata
|
|
86
96
|
*/
|
|
87
|
-
export declare function getChunkerMetadata(strategyOrAlias: string): ChunkerMetadata | undefined
|
|
97
|
+
export declare function getChunkerMetadata(strategyOrAlias: string): Promise<ChunkerMetadata | undefined>;
|
|
88
98
|
/**
|
|
89
99
|
* Convenience function to get default config
|
|
90
100
|
*/
|
|
91
|
-
export declare function getDefaultConfig(strategyOrAlias: string): ChunkerConfig | undefined
|
|
101
|
+
export declare function getDefaultConfig(strategyOrAlias: string): Promise<ChunkerConfig | undefined>;
|
|
@@ -229,17 +229,28 @@ export class ChunkerFactory extends BaseFactory {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
|
-
* Get metadata for a chunker
|
|
232
|
+
* Get metadata for a chunker.
|
|
233
|
+
*
|
|
234
|
+
* Awaits registration first. `metadataMap` and the alias map are populated by
|
|
235
|
+
* `registerAll()`, which only runs via the async `ensureInitialized()` — and
|
|
236
|
+
* the only place that awaited it was `create()`. So on a fresh process this
|
|
237
|
+
* returned `undefined` for every strategy until something happened to build a
|
|
238
|
+
* chunker first, and returned real metadata after. Order-dependent, silent,
|
|
239
|
+
* and `undefined` rather than a throw.
|
|
240
|
+
*
|
|
241
|
+
* `createChunker()` and `getAvailableStrategies()` were already async for
|
|
242
|
+
* exactly this reason; these readers were the ones that had not caught up.
|
|
233
243
|
*/
|
|
234
|
-
getChunkerMetadata(strategyOrAlias) {
|
|
244
|
+
async getChunkerMetadata(strategyOrAlias) {
|
|
245
|
+
await this.ensureInitialized();
|
|
235
246
|
const resolvedName = this.resolveName(strategyOrAlias);
|
|
236
247
|
return this.metadataMap.get(resolvedName);
|
|
237
248
|
}
|
|
238
249
|
/**
|
|
239
250
|
* Get default configuration for a chunker
|
|
240
251
|
*/
|
|
241
|
-
getDefaultConfig(strategyOrAlias) {
|
|
242
|
-
const metadata = this.getChunkerMetadata(strategyOrAlias);
|
|
252
|
+
async getDefaultConfig(strategyOrAlias) {
|
|
253
|
+
const metadata = await this.getChunkerMetadata(strategyOrAlias);
|
|
243
254
|
return metadata?.defaultConfig;
|
|
244
255
|
}
|
|
245
256
|
/**
|
|
@@ -252,20 +263,23 @@ export class ChunkerFactory extends BaseFactory {
|
|
|
252
263
|
/**
|
|
253
264
|
* Get all aliases mapped to their strategies
|
|
254
265
|
*/
|
|
255
|
-
getStrategyAliases() {
|
|
266
|
+
async getStrategyAliases() {
|
|
267
|
+
await this.ensureInitialized();
|
|
256
268
|
return this.getAliases();
|
|
257
269
|
}
|
|
258
270
|
/**
|
|
259
271
|
* Check if a strategy exists
|
|
260
272
|
*/
|
|
261
|
-
hasStrategy(strategyOrAlias) {
|
|
273
|
+
async hasStrategy(strategyOrAlias) {
|
|
274
|
+
await this.ensureInitialized();
|
|
262
275
|
const resolved = this.resolveName(strategyOrAlias);
|
|
263
276
|
return this.has(resolved);
|
|
264
277
|
}
|
|
265
278
|
/**
|
|
266
279
|
* Get chunkers suitable for a use case
|
|
267
280
|
*/
|
|
268
|
-
getChunkersForUseCase(useCase) {
|
|
281
|
+
async getChunkersForUseCase(useCase) {
|
|
282
|
+
await this.ensureInitialized();
|
|
269
283
|
const matches = [];
|
|
270
284
|
const useCaseLower = useCase.toLowerCase();
|
|
271
285
|
for (const [strategy, metadata] of this.metadataMap) {
|
|
@@ -279,7 +293,8 @@ export class ChunkerFactory extends BaseFactory {
|
|
|
279
293
|
/**
|
|
280
294
|
* Get all chunker metadata
|
|
281
295
|
*/
|
|
282
|
-
getAllMetadata() {
|
|
296
|
+
async getAllMetadata() {
|
|
297
|
+
await this.ensureInitialized();
|
|
283
298
|
return new Map(this.metadataMap);
|
|
284
299
|
}
|
|
285
300
|
/**
|
|
@@ -64,11 +64,11 @@ export declare class RerankerFactory extends BaseFactory<Reranker, RerankerConfi
|
|
|
64
64
|
/**
|
|
65
65
|
* Get metadata for a reranker
|
|
66
66
|
*/
|
|
67
|
-
getRerankerMetadata(typeOrAlias: string): RerankerMetadata | undefined
|
|
67
|
+
getRerankerMetadata(typeOrAlias: string): Promise<RerankerMetadata | undefined>;
|
|
68
68
|
/**
|
|
69
69
|
* Get default configuration for a reranker
|
|
70
70
|
*/
|
|
71
|
-
getDefaultConfig(typeOrAlias: string): Partial<RerankerConfig> | undefined
|
|
71
|
+
getDefaultConfig(typeOrAlias: string): Promise<Partial<RerankerConfig> | undefined>;
|
|
72
72
|
/**
|
|
73
73
|
* Get available reranker types (not including aliases)
|
|
74
74
|
*/
|
|
@@ -76,27 +76,27 @@ export declare class RerankerFactory extends BaseFactory<Reranker, RerankerConfi
|
|
|
76
76
|
/**
|
|
77
77
|
* Get all aliases mapped to their types
|
|
78
78
|
*/
|
|
79
|
-
getTypeAliases(): Map<string, string
|
|
79
|
+
getTypeAliases(): Promise<Map<string, string>>;
|
|
80
80
|
/**
|
|
81
81
|
* Check if a type exists
|
|
82
82
|
*/
|
|
83
|
-
hasType(typeOrAlias: string): boolean
|
|
83
|
+
hasType(typeOrAlias: string): Promise<boolean>;
|
|
84
84
|
/**
|
|
85
85
|
* Get rerankers suitable for a use case
|
|
86
86
|
*/
|
|
87
|
-
getRerankersForUseCase(useCase: string): RerankerType[]
|
|
87
|
+
getRerankersForUseCase(useCase: string): Promise<RerankerType[]>;
|
|
88
88
|
/**
|
|
89
89
|
* Get rerankers that don't require external APIs
|
|
90
90
|
*/
|
|
91
|
-
getLocalRerankers(): RerankerType[]
|
|
91
|
+
getLocalRerankers(): Promise<RerankerType[]>;
|
|
92
92
|
/**
|
|
93
93
|
* Get rerankers that don't require AI models
|
|
94
94
|
*/
|
|
95
|
-
getModelFreeRerankers(): RerankerType[]
|
|
95
|
+
getModelFreeRerankers(): Promise<RerankerType[]>;
|
|
96
96
|
/**
|
|
97
97
|
* Get all reranker metadata
|
|
98
98
|
*/
|
|
99
|
-
getAllMetadata(): Map<RerankerType, RerankerMetadata
|
|
99
|
+
getAllMetadata(): Promise<Map<RerankerType, RerankerMetadata>>;
|
|
100
100
|
/**
|
|
101
101
|
* Clear factory and metadata
|
|
102
102
|
*/
|
|
@@ -117,8 +117,8 @@ export declare function getAvailableRerankerTypes(): Promise<RerankerType[]>;
|
|
|
117
117
|
/**
|
|
118
118
|
* Convenience function to get reranker metadata
|
|
119
119
|
*/
|
|
120
|
-
export declare function getRerankerMetadata(typeOrAlias: string): RerankerMetadata | undefined
|
|
120
|
+
export declare function getRerankerMetadata(typeOrAlias: string): Promise<RerankerMetadata | undefined>;
|
|
121
121
|
/**
|
|
122
122
|
* Convenience function to get default config
|
|
123
123
|
*/
|
|
124
|
-
export declare function getRerankerDefaultConfig(typeOrAlias: string): Partial<RerankerConfig> | undefined
|
|
124
|
+
export declare function getRerankerDefaultConfig(typeOrAlias: string): Promise<Partial<RerankerConfig> | undefined>;
|
|
@@ -316,15 +316,16 @@ export class RerankerFactory extends BaseFactory {
|
|
|
316
316
|
/**
|
|
317
317
|
* Get metadata for a reranker
|
|
318
318
|
*/
|
|
319
|
-
getRerankerMetadata(typeOrAlias) {
|
|
319
|
+
async getRerankerMetadata(typeOrAlias) {
|
|
320
|
+
await this.ensureInitialized();
|
|
320
321
|
const resolvedName = this.resolveName(typeOrAlias);
|
|
321
322
|
return this.metadataMap.get(resolvedName);
|
|
322
323
|
}
|
|
323
324
|
/**
|
|
324
325
|
* Get default configuration for a reranker
|
|
325
326
|
*/
|
|
326
|
-
getDefaultConfig(typeOrAlias) {
|
|
327
|
-
const metadata = this.getRerankerMetadata(typeOrAlias);
|
|
327
|
+
async getDefaultConfig(typeOrAlias) {
|
|
328
|
+
const metadata = await this.getRerankerMetadata(typeOrAlias);
|
|
328
329
|
return metadata?.defaultConfig;
|
|
329
330
|
}
|
|
330
331
|
/**
|
|
@@ -337,20 +338,23 @@ export class RerankerFactory extends BaseFactory {
|
|
|
337
338
|
/**
|
|
338
339
|
* Get all aliases mapped to their types
|
|
339
340
|
*/
|
|
340
|
-
getTypeAliases() {
|
|
341
|
+
async getTypeAliases() {
|
|
342
|
+
await this.ensureInitialized();
|
|
341
343
|
return this.getAliases();
|
|
342
344
|
}
|
|
343
345
|
/**
|
|
344
346
|
* Check if a type exists
|
|
345
347
|
*/
|
|
346
|
-
hasType(typeOrAlias) {
|
|
348
|
+
async hasType(typeOrAlias) {
|
|
349
|
+
await this.ensureInitialized();
|
|
347
350
|
const resolved = this.resolveName(typeOrAlias);
|
|
348
351
|
return this.has(resolved);
|
|
349
352
|
}
|
|
350
353
|
/**
|
|
351
354
|
* Get rerankers suitable for a use case
|
|
352
355
|
*/
|
|
353
|
-
getRerankersForUseCase(useCase) {
|
|
356
|
+
async getRerankersForUseCase(useCase) {
|
|
357
|
+
await this.ensureInitialized();
|
|
354
358
|
const matches = [];
|
|
355
359
|
const useCaseLower = useCase.toLowerCase();
|
|
356
360
|
for (const [type, metadata] of this.metadataMap) {
|
|
@@ -364,7 +368,8 @@ export class RerankerFactory extends BaseFactory {
|
|
|
364
368
|
/**
|
|
365
369
|
* Get rerankers that don't require external APIs
|
|
366
370
|
*/
|
|
367
|
-
getLocalRerankers() {
|
|
371
|
+
async getLocalRerankers() {
|
|
372
|
+
await this.ensureInitialized();
|
|
368
373
|
const matches = [];
|
|
369
374
|
for (const [type, metadata] of this.metadataMap) {
|
|
370
375
|
if (!metadata.requiresExternalAPI) {
|
|
@@ -376,7 +381,8 @@ export class RerankerFactory extends BaseFactory {
|
|
|
376
381
|
/**
|
|
377
382
|
* Get rerankers that don't require AI models
|
|
378
383
|
*/
|
|
379
|
-
getModelFreeRerankers() {
|
|
384
|
+
async getModelFreeRerankers() {
|
|
385
|
+
await this.ensureInitialized();
|
|
380
386
|
const matches = [];
|
|
381
387
|
for (const [type, metadata] of this.metadataMap) {
|
|
382
388
|
if (!metadata.requiresModel) {
|
|
@@ -388,7 +394,8 @@ export class RerankerFactory extends BaseFactory {
|
|
|
388
394
|
/**
|
|
389
395
|
* Get all reranker metadata
|
|
390
396
|
*/
|
|
391
|
-
getAllMetadata() {
|
|
397
|
+
async getAllMetadata() {
|
|
398
|
+
await this.ensureInitialized();
|
|
392
399
|
return new Map(this.metadataMap);
|
|
393
400
|
}
|
|
394
401
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "11.23.
|
|
3
|
+
"version": "11.23.1",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (connect any MCP server), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
|
|
6
6
|
"author": {
|