@chainfuse/ai-tools 0.4.0 → 0.5.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/dist/providers/rawProviders.mjs +20 -5
- package/dist/types.d.mts +6 -1
- package/package.json +10 -10
|
@@ -35,7 +35,10 @@ export class AiRawProviders extends AiBase {
|
|
|
35
35
|
headers: {
|
|
36
36
|
'cf-aig-authorization': `Bearer ${this.config.gateway.apiToken}`,
|
|
37
37
|
'cf-aig-metadata': JSON.stringify({
|
|
38
|
-
|
|
38
|
+
dbInfo: JSON.stringify({
|
|
39
|
+
messageId: (await BufferHelpers.uuidConvert(args.messageId)).utf8,
|
|
40
|
+
dataspaceId: (await BufferHelpers.uuidConvert(args.dataspaceId)).utf8,
|
|
41
|
+
}),
|
|
39
42
|
executor: JSON.stringify(args.executor),
|
|
40
43
|
// Generate incomplete id because we don't have the body to hash yet. Fill it in in the `fetch()`
|
|
41
44
|
idempotencyId: args.idempotencyId ?? (await BufferHelpers.generateUuid).utf8.slice(0, 23),
|
|
@@ -93,7 +96,10 @@ export class AiRawProviders extends AiBase {
|
|
|
93
96
|
headers: {
|
|
94
97
|
'cf-aig-authorization': `Bearer ${this.config.gateway.apiToken}`,
|
|
95
98
|
'cf-aig-metadata': JSON.stringify({
|
|
96
|
-
|
|
99
|
+
dbInfo: JSON.stringify({
|
|
100
|
+
messageId: (await BufferHelpers.uuidConvert(args.messageId)).utf8,
|
|
101
|
+
dataspaceId: (await BufferHelpers.uuidConvert(args.dataspaceId)).utf8,
|
|
102
|
+
}),
|
|
97
103
|
executor: JSON.stringify(args.executor),
|
|
98
104
|
// Generate incomplete id because we don't have the body to hash yet. Fill it in in the `fetch()`
|
|
99
105
|
idempotencyId: args.idempotencyId ?? (await BufferHelpers.generateUuid).utf8.slice(0, 23),
|
|
@@ -149,7 +155,10 @@ export class AiRawProviders extends AiBase {
|
|
|
149
155
|
headers: {
|
|
150
156
|
'cf-aig-authorization': `Bearer ${this.config.gateway.apiToken}`,
|
|
151
157
|
'cf-aig-metadata': JSON.stringify({
|
|
152
|
-
|
|
158
|
+
dbInfo: JSON.stringify({
|
|
159
|
+
messageId: (await BufferHelpers.uuidConvert(args.messageId)).utf8,
|
|
160
|
+
dataspaceId: (await BufferHelpers.uuidConvert(args.dataspaceId)).utf8,
|
|
161
|
+
}),
|
|
153
162
|
executor: JSON.stringify(args.executor),
|
|
154
163
|
// Generate incomplete id because we don't have the body to hash yet. Fill it in in the `fetch()`
|
|
155
164
|
idempotencyId: args.idempotencyId ?? (await BufferHelpers.generateUuid).utf8.slice(0, 23),
|
|
@@ -310,7 +319,10 @@ export class AiRawProviders extends AiBase {
|
|
|
310
319
|
headers: {
|
|
311
320
|
'cf-aig-authorization': `Bearer ${this.config.gateway.apiToken}`,
|
|
312
321
|
'cf-aig-metadata': JSON.stringify({
|
|
313
|
-
|
|
322
|
+
dbInfo: JSON.stringify({
|
|
323
|
+
messageId: (await BufferHelpers.uuidConvert(args.messageId)).utf8,
|
|
324
|
+
dataspaceId: (await BufferHelpers.uuidConvert(args.dataspaceId)).utf8,
|
|
325
|
+
}),
|
|
314
326
|
executor: JSON.stringify(args.executor),
|
|
315
327
|
// Generate incomplete id because we don't have the body to hash yet. Fill it in in the `fetch()`
|
|
316
328
|
idempotencyId: args.idempotencyId ?? (await BufferHelpers.generateUuid).utf8.slice(0, 23),
|
|
@@ -362,7 +374,10 @@ export class AiRawProviders extends AiBase {
|
|
|
362
374
|
headers: {
|
|
363
375
|
'cf-aig-authorization': `Bearer ${this.config.gateway.apiToken}`,
|
|
364
376
|
'cf-aig-metadata': JSON.stringify({
|
|
365
|
-
|
|
377
|
+
dbInfo: JSON.stringify({
|
|
378
|
+
messageId: (await BufferHelpers.uuidConvert(args.messageId)).utf8,
|
|
379
|
+
dataspaceId: (await BufferHelpers.uuidConvert(args.dataspaceId)).utf8,
|
|
380
|
+
}),
|
|
366
381
|
executor: JSON.stringify(args.executor),
|
|
367
382
|
// Generate incomplete id because we don't have the body to hash yet. Fill it in in the `fetch()`
|
|
368
383
|
idempotencyId: args.idempotencyId ?? (await BufferHelpers.generateUuid).utf8.slice(0, 23),
|
package/dist/types.d.mts
CHANGED
|
@@ -71,6 +71,7 @@ export interface AiRequestConfig {
|
|
|
71
71
|
* @default true
|
|
72
72
|
*/
|
|
73
73
|
cache?: boolean | number;
|
|
74
|
+
messageId: PrefixedUuid | UuidExport['utf8'] | UuidExport['hex'];
|
|
74
75
|
dataspaceId: PrefixedUuid | UuidExport['utf8'] | UuidExport['hex'];
|
|
75
76
|
/**
|
|
76
77
|
* Service identification of caller
|
|
@@ -92,6 +93,10 @@ export interface AiRequestConfig {
|
|
|
92
93
|
*/
|
|
93
94
|
skipCache?: boolean;
|
|
94
95
|
}
|
|
96
|
+
export interface AiRequestMetadataDbInfo {
|
|
97
|
+
dataspaceId: AiRequestConfig['dataspaceId'];
|
|
98
|
+
messageId: AiRequestConfig['dataspaceId'];
|
|
99
|
+
}
|
|
95
100
|
export interface AiRequestMetadataServerInfo {
|
|
96
101
|
name: 'anthropic' | 'cloudflare' | 'googleai' | 'openai';
|
|
97
102
|
}
|
|
@@ -108,7 +113,7 @@ export interface AiRequestMetadataTiming {
|
|
|
108
113
|
totalRoundtripTime: number;
|
|
109
114
|
}
|
|
110
115
|
export interface AiRequestMetadata {
|
|
111
|
-
|
|
116
|
+
dbInfo: AiRequestMetadataDbInfo;
|
|
112
117
|
serverInfo: AiRequestMetadataServerInfo | AiRequestMetadataServerInfoWithLocation;
|
|
113
118
|
idempotencyId: AiRequestIdempotencyId;
|
|
114
119
|
executor: AiRequestExecutor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainfuse/ai-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "ChainFuse",
|
|
6
6
|
"homepage": "https://github.com/ChainFuse/packages/tree/main/packages/ai-tools#readme",
|
|
@@ -48,21 +48,21 @@
|
|
|
48
48
|
},
|
|
49
49
|
"prettier": "@demosjarco/prettier-config",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@ai-sdk/anthropic": "^1.1.
|
|
52
|
-
"@ai-sdk/azure": "^1.1.
|
|
53
|
-
"@ai-sdk/google": "^1.1.
|
|
51
|
+
"@ai-sdk/anthropic": "^1.1.9",
|
|
52
|
+
"@ai-sdk/azure": "^1.1.13",
|
|
53
|
+
"@ai-sdk/google": "^1.1.16",
|
|
54
54
|
"@ai-sdk/openai": "^1.0.5",
|
|
55
|
-
"@ai-sdk/openai-compatible": "^0.1.
|
|
56
|
-
"@chainfuse/helpers": "^1.1.
|
|
57
|
-
"@chainfuse/types": "^1.6.
|
|
58
|
-
"ai": "^4.1.
|
|
55
|
+
"@ai-sdk/openai-compatible": "^0.1.11",
|
|
56
|
+
"@chainfuse/helpers": "^1.1.7",
|
|
57
|
+
"@chainfuse/types": "^1.6.7",
|
|
58
|
+
"ai": "^4.1.44",
|
|
59
59
|
"chalk": "^5.4.1",
|
|
60
60
|
"haversine-distance": "^1.2.3",
|
|
61
61
|
"workers-ai-provider": "^0.0.11"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@cloudflare/workers-types": "^4.20250214.0",
|
|
65
|
-
"openai": "^4.85.
|
|
65
|
+
"openai": "^4.85.2"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "4ea3e6aed331ba9832092618ef88fa33cf38ca64"
|
|
68
68
|
}
|