@t2000/engine 0.5.0 → 0.5.2
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.ts +3 -0
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -143,6 +143,7 @@ interface EngineConfig {
|
|
|
143
143
|
model?: string;
|
|
144
144
|
maxTurns?: number;
|
|
145
145
|
maxTokens?: number;
|
|
146
|
+
temperature?: number;
|
|
146
147
|
costTracker?: {
|
|
147
148
|
budgetLimitUsd?: number;
|
|
148
149
|
inputCostPerToken?: number;
|
|
@@ -158,6 +159,7 @@ interface ChatParams {
|
|
|
158
159
|
tools: ToolDefinition[];
|
|
159
160
|
model?: string;
|
|
160
161
|
maxTokens?: number;
|
|
162
|
+
temperature?: number;
|
|
161
163
|
signal?: AbortSignal;
|
|
162
164
|
}
|
|
163
165
|
interface ToolDefinition {
|
|
@@ -232,6 +234,7 @@ declare class QueryEngine {
|
|
|
232
234
|
private readonly model;
|
|
233
235
|
private readonly maxTurns;
|
|
234
236
|
private readonly maxTokens;
|
|
237
|
+
private readonly temperature;
|
|
235
238
|
private readonly agent;
|
|
236
239
|
private readonly mcpManager;
|
|
237
240
|
private readonly walletAddress;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { getSwapQuote } from '@t2000/sdk';
|
|
2
3
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
3
4
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
4
5
|
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
@@ -1260,8 +1261,9 @@ var swapQuoteTool = buildTool({
|
|
|
1260
1261
|
},
|
|
1261
1262
|
isReadOnly: true,
|
|
1262
1263
|
async call(input, context) {
|
|
1263
|
-
const
|
|
1264
|
-
const result = await
|
|
1264
|
+
const walletAddress = context.agent ? context.agent.address() : getWalletAddress(context);
|
|
1265
|
+
const result = await getSwapQuote({
|
|
1266
|
+
walletAddress,
|
|
1265
1267
|
from: input.from,
|
|
1266
1268
|
to: input.to,
|
|
1267
1269
|
amount: input.amount,
|
|
@@ -1757,6 +1759,7 @@ var QueryEngine = class {
|
|
|
1757
1759
|
model;
|
|
1758
1760
|
maxTurns;
|
|
1759
1761
|
maxTokens;
|
|
1762
|
+
temperature;
|
|
1760
1763
|
agent;
|
|
1761
1764
|
mcpManager;
|
|
1762
1765
|
walletAddress;
|
|
@@ -1776,6 +1779,7 @@ var QueryEngine = class {
|
|
|
1776
1779
|
this.model = config.model;
|
|
1777
1780
|
this.maxTurns = config.maxTurns ?? DEFAULT_MAX_TURNS;
|
|
1778
1781
|
this.maxTokens = config.maxTokens ?? DEFAULT_MAX_TOKENS;
|
|
1782
|
+
this.temperature = config.temperature;
|
|
1779
1783
|
this.systemPrompt = config.systemPrompt ?? DEFAULT_SYSTEM_PROMPT;
|
|
1780
1784
|
this.costTracker = new CostTracker(config.costTracker);
|
|
1781
1785
|
this.tools = config.tools ?? (config.agent ? getDefaultTools() : []);
|
|
@@ -1919,6 +1923,7 @@ ${summary.join("\n")}`);
|
|
|
1919
1923
|
tools: toolDefs,
|
|
1920
1924
|
model: this.model,
|
|
1921
1925
|
maxTokens: this.maxTokens,
|
|
1926
|
+
temperature: this.temperature,
|
|
1922
1927
|
signal
|
|
1923
1928
|
});
|
|
1924
1929
|
for await (const event of stream) {
|
|
@@ -2681,7 +2686,8 @@ var AnthropicProvider = class {
|
|
|
2681
2686
|
max_tokens: params.maxTokens ?? this.defaultMaxTokens,
|
|
2682
2687
|
system: params.systemPrompt,
|
|
2683
2688
|
messages,
|
|
2684
|
-
tools: tools.length > 0 ? tools : void 0
|
|
2689
|
+
tools: tools.length > 0 ? tools : void 0,
|
|
2690
|
+
...params.temperature !== void 0 && { temperature: params.temperature }
|
|
2685
2691
|
};
|
|
2686
2692
|
const stream = params.signal ? this.client.messages.stream(streamParams, { signal: params.signal }) : this.client.messages.stream(streamParams);
|
|
2687
2693
|
const toolInputBuffers = /* @__PURE__ */ new Map();
|