@axiom-lattice/gateway 2.1.45 → 2.1.47
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +19 -0
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/controllers/models.ts +8 -0
- package/src/controllers/run.ts +19 -6
package/dist/index.mjs
CHANGED
|
@@ -200,7 +200,6 @@ var getAgentGraph = async (request, reply) => {
|
|
|
200
200
|
// src/controllers/run.ts
|
|
201
201
|
import { v4 } from "uuid";
|
|
202
202
|
import {
|
|
203
|
-
Agent,
|
|
204
203
|
agentInstanceManager as agentInstanceManager2
|
|
205
204
|
} from "@axiom-lattice/core";
|
|
206
205
|
var createRun = async (request, reply) => {
|
|
@@ -244,7 +243,8 @@ var createRun = async (request, reply) => {
|
|
|
244
243
|
try {
|
|
245
244
|
const result = await agent.addMessage({
|
|
246
245
|
input,
|
|
247
|
-
command
|
|
246
|
+
command,
|
|
247
|
+
custom_run_config
|
|
248
248
|
});
|
|
249
249
|
const stream = agent.chunkStream(result.messageId);
|
|
250
250
|
for await (const chunk of stream) {
|
|
@@ -274,7 +274,8 @@ var createRun = async (request, reply) => {
|
|
|
274
274
|
const { message: msg, ...restInputNonStream } = input;
|
|
275
275
|
const result = await agent.invoke({
|
|
276
276
|
input: { message: msg, ...restInputNonStream },
|
|
277
|
-
command
|
|
277
|
+
command,
|
|
278
|
+
custom_run_config
|
|
278
279
|
});
|
|
279
280
|
reply.status(200).send({
|
|
280
281
|
success: true,
|
|
@@ -290,11 +291,14 @@ var createRun = async (request, reply) => {
|
|
|
290
291
|
};
|
|
291
292
|
var resumeStream = async (request, reply) => {
|
|
292
293
|
try {
|
|
293
|
-
const { thread_id, message_id, known_content, poll_interval } = request.body;
|
|
294
|
-
|
|
294
|
+
const { thread_id, message_id, assistant_id, known_content, poll_interval } = request.body;
|
|
295
|
+
const tenant_id = request.headers["x-tenant-id"];
|
|
296
|
+
const workspace_id = request.headers["x-workspace-id"];
|
|
297
|
+
const project_id = request.headers["x-project-id"];
|
|
298
|
+
if (!thread_id || !message_id || !assistant_id || known_content === void 0) {
|
|
295
299
|
reply.status(400).send({
|
|
296
300
|
success: false,
|
|
297
|
-
error: "thread_id, message_id, and known_content are required"
|
|
301
|
+
error: "thread_id, message_id, assistant_id, and known_content are required"
|
|
298
302
|
});
|
|
299
303
|
return;
|
|
300
304
|
}
|
|
@@ -306,10 +310,12 @@ var resumeStream = async (request, reply) => {
|
|
|
306
310
|
"Access-Control-Allow-Origin": "*"
|
|
307
311
|
});
|
|
308
312
|
try {
|
|
309
|
-
const agent =
|
|
310
|
-
assistant_id
|
|
313
|
+
const agent = agentInstanceManager2.getAgent({
|
|
314
|
+
assistant_id,
|
|
311
315
|
thread_id,
|
|
312
|
-
tenant_id
|
|
316
|
+
tenant_id,
|
|
317
|
+
workspace_id,
|
|
318
|
+
project_id
|
|
313
319
|
});
|
|
314
320
|
const stream = agent.chunkStream(message_id, known_content);
|
|
315
321
|
for await (const chunk of stream) {
|
|
@@ -1055,10 +1061,12 @@ async function getModels(request, reply) {
|
|
|
1055
1061
|
const allLattices = modelLatticeManager.getAllLattices();
|
|
1056
1062
|
const models = allLattices.map((lattice) => {
|
|
1057
1063
|
const config = lattice.client.config || {};
|
|
1064
|
+
const displayName = config.displayName || lattice.key.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
1058
1065
|
return {
|
|
1059
1066
|
key: lattice.key,
|
|
1060
1067
|
model: config.model || "",
|
|
1061
1068
|
provider: config.provider || "openai",
|
|
1069
|
+
displayName,
|
|
1062
1070
|
streaming: config.streaming || false,
|
|
1063
1071
|
apiKey: config.apiKey || "",
|
|
1064
1072
|
baseURL: config.baseURL || "",
|
|
@@ -1108,6 +1116,7 @@ async function updateModels(request, reply) {
|
|
|
1108
1116
|
const llmConfig = {
|
|
1109
1117
|
provider: modelConfig.provider,
|
|
1110
1118
|
model: modelConfig.model,
|
|
1119
|
+
displayName: modelConfig.displayName,
|
|
1111
1120
|
streaming: modelConfig.streaming ?? false,
|
|
1112
1121
|
apiKey: modelConfig.apiKey,
|
|
1113
1122
|
baseURL: modelConfig.baseURL,
|