@arcote.tech/arc-ai 0.4.6 → 0.4.9
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcote.tech/arc-ai",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.9",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "AI provider abstraction, completion tracking, and budget management for Arc framework",
|
|
7
7
|
"main": "./src/index.ts",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"type-check": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@arcote.tech/arc": "^0.4.
|
|
14
|
-
"@arcote.tech/arc-auth": "^0.4.
|
|
13
|
+
"@arcote.tech/arc": "^0.4.9",
|
|
14
|
+
"@arcote.tech/arc-auth": "^0.4.9",
|
|
15
15
|
"typescript": "^5.0.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
package/src/aggregates/budget.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
id,
|
|
6
6
|
number,
|
|
7
7
|
string,
|
|
8
|
-
type
|
|
8
|
+
type ArcAggregateElement,
|
|
9
9
|
type ArcId,
|
|
10
10
|
} from "@arcote.tech/arc";
|
|
11
11
|
import type { Token } from "@arcote.tech/arc-auth";
|
|
@@ -27,7 +27,7 @@ export type BudgetAggregateData = {
|
|
|
27
27
|
budgetId: ArcId<any>;
|
|
28
28
|
accountId: ArcId<any>;
|
|
29
29
|
userToken: Token;
|
|
30
|
-
CompletionAggregate:
|
|
30
|
+
CompletionAggregate: ArcAggregateElement;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export const createBudgetAggregate = <
|
|
@@ -133,7 +133,7 @@ export const createBudgetAggregate = <
|
|
|
133
133
|
)
|
|
134
134
|
|
|
135
135
|
.protectBy(userToken, (p) => ({ accountId: p.accountId }))
|
|
136
|
-
|
|
136
|
+
;
|
|
137
137
|
};
|
|
138
138
|
|
|
139
139
|
export type BudgetAggregate = ReturnType<typeof createBudgetAggregate>;
|
package/src/ai-builder.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
aggregateContextElement,
|
|
3
2
|
context,
|
|
4
|
-
type
|
|
3
|
+
type ArcAggregateElement,
|
|
5
4
|
type ArcContextElement,
|
|
6
5
|
} from "@arcote.tech/arc";
|
|
7
6
|
import type { AccountId, Token } from "@arcote.tech/arc-auth";
|
|
@@ -13,8 +12,8 @@ import type { LLMProvider, PricingConfig } from "./types";
|
|
|
13
12
|
export class AIBuilder<
|
|
14
13
|
CompId,
|
|
15
14
|
BudId,
|
|
16
|
-
Completion extends
|
|
17
|
-
Budget extends
|
|
15
|
+
Completion extends ArcAggregateElement,
|
|
16
|
+
Budget extends ArcAggregateElement,
|
|
18
17
|
Providers extends LLMProvider[],
|
|
19
18
|
Elements extends ArcContextElement<any>[],
|
|
20
19
|
> {
|
|
@@ -64,7 +63,7 @@ export function ai<
|
|
|
64
63
|
providers: config.providers,
|
|
65
64
|
pricing: config.pricing,
|
|
66
65
|
});
|
|
67
|
-
const completionElement =
|
|
66
|
+
const completionElement = Completion;
|
|
68
67
|
|
|
69
68
|
const Budget = createBudgetAggregate({
|
|
70
69
|
name: config.name,
|
|
@@ -73,7 +72,7 @@ export function ai<
|
|
|
73
72
|
userToken: config.userToken,
|
|
74
73
|
CompletionAggregate: Completion,
|
|
75
74
|
});
|
|
76
|
-
const budgetElement =
|
|
75
|
+
const budgetElement = Budget;
|
|
77
76
|
|
|
78
77
|
const streamRoute = createStreamCompletionRoute({
|
|
79
78
|
name: config.name,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { route, type ArcAggregateElement
|
|
1
|
+
import { route, type ArcAggregateElement } from "@arcote.tech/arc";
|
|
2
2
|
import type { Token } from "@arcote.tech/arc-auth";
|
|
3
3
|
import type { LLMProvider, PricingConfig, StreamChunk } from "../types";
|
|
4
4
|
import type { ArcToolAny } from "../tool/tool";
|
|
5
5
|
|
|
6
6
|
export type StreamCompletionRouteData = {
|
|
7
7
|
name: string;
|
|
8
|
-
completionElement: ArcAggregateElement
|
|
8
|
+
completionElement: ArcAggregateElement;
|
|
9
9
|
userToken: Token;
|
|
10
10
|
providers: LLMProvider[];
|
|
11
11
|
pricing?: Record<string, PricingConfig>;
|