@yrpri/api 9.0.155 → 9.0.157
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/agents/managers/newAiModelSetup.js +70 -0
- package/app.js +4 -2
- package/package.json +2 -2
|
@@ -475,6 +475,74 @@ export class NewAiModelSetup {
|
|
|
475
475
|
await openAiGpt41.save();
|
|
476
476
|
log.debug("OpenAI model already exists: GPT-4.1");
|
|
477
477
|
}
|
|
478
|
+
const openAiGpt41Mini = await PsAiModel.findOne({
|
|
479
|
+
where: { name: "GPT-4.1 mini" },
|
|
480
|
+
});
|
|
481
|
+
const openAiGpt41MiniConfig = {
|
|
482
|
+
type: PsAiModelType.Text,
|
|
483
|
+
modelSize: PsAiModelSize.Small,
|
|
484
|
+
provider: "openai",
|
|
485
|
+
prices: {
|
|
486
|
+
costInTokensPerMillion: 0.4,
|
|
487
|
+
costOutTokensPerMillion: 1.6,
|
|
488
|
+
costInCachedContextTokensPerMillion: 0.10,
|
|
489
|
+
currency: "USD",
|
|
490
|
+
},
|
|
491
|
+
maxTokensOut: 32768,
|
|
492
|
+
maxContextTokens: 1047576,
|
|
493
|
+
defaultTemperature: 0.7,
|
|
494
|
+
model: "gpt-4.1-mini",
|
|
495
|
+
active: true,
|
|
496
|
+
};
|
|
497
|
+
if (!openAiGpt41Mini) {
|
|
498
|
+
await PsAiModel.create({
|
|
499
|
+
name: "GPT-4.1 mini",
|
|
500
|
+
organization_id: 1,
|
|
501
|
+
user_id: userId,
|
|
502
|
+
configuration: openAiGpt41MiniConfig,
|
|
503
|
+
});
|
|
504
|
+
log.info("Created OpenAI model: GPT-4.1 mini");
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
openAiGpt41Mini.set("configuration", openAiGpt41MiniConfig);
|
|
508
|
+
openAiGpt41Mini.changed("configuration", true);
|
|
509
|
+
await openAiGpt41Mini.save();
|
|
510
|
+
log.debug("OpenAI model already exists: GPT-4.1 mini");
|
|
511
|
+
}
|
|
512
|
+
const openAiGpt41Nano = await PsAiModel.findOne({
|
|
513
|
+
where: { name: "GPT-4.1 nano" },
|
|
514
|
+
});
|
|
515
|
+
const openAiGpt41NanoConfig = {
|
|
516
|
+
type: PsAiModelType.Text,
|
|
517
|
+
modelSize: PsAiModelSize.Small,
|
|
518
|
+
provider: "openai",
|
|
519
|
+
prices: {
|
|
520
|
+
costInTokensPerMillion: 0.1,
|
|
521
|
+
costOutTokensPerMillion: 0.4,
|
|
522
|
+
costInCachedContextTokensPerMillion: 0.025,
|
|
523
|
+
currency: "USD",
|
|
524
|
+
},
|
|
525
|
+
maxTokensOut: 32768,
|
|
526
|
+
maxContextTokens: 1047576,
|
|
527
|
+
defaultTemperature: 0.7,
|
|
528
|
+
model: "gpt-4.1-nano",
|
|
529
|
+
active: true,
|
|
530
|
+
};
|
|
531
|
+
if (!openAiGpt41Nano) {
|
|
532
|
+
await PsAiModel.create({
|
|
533
|
+
name: "GPT-4.1 nano",
|
|
534
|
+
organization_id: 1,
|
|
535
|
+
user_id: userId,
|
|
536
|
+
configuration: openAiGpt41NanoConfig,
|
|
537
|
+
});
|
|
538
|
+
log.info("Created OpenAI model: GPT-4.1 nano");
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
openAiGpt41Nano.set("configuration", openAiGpt41NanoConfig);
|
|
542
|
+
openAiGpt41Nano.changed("configuration", true);
|
|
543
|
+
await openAiGpt41Nano.save();
|
|
544
|
+
log.debug("OpenAI model already exists: GPT-4.1 nano");
|
|
545
|
+
}
|
|
478
546
|
}
|
|
479
547
|
/**
|
|
480
548
|
* Seeds Google models.
|
|
@@ -810,6 +878,8 @@ export class NewAiModelSetup {
|
|
|
810
878
|
{ name: "o3 mini", envKey: "OPENAI_API_KEY" },
|
|
811
879
|
{ name: "o4 mini", envKey: "OPENAI_API_KEY" },
|
|
812
880
|
{ name: "GPT-4.1", envKey: "OPENAI_API_KEY" },
|
|
881
|
+
{ name: "GPT-4.1 mini", envKey: "OPENAI_API_KEY" },
|
|
882
|
+
{ name: "GPT-4.1 nano", envKey: "OPENAI_API_KEY" },
|
|
813
883
|
{ name: "o3", envKey: "OPENAI_API_KEY" },
|
|
814
884
|
];
|
|
815
885
|
const groupAccessConfig = [];
|
package/app.js
CHANGED
|
@@ -55,7 +55,8 @@ import { Notifier } from "@airbrake/node";
|
|
|
55
55
|
import { fileURLToPath } from "url";
|
|
56
56
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
57
57
|
let airbrake;
|
|
58
|
-
if (process.env.AIRBRAKE_PROJECT_ID &&
|
|
58
|
+
if (process.env.AIRBRAKE_PROJECT_ID &&
|
|
59
|
+
(process.env.AIRBRAKE_API_KEY || process.env.AIRBRAKE_PROJECT_KEY)) {
|
|
59
60
|
airbrake = new Notifier({
|
|
60
61
|
projectId: parseInt(process.env.AIRBRAKE_PROJECT_ID),
|
|
61
62
|
projectKey: process.env.AIRBRAKE_API_KEY || process.env.AIRBRAKE_PROJECT_KEY || "",
|
|
@@ -895,7 +896,8 @@ export class YourPrioritiesApi {
|
|
|
895
896
|
log.error("User Unauthorized", {
|
|
896
897
|
context: "unauthorizedError",
|
|
897
898
|
user: toJson(req.user),
|
|
898
|
-
|
|
899
|
+
url: req.originalUrl,
|
|
900
|
+
err: err ? (err.message ? err.message : err) : "Unauthorized",
|
|
899
901
|
errorStatus: 401,
|
|
900
902
|
});
|
|
901
903
|
res.sendStatus(401);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yrpri/api",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.157",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Bjarnason & Citizens Foundation",
|
|
6
6
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@google-cloud/vertexai": "^1.10.0",
|
|
26
26
|
"@google-cloud/vision": "^5.1.0",
|
|
27
27
|
"@node-saml/passport-saml": "^5.0.1",
|
|
28
|
-
"@policysynth/agents": "^1.3.
|
|
28
|
+
"@policysynth/agents": "^1.3.127",
|
|
29
29
|
"async": "^3.2.6",
|
|
30
30
|
"authorized": "^1.0.0",
|
|
31
31
|
"aws-sdk": "^2.1692.0",
|