n8n-nodes-agnicwallet 1.0.12 → 1.0.14

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.
@@ -1,365 +1,367 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgnicAILanguageModel = void 0;
4
- const n8n_workflow_1 = require("n8n-workflow");
5
- const openai_1 = require("@langchain/openai");
6
- const base_1 = require("@langchain/core/callbacks/base");
7
- /**
8
- * Custom LLM Tracing callback for AgnicAI
9
- * This enables the spinning indicator and AI Agent logging
10
- * Mirrors n8n's internal N8nLlmTracing implementation
11
- */
12
- class AgnicLlmTracing extends base_1.BaseCallbackHandler {
13
- constructor(executionFunctions) {
14
- super();
15
- this.name = "AgnicLlmTracing";
16
- // This flag makes LangChain wait for handlers before continuing
17
- this.awaitHandlers = true;
18
- this.connectionType = n8n_workflow_1.NodeConnectionTypes.AiLanguageModel;
19
- this.runsMap = {};
20
- this.executionFunctions = executionFunctions;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // nodes/AgnicAILanguageModel/AgnicAILanguageModel.node.ts
22
+ var AgnicAILanguageModel_node_exports = {};
23
+ __export(AgnicAILanguageModel_node_exports, {
24
+ AgnicAILanguageModel: () => AgnicAILanguageModel
25
+ });
26
+ module.exports = __toCommonJS(AgnicAILanguageModel_node_exports);
27
+ var import_n8n_workflow = require("n8n-workflow");
28
+ var import_openai = require("@langchain/openai");
29
+ var import_base = require("@langchain/core/callbacks/base");
30
+ var AgnicLlmTracing = class extends import_base.BaseCallbackHandler {
31
+ constructor(executionFunctions) {
32
+ super();
33
+ this.name = "AgnicLlmTracing";
34
+ // This flag makes LangChain wait for handlers before continuing
35
+ this.awaitHandlers = true;
36
+ this.connectionType = import_n8n_workflow.NodeConnectionTypes.AiLanguageModel;
37
+ this.runsMap = {};
38
+ this.executionFunctions = executionFunctions;
39
+ }
40
+ static {
41
+ __name(this, "AgnicLlmTracing");
42
+ }
43
+ async handleLLMStart(llm, prompts, runId) {
44
+ const options = llm.kwargs || llm;
45
+ const { index } = this.executionFunctions.addInputData(
46
+ this.connectionType,
47
+ [[{ json: { messages: prompts, options } }]]
48
+ );
49
+ this.runsMap[runId] = {
50
+ index,
51
+ options,
52
+ messages: prompts
53
+ };
54
+ this.logAiEvent("ai-llm-generated-output-started", {
55
+ messages: prompts,
56
+ options
57
+ });
58
+ }
59
+ async handleLLMEnd(output, runId) {
60
+ const runDetails = this.runsMap[runId] ?? { index: 0 };
61
+ const generations = output.generations.map(
62
+ (gen) => gen.map((g) => ({ text: g.text, generationInfo: g.generationInfo }))
63
+ );
64
+ const response = {
65
+ generations,
66
+ llmOutput: output.llmOutput
67
+ };
68
+ this.executionFunctions.addOutputData(
69
+ this.connectionType,
70
+ runDetails.index,
71
+ [[{ json: response }]]
72
+ );
73
+ this.logAiEvent("ai-llm-generated-output", {
74
+ messages: runDetails.messages,
75
+ options: runDetails.options,
76
+ response
77
+ });
78
+ }
79
+ async handleLLMError(error, runId) {
80
+ const runDetails = this.runsMap[runId] ?? { index: 0 };
81
+ this.executionFunctions.addOutputData(
82
+ this.connectionType,
83
+ runDetails.index,
84
+ new import_n8n_workflow.NodeOperationError(this.executionFunctions.getNode(), error, {
85
+ functionality: "configuration-node"
86
+ })
87
+ );
88
+ this.logAiEvent("ai-llm-errored", {
89
+ error: error.message || String(error),
90
+ runId
91
+ });
92
+ }
93
+ logAiEvent(event, data) {
94
+ try {
95
+ this.executionFunctions.logAiEvent?.(
96
+ event,
97
+ data ? (0, import_n8n_workflow.jsonStringify)(data) : void 0
98
+ );
99
+ } catch {
21
100
  }
22
- async handleLLMStart(llm, prompts, runId) {
23
- const options = llm.kwargs || llm;
24
- // Add input data to n8n's execution context
25
- // This triggers the spinning indicator
26
- const { index } = this.executionFunctions.addInputData(this.connectionType, [[{ json: { messages: prompts, options } }]]);
27
- this.runsMap[runId] = {
28
- index,
29
- options,
30
- messages: prompts,
31
- };
32
- // Log AI event for the AI Agent's log panel
33
- this.logAiEvent("ai-llm-generated-output-started", {
34
- messages: prompts,
35
- options,
36
- });
37
- }
38
- async handleLLMEnd(output, runId) {
39
- var _a;
40
- const runDetails = (_a = this.runsMap[runId]) !== null && _a !== void 0 ? _a : { index: 0 };
41
- // Parse the response
42
- const generations = output.generations.map((gen) => gen.map((g) => ({ text: g.text, generationInfo: g.generationInfo })));
43
- const response = {
44
- generations,
45
- llmOutput: output.llmOutput,
46
- };
47
- // Add output data to n8n's execution context
48
- // This stops the spinning indicator and shows success
49
- this.executionFunctions.addOutputData(this.connectionType, runDetails.index, [[{ json: response }]]);
50
- // Log AI event for the AI Agent's log panel
51
- this.logAiEvent("ai-llm-generated-output", {
52
- messages: runDetails.messages,
53
- options: runDetails.options,
54
- response,
55
- });
56
- }
57
- async handleLLMError(error, runId) {
58
- var _a;
59
- const runDetails = (_a = this.runsMap[runId]) !== null && _a !== void 0 ? _a : { index: 0 };
60
- // Add error output
61
- this.executionFunctions.addOutputData(this.connectionType, runDetails.index, new n8n_workflow_1.NodeOperationError(this.executionFunctions.getNode(), error, {
62
- functionality: "configuration-node",
63
- }));
64
- // Log AI error event
65
- this.logAiEvent("ai-llm-errored", {
66
- error: error.message || String(error),
67
- runId,
68
- });
69
- }
70
- logAiEvent(event, data) {
71
- var _a, _b;
72
- try {
73
- (_b = (_a = this.executionFunctions).logAiEvent) === null || _b === void 0 ? void 0 : _b.call(_a, event, data ? (0, n8n_workflow_1.jsonStringify)(data) : undefined);
101
+ }
102
+ };
103
+ var AgnicAILanguageModel = class {
104
+ constructor() {
105
+ this.description = {
106
+ displayName: "AgnicAI Chat Model",
107
+ name: "lmChatAgnicAI",
108
+ icon: "file:AgnicAILanguageModel.png",
109
+ group: ["transform"],
110
+ version: [1, 1.1],
111
+ description: "Chat model using AgnicPay AI Gateway with X402 payment support",
112
+ defaults: {
113
+ name: "AgnicAI Chat Model"
114
+ },
115
+ codex: {
116
+ categories: ["AI"],
117
+ subcategories: {
118
+ AI: ["Language Models", "Root Nodes"],
119
+ "Language Models": ["Chat Models (Recommended)"]
120
+ },
121
+ resources: {
122
+ primaryDocumentation: [
123
+ {
124
+ url: "https://www.agnicpay.xyz/ai-gateway"
125
+ }
126
+ ]
74
127
  }
75
- catch {
76
- // Silently ignore if logAiEvent is not available
128
+ },
129
+ inputs: [],
130
+ outputs: [import_n8n_workflow.NodeConnectionTypes.AiLanguageModel],
131
+ outputNames: ["Model"],
132
+ credentials: [
133
+ {
134
+ name: "agnicWalletOAuth2Api",
135
+ required: false,
136
+ displayOptions: {
137
+ show: {
138
+ authentication: ["oAuth2"]
139
+ }
140
+ }
141
+ },
142
+ {
143
+ name: "agnicWalletApi",
144
+ required: false,
145
+ displayOptions: {
146
+ show: {
147
+ authentication: ["apiKey"]
148
+ }
149
+ }
77
150
  }
78
- }
79
- }
80
- /**
81
- * AgnicAI Chat Model Node for n8n
82
- *
83
- * Uses LangChain's ChatOpenAI class with AgnicPay's OpenAI-compatible endpoint.
84
- * This approach is identical to how n8n's built-in OpenAI Chat Model works,
85
- * just pointing to AgnicPay's AI Gateway instead.
86
- */
87
- class AgnicAILanguageModel {
88
- constructor() {
89
- this.description = {
90
- displayName: "AgnicAI Chat Model",
91
- name: "lmChatAgnicAI",
92
- icon: "file:AgnicAILanguageModel.png",
93
- group: ["transform"],
94
- version: [1, 1.1],
95
- description: "Chat model using AgnicPay AI Gateway with X402 payment support",
96
- defaults: {
97
- name: "AgnicAI Chat Model",
151
+ ],
152
+ properties: [
153
+ {
154
+ displayName: "Authentication",
155
+ name: "authentication",
156
+ type: "options",
157
+ options: [
158
+ {
159
+ name: "OAuth2",
160
+ value: "oAuth2",
161
+ description: "Recommended: Connect your account"
162
+ },
163
+ {
164
+ name: "API Key",
165
+ value: "apiKey",
166
+ description: "For CI/CD or programmatic access"
167
+ }
168
+ ],
169
+ default: "apiKey",
170
+ description: "How to authenticate with AgnicWallet"
171
+ },
172
+ {
173
+ displayName: "Model",
174
+ name: "model",
175
+ type: "options",
176
+ typeOptions: {
177
+ loadOptionsMethod: "getModels",
178
+ allowCustomValues: true
179
+ },
180
+ default: "openai/gpt-4o-mini",
181
+ description: "Select a model or type a custom model ID. Models are loaded dynamically from AgnicPay API."
182
+ },
183
+ {
184
+ displayName: "Options",
185
+ name: "options",
186
+ type: "collection",
187
+ placeholder: "Add Option",
188
+ default: {},
189
+ options: [
190
+ {
191
+ displayName: "Temperature",
192
+ name: "temperature",
193
+ type: "number",
194
+ typeOptions: {
195
+ minValue: 0,
196
+ maxValue: 2,
197
+ numberStepSize: 0.1
198
+ },
199
+ default: 0.7,
200
+ description: "Controls randomness: Lower = more focused and deterministic"
98
201
  },
99
- codex: {
100
- categories: ["AI"],
101
- subcategories: {
102
- AI: ["Language Models", "Root Nodes"],
103
- "Language Models": ["Chat Models (Recommended)"],
104
- },
105
- resources: {
106
- primaryDocumentation: [
107
- {
108
- url: "https://www.agnicpay.xyz/ai-gateway",
109
- },
110
- ],
111
- },
202
+ {
203
+ displayName: "Max Tokens",
204
+ name: "maxTokens",
205
+ type: "number",
206
+ typeOptions: {
207
+ minValue: 1
208
+ },
209
+ default: 2048,
210
+ description: "Maximum number of tokens to generate"
112
211
  },
113
- inputs: [],
114
- outputs: [n8n_workflow_1.NodeConnectionTypes.AiLanguageModel],
115
- outputNames: ["Model"],
116
- credentials: [
117
- {
118
- name: "agnicWalletOAuth2Api",
119
- required: false,
120
- displayOptions: {
121
- show: {
122
- authentication: ["oAuth2"],
123
- },
124
- },
125
- },
126
- {
127
- name: "agnicWalletApi",
128
- required: false,
129
- displayOptions: {
130
- show: {
131
- authentication: ["apiKey"],
132
- },
133
- },
134
- },
135
- ],
136
- properties: [
137
- {
138
- displayName: "Authentication",
139
- name: "authentication",
140
- type: "options",
141
- options: [
142
- {
143
- name: "OAuth2",
144
- value: "oAuth2",
145
- description: "Recommended: Connect your account",
146
- },
147
- {
148
- name: "API Key",
149
- value: "apiKey",
150
- description: "For CI/CD or programmatic access",
151
- },
152
- ],
153
- default: "apiKey",
154
- description: "How to authenticate with AgnicWallet",
155
- },
156
- {
157
- displayName: "Model",
158
- name: "model",
159
- type: "options",
160
- typeOptions: {
161
- allowCustomValues: true,
162
- },
163
- options: [
164
- {
165
- name: "GPT-4o Mini (Fast & Affordable)",
166
- value: "openai/gpt-4o-mini",
167
- },
168
- {
169
- name: "GPT-4o (Best Quality)",
170
- value: "openai/gpt-4o",
171
- },
172
- {
173
- name: "GPT-4 Turbo",
174
- value: "openai/gpt-4-turbo",
175
- },
176
- {
177
- name: "GPT-3.5 Turbo",
178
- value: "openai/gpt-3.5-turbo",
179
- },
180
- {
181
- name: "Claude 3.5 Sonnet",
182
- value: "anthropic/claude-3.5-sonnet",
183
- },
184
- {
185
- name: "Claude 3 Opus",
186
- value: "anthropic/claude-3-opus",
187
- },
188
- {
189
- name: "Claude 3 Haiku",
190
- value: "anthropic/claude-3-haiku",
191
- },
192
- {
193
- name: "Gemini Pro 1.5",
194
- value: "google/gemini-pro-1.5",
195
- },
196
- {
197
- name: "Gemini Flash 1.5",
198
- value: "google/gemini-flash-1.5",
199
- },
200
- {
201
- name: "Llama 3.1 70B",
202
- value: "meta-llama/llama-3.1-70b-instruct",
203
- },
204
- {
205
- name: "Llama 3.1 8B",
206
- value: "meta-llama/llama-3.1-8b-instruct",
207
- },
208
- {
209
- name: "Mistral Large",
210
- value: "mistralai/mistral-large",
211
- },
212
- {
213
- name: "Mixtral 8x22B",
214
- value: "mistralai/mixtral-8x22b-instruct",
215
- },
216
- {
217
- name: "DeepSeek R1",
218
- value: "deepseek/deepseek-r1",
219
- },
220
- {
221
- name: "DeepSeek Chat",
222
- value: "deepseek/deepseek-chat",
223
- },
224
- {
225
- name: "Qwen 2.5 72B",
226
- value: "qwen/qwen-2.5-72b-instruct",
227
- },
228
- ],
229
- default: "openai/gpt-4o-mini",
230
- description: "Select a model or type a custom OpenRouter model ID. See https://openrouter.ai/models for all available models.",
231
- },
232
- {
233
- displayName: "Options",
234
- name: "options",
235
- type: "collection",
236
- placeholder: "Add Option",
237
- default: {},
238
- options: [
239
- {
240
- displayName: "Temperature",
241
- name: "temperature",
242
- type: "number",
243
- typeOptions: {
244
- minValue: 0,
245
- maxValue: 2,
246
- numberStepSize: 0.1,
247
- },
248
- default: 0.7,
249
- description: "Controls randomness: Lower = more focused and deterministic",
250
- },
251
- {
252
- displayName: "Max Tokens",
253
- name: "maxTokens",
254
- type: "number",
255
- typeOptions: {
256
- minValue: 1,
257
- },
258
- default: 2048,
259
- description: "Maximum number of tokens to generate",
260
- },
261
- {
262
- displayName: "Top P",
263
- name: "topP",
264
- type: "number",
265
- typeOptions: {
266
- minValue: 0,
267
- maxValue: 1,
268
- numberStepSize: 0.1,
269
- },
270
- default: 1,
271
- description: "Nucleus sampling: considers tokens with top_p probability mass",
272
- },
273
- {
274
- displayName: "Frequency Penalty",
275
- name: "frequencyPenalty",
276
- type: "number",
277
- typeOptions: {
278
- minValue: -2,
279
- maxValue: 2,
280
- numberStepSize: 0.1,
281
- },
282
- default: 0,
283
- description: "Penalizes new tokens based on frequency in text so far",
284
- },
285
- {
286
- displayName: "Presence Penalty",
287
- name: "presencePenalty",
288
- type: "number",
289
- typeOptions: {
290
- minValue: -2,
291
- maxValue: 2,
292
- numberStepSize: 0.1,
293
- },
294
- default: 0,
295
- description: "Penalizes new tokens based on presence in text so far",
296
- },
297
- {
298
- displayName: "Timeout",
299
- name: "timeout",
300
- type: "number",
301
- default: 60000,
302
- description: "Request timeout in milliseconds",
303
- },
304
- ],
305
- },
306
- ],
307
- };
308
- }
309
- async supplyData(itemIndex) {
310
- var _a, _b;
311
- // Get authentication type and credentials
312
- const authentication = this.getNodeParameter("authentication", itemIndex);
313
- let apiKey;
314
- try {
315
- if (authentication === "oAuth2") {
316
- const credentials = (await this.getCredentials("agnicWalletOAuth2Api", itemIndex));
317
- apiKey = (_a = credentials.oauthTokenData) === null || _a === void 0 ? void 0 : _a.access_token;
318
- if (!apiKey) {
319
- throw new Error("OAuth2 access token not found. Please reconnect your AgnicWallet account.");
320
- }
212
+ {
213
+ displayName: "Top P",
214
+ name: "topP",
215
+ type: "number",
216
+ typeOptions: {
217
+ minValue: 0,
218
+ maxValue: 1,
219
+ numberStepSize: 0.1
220
+ },
221
+ default: 1,
222
+ description: "Nucleus sampling: considers tokens with top_p probability mass"
223
+ },
224
+ {
225
+ displayName: "Frequency Penalty",
226
+ name: "frequencyPenalty",
227
+ type: "number",
228
+ typeOptions: {
229
+ minValue: -2,
230
+ maxValue: 2,
231
+ numberStepSize: 0.1
232
+ },
233
+ default: 0,
234
+ description: "Penalizes new tokens based on frequency in text so far"
235
+ },
236
+ {
237
+ displayName: "Presence Penalty",
238
+ name: "presencePenalty",
239
+ type: "number",
240
+ typeOptions: {
241
+ minValue: -2,
242
+ maxValue: 2,
243
+ numberStepSize: 0.1
244
+ },
245
+ default: 0,
246
+ description: "Penalizes new tokens based on presence in text so far"
247
+ },
248
+ {
249
+ displayName: "Timeout",
250
+ name: "timeout",
251
+ type: "number",
252
+ default: 6e4,
253
+ description: "Request timeout in milliseconds"
321
254
  }
322
- else {
323
- const credentials = await this.getCredentials("agnicWalletApi", itemIndex);
324
- apiKey = credentials.apiToken;
325
- if (!apiKey) {
326
- throw new Error("API Key not found. Please configure your AgnicWallet API credentials.");
327
- }
255
+ ]
256
+ }
257
+ ]
258
+ };
259
+ /**
260
+ * Methods for dynamic option loading
261
+ */
262
+ this.methods = {
263
+ loadOptions: {
264
+ async getModels() {
265
+ const fallbackModels = [
266
+ { name: "\u2B50 OpenAI: GPT-4o Mini (Recommended)", value: "openai/gpt-4o-mini" },
267
+ { name: "\u2B50 Anthropic: Claude 3.5 Sonnet", value: "anthropic/claude-3.5-sonnet" },
268
+ { name: "\u2B50 Google: Gemini 2.0 Flash", value: "google/gemini-2.0-flash-001" },
269
+ { name: "\u2B50 Meta: Llama 3.3 70B", value: "meta-llama/llama-3.3-70b-instruct" },
270
+ { name: "\u2B50 DeepSeek: Chat V3 (Affordable)", value: "deepseek/deepseek-chat" },
271
+ { name: "[FREE] Meta: Llama 3.1 8B", value: "meta-llama/llama-3.1-8b-instruct:free" }
272
+ ];
273
+ try {
274
+ const response = await this.helpers.httpRequest({
275
+ method: "GET",
276
+ url: "https://api.agnicpay.xyz/v1/models",
277
+ timeout: 1e4
278
+ });
279
+ if (!response?.data || !Array.isArray(response.data) || response.data.length === 0) {
280
+ return fallbackModels;
328
281
  }
282
+ return response.data.map((model) => ({
283
+ name: model.name || model.id,
284
+ value: model.id
285
+ }));
286
+ } catch {
287
+ return fallbackModels;
288
+ }
329
289
  }
330
- catch (error) {
331
- const errorMsg = error instanceof Error ? error.message : String(error);
332
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Authentication failed: ${errorMsg}`, { itemIndex });
290
+ }
291
+ };
292
+ }
293
+ static {
294
+ __name(this, "AgnicAILanguageModel");
295
+ }
296
+ async supplyData(itemIndex) {
297
+ const authentication = this.getNodeParameter(
298
+ "authentication",
299
+ itemIndex
300
+ );
301
+ let apiKey;
302
+ try {
303
+ if (authentication === "oAuth2") {
304
+ const credentials = await this.getCredentials(
305
+ "agnicWalletOAuth2Api",
306
+ itemIndex
307
+ );
308
+ apiKey = credentials.oauthTokenData?.access_token;
309
+ if (!apiKey) {
310
+ throw new Error(
311
+ "OAuth2 access token not found. Please reconnect your AgnicWallet account."
312
+ );
333
313
  }
334
- // Get model parameter
335
- const model = this.getNodeParameter("model", itemIndex);
336
- if (!(model === null || model === void 0 ? void 0 : model.trim())) {
337
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Model must be specified. Select from dropdown or enter a custom OpenRouter model ID.", { itemIndex });
314
+ } else {
315
+ const credentials = await this.getCredentials(
316
+ "agnicWalletApi",
317
+ itemIndex
318
+ );
319
+ apiKey = credentials.apiToken;
320
+ if (!apiKey) {
321
+ throw new Error(
322
+ "API Key not found. Please configure your AgnicWallet API credentials."
323
+ );
338
324
  }
339
- // Get options
340
- const options = this.getNodeParameter("options", itemIndex, {});
341
- // Create ChatOpenAI instance pointing to AgnicPay's endpoint
342
- // Pass our custom tracing callback to enable spinning indicator and logging
343
- const chatModel = new openai_1.ChatOpenAI({
344
- apiKey,
345
- model: model.trim(),
346
- temperature: options.temperature,
347
- maxTokens: options.maxTokens,
348
- topP: options.topP,
349
- frequencyPenalty: options.frequencyPenalty,
350
- presencePenalty: options.presencePenalty,
351
- timeout: (_b = options.timeout) !== null && _b !== void 0 ? _b : 60000,
352
- maxRetries: 2,
353
- configuration: {
354
- baseURL: "https://api.agnicpay.xyz/v1",
355
- },
356
- // Add our custom tracing callback for spinning indicator and AI Agent logging
357
- callbacks: [new AgnicLlmTracing(this)],
358
- });
359
- // Return in the same format as n8n's built-in OpenAI Chat Model
360
- return {
361
- response: chatModel,
362
- };
325
+ }
326
+ } catch (error) {
327
+ const errorMsg = error instanceof Error ? error.message : String(error);
328
+ throw new import_n8n_workflow.NodeOperationError(
329
+ this.getNode(),
330
+ `Authentication failed: ${errorMsg}`,
331
+ { itemIndex }
332
+ );
333
+ }
334
+ const model = this.getNodeParameter("model", itemIndex);
335
+ if (!model?.trim()) {
336
+ throw new import_n8n_workflow.NodeOperationError(
337
+ this.getNode(),
338
+ "Model must be specified. Select from dropdown or enter a custom OpenRouter model ID.",
339
+ { itemIndex }
340
+ );
363
341
  }
364
- }
365
- exports.AgnicAILanguageModel = AgnicAILanguageModel;
342
+ const options = this.getNodeParameter("options", itemIndex, {});
343
+ const chatModel = new import_openai.ChatOpenAI({
344
+ apiKey,
345
+ model: model.trim(),
346
+ temperature: options.temperature,
347
+ maxTokens: options.maxTokens,
348
+ topP: options.topP,
349
+ frequencyPenalty: options.frequencyPenalty,
350
+ presencePenalty: options.presencePenalty,
351
+ timeout: options.timeout ?? 6e4,
352
+ maxRetries: 2,
353
+ configuration: {
354
+ baseURL: "https://api.agnicpay.xyz/v1"
355
+ },
356
+ // Add our custom tracing callback for spinning indicator and AI Agent logging
357
+ callbacks: [new AgnicLlmTracing(this)]
358
+ });
359
+ return {
360
+ response: chatModel
361
+ };
362
+ }
363
+ };
364
+ // Annotate the CommonJS export names for ESM import in node:
365
+ 0 && (module.exports = {
366
+ AgnicAILanguageModel
367
+ });