adaptive-memory-multi-model-router 1.9.5 → 2.0.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/.github/ISSUE_TEMPLATE/bug_report.md +50 -0
- package/.github/ISSUE_TEMPLATE/config.yml +11 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +37 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +44 -0
- package/.github/workflows/npm-stats-validation.yml +152 -0
- package/.github/workflows/pages.yml +37 -0
- package/CHANGELOG.md +122 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +110 -0
- package/LAUNCH-PAIN-DRIVEN.md +339 -0
- package/LAUNCH.md +575 -0
- package/POPULARITY_BOOSTERS.md +285 -0
- package/README.md +231 -300
- package/SECURITY.md +69 -0
- package/articles/CONTENT_STRUCTURE.md +292 -0
- package/articles/DEVTO_COST_GUIDE.md +473 -0
- package/articles/DEVTO_FINAL.md +416 -0
- package/articles/DEVTO_MULTI_PROVIDER.md +542 -0
- package/articles/DEVTO_V2_ANNOUNCEMENT.md +160 -0
- package/articles/HN_10X_BETTER.md +430 -0
- package/articles/HN_CHINESE_STYLE.md +308 -0
- package/articles/HN_FINAL.md +199 -0
- package/articles/HN_POSTED_VERSION.md +56 -0
- package/articles/HN_RESEARCH.md +364 -0
- package/articles/PAIN-DRIVEN-devto-v2.md +308 -0
- package/articles/PAIN-DRIVEN-devto-v3.md +268 -0
- package/articles/PAIN-DRIVEN-devto.md +242 -0
- package/articles/PAIN-DRIVEN-hackernews-v2.md +138 -0
- package/articles/PAIN-DRIVEN-hackernews-v3.md +151 -0
- package/articles/PAIN-DRIVEN-hackernews.md +131 -0
- package/articles/PAIN-DRIVEN-reddit-v2.md +301 -0
- package/articles/PAIN-DRIVEN-reddit-v3.md +236 -0
- package/articles/PAIN-DRIVEN-reddit.md +218 -0
- package/articles/PAIN-DRIVEN-twitter-v2.md +110 -0
- package/articles/PAIN-DRIVEN-twitter-v3.md +121 -0
- package/articles/PAIN-DRIVEN-twitter.md +120 -0
- package/articles/PORTKEY_VS_A3M.md +147 -0
- package/articles/REDDIT_FINAL.md +232 -0
- package/articles/TWITTER_FINAL.md +167 -0
- package/articles/WHY_10X_BETTER.md +261 -0
- package/articles/WHY_CHINESE_STYLE_BETTER.md +323 -0
- package/articles/hashnode-llm-cost-optimization.md +125 -0
- package/articles/medium-building-llm-router.md +205 -0
- package/articles/twitter-thread-cost-savings.md +98 -0
- package/articles/youtube-tutorial-script.md +262 -0
- package/assets/banner.svg +109 -0
- package/assets/logo.svg +68 -0
- package/assets/social-preview.svg +64 -0
- package/demo/demo-script.md +53 -0
- package/dist/analytics/costAnalytics.d.ts +77 -0
- package/dist/analytics/costAnalytics.d.ts.map +1 -0
- package/dist/analytics/costAnalytics.js +219 -0
- package/dist/analytics/costAnalytics.js.map +1 -0
- package/dist/cache/semanticCache.d.ts +62 -0
- package/dist/cache/semanticCache.d.ts.map +1 -0
- package/dist/cache/semanticCache.js +176 -0
- package/dist/cache/semanticCache.js.map +1 -0
- package/dist/cli.js +35 -0
- package/dist/index.d.ts +30 -722
- package/dist/index.js +76 -355
- package/dist/index.js.map +1 -1
- package/dist/integrations/langchainAdapter.d.ts +146 -0
- package/dist/integrations/langchainAdapter.d.ts.map +1 -0
- package/dist/integrations/langchainAdapter.js +731 -0
- package/dist/integrations/langchainAdapter.js.map +1 -0
- package/dist/integrations/oauth.d.ts +69 -0
- package/dist/integrations/oauth.d.ts.map +1 -0
- package/dist/integrations/oauth.js +225 -21
- package/dist/integrations/oauth.js.map +1 -0
- package/dist/memory/autoFetch.d.ts +39 -0
- package/dist/memory/autoFetch.d.ts.map +1 -0
- package/dist/memory/autoFetch.js +80 -88
- package/dist/memory/autoFetch.js.map +1 -0
- package/dist/memory/memoryTree.d.ts +76 -0
- package/dist/memory/memoryTree.d.ts.map +1 -0
- package/dist/memory/memoryTree.js +185 -130
- package/dist/memory/memoryTree.js.map +1 -0
- package/dist/memory/obsidianVault.d.ts +71 -0
- package/dist/memory/obsidianVault.d.ts.map +1 -0
- package/dist/memory/obsidianVault.js +207 -22
- package/dist/memory/obsidianVault.js.map +1 -0
- package/dist/providers/providerConfig.d.ts +49 -0
- package/dist/providers/providerConfig.d.ts.map +1 -0
- package/dist/providers/providerConfig.js +806 -401
- package/dist/providers/providerConfig.js.map +1 -0
- package/dist/security/guardrails.d.ts +76 -0
- package/dist/security/guardrails.d.ts.map +1 -0
- package/dist/security/guardrails.js +479 -0
- package/dist/security/guardrails.js.map +1 -0
- package/dist/server/dashboard.d.ts +58 -0
- package/dist/server/dashboard.d.ts.map +1 -0
- package/dist/server/dashboard.js +553 -0
- package/dist/server/dashboard.js.map +1 -0
- package/dist/server/modelMapper.d.ts +43 -0
- package/dist/server/modelMapper.d.ts.map +1 -0
- package/dist/server/modelMapper.js +154 -0
- package/dist/server/modelMapper.js.map +1 -0
- package/dist/server/proxyServer.d.ts +41 -0
- package/dist/server/proxyServer.d.ts.map +1 -0
- package/dist/server/proxyServer.js +932 -0
- package/dist/server/proxyServer.js.map +1 -0
- package/dist/skills/__tests__/skill_manager.test.d.ts +2 -0
- package/dist/skills/__tests__/skill_manager.test.d.ts.map +1 -0
- package/dist/skills/__tests__/skill_manager.test.js +268 -0
- package/dist/skills/__tests__/skill_manager.test.js.map +1 -0
- package/docs-site/index.html +347 -0
- package/package.json +53 -7
- package/playground/README.md +51 -0
- package/playground/codesandbox.json +12 -0
- package/playground/index.js +39 -0
- package/scripts/update-npm-badges.js +158 -0
- package/src/analytics/costAnalytics.ts +304 -0
- package/src/cache/semanticCache.ts +221 -0
- package/src/index.ts +99 -0
- package/src/integrations/langchainAdapter.ts +955 -0
- package/src/providers/providerConfig.ts +923 -0
- package/src/security/guardrails.ts +585 -0
- package/src/server/dashboard.ts +610 -0
- package/src/server/modelMapper.ts +182 -0
- package/src/server/proxyServer.ts +1105 -0
- package/src/types/langchain.d.ts +83 -0
- package/tsconfig.build.json +20 -0
package/dist/index.js
CHANGED
|
@@ -1,364 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Parallel Multi-LLM Processing with Streaming, Caching, Cost Tracking, Reliability
|
|
6
|
-
* + Reference Architecture to Full TMLPD (Episodic Memory, MCTS, HALO)
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import { createTMLPD, HALOOrchestrator, EpisodicMemoryStore } from "tmlpd-pi";
|
|
11
|
-
*
|
|
12
|
-
* // Lightweight usage (core features)
|
|
13
|
-
* const tmlpd = createTMLPD({ cache: { ttl_seconds: 3600 } });
|
|
14
|
-
* const result = await tmlpd.executeParallel(prompt, ["gpt-4o", "claude"]);
|
|
15
|
-
*
|
|
16
|
-
* // Advanced: HALO orchestration with episodic memory
|
|
17
|
-
* const halo = new HALOOrchestrator({ maxConcurrent: 3, enableMCTS: true });
|
|
18
|
-
* const haloResult = await halo.execute("Build a REST API", async (subtask, agent) => {
|
|
19
|
-
* // Execute via agent
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* // Query episodic memory
|
|
23
|
-
* const similar = memory.getSimilarTasks("Python async API", 5);
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
2
|
+
// A3M Router - Main Entry Point
|
|
3
|
+
// Version: 2.0.0
|
|
26
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const costTracker_1 = require("./cost/costTracker");
|
|
34
|
-
Object.defineProperty(exports, "CostTracker", { enumerable: true, get: function () { return costTracker_1.CostTracker; } });
|
|
35
|
-
const registry_1 = require("./providers/registry");
|
|
36
|
-
Object.defineProperty(exports, "ProviderRegistry", { enumerable: true, get: function () { return registry_1.ProviderRegistry; } });
|
|
37
|
-
const providerConfig_1 = require("./providers/providerConfig");
|
|
38
|
-
Object.defineProperty(exports, "loadProviders", { enumerable: true, get: function () { return providerConfig_1.loadProviders; } });
|
|
39
|
-
Object.defineProperty(exports, "getAvailableProviders", { enumerable: true, get: function () { return providerConfig_1.getAvailableProviders; } });
|
|
40
|
-
Object.defineProperty(exports, "healthCheckProvider", { enumerable: true, get: function () { return providerConfig_1.healthCheck; } });
|
|
41
|
-
Object.defineProperty(exports, "registerProvider", { enumerable: true, get: function () { return providerConfig_1.registerProvider; } });
|
|
42
|
-
Object.defineProperty(exports, "deregisterProvider", { enumerable: true, get: function () { return providerConfig_1.deregisterProvider; } });
|
|
43
|
-
Object.defineProperty(exports, "findCheapestAvailableProvider", { enumerable: true, get: function () { return providerConfig_1.findCheapestAvailableProvider; } });
|
|
44
|
-
Object.defineProperty(exports, "findFastestAvailableProvider", { enumerable: true, get: function () { return providerConfig_1.findFastestAvailableProvider; } });
|
|
45
|
-
Object.defineProperty(exports, "DEFAULT_PROVIDERS", { enumerable: true, get: function () { return providerConfig_1.DEFAULT_PROVIDERS; } });
|
|
46
|
-
const reliability_1 = require("./utils/reliability");
|
|
47
|
-
Object.defineProperty(exports, "CircuitBreaker", { enumerable: true, get: function () { return reliability_1.CircuitBreaker; } });
|
|
48
|
-
Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return reliability_1.withRetry; } });
|
|
49
|
-
Object.defineProperty(exports, "calculateRetryDelay", { enumerable: true, get: function () { return reliability_1.calculateRetryDelay; } });
|
|
50
|
-
Object.defineProperty(exports, "isRetryableStatus", { enumerable: true, get: function () { return reliability_1.isRetryableStatus; } });
|
|
51
|
-
Object.defineProperty(exports, "DEFAULT_RETRY_CONFIG", { enumerable: true, get: function () { return reliability_1.DEFAULT_RETRY_CONFIG; } });
|
|
52
|
-
const episodicMemory_1 = require("./memory/episodicMemory");
|
|
53
|
-
Object.defineProperty(exports, "EpisodicMemoryStore", { enumerable: true, get: function () { return episodicMemory_1.EpisodicMemoryStore; } });
|
|
54
|
-
const mctsWorkflow_1 = require("./orchestration/mctsWorkflow");
|
|
55
|
-
Object.defineProperty(exports, "MCTSWorkflowOptimizer", { enumerable: true, get: function () { return mctsWorkflow_1.MCTSWorkflowOptimizer; } });
|
|
56
|
-
const haloOrchestrator_1 = require("./orchestration/haloOrchestrator");
|
|
57
|
-
Object.defineProperty(exports, "HALOOrchestrator", { enumerable: true, get: function () { return haloOrchestrator_1.HALOOrchestrator; } });
|
|
58
|
-
const tokenUtils_1 = require("./utils/tokenUtils");
|
|
59
|
-
Object.defineProperty(exports, "countTokens", { enumerable: true, get: function () { return tokenUtils_1.countTokens; } });
|
|
60
|
-
Object.defineProperty(exports, "estimateCost", { enumerable: true, get: function () { return tokenUtils_1.estimateCost; } });
|
|
61
|
-
Object.defineProperty(exports, "estimateCostFromText", { enumerable: true, get: function () { return tokenUtils_1.estimateCostFromText; } });
|
|
62
|
-
Object.defineProperty(exports, "getModelCost", { enumerable: true, get: function () { return tokenUtils_1.getModelCost; } });
|
|
63
|
-
Object.defineProperty(exports, "listModelsByCost", { enumerable: true, get: function () { return tokenUtils_1.listModelsByCost; } });
|
|
64
|
-
Object.defineProperty(exports, "findCheapestModels", { enumerable: true, get: function () { return tokenUtils_1.findCheapestModels; } });
|
|
65
|
-
Object.defineProperty(exports, "MODEL_COSTS", { enumerable: true, get: function () { return tokenUtils_1.MODEL_COSTS; } });
|
|
66
|
-
const compression_1 = require("./utils/compression");
|
|
67
|
-
Object.defineProperty(exports, "isonEncode", { enumerable: true, get: function () { return compression_1.isonEncode; } });
|
|
68
|
-
Object.defineProperty(exports, "isonDecode", { enumerable: true, get: function () { return compression_1.isonDecode; } });
|
|
69
|
-
Object.defineProperty(exports, "compressText", { enumerable: true, get: function () { return compression_1.compressText; } });
|
|
70
|
-
Object.defineProperty(exports, "truncateMessages", { enumerable: true, get: function () { return compression_1.truncateMessages; } });
|
|
71
|
-
Object.defineProperty(exports, "truncateToTokenBudget", { enumerable: true, get: function () { return compression_1.truncateToTokenBudget; } });
|
|
72
|
-
Object.defineProperty(exports, "calculateCompressionRatio", { enumerable: true, get: function () { return compression_1.calculateCompressionRatio; } });
|
|
73
|
-
const localProvider_1 = require("./providers/localProvider");
|
|
74
|
-
Object.defineProperty(exports, "LocalProvider", { enumerable: true, get: function () { return localProvider_1.LocalProvider; } });
|
|
75
|
-
Object.defineProperty(exports, "LocalProviderManager", { enumerable: true, get: function () { return localProvider_1.LocalProviderManager; } });
|
|
76
|
-
Object.defineProperty(exports, "createOllamaProvider", { enumerable: true, get: function () { return localProvider_1.createOllamaProvider; } });
|
|
77
|
-
Object.defineProperty(exports, "createVLLMProvider", { enumerable: true, get: function () { return localProvider_1.createVLLMProvider; } });
|
|
78
|
-
Object.defineProperty(exports, "createLMStudioProvider", { enumerable: true, get: function () { return localProvider_1.createLMStudioProvider; } });
|
|
79
|
-
const batchProcessor_1 = require("./utils/batchProcessor");
|
|
80
|
-
Object.defineProperty(exports, "BatchProcessor", { enumerable: true, get: function () { return batchProcessor_1.BatchProcessor; } });
|
|
81
|
-
Object.defineProperty(exports, "executeBatch", { enumerable: true, get: function () { return batchProcessor_1.executeBatch; } });
|
|
82
|
-
const advancedRouter_1 = require("./routing/advancedRouter");
|
|
5
|
+
exports.createProxyServer = exports.CostAnalytics = exports.GuardrailEngine = exports.SemanticCache = exports.MODEL_COSTS = exports.estimateTokens = exports.countTokens = exports.MemoryTree = exports.CostTracker = exports.saveConfig = exports.loadConfig = exports.findFastestAvailableProvider = exports.findCheapestAvailableProvider = exports.checkAllProviders = exports.healthCheck = exports.updateProvider = exports.deregisterProvider = exports.registerProvider = exports.getAvailableProviders = exports.DEFAULT_PROVIDERS = exports.getProviderHealth = exports.updateModelProfile = exports.MODEL_PROFILES = exports.extractQueryFeatures = exports.recommendForTask = exports.routeBatch = exports.routeQuery = void 0;
|
|
6
|
+
exports.createA3MRouter = createA3MRouter;
|
|
7
|
+
// ============================================================
|
|
8
|
+
// ROUTING ENGINE
|
|
9
|
+
// ============================================================
|
|
10
|
+
var advancedRouter_1 = require("./routing/advancedRouter");
|
|
83
11
|
Object.defineProperty(exports, "routeQuery", { enumerable: true, get: function () { return advancedRouter_1.routeQuery; } });
|
|
84
12
|
Object.defineProperty(exports, "routeBatch", { enumerable: true, get: function () { return advancedRouter_1.routeBatch; } });
|
|
85
13
|
Object.defineProperty(exports, "recommendForTask", { enumerable: true, get: function () { return advancedRouter_1.recommendForTask; } });
|
|
86
14
|
Object.defineProperty(exports, "extractQueryFeatures", { enumerable: true, get: function () { return advancedRouter_1.extractQueryFeatures; } });
|
|
87
|
-
Object.defineProperty(exports, "updateModelProfile", { enumerable: true, get: function () { return advancedRouter_1.updateModelProfile; } });
|
|
88
15
|
Object.defineProperty(exports, "MODEL_PROFILES", { enumerable: true, get: function () { return advancedRouter_1.MODEL_PROFILES; } });
|
|
89
|
-
|
|
90
|
-
Object.defineProperty(exports, "
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
Object.defineProperty(exports, "
|
|
96
|
-
Object.defineProperty(exports, "
|
|
97
|
-
Object.defineProperty(exports, "
|
|
98
|
-
|
|
99
|
-
exports.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
description: "Execute with single model via smart routing. Analyzes prompt to select optimal agent based on task type (coding, explanation, analysis, etc.) with cost-quality optimization.",
|
|
116
|
-
inputSchema: {
|
|
117
|
-
type: "object",
|
|
118
|
-
properties: {
|
|
119
|
-
prompt: { type: "string", description: "The prompt to execute" },
|
|
120
|
-
model: { type: "string", description: "Optional specific model" }
|
|
121
|
-
},
|
|
122
|
-
required: ["prompt"]
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: "tmlpd_cost_summary",
|
|
127
|
-
description: "Get real-time cost tracking summary. Shows spending by provider, model, daily/monthly breakdowns, and remaining budget. Essential for cost monitoring in production.",
|
|
128
|
-
inputSchema: { type: "object", properties: {} }
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
name: "tmlpd_cache_stats",
|
|
132
|
-
description: "Get response cache statistics. Shows hit rate, cache size, and effectiveness. Cache hits cost $0 and provide instant responses.",
|
|
133
|
-
inputSchema: { type: "object", properties: {} }
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: "tmlpd_provider_status",
|
|
137
|
-
description: "Get status of all configured LLM providers. Shows readiness, cooldown status, failure counts. Use for debugging or selecting specific providers.",
|
|
138
|
-
inputSchema: { type: "object", properties: {} }
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
name: "tmlpd_invalidate_cache",
|
|
142
|
-
description: "Invalidate cached responses. Use when prompt content has changed and fresh response needed, or to clear stale cache entries.",
|
|
143
|
-
inputSchema: {
|
|
144
|
-
type: "object",
|
|
145
|
-
properties: { model: { type: "string", description: "Optional model to invalidate (all if omitted)" } }
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
name: "tmlpd_get_budget",
|
|
150
|
-
description: "Get remaining budget for cost controls. Returns daily, monthly, and per-model limits. Use for budget enforcement and alerting.",
|
|
151
|
-
inputSchema: { type: "object", properties: {} }
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
name: "tmlpd_halo_execute",
|
|
155
|
-
description: "Execute via HALO (Hierarchical Autonomous Logic-Oriented) orchestrator with 3-tier planning: decompose → assign → execute. Includes episodic memory for learning from past executions. For complex multi-step tasks.",
|
|
156
|
-
inputSchema: {
|
|
157
|
-
type: "object",
|
|
158
|
-
properties: {
|
|
159
|
-
task_description: { type: "string", description: "Task to execute" },
|
|
160
|
-
max_concurrent: { type: "number", description: "Max parallel executions (default: 3)" },
|
|
161
|
-
enable_mcts: { type: "boolean", description: "Enable MCTS optimization (slower but better)" }
|
|
162
|
-
},
|
|
163
|
-
required: ["task_description"]
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: "tmlpd_episodic_query",
|
|
168
|
-
description: "Query episodic memory for similar past tasks. Useful for learning from past executions and improving future routing decisions.",
|
|
169
|
-
inputSchema: {
|
|
170
|
-
type: "object",
|
|
171
|
-
properties: {
|
|
172
|
-
task_description: { type: "string", description: "Task to find similar executions for" },
|
|
173
|
-
limit: { type: "number", description: "Max results (default: 5)" }
|
|
174
|
-
},
|
|
175
|
-
required: ["task_description"]
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
name: "tmlpd_count_tokens",
|
|
180
|
-
description: "Count tokens in text for cost estimation. Supports all major models (GPT-4, Claude, Gemini, Llama). Use for estimating costs before execution or calculating context window usage.",
|
|
181
|
-
inputSchema: {
|
|
182
|
-
type: "object",
|
|
183
|
-
properties: {
|
|
184
|
-
text: { type: "string", description: "Text to count tokens in" },
|
|
185
|
-
model: { type: "string", description: "Model for tokenization (default: gpt-4o)" }
|
|
186
|
-
},
|
|
187
|
-
required: ["text"]
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: "tmlpd_compress_context",
|
|
192
|
-
description: "Compress context/messages using ISON encoding for token reduction. Reduces context by ~20-40% while preserving meaning. Useful for fitting more content in context windows.",
|
|
193
|
-
inputSchema: {
|
|
194
|
-
type: "object",
|
|
195
|
-
properties: {
|
|
196
|
-
messages: { type: "array", description: "Messages to compress", items: { type: "object" } },
|
|
197
|
-
strategy: { type: "string", enum: ["smart", "first", "last"], description: "Compression strategy (default: smart)" },
|
|
198
|
-
max_tokens: { type: "number", description: "Target token budget" }
|
|
199
|
-
},
|
|
200
|
-
required: ["messages"]
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
name: "tmlpd_local_generate",
|
|
205
|
-
description: "Generate using local LLM runtime (Ollama, vLLM, LM Studio). Zero cost, privacy-preserving. Use for development, testing, or when local GPU available. Falls back to cloud if local unavailable.",
|
|
206
|
-
inputSchema: {
|
|
207
|
-
type: "object",
|
|
208
|
-
properties: {
|
|
209
|
-
prompt: { type: "string", description: "Prompt for generation" },
|
|
210
|
-
runtime: { type: "string", enum: ["ollama", "vllm", "lmstudio"], description: "Local runtime type" },
|
|
211
|
-
model: { type: "string", description: "Model name (default: llama-3.3-70b)" }
|
|
212
|
-
},
|
|
213
|
-
required: ["prompt", "runtime"]
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
name: "tmlpd_batch_execute",
|
|
218
|
-
description: "Execute batch of prompts with concurrency control. Supports priority queuing, progress callbacks, rate limiting. Use for processing multiple prompts efficiently.",
|
|
219
|
-
inputSchema: {
|
|
220
|
-
type: "object",
|
|
221
|
-
properties: {
|
|
222
|
-
prompts: { type: "array", items: { type: "string" }, description: "Prompts to execute" },
|
|
223
|
-
concurrency: { type: "number", description: "Max parallel executions (default: 5)" },
|
|
224
|
-
model: { type: "string", description: "Model to use (default: gpt-4o)" }
|
|
225
|
-
},
|
|
226
|
-
required: ["prompts"]
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
];
|
|
230
|
-
/**
|
|
231
|
-
* Reference to Full TMLPD
|
|
232
|
-
*
|
|
233
|
-
* This package provides:
|
|
234
|
-
* - Core: streaming, caching, cost tracking, reliability
|
|
235
|
-
* - Reference: episodic memory, MCTS, HALO orchestrator
|
|
236
|
-
*
|
|
237
|
-
* For production with full features:
|
|
238
|
-
* - Python TMLPD: https://github.com/Das-rebel/tmlpd-skill
|
|
239
|
-
* - Full memory: 3-tier (episodic + semantic + working)
|
|
240
|
-
* - Full MCTS: UCB1, deterministic rollouts, strategy caching
|
|
241
|
-
* - Full HALO: NLP decomposition, capability matching, verification
|
|
242
|
-
*/
|
|
243
|
-
exports.default = {
|
|
244
|
-
createTMLPD: tmlpdTools_1.createTMLPD,
|
|
245
|
-
TMLPDTools: tmlpdTools_1.TMLPDTools,
|
|
246
|
-
TMLPD_PI_TOOLS: exports.TMLPD_PI_TOOLS
|
|
247
|
-
};
|
|
248
|
-
//# sourceMappingURL=index.js.map
|
|
249
|
-
// ============================================
|
|
250
|
-
// A3M Router - Adaptive Memory Multi-Model Router
|
|
251
|
-
// Re-exports for the A3M Router package
|
|
252
|
-
// ============================================
|
|
253
|
-
|
|
254
|
-
// Memory
|
|
255
|
-
const memoryTree_1 = require("./memory/memoryTree");
|
|
16
|
+
Object.defineProperty(exports, "updateModelProfile", { enumerable: true, get: function () { return advancedRouter_1.updateModelProfile; } });
|
|
17
|
+
Object.defineProperty(exports, "getProviderHealth", { enumerable: true, get: function () { return advancedRouter_1.getProviderHealth; } });
|
|
18
|
+
// ============================================================
|
|
19
|
+
// PROVIDERS
|
|
20
|
+
// ============================================================
|
|
21
|
+
var providerConfig_1 = require("./providers/providerConfig");
|
|
22
|
+
Object.defineProperty(exports, "DEFAULT_PROVIDERS", { enumerable: true, get: function () { return providerConfig_1.DEFAULT_PROVIDERS; } });
|
|
23
|
+
Object.defineProperty(exports, "getAvailableProviders", { enumerable: true, get: function () { return providerConfig_1.getAvailableProviders; } });
|
|
24
|
+
Object.defineProperty(exports, "registerProvider", { enumerable: true, get: function () { return providerConfig_1.registerProvider; } });
|
|
25
|
+
Object.defineProperty(exports, "deregisterProvider", { enumerable: true, get: function () { return providerConfig_1.deregisterProvider; } });
|
|
26
|
+
Object.defineProperty(exports, "updateProvider", { enumerable: true, get: function () { return providerConfig_1.updateProvider; } });
|
|
27
|
+
Object.defineProperty(exports, "healthCheck", { enumerable: true, get: function () { return providerConfig_1.healthCheck; } });
|
|
28
|
+
Object.defineProperty(exports, "checkAllProviders", { enumerable: true, get: function () { return providerConfig_1.checkAllProviders; } });
|
|
29
|
+
Object.defineProperty(exports, "findCheapestAvailableProvider", { enumerable: true, get: function () { return providerConfig_1.findCheapestAvailableProvider; } });
|
|
30
|
+
Object.defineProperty(exports, "findFastestAvailableProvider", { enumerable: true, get: function () { return providerConfig_1.findFastestAvailableProvider; } });
|
|
31
|
+
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return providerConfig_1.loadConfig; } });
|
|
32
|
+
Object.defineProperty(exports, "saveConfig", { enumerable: true, get: function () { return providerConfig_1.saveConfig; } });
|
|
33
|
+
// ============================================================
|
|
34
|
+
// COST TRACKING
|
|
35
|
+
// ============================================================
|
|
36
|
+
var costTracker_1 = require("./cost/costTracker");
|
|
37
|
+
Object.defineProperty(exports, "CostTracker", { enumerable: true, get: function () { return costTracker_1.CostTracker; } });
|
|
38
|
+
// ============================================================
|
|
39
|
+
// MEMORY
|
|
40
|
+
// ============================================================
|
|
41
|
+
var memoryTree_1 = require("./memory/memoryTree");
|
|
256
42
|
Object.defineProperty(exports, "MemoryTree", { enumerable: true, get: function () { return memoryTree_1.MemoryTree; } });
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
Object.defineProperty(exports, "
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
//
|
|
268
|
-
|
|
269
|
-
Object.defineProperty(exports, "
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
Object.defineProperty(exports, "
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
function createA3MRouter(config = {}) {
|
|
297
|
-
const { providers = {}, memory = {}, cache = {}, cost = {} } = config;
|
|
298
|
-
|
|
299
|
-
const memoryTree = new memoryTree_1.MemoryTree(memory);
|
|
300
|
-
const prefixCache = new (require("./cache/prefixCache").PrefixCache)(cache);
|
|
301
|
-
const costTracker = new (require("./cost/costTracker").CostTracker)(cost);
|
|
302
|
-
// Alias getSummary as getStatus for convenience
|
|
303
|
-
if (typeof costTracker.getSummary === "function" && !costTracker.getStatus) {
|
|
304
|
-
costTracker.getStatus = costTracker.getSummary.bind(costTracker);
|
|
305
|
-
}
|
|
306
|
-
const autoFetch = new autoFetch_1.AutoFetch(memory);
|
|
307
|
-
const compression = new enhancedCompression_1.EnhancedCompression();
|
|
308
|
-
const oauth = new oauth_1.OAuthManager();
|
|
309
|
-
const vault = new obsidianVault_1.ObsidianVault();
|
|
310
|
-
|
|
311
|
-
return {
|
|
312
|
-
// Routing
|
|
313
|
-
route: (query, options) => (0, require("./routing/advancedRouter").routeQuery)(query, options),
|
|
314
|
-
routeBatch: (queries, options) => (0, require("./routing/advancedRouter").routeBatch)(queries, options),
|
|
315
|
-
recommend: (task) => (0, require("./routing/advancedRouter").recommendForTask)(task),
|
|
316
|
-
|
|
317
|
-
// Memory
|
|
318
|
-
memory: memoryTree,
|
|
319
|
-
autoFetch,
|
|
320
|
-
vault,
|
|
321
|
-
compression,
|
|
322
|
-
|
|
323
|
-
// Cache & Cost
|
|
324
|
-
cache: prefixCache,
|
|
325
|
-
costTracker,
|
|
326
|
-
|
|
327
|
-
// Auth
|
|
328
|
-
oauth,
|
|
329
|
-
|
|
330
|
-
// Providers (from existing TMLPD)
|
|
331
|
-
providers: new (require("./providers/registry").ProviderRegistry)(),
|
|
332
|
-
|
|
333
|
-
// Integrations
|
|
334
|
-
createIntegration: integrations_1.createIntegration,
|
|
335
|
-
|
|
336
|
-
// Utils
|
|
337
|
-
countTokens: require("./utils/tokenUtils").countTokens,
|
|
338
|
-
estimateCost: require("./utils/tokenUtils").estimateCost,
|
|
339
|
-
};
|
|
43
|
+
// ============================================================
|
|
44
|
+
// UTILITIES
|
|
45
|
+
// ============================================================
|
|
46
|
+
var tokenUtils_1 = require("./utils/tokenUtils");
|
|
47
|
+
Object.defineProperty(exports, "countTokens", { enumerable: true, get: function () { return tokenUtils_1.countTokens; } });
|
|
48
|
+
Object.defineProperty(exports, "estimateTokens", { enumerable: true, get: function () { return tokenUtils_1.estimateTokens; } });
|
|
49
|
+
var tokenUtils_2 = require("./utils/tokenUtils");
|
|
50
|
+
Object.defineProperty(exports, "MODEL_COSTS", { enumerable: true, get: function () { return tokenUtils_2.MODEL_COSTS; } });
|
|
51
|
+
// ============================================================
|
|
52
|
+
// v2.0.0 FEATURES
|
|
53
|
+
// ============================================================
|
|
54
|
+
var semanticCache_1 = require("./cache/semanticCache");
|
|
55
|
+
Object.defineProperty(exports, "SemanticCache", { enumerable: true, get: function () { return semanticCache_1.SemanticCache; } });
|
|
56
|
+
var guardrails_1 = require("./security/guardrails");
|
|
57
|
+
Object.defineProperty(exports, "GuardrailEngine", { enumerable: true, get: function () { return guardrails_1.GuardrailEngine; } });
|
|
58
|
+
var costAnalytics_1 = require("./analytics/costAnalytics");
|
|
59
|
+
Object.defineProperty(exports, "CostAnalytics", { enumerable: true, get: function () { return costAnalytics_1.CostAnalytics; } });
|
|
60
|
+
var proxyServer_1 = require("./server/proxyServer");
|
|
61
|
+
Object.defineProperty(exports, "createProxyServer", { enumerable: true, get: function () { return proxyServer_1.createProxyServer; } });
|
|
62
|
+
// ============================================================
|
|
63
|
+
// CONVENIENCE: Create a router instance
|
|
64
|
+
// ============================================================
|
|
65
|
+
const advancedRouter_2 = require("./routing/advancedRouter");
|
|
66
|
+
const providerConfig_2 = require("./providers/providerConfig");
|
|
67
|
+
const costTracker_2 = require("./cost/costTracker");
|
|
68
|
+
const memoryTree_2 = require("./memory/memoryTree");
|
|
69
|
+
function createA3MRouter(options) {
|
|
70
|
+
const costTracker = new costTracker_2.CostTracker();
|
|
71
|
+
const memoryTree = new memoryTree_2.MemoryTree();
|
|
72
|
+
return {
|
|
73
|
+
route: advancedRouter_2.routeQuery,
|
|
74
|
+
routeBatch: advancedRouter_2.routeBatch,
|
|
75
|
+
recommendForTask: advancedRouter_2.recommendForTask,
|
|
76
|
+
getAvailableProviders: providerConfig_2.getAvailableProviders,
|
|
77
|
+
healthCheck: providerConfig_2.healthCheck,
|
|
78
|
+
costTracker,
|
|
79
|
+
memoryTree,
|
|
80
|
+
options: options || {},
|
|
81
|
+
};
|
|
340
82
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
const providerConfig = require("./providers/providerConfig");
|
|
345
|
-
Object.defineProperty(exports, "providerConfig", { enumerable: true, get: function () { return providerConfig; } });
|
|
346
|
-
Object.defineProperty(exports, "saveProviderConfig", { enumerable: true, get: function () { return providerConfig.saveConfig; } });
|
|
347
|
-
|
|
348
|
-
// Security features
|
|
349
|
-
const inputValidation = require("./security/inputValidation");
|
|
350
|
-
Object.defineProperty(exports, "InputValidator", { enumerable: true, get: function () { return inputValidation.InputValidator; } });
|
|
351
|
-
Object.defineProperty(exports, "sanitizeInput", { enumerable: true, get: function () { return inputValidation.sanitizeInput; } });
|
|
352
|
-
Object.defineProperty(exports, "validateInput", { enumerable: true, get: function () { return inputValidation.validateInput; } });
|
|
353
|
-
Object.defineProperty(exports, "detectInjection", { enumerable: true, get: function () { return inputValidation.detectInjection; } });
|
|
354
|
-
Object.defineProperty(exports, "detectPII", { enumerable: true, get: function () { return inputValidation.detectPII; } });
|
|
355
|
-
|
|
356
|
-
// GEO (Generative Engine Optimization) features
|
|
357
|
-
const generativeEngineOptimization = require("./geo/generativeEngineOptimization");
|
|
358
|
-
Object.defineProperty(exports, "GenerativeEngineOptimizer", { enumerable: true, get: function () { return generativeEngineOptimization.GenerativeEngineOptimizer; } });
|
|
359
|
-
Object.defineProperty(exports, "getCodeForIntent", { enumerable: true, get: function () { return generativeEngineOptimization.getCodeForIntent; } });
|
|
360
|
-
Object.defineProperty(exports, "searchIntents", { enumerable: true, get: function () { return generativeEngineOptimization.searchIntents; } });
|
|
361
|
-
Object.defineProperty(exports, "getPackageMetadata", { enumerable: true, get: function () { return generativeEngineOptimization.getPackageMetadata; } });
|
|
362
|
-
Object.defineProperty(exports, "generateAIDocumentation", { enumerable: true, get: function () { return generativeEngineOptimization.generateAIDocumentation; } });
|
|
363
|
-
Object.defineProperty(exports, "INTENT_MAP", { enumerable: true, get: function () { return generativeEngineOptimization.INTENT_MAP; } });
|
|
364
|
-
Object.defineProperty(exports, "AI_INDEXING_KEYWORDS", { enumerable: true, get: function () { return generativeEngineOptimization.AI_INDEXING_KEYWORDS; } });
|
|
83
|
+
// Default export
|
|
84
|
+
exports.default = createA3MRouter;
|
|
85
|
+
//# 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":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,gCAAgC;AAChC,iBAAiB;;;AAgFjB,0CAcC;AA5FD,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAC/D,2DAQkC;AAPhC,4GAAA,UAAU,OAAA;AACV,4GAAA,UAAU,OAAA;AACV,kHAAA,gBAAgB,OAAA;AAChB,sHAAA,oBAAoB,OAAA;AACpB,gHAAA,cAAc,OAAA;AACd,oHAAA,kBAAkB,OAAA;AAClB,mHAAA,iBAAiB,OAAA;AAGnB,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAC/D,6DAYoC;AAXlC,mHAAA,iBAAiB,OAAA;AACjB,uHAAA,qBAAqB,OAAA;AACrB,kHAAA,gBAAgB,OAAA;AAChB,oHAAA,kBAAkB,OAAA;AAClB,gHAAA,cAAc,OAAA;AACd,6GAAA,WAAW,OAAA;AACX,mHAAA,iBAAiB,OAAA;AACjB,+HAAA,6BAA6B,OAAA;AAC7B,8HAAA,4BAA4B,OAAA;AAC5B,4GAAA,UAAU,OAAA;AACV,4GAAA,UAAU,OAAA;AAWZ,+DAA+D;AAC/D,gBAAgB;AAChB,+DAA+D;AAC/D,kDAAiD;AAAxC,0GAAA,WAAW,OAAA;AAEpB,+DAA+D;AAC/D,SAAS;AACT,+DAA+D;AAC/D,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AAGnB,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAC/D,iDAAiE;AAAxD,yGAAA,WAAW,OAAA;AAAE,4GAAA,cAAc,OAAA;AACpC,iDAAiD;AAAxC,yGAAA,WAAW,OAAA;AAEpB,+DAA+D;AAC/D,kBAAkB;AAClB,+DAA+D;AAC/D,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AACtB,oDAAwD;AAA/C,6GAAA,eAAe,OAAA;AACxB,2DAA0D;AAAjD,8GAAA,aAAa,OAAA;AACtB,oDAAyD;AAAhD,gHAAA,iBAAiB,OAAA;AAE1B,+DAA+D;AAC/D,wCAAwC;AACxC,+DAA+D;AAC/D,6DAAoF;AACpF,+DAAgF;AAChF,oDAAiD;AACjD,oDAAiD;AASjD,SAAgB,eAAe,CAAC,OAA0B;IACxD,MAAM,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAC;IACtC,MAAM,UAAU,GAAG,IAAI,uBAAU,EAAE,CAAC;IAEpC,OAAO;QACL,KAAK,EAAE,2BAAU;QACjB,UAAU,EAAV,2BAAU;QACV,gBAAgB,EAAhB,iCAAgB;QAChB,qBAAqB,EAArB,sCAAqB;QACrB,WAAW,EAAX,4BAAW;QACX,WAAW;QACX,UAAU;QACV,OAAO,EAAE,OAAO,IAAI,EAAE;KACvB,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,kBAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A3M Router - LangChain Adapter
|
|
3
|
+
*
|
|
4
|
+
* Drop-in replacement for ChatOpenAI from @langchain/openai.
|
|
5
|
+
* Routes all LLM calls through the A3M Router for cost optimization,
|
|
6
|
+
* load balancing, and intelligent provider selection.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { A3MChatModel } from 'adaptive-memory-multi-model-router/langchain';
|
|
11
|
+
* import { HumanMessage } from '@langchain/core/messages';
|
|
12
|
+
*
|
|
13
|
+
* const model = new A3MChatModel({
|
|
14
|
+
* modelName: 'auto', // or 'groq/llama-3.3-70b-versatile'
|
|
15
|
+
* temperature: 0.7,
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* const response = await model.invoke([
|
|
19
|
+
* new HumanMessage("What is 2+2?")
|
|
20
|
+
* ]);
|
|
21
|
+
*
|
|
22
|
+
* // Streaming
|
|
23
|
+
* const stream = await model.stream([
|
|
24
|
+
* new HumanMessage("Tell me a story")
|
|
25
|
+
* ]);
|
|
26
|
+
* for await (const chunk of stream) {
|
|
27
|
+
* process.stdout.write(chunk.content as string);
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* LangChain is a PEER DEPENDENCY. Install it separately:
|
|
32
|
+
* npm install @langchain/core @langchain/openai
|
|
33
|
+
*/
|
|
34
|
+
import type { BaseChatModelCallOptions } from '@langchain/core/language_models/chat_models';
|
|
35
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
36
|
+
import type { ChatGenerationChunk, ChatResult } from '@langchain/core/outputs';
|
|
37
|
+
import type { StructuredOutputMethodParams } from '@langchain/core/language_models/structured_output';
|
|
38
|
+
import { type ProviderDefinition } from '../providers/providerConfig.js';
|
|
39
|
+
export interface A3MChatModelOptions {
|
|
40
|
+
/** A3M router instance (creates default if not provided) */
|
|
41
|
+
router?: any;
|
|
42
|
+
/** Model to use: 'auto' for router selection, or 'provider/model' */
|
|
43
|
+
modelName?: string;
|
|
44
|
+
/** Temperature (0-2) */
|
|
45
|
+
temperature?: number;
|
|
46
|
+
/** Max output tokens */
|
|
47
|
+
maxTokens?: number;
|
|
48
|
+
/** Top-p sampling */
|
|
49
|
+
topP?: number;
|
|
50
|
+
/** Frequency penalty (-2 to 2) */
|
|
51
|
+
frequencyPenalty?: number;
|
|
52
|
+
/** Presence penalty (-2 to 2) */
|
|
53
|
+
presencePenalty?: number;
|
|
54
|
+
/** Stop sequences */
|
|
55
|
+
stop?: string[];
|
|
56
|
+
/** Timeout in ms */
|
|
57
|
+
timeout?: number;
|
|
58
|
+
/** API key override (uses env vars if not set) */
|
|
59
|
+
apiKey?: string;
|
|
60
|
+
/** Base URL override */
|
|
61
|
+
baseUrl?: string;
|
|
62
|
+
/** Provider format hint */
|
|
63
|
+
format?: 'openai' | 'anthropic' | 'google';
|
|
64
|
+
/** Extra headers to send with requests */
|
|
65
|
+
headers?: Record<string, string>;
|
|
66
|
+
/** Tags for tracing */
|
|
67
|
+
tags?: string[];
|
|
68
|
+
/** Metadata for tracing */
|
|
69
|
+
metadata?: Record<string, any>;
|
|
70
|
+
/** Verbose logging */
|
|
71
|
+
verbose?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface A3MToolCall {
|
|
74
|
+
id: string;
|
|
75
|
+
type: 'function';
|
|
76
|
+
function: {
|
|
77
|
+
name: string;
|
|
78
|
+
arguments: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export declare class A3MChatModel {
|
|
82
|
+
lc_namespace: string[];
|
|
83
|
+
lc_sequential: boolean;
|
|
84
|
+
lc_runnable: boolean;
|
|
85
|
+
private modelName;
|
|
86
|
+
private temperature;
|
|
87
|
+
private maxTokens;
|
|
88
|
+
private topP?;
|
|
89
|
+
private frequencyPenalty?;
|
|
90
|
+
private presencePenalty?;
|
|
91
|
+
private stop?;
|
|
92
|
+
private timeout;
|
|
93
|
+
private apiKey?;
|
|
94
|
+
private baseUrl?;
|
|
95
|
+
private format?;
|
|
96
|
+
private extraHeaders?;
|
|
97
|
+
private verbose;
|
|
98
|
+
private boundTools;
|
|
99
|
+
private registry;
|
|
100
|
+
constructor(options?: A3MChatModelOptions & Record<string, any>);
|
|
101
|
+
get model(): string;
|
|
102
|
+
get identifyingParams(): Record<string, any>;
|
|
103
|
+
get lc_aliases(): Record<string, string>;
|
|
104
|
+
toJSON(): Record<string, any>;
|
|
105
|
+
static deserialize(data: Record<string, any>): Promise<A3MChatModel>;
|
|
106
|
+
_generate(messages: BaseMessage[], options?: BaseChatModelCallOptions & {
|
|
107
|
+
tools?: any[];
|
|
108
|
+
}): Promise<ChatResult>;
|
|
109
|
+
invoke(input: BaseMessage[] | string, options?: BaseChatModelCallOptions & {
|
|
110
|
+
tools?: any[];
|
|
111
|
+
}): Promise<any>;
|
|
112
|
+
_streamResponseChunks(messages: BaseMessage[], options?: BaseChatModelCallOptions & {
|
|
113
|
+
tools?: any[];
|
|
114
|
+
}): AsyncGenerator<ChatGenerationChunk>;
|
|
115
|
+
stream(input: BaseMessage[] | string, options?: BaseChatModelCallOptions & {
|
|
116
|
+
tools?: any[];
|
|
117
|
+
}): AsyncGenerator<any>;
|
|
118
|
+
bindTools(tools: any[]): A3MChatModel;
|
|
119
|
+
withStructuredOutput<T extends Record<string, any>>(schema: any, config?: StructuredOutputMethodParams | boolean): any;
|
|
120
|
+
/**
|
|
121
|
+
* Get the list of available providers
|
|
122
|
+
*/
|
|
123
|
+
getAvailableProviders(): Record<string, ProviderDefinition>;
|
|
124
|
+
/**
|
|
125
|
+
* Get provider status from the registry
|
|
126
|
+
*/
|
|
127
|
+
getProviderStatus(): any;
|
|
128
|
+
/**
|
|
129
|
+
* Switch the model at runtime
|
|
130
|
+
*/
|
|
131
|
+
withModel(modelName: string): A3MChatModel;
|
|
132
|
+
/**
|
|
133
|
+
* Set temperature
|
|
134
|
+
*/
|
|
135
|
+
withTemperature(temperature: number): A3MChatModel;
|
|
136
|
+
/** LLM type identifier for LangChain compatibility */
|
|
137
|
+
_llmType(): string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Create an A3MChatModel pre-configured for a specific provider
|
|
141
|
+
*/
|
|
142
|
+
export declare function createA3MChatModel(provider: string, options?: Omit<A3MChatModelOptions, 'modelName'>): A3MChatModel;
|
|
143
|
+
/**
|
|
144
|
+
* Create an A3MChatModel with automatic routing
|
|
145
|
+
*/
|
|
146
|
+
export declare function createAutoRoutingChatModel(options?: Omit<A3MChatModelOptions, 'modelName'>): A3MChatModel;
|