n8n-nodes-zihin 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nodes/ZihinChatModel/ZihinChatModel.node.d.ts +12 -0
- package/dist/nodes/ZihinChatModel/ZihinChatModel.node.js +453 -0
- package/dist/nodes/ZihinChatModel/ZihinChatModel.node.js.map +1 -0
- package/dist/nodes/ZihinChatModel/ZihinChatModel.node.json +22 -0
- package/dist/nodes/ZihinChatModel/zihin.png +0 -0
- package/dist/nodes/ZihinGateway/ZihinGateway.node.json +22 -0
- package/package.json +13 -5
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { INodeType, INodeTypeDescription, ISupplyDataFunctions, SupplyData } from 'n8n-workflow';
|
|
2
|
+
/**
|
|
3
|
+
* n8n Node: Zihin Chat Model
|
|
4
|
+
* Sub-node for AI Agents that provides Zihin LLM as a chat model with Tool Calling support
|
|
5
|
+
*/
|
|
6
|
+
export declare class ZihinChatModel implements INodeType {
|
|
7
|
+
description: INodeTypeDescription;
|
|
8
|
+
/**
|
|
9
|
+
* Supply the LangChain chat model to the AI Agent
|
|
10
|
+
*/
|
|
11
|
+
supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZihinChatModel = void 0;
|
|
4
|
+
// String literal for AI Language Model connection type
|
|
5
|
+
const AI_LANGUAGE_MODEL_OUTPUT = 'ai_languageModel';
|
|
6
|
+
const chat_models_1 = require("@langchain/core/language_models/chat_models");
|
|
7
|
+
const messages_1 = require("@langchain/core/messages");
|
|
8
|
+
/**
|
|
9
|
+
* Zihin Chat Model - LangChain compatible chat model for n8n AI Agents
|
|
10
|
+
* Supports Tool Calling for AI Agent integration
|
|
11
|
+
*/
|
|
12
|
+
class ZihinLangChainChatModel extends chat_models_1.BaseChatModel {
|
|
13
|
+
static lc_name() {
|
|
14
|
+
return 'ZihinChatModel';
|
|
15
|
+
}
|
|
16
|
+
get lc_secrets() {
|
|
17
|
+
return {
|
|
18
|
+
apiKey: 'ZIHIN_API_KEY',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
constructor(fields) {
|
|
22
|
+
super({});
|
|
23
|
+
this.boundTools = [];
|
|
24
|
+
this.apiKey = fields.apiKey;
|
|
25
|
+
this.modelName = fields.modelName;
|
|
26
|
+
this.taskType = fields.taskType || 'tool_calling';
|
|
27
|
+
this.temperature = fields.temperature ?? 0.7;
|
|
28
|
+
this.maxTokens = fields.maxTokens ?? 4096;
|
|
29
|
+
this.topP = fields.topP ?? 1;
|
|
30
|
+
this.frequencyPenalty = fields.frequencyPenalty ?? 0;
|
|
31
|
+
this.presencePenalty = fields.presencePenalty ?? 0;
|
|
32
|
+
}
|
|
33
|
+
_llmType() {
|
|
34
|
+
return 'zihin';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Convert a schema to JSON Schema format
|
|
38
|
+
*/
|
|
39
|
+
schemaToJsonSchema(schema) {
|
|
40
|
+
if (!schema)
|
|
41
|
+
return {};
|
|
42
|
+
// If it's already a plain object (JSON Schema), return it
|
|
43
|
+
if (typeof schema === 'object' && schema !== null) {
|
|
44
|
+
// Check if it's a Zod schema (has _def property)
|
|
45
|
+
if ('_def' in schema) {
|
|
46
|
+
// Try to get the JSON schema if available
|
|
47
|
+
const zodSchema = schema;
|
|
48
|
+
if (zodSchema.shape && typeof zodSchema.shape === 'object') {
|
|
49
|
+
// Basic Zod object schema conversion
|
|
50
|
+
const properties = {};
|
|
51
|
+
for (const [key, value] of Object.entries(zodSchema.shape)) {
|
|
52
|
+
properties[key] = { type: 'string' }; // Simplified - could be enhanced
|
|
53
|
+
if (value && typeof value === 'object' && '_def' in value) {
|
|
54
|
+
const def = value._def;
|
|
55
|
+
if (def.description) {
|
|
56
|
+
properties[key].description = def.description;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return { type: 'object', properties: {} };
|
|
66
|
+
}
|
|
67
|
+
// Already JSON Schema format
|
|
68
|
+
return schema;
|
|
69
|
+
}
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Bind tools to the model for function calling
|
|
74
|
+
*/
|
|
75
|
+
bindTools(tools, _kwargs) {
|
|
76
|
+
// Convert LangChain tools to Zihin format
|
|
77
|
+
this.boundTools = tools.map((tool) => {
|
|
78
|
+
// Handle different tool formats
|
|
79
|
+
if ('name' in tool && 'description' in tool) {
|
|
80
|
+
const structuredTool = tool;
|
|
81
|
+
return {
|
|
82
|
+
type: 'function',
|
|
83
|
+
function: {
|
|
84
|
+
name: structuredTool.name,
|
|
85
|
+
description: structuredTool.description,
|
|
86
|
+
parameters: this.schemaToJsonSchema(structuredTool.schema),
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// Fallback for other formats
|
|
91
|
+
return {
|
|
92
|
+
type: 'function',
|
|
93
|
+
function: {
|
|
94
|
+
name: String(tool.name || 'unknown'),
|
|
95
|
+
description: String(tool.description || ''),
|
|
96
|
+
parameters: this.schemaToJsonSchema(tool.schema),
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
// Return this model with tools bound (as a Runnable)
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Convert LangChain messages to Zihin API format
|
|
105
|
+
*/
|
|
106
|
+
convertMessages(messages) {
|
|
107
|
+
return messages.map((message) => {
|
|
108
|
+
const type = message._getType();
|
|
109
|
+
// Handle Tool Messages (results from tool calls)
|
|
110
|
+
if (type === 'tool') {
|
|
111
|
+
const toolMsg = message;
|
|
112
|
+
return {
|
|
113
|
+
role: 'tool',
|
|
114
|
+
content: typeof toolMsg.content === 'string' ? toolMsg.content : JSON.stringify(toolMsg.content),
|
|
115
|
+
tool_call_id: toolMsg.tool_call_id,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// Handle AI Messages with tool calls
|
|
119
|
+
if (type === 'ai') {
|
|
120
|
+
const aiMsg = message;
|
|
121
|
+
const zihinMsg = {
|
|
122
|
+
role: 'assistant',
|
|
123
|
+
content: typeof aiMsg.content === 'string' ? aiMsg.content : JSON.stringify(aiMsg.content),
|
|
124
|
+
};
|
|
125
|
+
// Check for tool calls in the message
|
|
126
|
+
if (aiMsg.tool_calls && aiMsg.tool_calls.length > 0) {
|
|
127
|
+
zihinMsg.tool_calls = aiMsg.tool_calls.map((tc) => ({
|
|
128
|
+
id: tc.id || `call_${Date.now()}`,
|
|
129
|
+
type: 'function',
|
|
130
|
+
function: {
|
|
131
|
+
name: tc.name,
|
|
132
|
+
arguments: typeof tc.args === 'string' ? tc.args : JSON.stringify(tc.args),
|
|
133
|
+
},
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
return zihinMsg;
|
|
137
|
+
}
|
|
138
|
+
// Handle other message types
|
|
139
|
+
let role;
|
|
140
|
+
if (type === 'system') {
|
|
141
|
+
role = 'system';
|
|
142
|
+
}
|
|
143
|
+
else if (type === 'human') {
|
|
144
|
+
role = 'user';
|
|
145
|
+
}
|
|
146
|
+
else if (message instanceof messages_1.ChatMessage) {
|
|
147
|
+
const chatRole = message.role.toLowerCase();
|
|
148
|
+
if (chatRole === 'system') {
|
|
149
|
+
role = 'system';
|
|
150
|
+
}
|
|
151
|
+
else if (chatRole === 'assistant') {
|
|
152
|
+
role = 'assistant';
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
role = 'user';
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
role = 'user';
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
role,
|
|
163
|
+
content: typeof message.content === 'string' ? message.content : JSON.stringify(message.content),
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Call the Zihin API
|
|
169
|
+
*/
|
|
170
|
+
async _generate(messages, options, _runManager) {
|
|
171
|
+
const zihinMessages = this.convertMessages(messages);
|
|
172
|
+
const requestBody = {
|
|
173
|
+
model: this.modelName,
|
|
174
|
+
messages: zihinMessages,
|
|
175
|
+
options: {
|
|
176
|
+
temperature: options.temperature ?? this.temperature,
|
|
177
|
+
maxTokens: options.maxTokens ?? this.maxTokens,
|
|
178
|
+
topP: options.topP ?? this.topP,
|
|
179
|
+
frequencyPenalty: options.frequencyPenalty ?? this.frequencyPenalty,
|
|
180
|
+
presencePenalty: options.presencePenalty ?? this.presencePenalty,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
// Add tools if bound
|
|
184
|
+
if (this.boundTools.length > 0) {
|
|
185
|
+
requestBody.tools = this.boundTools;
|
|
186
|
+
}
|
|
187
|
+
// Add context for auto-routing
|
|
188
|
+
if (this.modelName === 'auto') {
|
|
189
|
+
requestBody.context = {
|
|
190
|
+
task: this.taskType,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const response = await fetch('https://llm.zihin.ai/api/v3/llm/public/call', {
|
|
194
|
+
method: 'POST',
|
|
195
|
+
headers: {
|
|
196
|
+
'Content-Type': 'application/json',
|
|
197
|
+
'X-Api-Key': this.apiKey,
|
|
198
|
+
},
|
|
199
|
+
body: JSON.stringify(requestBody),
|
|
200
|
+
});
|
|
201
|
+
if (!response.ok) {
|
|
202
|
+
throw new Error(`Zihin API error: ${response.status} ${response.statusText}`);
|
|
203
|
+
}
|
|
204
|
+
const result = (await response.json());
|
|
205
|
+
if (!result.success || !result.data) {
|
|
206
|
+
throw new Error(result.message || result.error || 'Zihin API returned an error');
|
|
207
|
+
}
|
|
208
|
+
// Build the AI message with potential tool calls
|
|
209
|
+
const aiMessageContent = result.data.content || '';
|
|
210
|
+
const toolCalls = result.data.tool_calls?.map((tc) => ({
|
|
211
|
+
id: tc.id,
|
|
212
|
+
name: tc.function.name,
|
|
213
|
+
args: JSON.parse(tc.function.arguments || '{}'),
|
|
214
|
+
type: 'tool_call',
|
|
215
|
+
}));
|
|
216
|
+
const aiMessage = new messages_1.AIMessage({
|
|
217
|
+
content: aiMessageContent,
|
|
218
|
+
tool_calls: toolCalls,
|
|
219
|
+
additional_kwargs: {
|
|
220
|
+
model: result.data.model,
|
|
221
|
+
provider: result.data.provider,
|
|
222
|
+
finish_reason: result.data.finish_reason,
|
|
223
|
+
autoRouting: result.data.autoRouting,
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
const generation = {
|
|
227
|
+
text: aiMessageContent,
|
|
228
|
+
message: aiMessage,
|
|
229
|
+
generationInfo: {
|
|
230
|
+
finish_reason: result.data.finish_reason,
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
return {
|
|
234
|
+
generations: [generation],
|
|
235
|
+
llmOutput: {
|
|
236
|
+
tokenUsage: {
|
|
237
|
+
promptTokens: result.data.usage.prompt_tokens,
|
|
238
|
+
completionTokens: result.data.usage.completion_tokens,
|
|
239
|
+
totalTokens: result.data.usage.total_tokens,
|
|
240
|
+
},
|
|
241
|
+
model: result.data.model,
|
|
242
|
+
provider: result.data.provider,
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* n8n Node: Zihin Chat Model
|
|
249
|
+
* Sub-node for AI Agents that provides Zihin LLM as a chat model with Tool Calling support
|
|
250
|
+
*/
|
|
251
|
+
class ZihinChatModel {
|
|
252
|
+
constructor() {
|
|
253
|
+
this.description = {
|
|
254
|
+
displayName: 'Zihin Chat Model',
|
|
255
|
+
name: 'lmChatZihin',
|
|
256
|
+
icon: 'file:zihin.png',
|
|
257
|
+
group: ['transform'],
|
|
258
|
+
version: 1,
|
|
259
|
+
description: 'Chat Model for Zihin LLM Gateway with intelligent provider routing and Tool Calling support',
|
|
260
|
+
defaults: {
|
|
261
|
+
name: 'Zihin Chat Model',
|
|
262
|
+
},
|
|
263
|
+
codex: {
|
|
264
|
+
categories: ['AI'],
|
|
265
|
+
subcategories: {
|
|
266
|
+
AI: ['Language Models', 'Chat Models (Recommended)'],
|
|
267
|
+
},
|
|
268
|
+
resources: {
|
|
269
|
+
primaryDocumentation: [
|
|
270
|
+
{
|
|
271
|
+
url: 'https://docs.zihin.ai',
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
// No inputs - this is a sub-node
|
|
277
|
+
inputs: [],
|
|
278
|
+
// Output to AI Agent as language model
|
|
279
|
+
outputs: [AI_LANGUAGE_MODEL_OUTPUT],
|
|
280
|
+
outputNames: ['Model'],
|
|
281
|
+
credentials: [
|
|
282
|
+
{
|
|
283
|
+
name: 'zihinApi',
|
|
284
|
+
required: true,
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
properties: [
|
|
288
|
+
// Model Selection
|
|
289
|
+
{
|
|
290
|
+
displayName: 'Model',
|
|
291
|
+
name: 'model',
|
|
292
|
+
type: 'options',
|
|
293
|
+
required: true,
|
|
294
|
+
default: 'auto',
|
|
295
|
+
description: 'Modelo LLM a ser usado. Use "auto" para roteamento inteligente baseado na tarefa.',
|
|
296
|
+
options: [
|
|
297
|
+
{ name: 'Auto (Roteamento Inteligente)', value: 'auto' },
|
|
298
|
+
// OpenAI - GPT-5 Family
|
|
299
|
+
{ name: 'OpenAI - GPT-5', value: 'openai.gpt-5' },
|
|
300
|
+
{ name: 'OpenAI - GPT-5 Mini', value: 'openai.gpt-5-mini' },
|
|
301
|
+
{ name: 'OpenAI - GPT-5 Nano', value: 'openai.gpt-5-nano' },
|
|
302
|
+
// OpenAI - GPT-4.1 Family
|
|
303
|
+
{ name: 'OpenAI - GPT-4.1', value: 'openai.gpt-4.1' },
|
|
304
|
+
{ name: 'OpenAI - GPT-4.1 Mini', value: 'openai.gpt-4.1-mini' },
|
|
305
|
+
{ name: 'OpenAI - GPT-4.1 Nano', value: 'openai.gpt-4.1-nano' },
|
|
306
|
+
// Anthropic - Claude 4.5 Family
|
|
307
|
+
{ name: 'Anthropic - Claude Sonnet 4.5', value: 'anthropic.claude-sonnet-4-5-20250929' },
|
|
308
|
+
{ name: 'Anthropic - Claude Haiku 4.5', value: 'anthropic.claude-haiku-4-5-20251001' },
|
|
309
|
+
// Anthropic - Claude 4 Family
|
|
310
|
+
{ name: 'Anthropic - Claude Opus 4.1', value: 'anthropic.claude-opus-4-1-20250805' },
|
|
311
|
+
{ name: 'Anthropic - Claude Sonnet 4', value: 'anthropic.claude-sonnet-4-20250514' },
|
|
312
|
+
// Anthropic - Legacy
|
|
313
|
+
{ name: 'Anthropic - Claude 3.5 Haiku', value: 'anthropic.claude-3-5-haiku-20241022' },
|
|
314
|
+
// Google - Gemini Family
|
|
315
|
+
{ name: 'Google - Gemini 2.5 Flash Lite', value: 'google.gemini-2.5-flash-lite' },
|
|
316
|
+
{ name: 'Google - Gemini 2.0 Flash', value: 'google.gemini-2.0-flash' },
|
|
317
|
+
{ name: 'Google - Gemini 2.0 Flash Lite', value: 'google.gemini-2.0-flash-lite' },
|
|
318
|
+
// Grok - Grok-4 Family
|
|
319
|
+
{ name: 'Grok - Grok 4 Fast Reasoning', value: 'grok.grok-4-fast-reasoning' },
|
|
320
|
+
{ name: 'Grok - Grok 4 Fast', value: 'grok.grok-4-fast-non-reasoning' },
|
|
321
|
+
{ name: 'Grok - Grok 4', value: 'grok.grok-4-0709' },
|
|
322
|
+
{ name: 'Grok - Grok Code Fast', value: 'grok.grok-code-fast-1' },
|
|
323
|
+
// Grok - Grok-3 Family
|
|
324
|
+
{ name: 'Grok - Grok 3', value: 'grok.grok-3' },
|
|
325
|
+
{ name: 'Grok - Grok 3 Mini', value: 'grok.grok-3-mini' },
|
|
326
|
+
// Grok - Grok-2 Legacy
|
|
327
|
+
{ name: 'Grok - Grok 2', value: 'grok.grok-2-1212' },
|
|
328
|
+
{ name: 'Grok - Grok 2 Vision', value: 'grok.grok-2-vision-1212' },
|
|
329
|
+
],
|
|
330
|
+
},
|
|
331
|
+
// Task Type (conditional - only when model="auto")
|
|
332
|
+
{
|
|
333
|
+
displayName: 'Task Type',
|
|
334
|
+
name: 'taskType',
|
|
335
|
+
type: 'options',
|
|
336
|
+
default: 'tool_calling',
|
|
337
|
+
description: 'Tipo de tarefa para otimizar a seleção automática do modelo (usado apenas no modo Auto)',
|
|
338
|
+
displayOptions: {
|
|
339
|
+
show: {
|
|
340
|
+
model: ['auto'],
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
options: [
|
|
344
|
+
{ name: 'Tool Calling / Chamada de Ferramentas', value: 'tool_calling' },
|
|
345
|
+
{ name: 'Chat / Conversação', value: 'chat' },
|
|
346
|
+
{ name: 'Coding / Programação', value: 'coding' },
|
|
347
|
+
{ name: 'Analysis / Análise', value: 'analysis' },
|
|
348
|
+
{ name: 'Planning / Planejamento', value: 'planning' },
|
|
349
|
+
{ name: 'Creative / Criativo', value: 'creative' },
|
|
350
|
+
{ name: 'Data Query / Consulta de Dados', value: 'data_query' },
|
|
351
|
+
],
|
|
352
|
+
},
|
|
353
|
+
// Options (collapsible collection)
|
|
354
|
+
{
|
|
355
|
+
displayName: 'Options',
|
|
356
|
+
name: 'options',
|
|
357
|
+
type: 'collection',
|
|
358
|
+
placeholder: 'Add Option',
|
|
359
|
+
default: {},
|
|
360
|
+
options: [
|
|
361
|
+
{
|
|
362
|
+
displayName: 'Temperature',
|
|
363
|
+
name: 'temperature',
|
|
364
|
+
type: 'number',
|
|
365
|
+
typeOptions: {
|
|
366
|
+
minValue: 0,
|
|
367
|
+
maxValue: 2,
|
|
368
|
+
numberStepSize: 0.1,
|
|
369
|
+
},
|
|
370
|
+
default: 0.7,
|
|
371
|
+
description: 'Controla a criatividade (0 = determinístico, 2 = muito criativo)',
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
displayName: 'Max Tokens',
|
|
375
|
+
name: 'maxTokens',
|
|
376
|
+
type: 'number',
|
|
377
|
+
typeOptions: {
|
|
378
|
+
minValue: 1,
|
|
379
|
+
maxValue: 128000,
|
|
380
|
+
},
|
|
381
|
+
default: 4096,
|
|
382
|
+
description: 'Limite máximo de tokens na resposta',
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
displayName: 'Top P',
|
|
386
|
+
name: 'topP',
|
|
387
|
+
type: 'number',
|
|
388
|
+
typeOptions: {
|
|
389
|
+
minValue: 0,
|
|
390
|
+
maxValue: 1,
|
|
391
|
+
numberStepSize: 0.1,
|
|
392
|
+
},
|
|
393
|
+
default: 1,
|
|
394
|
+
description: 'Nucleus sampling (alternativa a temperature)',
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
displayName: 'Frequency Penalty',
|
|
398
|
+
name: 'frequencyPenalty',
|
|
399
|
+
type: 'number',
|
|
400
|
+
typeOptions: {
|
|
401
|
+
minValue: -2,
|
|
402
|
+
maxValue: 2,
|
|
403
|
+
numberStepSize: 0.1,
|
|
404
|
+
},
|
|
405
|
+
default: 0,
|
|
406
|
+
description: 'Reduz repetição de tokens frequentes',
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
displayName: 'Presence Penalty',
|
|
410
|
+
name: 'presencePenalty',
|
|
411
|
+
type: 'number',
|
|
412
|
+
typeOptions: {
|
|
413
|
+
minValue: -2,
|
|
414
|
+
maxValue: 2,
|
|
415
|
+
numberStepSize: 0.1,
|
|
416
|
+
},
|
|
417
|
+
default: 0,
|
|
418
|
+
description: 'Incentiva novos tópicos na resposta',
|
|
419
|
+
},
|
|
420
|
+
],
|
|
421
|
+
},
|
|
422
|
+
],
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Supply the LangChain chat model to the AI Agent
|
|
427
|
+
*/
|
|
428
|
+
async supplyData(itemIndex) {
|
|
429
|
+
// Get credentials
|
|
430
|
+
const credentials = await this.getCredentials('zihinApi');
|
|
431
|
+
const apiKey = credentials.apiKey;
|
|
432
|
+
// Get node parameters
|
|
433
|
+
const model = this.getNodeParameter('model', itemIndex);
|
|
434
|
+
const taskType = this.getNodeParameter('taskType', itemIndex, 'tool_calling');
|
|
435
|
+
const options = this.getNodeParameter('options', itemIndex, {});
|
|
436
|
+
// Create the LangChain chat model
|
|
437
|
+
const chatModel = new ZihinLangChainChatModel({
|
|
438
|
+
apiKey,
|
|
439
|
+
modelName: model,
|
|
440
|
+
taskType,
|
|
441
|
+
temperature: options.temperature,
|
|
442
|
+
maxTokens: options.maxTokens,
|
|
443
|
+
topP: options.topP,
|
|
444
|
+
frequencyPenalty: options.frequencyPenalty,
|
|
445
|
+
presencePenalty: options.presencePenalty,
|
|
446
|
+
});
|
|
447
|
+
return {
|
|
448
|
+
response: chatModel,
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
exports.ZihinChatModel = ZihinChatModel;
|
|
453
|
+
//# sourceMappingURL=ZihinChatModel.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZihinChatModel.node.js","sourceRoot":"","sources":["../../../src/nodes/ZihinChatModel/ZihinChatModel.node.ts"],"names":[],"mappings":";;;AAQA,uDAAuD;AACvD,MAAM,wBAAwB,GAAG,kBAAwC,CAAC;AAE1E,6EAIqD;AACrD,uDAMkC;AA0ElC;;;GAGG;AACH,MAAM,uBAAwB,SAAQ,2BAAoC;IAWzE,MAAM,CAAC,OAAO;QACb,OAAO,gBAAgB,CAAC;IACzB,CAAC;IAED,IAAI,UAAU;QACb,OAAO;YACN,MAAM,EAAE,eAAe;SACvB,CAAC;IACH,CAAC;IAED,YAAY,MAA4B;QACvC,KAAK,CAAC,EAAE,CAAC,CAAC;QAbH,eAAU,GAAgB,EAAE,CAAC;QAcpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QA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Documentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://docs.zihin.ai/api-keys"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://docs.zihin.ai/n8n"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"alias": ["llm", "ai", "gpt", "claude", "gemini", "chat", "openai", "anthropic", "google", "grok", "langchain", "agent"],
|
|
19
|
+
"subcategories": {
|
|
20
|
+
"AI": ["Language Models", "Chat Models (Recommended)"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-zihin.zihinGateway",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["AI", "Development"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://docs.zihin.ai/api-keys"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://docs.zihin.ai/n8n"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"alias": ["llm", "ai", "gpt", "claude", "gemini", "chat", "completion", "openai", "anthropic", "google"],
|
|
19
|
+
"subcategories": {
|
|
20
|
+
"AI": ["Language Models"]
|
|
21
|
+
}
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-zihin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "n8n node for Zihin LLM Gateway - Unified LLM API with intelligent provider routing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
"anthropic",
|
|
13
13
|
"claude",
|
|
14
14
|
"gpt",
|
|
15
|
-
"gemini"
|
|
15
|
+
"gemini",
|
|
16
|
+
"langchain",
|
|
17
|
+
"chat-model",
|
|
18
|
+
"ai-agent"
|
|
16
19
|
],
|
|
17
20
|
"license": "MIT",
|
|
18
21
|
"homepage": "https://zihin.ai",
|
|
@@ -26,7 +29,7 @@
|
|
|
26
29
|
},
|
|
27
30
|
"main": "dist/nodes/ZihinGateway/ZihinGateway.node.js",
|
|
28
31
|
"scripts": {
|
|
29
|
-
"build": "tsc && gulp build:icons",
|
|
32
|
+
"build": "tsc && gulp build:icons && gulp build:json",
|
|
30
33
|
"dev": "tsc --watch",
|
|
31
34
|
"lint": "eslint src --ext .ts",
|
|
32
35
|
"lint:fix": "eslint src --ext .ts --fix",
|
|
@@ -41,9 +44,13 @@
|
|
|
41
44
|
"dist/credentials/ZihinApi.credentials.js"
|
|
42
45
|
],
|
|
43
46
|
"nodes": [
|
|
44
|
-
"dist/nodes/ZihinGateway/ZihinGateway.node.js"
|
|
47
|
+
"dist/nodes/ZihinGateway/ZihinGateway.node.js",
|
|
48
|
+
"dist/nodes/ZihinChatModel/ZihinChatModel.node.js"
|
|
45
49
|
]
|
|
46
50
|
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@langchain/core": "^0.3.0"
|
|
53
|
+
},
|
|
47
54
|
"devDependencies": {
|
|
48
55
|
"@types/node": "^20.10.0",
|
|
49
56
|
"@typescript-eslint/eslint-plugin": "^6.13.0",
|
|
@@ -54,7 +61,8 @@
|
|
|
54
61
|
"typescript": "^5.3.0"
|
|
55
62
|
},
|
|
56
63
|
"peerDependencies": {
|
|
57
|
-
"n8n-workflow": "*"
|
|
64
|
+
"n8n-workflow": "*",
|
|
65
|
+
"@langchain/core": ">=0.3.0"
|
|
58
66
|
},
|
|
59
67
|
"engines": {
|
|
60
68
|
"node": ">=18.0.0"
|