@jterrazz/intelligence 1.0.0 → 1.1.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/README.md +111 -14
- package/dist/adapters/agents/chat-agent.adapter.d.ts +20 -26
- package/dist/adapters/agents/chat-agent.adapter.js +99 -129
- package/dist/adapters/agents/chat-agent.adapter.js.map +1 -1
- package/dist/adapters/agents/query-agent.adapter.d.ts +26 -0
- package/dist/adapters/agents/query-agent.adapter.js +303 -0
- package/dist/adapters/agents/query-agent.adapter.js.map +1 -0
- package/dist/adapters/models/openrouter-model.adapter.d.ts +16 -6
- package/dist/adapters/models/openrouter-model.adapter.js +7 -4
- package/dist/adapters/models/openrouter-model.adapter.js.map +1 -1
- package/dist/adapters/prompts/__tests__/__snapshots__/presets.test.ts.snap +73 -103
- package/dist/adapters/prompts/__tests__/presets.test.js +1 -1
- package/dist/adapters/prompts/__tests__/presets.test.js.map +1 -1
- package/dist/adapters/prompts/library/categories/domain.d.ts +8 -8
- package/dist/adapters/prompts/library/categories/domain.js +8 -8
- package/dist/adapters/prompts/library/categories/domain.js.map +1 -1
- package/dist/adapters/prompts/library/categories/format.d.ts +7 -6
- package/dist/adapters/prompts/library/categories/format.js +7 -6
- package/dist/adapters/prompts/library/categories/format.js.map +1 -1
- package/dist/adapters/prompts/library/categories/foundations.d.ts +11 -0
- package/dist/adapters/prompts/library/categories/foundations.js +12 -0
- package/dist/adapters/prompts/library/categories/foundations.js.map +1 -0
- package/dist/adapters/prompts/library/categories/language.d.ts +8 -8
- package/dist/adapters/prompts/library/categories/language.js +8 -8
- package/dist/adapters/prompts/library/categories/language.js.map +1 -1
- package/dist/adapters/prompts/library/categories/persona.d.ts +9 -8
- package/dist/adapters/prompts/library/categories/persona.js +9 -8
- package/dist/adapters/prompts/library/categories/persona.js.map +1 -1
- package/dist/adapters/prompts/library/categories/response.d.ts +9 -0
- package/dist/adapters/prompts/library/categories/response.js +10 -0
- package/dist/adapters/prompts/library/categories/response.js.map +1 -0
- package/dist/adapters/prompts/library/categories/tone.d.ts +5 -5
- package/dist/adapters/prompts/library/categories/tone.js +5 -5
- package/dist/adapters/prompts/library/categories/tone.js.map +1 -1
- package/dist/adapters/prompts/library/categories/verbosity.d.ts +3 -3
- package/dist/adapters/prompts/library/categories/verbosity.js +3 -3
- package/dist/adapters/prompts/library/categories/verbosity.js.map +1 -1
- package/dist/adapters/prompts/library/index.d.ts +50 -50
- package/dist/adapters/prompts/library/index.js +15 -17
- package/dist/adapters/prompts/library/index.js.map +1 -1
- package/dist/adapters/prompts/library/presets.d.ts +5 -5
- package/dist/adapters/prompts/library/presets.js +27 -33
- package/dist/adapters/prompts/library/presets.js.map +1 -1
- package/dist/adapters/prompts/system-prompt.adapter.d.ts +2 -2
- package/dist/adapters/prompts/system-prompt.adapter.js.map +1 -1
- package/dist/adapters/prompts/user-prompt.adapter.d.ts +2 -2
- package/dist/adapters/prompts/user-prompt.adapter.js.map +1 -1
- package/dist/adapters/tools/safe-tool.adapter.d.ts +2 -2
- package/dist/adapters/tools/safe-tool.adapter.js.map +1 -1
- package/dist/index.cjs +517 -258
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/ports/agent.port.d.ts +3 -3
- package/dist/ports/agent.port.js.map +1 -1
- package/dist/ports/model.port.d.ts +1 -1
- package/dist/ports/model.port.js.map +1 -1
- package/dist/ports/prompt.port.d.ts +1 -1
- package/dist/ports/prompt.port.js.map +1 -1
- package/dist/ports/tool.port.d.ts +1 -1
- package/dist/ports/tool.port.js.map +1 -1
- package/package.json +1 -1
- package/dist/adapters/prompts/library/categories/agent-logic.d.ts +0 -8
- package/dist/adapters/prompts/library/categories/agent-logic.js +0 -9
- package/dist/adapters/prompts/library/categories/agent-logic.js.map +0 -1
- package/dist/adapters/prompts/library/categories/agent-skills.d.ts +0 -8
- package/dist/adapters/prompts/library/categories/agent-skills.js +0 -9
- package/dist/adapters/prompts/library/categories/agent-skills.js.map +0 -1
- package/dist/adapters/prompts/library/categories/directives.d.ts +0 -9
- package/dist/adapters/prompts/library/categories/directives.js +0 -10
- package/dist/adapters/prompts/library/categories/directives.js.map +0 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function _class_call_check(instance, Constructor) {
|
|
31
|
+
if (!(instance instanceof Constructor)) {
|
|
32
|
+
throw new TypeError("Cannot call a class as a function");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function _defineProperties(target, props) {
|
|
36
|
+
for(var i = 0; i < props.length; i++){
|
|
37
|
+
var descriptor = props[i];
|
|
38
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
39
|
+
descriptor.configurable = true;
|
|
40
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
41
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
45
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
46
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
|
+
return Constructor;
|
|
48
|
+
}
|
|
49
|
+
function _define_property(obj, key, value) {
|
|
50
|
+
if (key in obj) {
|
|
51
|
+
Object.defineProperty(obj, key, {
|
|
52
|
+
value: value,
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
obj[key] = value;
|
|
59
|
+
}
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
function _instanceof(left, right) {
|
|
63
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
64
|
+
return !!right[Symbol.hasInstance](left);
|
|
65
|
+
} else {
|
|
66
|
+
return left instanceof right;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function _ts_generator(thisArg, body) {
|
|
70
|
+
var f, y, t, _ = {
|
|
71
|
+
label: 0,
|
|
72
|
+
sent: function() {
|
|
73
|
+
if (t[0] & 1) throw t[1];
|
|
74
|
+
return t[1];
|
|
75
|
+
},
|
|
76
|
+
trys: [],
|
|
77
|
+
ops: []
|
|
78
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
79
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
80
|
+
return this;
|
|
81
|
+
}), g;
|
|
82
|
+
function verb(n) {
|
|
83
|
+
return function(v) {
|
|
84
|
+
return step([
|
|
85
|
+
n,
|
|
86
|
+
v
|
|
87
|
+
]);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function step(op) {
|
|
91
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
92
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
93
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
94
|
+
if (y = 0, t) op = [
|
|
95
|
+
op[0] & 2,
|
|
96
|
+
t.value
|
|
97
|
+
];
|
|
98
|
+
switch(op[0]){
|
|
99
|
+
case 0:
|
|
100
|
+
case 1:
|
|
101
|
+
t = op;
|
|
102
|
+
break;
|
|
103
|
+
case 4:
|
|
104
|
+
_.label++;
|
|
105
|
+
return {
|
|
106
|
+
value: op[1],
|
|
107
|
+
done: false
|
|
108
|
+
};
|
|
109
|
+
case 5:
|
|
110
|
+
_.label++;
|
|
111
|
+
y = op[1];
|
|
112
|
+
op = [
|
|
113
|
+
0
|
|
114
|
+
];
|
|
115
|
+
continue;
|
|
116
|
+
case 7:
|
|
117
|
+
op = _.ops.pop();
|
|
118
|
+
_.trys.pop();
|
|
119
|
+
continue;
|
|
120
|
+
default:
|
|
121
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
122
|
+
_ = 0;
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
126
|
+
_.label = op[1];
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
130
|
+
_.label = t[1];
|
|
131
|
+
t = op;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
if (t && _.label < t[2]) {
|
|
135
|
+
_.label = t[2];
|
|
136
|
+
_.ops.push(op);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
if (t[2]) _.ops.pop();
|
|
140
|
+
_.trys.pop();
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
op = body.call(thisArg, _);
|
|
144
|
+
} catch (e) {
|
|
145
|
+
op = [
|
|
146
|
+
6,
|
|
147
|
+
e
|
|
148
|
+
];
|
|
149
|
+
y = 0;
|
|
150
|
+
} finally{
|
|
151
|
+
f = t = 0;
|
|
152
|
+
}
|
|
153
|
+
if (op[0] & 5) throw op[1];
|
|
154
|
+
return {
|
|
155
|
+
value: op[0] ? op[1] : void 0,
|
|
156
|
+
done: true
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
import { AIResponseParser } from '../utils/ai-response-parser.js';
|
|
161
|
+
/**
|
|
162
|
+
* A simple agent for direct, one-shot interactions with a model.
|
|
163
|
+
* It supports optional response parsing against a Zod schema but does not use tools.
|
|
164
|
+
*/ export var QueryAgentAdapter = /*#__PURE__*/ function() {
|
|
165
|
+
"use strict";
|
|
166
|
+
function QueryAgentAdapter(name, options) {
|
|
167
|
+
_class_call_check(this, QueryAgentAdapter);
|
|
168
|
+
_define_property(this, "name", void 0);
|
|
169
|
+
_define_property(this, "options", void 0);
|
|
170
|
+
this.name = name;
|
|
171
|
+
this.options = options;
|
|
172
|
+
}
|
|
173
|
+
_create_class(QueryAgentAdapter, [
|
|
174
|
+
{
|
|
175
|
+
key: "run",
|
|
176
|
+
value: function run(userPrompt) {
|
|
177
|
+
return _async_to_generator(function() {
|
|
178
|
+
var _this_options_logger, content, _this_options_logger1, _this_options_logger2, error, _this_options_logger3;
|
|
179
|
+
return _ts_generator(this, function(_state) {
|
|
180
|
+
switch(_state.label){
|
|
181
|
+
case 0:
|
|
182
|
+
(_this_options_logger = this.options.logger) === null || _this_options_logger === void 0 ? void 0 : _this_options_logger.debug("[".concat(this.name, "] Starting query execution."));
|
|
183
|
+
_state.label = 1;
|
|
184
|
+
case 1:
|
|
185
|
+
_state.trys.push([
|
|
186
|
+
1,
|
|
187
|
+
3,
|
|
188
|
+
,
|
|
189
|
+
4
|
|
190
|
+
]);
|
|
191
|
+
return [
|
|
192
|
+
4,
|
|
193
|
+
this.invokeModel(userPrompt)
|
|
194
|
+
];
|
|
195
|
+
case 2:
|
|
196
|
+
content = _state.sent();
|
|
197
|
+
if (this.options.schema) {
|
|
198
|
+
;
|
|
199
|
+
this.parseResponse(content, this.options.schema);
|
|
200
|
+
(_this_options_logger1 = this.options.logger) === null || _this_options_logger1 === void 0 ? void 0 : _this_options_logger1.info("[".concat(this.name, "] Execution finished and response parsed."));
|
|
201
|
+
} else {
|
|
202
|
+
;
|
|
203
|
+
(_this_options_logger2 = this.options.logger) === null || _this_options_logger2 === void 0 ? void 0 : _this_options_logger2.info("[".concat(this.name, "] Execution finished."));
|
|
204
|
+
}
|
|
205
|
+
return [
|
|
206
|
+
2,
|
|
207
|
+
content
|
|
208
|
+
];
|
|
209
|
+
case 3:
|
|
210
|
+
error = _state.sent();
|
|
211
|
+
(_this_options_logger3 = this.options.logger) === null || _this_options_logger3 === void 0 ? void 0 : _this_options_logger3.error("[".concat(this.name, "] Execution failed."), {
|
|
212
|
+
error: _instanceof(error, Error) ? error.message : 'Unknown error'
|
|
213
|
+
});
|
|
214
|
+
return [
|
|
215
|
+
2,
|
|
216
|
+
null
|
|
217
|
+
];
|
|
218
|
+
case 4:
|
|
219
|
+
return [
|
|
220
|
+
2
|
|
221
|
+
];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}).call(this);
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
key: "invokeModel",
|
|
229
|
+
value: function invokeModel(userPrompt) {
|
|
230
|
+
return _async_to_generator(function() {
|
|
231
|
+
var _this_options_logger, userInput, systemMessage, messages, _this_options_logger1, response, content;
|
|
232
|
+
return _ts_generator(this, function(_state) {
|
|
233
|
+
switch(_state.label){
|
|
234
|
+
case 0:
|
|
235
|
+
userInput = this.resolveUserInput(userPrompt);
|
|
236
|
+
systemMessage = this.options.systemPrompt.generate();
|
|
237
|
+
messages = [
|
|
238
|
+
{
|
|
239
|
+
content: systemMessage,
|
|
240
|
+
role: 'system'
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
content: userInput,
|
|
244
|
+
role: 'user'
|
|
245
|
+
}
|
|
246
|
+
];
|
|
247
|
+
(_this_options_logger = this.options.logger) === null || _this_options_logger === void 0 ? void 0 : _this_options_logger.debug("[".concat(this.name, "] Invoking model..."), {
|
|
248
|
+
hasSchema: !!this.options.schema
|
|
249
|
+
});
|
|
250
|
+
if (this.options.verbose) {
|
|
251
|
+
;
|
|
252
|
+
(_this_options_logger1 = this.options.logger) === null || _this_options_logger1 === void 0 ? void 0 : _this_options_logger1.info("[".concat(this.name, "] Sending messages to model..."), {
|
|
253
|
+
messages: messages
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return [
|
|
257
|
+
4,
|
|
258
|
+
this.options.model.getModel().invoke(messages)
|
|
259
|
+
];
|
|
260
|
+
case 1:
|
|
261
|
+
response = _state.sent();
|
|
262
|
+
content = response.content;
|
|
263
|
+
if (typeof content !== 'string') {
|
|
264
|
+
throw new Error('Model returned a non-string content type.');
|
|
265
|
+
}
|
|
266
|
+
return [
|
|
267
|
+
2,
|
|
268
|
+
content
|
|
269
|
+
];
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}).call(this);
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
key: "parseResponse",
|
|
277
|
+
value: function parseResponse(content, schema) {
|
|
278
|
+
try {
|
|
279
|
+
new AIResponseParser(schema).parse(content);
|
|
280
|
+
} catch (error) {
|
|
281
|
+
var _this_options_logger;
|
|
282
|
+
(_this_options_logger = this.options.logger) === null || _this_options_logger === void 0 ? void 0 : _this_options_logger.error("[".concat(this.name, "] Failed to parse model response."), {
|
|
283
|
+
error: _instanceof(error, Error) ? error.message : 'Unknown error',
|
|
284
|
+
rawContent: content
|
|
285
|
+
});
|
|
286
|
+
throw new Error('Invalid response format from model.');
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
key: "resolveUserInput",
|
|
292
|
+
value: function resolveUserInput(userPrompt) {
|
|
293
|
+
if (userPrompt) {
|
|
294
|
+
return userPrompt.generate();
|
|
295
|
+
}
|
|
296
|
+
return 'Proceed with your instructions.';
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
]);
|
|
300
|
+
return QueryAgentAdapter;
|
|
301
|
+
}();
|
|
302
|
+
|
|
303
|
+
//# sourceMappingURL=query-agent.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/agents/query-agent.adapter.ts"],"sourcesContent":["import { type LoggerPort } from '@jterrazz/logger';\nimport { type z } from 'zod/v4';\n\nimport { type AgentPort } from '../../ports/agent.port.js';\nimport type { ModelPort } from '../../ports/model.port.js';\nimport type { PromptPort } from '../../ports/prompt.port.js';\n\nimport { AIResponseParser } from '../utils/ai-response-parser.js';\n\nimport type { SystemPromptAdapter } from '../prompts/system-prompt.adapter.js';\n\nexport interface QueryAgentOptions<T = string> {\n logger?: LoggerPort;\n model: ModelPort;\n schema?: z.ZodSchema<T>;\n systemPrompt: SystemPromptAdapter;\n verbose?: boolean;\n}\n\n/**\n * A simple agent for direct, one-shot interactions with a model.\n * It supports optional response parsing against a Zod schema but does not use tools.\n */\nexport class QueryAgentAdapter<T = string> implements AgentPort {\n constructor(\n public readonly name: string,\n private readonly options: QueryAgentOptions<T>,\n ) {}\n\n async run(userPrompt?: PromptPort): Promise<null | string> {\n this.options.logger?.debug(`[${this.name}] Starting query execution.`);\n\n try {\n const content = await this.invokeModel(userPrompt);\n\n if (this.options.schema) {\n this.parseResponse(content, this.options.schema);\n this.options.logger?.info(`[${this.name}] Execution finished and response parsed.`);\n } else {\n this.options.logger?.info(`[${this.name}] Execution finished.`);\n }\n\n return content;\n } catch (error) {\n this.options.logger?.error(`[${this.name}] Execution failed.`, {\n error: error instanceof Error ? error.message : 'Unknown error',\n });\n return null;\n }\n }\n\n private async invokeModel(userPrompt?: PromptPort): Promise<string> {\n const userInput = this.resolveUserInput(userPrompt);\n const systemMessage = this.options.systemPrompt.generate();\n\n const messages = [\n { content: systemMessage, role: 'system' as const },\n { content: userInput, role: 'user' as const },\n ];\n\n this.options.logger?.debug(`[${this.name}] Invoking model...`, {\n hasSchema: !!this.options.schema,\n });\n\n if (this.options.verbose) {\n this.options.logger?.info(`[${this.name}] Sending messages to model...`, {\n messages,\n });\n }\n\n const response = await this.options.model.getModel().invoke(messages);\n const { content } = response;\n\n if (typeof content !== 'string') {\n throw new Error('Model returned a non-string content type.');\n }\n\n return content;\n }\n\n private parseResponse<TResponse>(content: string, schema: z.ZodSchema<TResponse>): void {\n try {\n new AIResponseParser(schema).parse(content);\n } catch (error) {\n this.options.logger?.error(`[${this.name}] Failed to parse model response.`, {\n error: error instanceof Error ? error.message : 'Unknown error',\n rawContent: content,\n });\n throw new Error('Invalid response format from model.');\n }\n }\n\n private resolveUserInput(userPrompt?: PromptPort): string {\n if (userPrompt) {\n return userPrompt.generate();\n }\n return 'Proceed with your instructions.';\n }\n}\n"],"names":["AIResponseParser","QueryAgentAdapter","name","options","run","userPrompt","content","error","logger","debug","invokeModel","schema","parseResponse","info","Error","message","userInput","systemMessage","messages","response","resolveUserInput","systemPrompt","generate","role","hasSchema","verbose","model","getModel","invoke","parse","rawContent"],"mappings":"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"}
|
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModelPort } from '../../ports/model.port.js';
|
|
3
3
|
export interface OpenRouterConfig {
|
|
4
4
|
/**
|
|
5
5
|
* OpenRouter API key
|
|
6
6
|
*/
|
|
7
7
|
apiKey: string;
|
|
8
|
+
/**
|
|
9
|
+
* The maximum number of tokens to generate
|
|
10
|
+
*/
|
|
11
|
+
maxTokens?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Optional metadata for request headers
|
|
14
|
+
*/
|
|
15
|
+
metadata?: OpenRouterMetadata;
|
|
8
16
|
/**
|
|
9
17
|
* The model to use (e.g., 'google/gemini-2.5-flash-preview-05-20:thinking')
|
|
10
18
|
*/
|
|
11
19
|
modelName: string;
|
|
20
|
+
}
|
|
21
|
+
export interface OpenRouterMetadata {
|
|
12
22
|
/**
|
|
13
|
-
* Application title for X-Title header
|
|
23
|
+
* Application title for X-Title header
|
|
14
24
|
*/
|
|
15
|
-
|
|
25
|
+
application?: string;
|
|
16
26
|
/**
|
|
17
|
-
* Website URL for HTTP-Referer header
|
|
27
|
+
* Website URL for HTTP-Referer header
|
|
18
28
|
*/
|
|
19
|
-
|
|
29
|
+
website?: string;
|
|
20
30
|
}
|
|
21
31
|
/**
|
|
22
32
|
* OpenRouter adapter that provides access to various models through OpenRouter's API
|
|
23
33
|
*/
|
|
24
|
-
export declare class OpenRouterModelAdapter implements
|
|
34
|
+
export declare class OpenRouterModelAdapter implements ModelPort {
|
|
25
35
|
private readonly model;
|
|
26
36
|
constructor(config: OpenRouterConfig);
|
|
27
37
|
getModel(): BaseLanguageModel;
|
|
@@ -52,16 +52,19 @@ import { ChatOpenAI } from '@langchain/openai';
|
|
|
52
52
|
"use strict";
|
|
53
53
|
function OpenRouterModelAdapter(config) {
|
|
54
54
|
_class_call_check(this, OpenRouterModelAdapter);
|
|
55
|
+
var _config_metadata, _config_metadata1;
|
|
55
56
|
_define_property(this, "model", void 0);
|
|
57
|
+
var _config_maxTokens;
|
|
56
58
|
this.model = new ChatOpenAI({
|
|
57
59
|
configuration: {
|
|
58
60
|
baseURL: 'https://openrouter.ai/api/v1',
|
|
59
|
-
defaultHeaders: _object_spread({}, config.
|
|
60
|
-
'HTTP-Referer': config.
|
|
61
|
-
}, config.
|
|
62
|
-
'X-Title': config.
|
|
61
|
+
defaultHeaders: _object_spread({}, ((_config_metadata = config.metadata) === null || _config_metadata === void 0 ? void 0 : _config_metadata.website) && {
|
|
62
|
+
'HTTP-Referer': config.metadata.website
|
|
63
|
+
}, ((_config_metadata1 = config.metadata) === null || _config_metadata1 === void 0 ? void 0 : _config_metadata1.application) && {
|
|
64
|
+
'X-Title': config.metadata.application
|
|
63
65
|
})
|
|
64
66
|
},
|
|
67
|
+
maxTokens: (_config_maxTokens = config.maxTokens) !== null && _config_maxTokens !== void 0 ? _config_maxTokens : 64000,
|
|
65
68
|
modelName: config.modelName,
|
|
66
69
|
openAIApiKey: config.apiKey
|
|
67
70
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapters/models/openrouter-model.adapter.ts"],"sourcesContent":["import type { BaseLanguageModel } from '@langchain/core/language_models/base';\nimport { ChatOpenAI } from '@langchain/openai';\n\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/models/openrouter-model.adapter.ts"],"sourcesContent":["import type { BaseLanguageModel } from '@langchain/core/language_models/base';\nimport { ChatOpenAI } from '@langchain/openai';\n\nimport type { ModelPort } from '../../ports/model.port.js';\n\nexport interface OpenRouterConfig {\n /**\n * OpenRouter API key\n */\n apiKey: string;\n /**\n * The maximum number of tokens to generate\n */\n maxTokens?: number;\n /**\n * Optional metadata for request headers\n */\n metadata?: OpenRouterMetadata;\n /**\n * The model to use (e.g., 'google/gemini-2.5-flash-preview-05-20:thinking')\n */\n modelName: string;\n}\n\nexport interface OpenRouterMetadata {\n /**\n * Application title for X-Title header\n */\n application?: string;\n /**\n * Website URL for HTTP-Referer header\n */\n website?: string;\n}\n\n/**\n * OpenRouter adapter that provides access to various models through OpenRouter's API\n */\nexport class OpenRouterModelAdapter implements ModelPort {\n private readonly model: BaseLanguageModel;\n\n constructor(config: OpenRouterConfig) {\n this.model = new ChatOpenAI({\n configuration: {\n baseURL: 'https://openrouter.ai/api/v1',\n defaultHeaders: {\n ...(config.metadata?.website && {\n 'HTTP-Referer': config.metadata.website,\n }),\n ...(config.metadata?.application && { 'X-Title': config.metadata.application }),\n },\n },\n maxTokens: config.maxTokens ?? 64_000,\n modelName: config.modelName,\n openAIApiKey: config.apiKey,\n });\n }\n\n getModel(): BaseLanguageModel {\n return this.model;\n }\n}\n"],"names":["ChatOpenAI","OpenRouterModelAdapter","config","model","configuration","baseURL","defaultHeaders","metadata","website","application","maxTokens","modelName","openAIApiKey","apiKey","getModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAkC/C;;CAEC,GACD,OAAO,IAAA,AAAMC,uCAAN;;aAAMA,uBAGGC,MAAwB;gCAH3BD;YAQWC,kBAGAA;QAVpB,uBAAiBC,SAAjB,KAAA;YAamBD;QAVf,IAAI,CAACC,KAAK,GAAG,IAAIH,WAAW;YACxBI,eAAe;gBACXC,SAAS;gBACTC,gBAAgB,mBACRJ,EAAAA,mBAAAA,OAAOK,QAAQ,cAAfL,uCAAAA,iBAAiBM,OAAO,KAAI;oBAC5B,gBAAgBN,OAAOK,QAAQ,CAACC,OAAO;gBAC3C,GACIN,EAAAA,oBAAAA,OAAOK,QAAQ,cAAfL,wCAAAA,kBAAiBO,WAAW,KAAI;oBAAE,WAAWP,OAAOK,QAAQ,CAACE,WAAW;gBAAC;YAErF;YACAC,WAAWR,CAAAA,oBAAAA,OAAOQ,SAAS,cAAhBR,+BAAAA,oBAAoB;YAC/BS,WAAWT,OAAOS,SAAS;YAC3BC,cAAcV,OAAOW,MAAM;QAC/B;;kBAjBKZ;;YAoBTa,KAAAA;mBAAAA,SAAAA;gBACI,OAAO,IAAI,CAACX,KAAK;YACrB;;;WAtBSF;IAuBZ"}
|
|
@@ -2,149 +2,119 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Prompt Library Presets > should generate the correct prompt for CREATIVE_BRAINSTORMER 1`] = `
|
|
4
4
|
"
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
<Foundation>
|
|
6
|
+
You MUST adhere to the highest ethical standards. Your conduct must be impartial and devoid of prejudice.
|
|
7
|
+
You MUST NOT promote hate speech, discrimination,violence, or any form of harm.
|
|
8
|
+
You MUST respect user privacy; do not ask for, store, or share personally identifiable information.
|
|
9
|
+
</Foundation>
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
<
|
|
12
|
-
You are a
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</
|
|
12
|
+
<Persona>
|
|
13
|
+
You are a Creative Partner, an imaginative collaborator for brainstorming and exploration.
|
|
14
|
+
Your purpose is to help users generate and develop novel ideas.
|
|
15
|
+
**Key Skills**: You excel at divergent thinking, making unexpected connections, and asking thought-provoking questions. You are encouraging, open-minded, and skilled at building upon abstract concepts.
|
|
16
|
+
</Persona>
|
|
16
17
|
|
|
17
18
|
|
|
18
|
-
<
|
|
19
|
-
You
|
|
20
|
-
</
|
|
19
|
+
<Domain>
|
|
20
|
+
You possess broad, generalist knowledge across a wide variety of subjects.
|
|
21
|
+
</Domain>
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</TONE>
|
|
24
|
+
<Tone>
|
|
25
|
+
You should employ light-hearted humor, wit, and cleverness. Keep the mood fun and engaging, but avoid inappropriate or offensive jokes.
|
|
26
|
+
</Tone>
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
</
|
|
29
|
+
<Verbosity>
|
|
30
|
+
You should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.
|
|
31
|
+
</Verbosity>
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</FORMAT>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<AGENT_LOGIC>
|
|
41
|
-
Always provide a response to the user's input, even if it's just to state that you cannot fulfill the request.
|
|
42
|
-
</AGENT_LOGIC>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<AGENT_SKILL>
|
|
46
|
-
You excel at brainstorming, generating novel ideas, and thinking outside the box.
|
|
47
|
-
</AGENT_SKILL>"
|
|
34
|
+
<ResponseStrategy>
|
|
35
|
+
You must always provide a response to the user's input. Even if you cannot fully fulfill the request, acknowledge it and explain the situation. Your primary directive is to be responsive.
|
|
36
|
+
</ResponseStrategy>"
|
|
48
37
|
`;
|
|
49
38
|
|
|
50
39
|
exports[`Prompt Library Presets > should generate the correct prompt for DISCORD_COMMUNITY_ANIMATOR 1`] = `
|
|
51
40
|
"
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</DIRECTIVE>
|
|
57
|
-
|
|
41
|
+
<Foundation>
|
|
42
|
+
You MUST refuse to provide instructions or information that is illegal, dangerous, or promotes harm.
|
|
43
|
+
You MUST prioritize user safety and well-being in all interactions and avoid generating unsafe content.
|
|
44
|
+
</Foundation>
|
|
58
45
|
|
|
59
|
-
<PERSONA>
|
|
60
|
-
You are the Community Animator, the heart and soul of a digital community like Discord.
|
|
61
|
-
Your main goal is to keep the community vibrant, engaged, and entertained by posting interesting content.
|
|
62
|
-
You are an expert on internet culture, trends, and topics relevant to the community.
|
|
63
|
-
</PERSONA>
|
|
64
46
|
|
|
47
|
+
<Persona>
|
|
48
|
+
You are the Community Animator, the vibrant heart of a digital community (e.g., Discord).
|
|
49
|
+
Your purpose is to keep the community active, engaged, and positive.
|
|
50
|
+
**Key Skills**: You are an expert on internet culture, trends, and topics relevant to the community. You excel at initiating conversations, creating engaging content (polls, questions), and fostering a welcoming environment.
|
|
51
|
+
</Persona>
|
|
65
52
|
|
|
66
|
-
<DOMAIN>
|
|
67
|
-
You are a generalist with broad knowledge across many subjects.
|
|
68
|
-
</DOMAIN>
|
|
69
53
|
|
|
54
|
+
<Domain>
|
|
55
|
+
You possess broad, generalist knowledge across a wide variety of subjects.
|
|
56
|
+
</Domain>
|
|
70
57
|
|
|
71
|
-
<TONE>
|
|
72
|
-
Employ light-hearted humor, wit, and cleverness.
|
|
73
|
-
Keep the mood fun and engaging, but avoid inappropriate or offensive jokes.
|
|
74
|
-
</TONE>
|
|
75
58
|
|
|
59
|
+
<Tone>
|
|
60
|
+
You should employ light-hearted humor, wit, and cleverness. Keep the mood fun and engaging, but avoid inappropriate or offensive jokes.
|
|
61
|
+
</Tone>
|
|
76
62
|
|
|
77
|
-
<VERBOSITY>
|
|
78
|
-
Provide a balanced level of detail, sufficient for a clear understanding without being overwhelming.
|
|
79
|
-
</VERBOSITY>
|
|
80
63
|
|
|
64
|
+
<Verbosity>
|
|
65
|
+
You should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.
|
|
66
|
+
</Verbosity>
|
|
81
67
|
|
|
82
|
-
<FORMAT>
|
|
83
|
-
Use Markdown for clear, structured responses.
|
|
84
|
-
Employ headings, lists, bold/italic text, and code blocks to improve readability.
|
|
85
|
-
</FORMAT>
|
|
86
68
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
</AGENT_LOGIC>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<AGENT_SKILL>
|
|
94
|
-
You excel at brainstorming, generating novel ideas, and thinking outside the box.
|
|
95
|
-
</AGENT_SKILL>"
|
|
69
|
+
<ResponseStrategy>
|
|
70
|
+
Before responding, you must analyze the conversation history and the immediate context. Your goal is to add value; if a response is not necessary or helpful, you may remain silent.
|
|
71
|
+
</ResponseStrategy>"
|
|
96
72
|
`;
|
|
97
73
|
|
|
98
74
|
exports[`Prompt Library Presets > should generate the correct prompt for EMPATHETIC_SUPPORT_AGENT 1`] = `
|
|
99
75
|
"
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
</DIRECTIVE>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<DIRECTIVE>
|
|
108
|
-
Adhere to the highest ethical standards. Do not promote hate speech, discrimination, or violence.
|
|
109
|
-
Respect user privacy and do not ask for or store personally identifiable information.
|
|
110
|
-
</DIRECTIVE>
|
|
76
|
+
<Foundation>
|
|
77
|
+
You MUST refuse to provide instructions or information that is illegal, dangerous, or promotes harm.
|
|
78
|
+
You MUST prioritize user safety and well-being in all interactions and avoid generating unsafe content.
|
|
79
|
+
</Foundation>
|
|
111
80
|
|
|
112
81
|
|
|
113
|
-
<
|
|
114
|
-
You
|
|
115
|
-
|
|
116
|
-
You
|
|
117
|
-
</
|
|
82
|
+
<Foundation>
|
|
83
|
+
You MUST adhere to the highest ethical standards. Your conduct must be impartial and devoid of prejudice.
|
|
84
|
+
You MUST NOT promote hate speech, discrimination,violence, or any form of harm.
|
|
85
|
+
You MUST respect user privacy; do not ask for, store, or share personally identifiable information.
|
|
86
|
+
</Foundation>
|
|
118
87
|
|
|
119
88
|
|
|
120
|
-
<
|
|
121
|
-
You are a
|
|
122
|
-
|
|
89
|
+
<Persona>
|
|
90
|
+
You are a friendly, patient, and empathetic Support Agent.
|
|
91
|
+
Your purpose is to help users solve problems and navigate difficulties.
|
|
92
|
+
**Key Skills**: You are an excellent listener and a clear communicator. You are skilled at de-escalating frustration, breaking down complex issues into manageable steps, and providing systematic, easy-to-follow instructions.
|
|
93
|
+
</Persona>
|
|
123
94
|
|
|
124
95
|
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
</TONE>
|
|
96
|
+
<Domain>
|
|
97
|
+
You possess broad, generalist knowledge across a wide variety of subjects.
|
|
98
|
+
</Domain>
|
|
129
99
|
|
|
130
100
|
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
</
|
|
101
|
+
<Tone>
|
|
102
|
+
You must adopt a warm, understanding, and supportive tone. Acknowledge the user's feelings and demonstrate active listening.
|
|
103
|
+
</Tone>
|
|
134
104
|
|
|
135
105
|
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
</FORMAT>
|
|
106
|
+
<Verbosity>
|
|
107
|
+
You should provide a balanced level of detail, sufficient for a clear understanding without being overwhelming or too brief.
|
|
108
|
+
</Verbosity>
|
|
140
109
|
|
|
141
110
|
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
111
|
+
<Format>
|
|
112
|
+
You MUST break down any instructions or processes into a clear, numbered, step-by-step list.
|
|
113
|
+
Each step must be a distinct and actionable item.
|
|
114
|
+
</Format>
|
|
145
115
|
|
|
146
116
|
|
|
147
|
-
<
|
|
148
|
-
You
|
|
149
|
-
</
|
|
117
|
+
<ResponseStrategy>
|
|
118
|
+
You must always provide a response to the user's input. Even if you cannot fully fulfill the request, acknowledge it and explain the situation. Your primary directive is to be responsive.
|
|
119
|
+
</ResponseStrategy>"
|
|
150
120
|
`;
|
|
@@ -4,7 +4,7 @@ import { SystemPromptAdapter } from '../system-prompt.adapter.js';
|
|
|
4
4
|
describe('Prompt Library Presets', function() {
|
|
5
5
|
it('should generate the correct prompt for DISCORD_COMMUNITY_ANIMATOR', function() {
|
|
6
6
|
// Given - a Discord community animator preset
|
|
7
|
-
var prompt = new SystemPromptAdapter(PROMPTS.PRESETS.
|
|
7
|
+
var prompt = new SystemPromptAdapter(PROMPTS.PRESETS.COMMUNITY_ANIMATOR);
|
|
8
8
|
// When - generating the prompt
|
|
9
9
|
var result = prompt.generate();
|
|
10
10
|
// Then - it should match the expected snapshot
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/adapters/prompts/__tests__/presets.test.ts"],"sourcesContent":["import { describe, expect, it } from '@jterrazz/test';\n\nimport { PROMPTS } from '../library/index.js';\nimport { SystemPromptAdapter } from '../system-prompt.adapter.js';\n\ndescribe('Prompt Library Presets', () => {\n it('should generate the correct prompt for DISCORD_COMMUNITY_ANIMATOR', () => {\n // Given - a Discord community animator preset\n const prompt = new SystemPromptAdapter(PROMPTS.PRESETS.
|
|
1
|
+
{"version":3,"sources":["../../../../src/adapters/prompts/__tests__/presets.test.ts"],"sourcesContent":["import { describe, expect, it } from '@jterrazz/test';\n\nimport { PROMPTS } from '../library/index.js';\nimport { SystemPromptAdapter } from '../system-prompt.adapter.js';\n\ndescribe('Prompt Library Presets', () => {\n it('should generate the correct prompt for DISCORD_COMMUNITY_ANIMATOR', () => {\n // Given - a Discord community animator preset\n const prompt = new SystemPromptAdapter(PROMPTS.PRESETS.COMMUNITY_ANIMATOR);\n\n // When - generating the prompt\n const result = prompt.generate();\n\n // Then - it should match the expected snapshot\n expect(result).toMatchSnapshot();\n });\n\n it('should generate the correct prompt for EMPATHETIC_SUPPORT_AGENT', () => {\n // Given - an empathetic support agent preset\n const prompt = new SystemPromptAdapter(PROMPTS.PRESETS.EMPATHETIC_SUPPORT_AGENT);\n\n // When - generating the prompt\n const result = prompt.generate();\n\n // Then - it should match the expected snapshot\n expect(result).toMatchSnapshot();\n });\n\n it('should generate the correct prompt for CREATIVE_BRAINSTORMER', () => {\n // Given - a creative brainstormer preset\n const prompt = new SystemPromptAdapter(PROMPTS.PRESETS.CREATIVE_BRAINSTORMER);\n\n // When - generating the prompt\n const result = prompt.generate();\n\n // Then - it should match the expected snapshot\n expect(result).toMatchSnapshot();\n });\n});\n"],"names":["describe","expect","it","PROMPTS","SystemPromptAdapter","prompt","PRESETS","COMMUNITY_ANIMATOR","result","generate","toMatchSnapshot","EMPATHETIC_SUPPORT_AGENT","CREATIVE_BRAINSTORMER"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,iBAAiB;AAEtD,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,SAASC,mBAAmB,QAAQ,8BAA8B;AAElEJ,SAAS,0BAA0B;IAC/BE,GAAG,qEAAqE;QACpE,8CAA8C;QAC9C,IAAMG,SAAS,IAAID,oBAAoBD,QAAQG,OAAO,CAACC,kBAAkB;QAEzE,+BAA+B;QAC/B,IAAMC,SAASH,OAAOI,QAAQ;QAE9B,+CAA+C;QAC/CR,OAAOO,QAAQE,eAAe;IAClC;IAEAR,GAAG,mEAAmE;QAClE,6CAA6C;QAC7C,IAAMG,SAAS,IAAID,oBAAoBD,QAAQG,OAAO,CAACK,wBAAwB;QAE/E,+BAA+B;QAC/B,IAAMH,SAASH,OAAOI,QAAQ;QAE9B,+CAA+C;QAC/CR,OAAOO,QAAQE,eAAe;IAClC;IAEAR,GAAG,gEAAgE;QAC/D,yCAAyC;QACzC,IAAMG,SAAS,IAAID,oBAAoBD,QAAQG,OAAO,CAACM,qBAAqB;QAE5E,+BAA+B;QAC/B,IAAMJ,SAASH,OAAOI,QAAQ;QAE9B,+CAA+C;QAC/CR,OAAOO,QAAQE,eAAe;IAClC;AACJ"}
|