@promptev/context-engine 0.0.1 → 0.0.2
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 +23 -0
- package/dist/cli.js +142 -58
- package/dist/cli.js.map +1 -1
- package/dist/{config-CdlSkKgV.d.ts → config-BODDdXJ7.d.ts} +33 -11
- package/dist/{config-CNnASw5X.d.cts → config-C5RZ00W6.d.cts} +33 -11
- package/dist/express.d.cts +3 -3
- package/dist/express.d.ts +3 -3
- package/dist/fastify.d.cts +3 -3
- package/dist/fastify.d.ts +3 -3
- package/dist/{governance-XFVgtEdV.d.ts → governance-BLPK7NMe.d.ts} +1 -1
- package/dist/{governance-D8g6Wyvb.d.cts → governance-P9pRb4Ol.d.cts} +1 -1
- package/dist/graph/index.cjs +51 -18
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +2 -2
- package/dist/graph/index.d.ts +2 -2
- package/dist/graph/index.js +51 -18
- package/dist/graph/index.js.map +1 -1
- package/dist/hono.d.cts +3 -3
- package/dist/hono.d.ts +3 -3
- package/dist/index.cjs +142 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -7
- package/dist/index.d.ts +62 -7
- package/dist/index.js +142 -58
- package/dist/index.js.map +1 -1
- package/dist/{router-Dsv3fv0R.d.cts → router-CiFwC-EN.d.cts} +1 -1
- package/dist/{router-B_DTkQgU.d.ts → router-D8gBzwLd.d.ts} +1 -1
- package/dist/skills/context-engine/SKILL.md +5 -1
- package/dist/{storage-DU1JRno5.d.cts → storage-CJrKgJeJ.d.ts} +5 -2
- package/dist/{storage-Dvt2ZxsV.d.ts → storage-Dvpq2xAC.d.cts} +5 -2
- package/package.json +1 -1
- package/src/skills/context-engine/SKILL.md +5 -1
|
@@ -2,39 +2,51 @@ import { z } from 'zod';
|
|
|
2
2
|
import { R as RedactionPolicy, b as RedactionRuleInit } from './redaction-BqD_DEUQ.js';
|
|
3
3
|
|
|
4
4
|
declare const embeddingSchema: z.ZodObject<{
|
|
5
|
-
provider: z.ZodEnum<["openai", "azure_openai", "gemini", "voyage", "cohere", "custom"]>;
|
|
5
|
+
provider: z.ZodEnum<["openai", "azure_openai", "gemini", "vertex_ai", "voyage", "cohere", "custom"]>;
|
|
6
6
|
model: z.ZodString;
|
|
7
7
|
dim: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
8
8
|
apiKey: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
9
9
|
baseUrl: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
10
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
12
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "voyage" | "cohere";
|
|
13
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "voyage" | "cohere";
|
|
12
14
|
model: string;
|
|
13
15
|
dim: number | null;
|
|
14
16
|
apiKey: string | null;
|
|
15
17
|
baseUrl: string | null;
|
|
18
|
+
project?: string | null | undefined;
|
|
19
|
+
location?: string | null | undefined;
|
|
16
20
|
}, {
|
|
17
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "voyage" | "cohere";
|
|
21
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "voyage" | "cohere";
|
|
18
22
|
model: string;
|
|
19
23
|
dim?: number | null | undefined;
|
|
20
24
|
apiKey?: string | null | undefined;
|
|
21
25
|
baseUrl?: string | null | undefined;
|
|
26
|
+
project?: string | null | undefined;
|
|
27
|
+
location?: string | null | undefined;
|
|
22
28
|
}>;
|
|
23
29
|
declare const llmSchema: z.ZodObject<{
|
|
24
|
-
provider: z.ZodEnum<["anthropic", "openai", "azure_openai", "gemini", "bedrock", "custom"]>;
|
|
30
|
+
provider: z.ZodEnum<["anthropic", "openai", "azure_openai", "gemini", "vertex_ai", "bedrock", "custom"]>;
|
|
25
31
|
model: z.ZodString;
|
|
26
32
|
apiKey: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
27
33
|
baseUrl: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
34
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
36
|
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
37
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
30
38
|
model: string;
|
|
31
39
|
apiKey: string | null;
|
|
32
40
|
baseUrl: string | null;
|
|
41
|
+
project?: string | null | undefined;
|
|
42
|
+
location?: string | null | undefined;
|
|
33
43
|
}, {
|
|
34
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
44
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
35
45
|
model: string;
|
|
36
46
|
apiKey?: string | null | undefined;
|
|
37
47
|
baseUrl?: string | null | undefined;
|
|
48
|
+
project?: string | null | undefined;
|
|
49
|
+
location?: string | null | undefined;
|
|
38
50
|
}>;
|
|
39
51
|
declare const graphSchema: z.ZodObject<{
|
|
40
52
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -43,20 +55,26 @@ declare const graphSchema: z.ZodObject<{
|
|
|
43
55
|
neo4jPassword: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
44
56
|
neo4jDatabase: z.ZodDefault<z.ZodString>;
|
|
45
57
|
extractionLlm: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
46
|
-
provider: z.ZodEnum<["anthropic", "openai", "azure_openai", "gemini", "bedrock", "custom"]>;
|
|
58
|
+
provider: z.ZodEnum<["anthropic", "openai", "azure_openai", "gemini", "vertex_ai", "bedrock", "custom"]>;
|
|
47
59
|
model: z.ZodString;
|
|
48
60
|
apiKey: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
49
61
|
baseUrl: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
62
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
64
|
}, "strip", z.ZodTypeAny, {
|
|
51
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
65
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
52
66
|
model: string;
|
|
53
67
|
apiKey: string | null;
|
|
54
68
|
baseUrl: string | null;
|
|
69
|
+
project?: string | null | undefined;
|
|
70
|
+
location?: string | null | undefined;
|
|
55
71
|
}, {
|
|
56
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
72
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
57
73
|
model: string;
|
|
58
74
|
apiKey?: string | null | undefined;
|
|
59
75
|
baseUrl?: string | null | undefined;
|
|
76
|
+
project?: string | null | undefined;
|
|
77
|
+
location?: string | null | undefined;
|
|
60
78
|
}>>>>;
|
|
61
79
|
}, "strip", z.ZodTypeAny, {
|
|
62
80
|
enabled: boolean;
|
|
@@ -65,10 +83,12 @@ declare const graphSchema: z.ZodObject<{
|
|
|
65
83
|
neo4jPassword: string | null;
|
|
66
84
|
neo4jDatabase: string;
|
|
67
85
|
extractionLlm: {
|
|
68
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
86
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
69
87
|
model: string;
|
|
70
88
|
apiKey: string | null;
|
|
71
89
|
baseUrl: string | null;
|
|
90
|
+
project?: string | null | undefined;
|
|
91
|
+
location?: string | null | undefined;
|
|
72
92
|
} | null;
|
|
73
93
|
}, {
|
|
74
94
|
enabled?: boolean | undefined;
|
|
@@ -77,10 +97,12 @@ declare const graphSchema: z.ZodObject<{
|
|
|
77
97
|
neo4jPassword?: string | null | undefined;
|
|
78
98
|
neo4jDatabase?: string | undefined;
|
|
79
99
|
extractionLlm?: {
|
|
80
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
100
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
81
101
|
model: string;
|
|
82
102
|
apiKey?: string | null | undefined;
|
|
83
103
|
baseUrl?: string | null | undefined;
|
|
104
|
+
project?: string | null | undefined;
|
|
105
|
+
location?: string | null | undefined;
|
|
84
106
|
} | null | undefined;
|
|
85
107
|
}>;
|
|
86
108
|
declare const rerankerSchema: z.ZodObject<{
|
|
@@ -2,39 +2,51 @@ import { z } from 'zod';
|
|
|
2
2
|
import { R as RedactionPolicy, b as RedactionRuleInit } from './redaction-BqD_DEUQ.cjs';
|
|
3
3
|
|
|
4
4
|
declare const embeddingSchema: z.ZodObject<{
|
|
5
|
-
provider: z.ZodEnum<["openai", "azure_openai", "gemini", "voyage", "cohere", "custom"]>;
|
|
5
|
+
provider: z.ZodEnum<["openai", "azure_openai", "gemini", "vertex_ai", "voyage", "cohere", "custom"]>;
|
|
6
6
|
model: z.ZodString;
|
|
7
7
|
dim: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
8
8
|
apiKey: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
9
9
|
baseUrl: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
10
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
12
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "voyage" | "cohere";
|
|
13
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "voyage" | "cohere";
|
|
12
14
|
model: string;
|
|
13
15
|
dim: number | null;
|
|
14
16
|
apiKey: string | null;
|
|
15
17
|
baseUrl: string | null;
|
|
18
|
+
project?: string | null | undefined;
|
|
19
|
+
location?: string | null | undefined;
|
|
16
20
|
}, {
|
|
17
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "voyage" | "cohere";
|
|
21
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "voyage" | "cohere";
|
|
18
22
|
model: string;
|
|
19
23
|
dim?: number | null | undefined;
|
|
20
24
|
apiKey?: string | null | undefined;
|
|
21
25
|
baseUrl?: string | null | undefined;
|
|
26
|
+
project?: string | null | undefined;
|
|
27
|
+
location?: string | null | undefined;
|
|
22
28
|
}>;
|
|
23
29
|
declare const llmSchema: z.ZodObject<{
|
|
24
|
-
provider: z.ZodEnum<["anthropic", "openai", "azure_openai", "gemini", "bedrock", "custom"]>;
|
|
30
|
+
provider: z.ZodEnum<["anthropic", "openai", "azure_openai", "gemini", "vertex_ai", "bedrock", "custom"]>;
|
|
25
31
|
model: z.ZodString;
|
|
26
32
|
apiKey: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
27
33
|
baseUrl: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
34
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
36
|
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
37
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
30
38
|
model: string;
|
|
31
39
|
apiKey: string | null;
|
|
32
40
|
baseUrl: string | null;
|
|
41
|
+
project?: string | null | undefined;
|
|
42
|
+
location?: string | null | undefined;
|
|
33
43
|
}, {
|
|
34
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
44
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
35
45
|
model: string;
|
|
36
46
|
apiKey?: string | null | undefined;
|
|
37
47
|
baseUrl?: string | null | undefined;
|
|
48
|
+
project?: string | null | undefined;
|
|
49
|
+
location?: string | null | undefined;
|
|
38
50
|
}>;
|
|
39
51
|
declare const graphSchema: z.ZodObject<{
|
|
40
52
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -43,20 +55,26 @@ declare const graphSchema: z.ZodObject<{
|
|
|
43
55
|
neo4jPassword: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
44
56
|
neo4jDatabase: z.ZodDefault<z.ZodString>;
|
|
45
57
|
extractionLlm: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
46
|
-
provider: z.ZodEnum<["anthropic", "openai", "azure_openai", "gemini", "bedrock", "custom"]>;
|
|
58
|
+
provider: z.ZodEnum<["anthropic", "openai", "azure_openai", "gemini", "vertex_ai", "bedrock", "custom"]>;
|
|
47
59
|
model: z.ZodString;
|
|
48
60
|
apiKey: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
49
61
|
baseUrl: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
62
|
+
project: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
|
+
location: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
64
|
}, "strip", z.ZodTypeAny, {
|
|
51
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
65
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
52
66
|
model: string;
|
|
53
67
|
apiKey: string | null;
|
|
54
68
|
baseUrl: string | null;
|
|
69
|
+
project?: string | null | undefined;
|
|
70
|
+
location?: string | null | undefined;
|
|
55
71
|
}, {
|
|
56
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
72
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
57
73
|
model: string;
|
|
58
74
|
apiKey?: string | null | undefined;
|
|
59
75
|
baseUrl?: string | null | undefined;
|
|
76
|
+
project?: string | null | undefined;
|
|
77
|
+
location?: string | null | undefined;
|
|
60
78
|
}>>>>;
|
|
61
79
|
}, "strip", z.ZodTypeAny, {
|
|
62
80
|
enabled: boolean;
|
|
@@ -65,10 +83,12 @@ declare const graphSchema: z.ZodObject<{
|
|
|
65
83
|
neo4jPassword: string | null;
|
|
66
84
|
neo4jDatabase: string;
|
|
67
85
|
extractionLlm: {
|
|
68
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
86
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
69
87
|
model: string;
|
|
70
88
|
apiKey: string | null;
|
|
71
89
|
baseUrl: string | null;
|
|
90
|
+
project?: string | null | undefined;
|
|
91
|
+
location?: string | null | undefined;
|
|
72
92
|
} | null;
|
|
73
93
|
}, {
|
|
74
94
|
enabled?: boolean | undefined;
|
|
@@ -77,10 +97,12 @@ declare const graphSchema: z.ZodObject<{
|
|
|
77
97
|
neo4jPassword?: string | null | undefined;
|
|
78
98
|
neo4jDatabase?: string | undefined;
|
|
79
99
|
extractionLlm?: {
|
|
80
|
-
provider: "custom" | "openai" | "azure_openai" | "gemini" | "anthropic" | "bedrock";
|
|
100
|
+
provider: "custom" | "openai" | "azure_openai" | "gemini" | "vertex_ai" | "anthropic" | "bedrock";
|
|
81
101
|
model: string;
|
|
82
102
|
apiKey?: string | null | undefined;
|
|
83
103
|
baseUrl?: string | null | undefined;
|
|
104
|
+
project?: string | null | undefined;
|
|
105
|
+
location?: string | null | undefined;
|
|
84
106
|
} | null | undefined;
|
|
85
107
|
}>;
|
|
86
108
|
declare const rerankerSchema: z.ZodObject<{
|
package/dist/express.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as express from 'express';
|
|
2
2
|
import { IncomingMessage } from 'node:http';
|
|
3
|
-
import { h as handleIngestJson, c as createToolsHandlers } from './router-
|
|
4
|
-
import './governance-
|
|
3
|
+
import { h as handleIngestJson, c as createToolsHandlers } from './router-CiFwC-EN.cjs';
|
|
4
|
+
import './governance-P9pRb4Ol.cjs';
|
|
5
5
|
import 'pg';
|
|
6
|
-
import './config-
|
|
6
|
+
import './config-C5RZ00W6.cjs';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import './redaction-BqD_DEUQ.cjs';
|
|
9
9
|
|
package/dist/express.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as express from 'express';
|
|
2
2
|
import { IncomingMessage } from 'node:http';
|
|
3
|
-
import { h as handleIngestJson, c as createToolsHandlers } from './router-
|
|
4
|
-
import './governance-
|
|
3
|
+
import { h as handleIngestJson, c as createToolsHandlers } from './router-D8gBzwLd.js';
|
|
4
|
+
import './governance-BLPK7NMe.js';
|
|
5
5
|
import 'pg';
|
|
6
|
-
import './config-
|
|
6
|
+
import './config-BODDdXJ7.js';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import './redaction-BqD_DEUQ.js';
|
|
9
9
|
|
package/dist/fastify.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as handleIngestJson, c as createToolsHandlers } from './router-
|
|
2
|
-
import './governance-
|
|
1
|
+
import { h as handleIngestJson, c as createToolsHandlers } from './router-CiFwC-EN.cjs';
|
|
2
|
+
import './governance-P9pRb4Ol.cjs';
|
|
3
3
|
import 'pg';
|
|
4
|
-
import './config-
|
|
4
|
+
import './config-C5RZ00W6.cjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './redaction-BqD_DEUQ.cjs';
|
|
7
7
|
|
package/dist/fastify.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as handleIngestJson, c as createToolsHandlers } from './router-
|
|
2
|
-
import './governance-
|
|
1
|
+
import { h as handleIngestJson, c as createToolsHandlers } from './router-D8gBzwLd.js';
|
|
2
|
+
import './governance-BLPK7NMe.js';
|
|
3
3
|
import 'pg';
|
|
4
|
-
import './config-
|
|
4
|
+
import './config-BODDdXJ7.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './redaction-BqD_DEUQ.js';
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pool } from 'pg';
|
|
2
|
-
import { C as ContextEngineConfig } from './config-
|
|
2
|
+
import { C as ContextEngineConfig } from './config-BODDdXJ7.js';
|
|
3
3
|
import { H as Hooks } from './redaction-BqD_DEUQ.js';
|
|
4
4
|
|
|
5
5
|
type ToolKind = "http" | "db" | "mcp" | "function";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pool } from 'pg';
|
|
2
|
-
import { C as ContextEngineConfig } from './config-
|
|
2
|
+
import { C as ContextEngineConfig } from './config-C5RZ00W6.cjs';
|
|
3
3
|
import { H as Hooks } from './redaction-BqD_DEUQ.cjs';
|
|
4
4
|
|
|
5
5
|
type ToolKind = "http" | "db" | "mcp" | "function";
|
package/dist/graph/index.cjs
CHANGED
|
@@ -65,6 +65,47 @@ var init_hooks = __esm({
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
+
// src/providers/google.ts
|
|
69
|
+
async function buildGenaiClient(cfg, timeoutMs, purpose) {
|
|
70
|
+
const specifier = "@google/genai";
|
|
71
|
+
let mod;
|
|
72
|
+
try {
|
|
73
|
+
mod = await import(specifier);
|
|
74
|
+
} catch {
|
|
75
|
+
throw new ExtraMissingError("gemini", specifier, purpose);
|
|
76
|
+
}
|
|
77
|
+
const Ctor = mod.GoogleGenAI ?? mod.Client;
|
|
78
|
+
if (!Ctor) {
|
|
79
|
+
throw new ExtraMissingError("gemini", specifier, purpose);
|
|
80
|
+
}
|
|
81
|
+
const opts = { httpOptions: { timeout: timeoutMs } };
|
|
82
|
+
if (cfg.provider === "vertex_ai") {
|
|
83
|
+
opts.vertexai = true;
|
|
84
|
+
if (cfg.project || cfg.location) {
|
|
85
|
+
if (cfg.project) opts.project = cfg.project;
|
|
86
|
+
if (cfg.location) opts.location = cfg.location;
|
|
87
|
+
} else if (cfg.apiKey) {
|
|
88
|
+
opts.apiKey = cfg.apiKey;
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
opts.apiKey = cfg.apiKey ?? null;
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
return new Ctor(opts);
|
|
95
|
+
} catch (err) {
|
|
96
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
97
|
+
if (!message.includes("Authentication is not set up")) throw err;
|
|
98
|
+
throw new Error(
|
|
99
|
+
`${message} Set \`project\` on the provider config, or export GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION. Credentials themselves come from Application Default Credentials.`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
var init_google = __esm({
|
|
104
|
+
"src/providers/google.ts"() {
|
|
105
|
+
init_errors();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
68
109
|
// src/providers/llm.ts
|
|
69
110
|
var llm_exports = {};
|
|
70
111
|
__export(llm_exports, {
|
|
@@ -100,20 +141,6 @@ function buildOpenAIChatClient(cfg) {
|
|
|
100
141
|
maxRetries: 0
|
|
101
142
|
});
|
|
102
143
|
}
|
|
103
|
-
async function loadGeminiChatClient(apiKey) {
|
|
104
|
-
const specifier = "@google/genai";
|
|
105
|
-
let mod;
|
|
106
|
-
try {
|
|
107
|
-
mod = await import(specifier);
|
|
108
|
-
} catch {
|
|
109
|
-
throw new ExtraMissingError("gemini", specifier, "gemini llm");
|
|
110
|
-
}
|
|
111
|
-
const Ctor = mod.GoogleGenAI ?? mod.Client;
|
|
112
|
-
if (!Ctor) {
|
|
113
|
-
throw new ExtraMissingError("gemini", specifier, "gemini llm");
|
|
114
|
-
}
|
|
115
|
-
return new Ctor({ apiKey: apiKey ?? null, httpOptions: { timeout: GEMINI_CALL_TIMEOUT_MS } });
|
|
116
|
-
}
|
|
117
144
|
async function loadBedrockSdk() {
|
|
118
145
|
const specifier = "@aws-sdk/client-bedrock-runtime";
|
|
119
146
|
try {
|
|
@@ -132,7 +159,7 @@ function buildLlmClient(cfg, opts) {
|
|
|
132
159
|
if (OPENAI_FAMILY.has(cfg.provider)) {
|
|
133
160
|
return new LLMClient(cfg, { client: buildOpenAIChatClient(cfg) });
|
|
134
161
|
}
|
|
135
|
-
if (cfg.provider
|
|
162
|
+
if (GOOGLE_FAMILY.has(cfg.provider) || cfg.provider === "bedrock") {
|
|
136
163
|
return new LLMClient(cfg);
|
|
137
164
|
}
|
|
138
165
|
throw new Error(`unknown llm provider: ${JSON.stringify(cfg.provider)}`);
|
|
@@ -149,16 +176,18 @@ async function callLlm(cfg, opts) {
|
|
|
149
176
|
await owned.aclose();
|
|
150
177
|
}
|
|
151
178
|
}
|
|
152
|
-
var CALL_TIMEOUT_MS, TIMEOUT_MS, GEMINI_CALL_TIMEOUT_MS, ANTHROPIC_VERSION, ANTHROPIC_MAX_TOKENS, OPENAI_FAMILY, LLMClient;
|
|
179
|
+
var CALL_TIMEOUT_MS, TIMEOUT_MS, GEMINI_CALL_TIMEOUT_MS, ANTHROPIC_VERSION, ANTHROPIC_MAX_TOKENS, OPENAI_FAMILY, GOOGLE_FAMILY, LLMClient;
|
|
153
180
|
var init_llm = __esm({
|
|
154
181
|
"src/providers/llm.ts"() {
|
|
155
182
|
init_errors();
|
|
183
|
+
init_google();
|
|
156
184
|
CALL_TIMEOUT_MS = 24e4;
|
|
157
185
|
TIMEOUT_MS = CALL_TIMEOUT_MS;
|
|
158
186
|
GEMINI_CALL_TIMEOUT_MS = CALL_TIMEOUT_MS;
|
|
159
187
|
ANTHROPIC_VERSION = "2023-06-01";
|
|
160
188
|
ANTHROPIC_MAX_TOKENS = 4096;
|
|
161
189
|
OPENAI_FAMILY = /* @__PURE__ */ new Set(["openai", "azure_openai", "custom"]);
|
|
190
|
+
GOOGLE_FAMILY = /* @__PURE__ */ new Set(["gemini", "vertex_ai"]);
|
|
162
191
|
LLMClient = class {
|
|
163
192
|
cfg;
|
|
164
193
|
provider;
|
|
@@ -198,7 +227,7 @@ var init_llm = __esm({
|
|
|
198
227
|
if (OPENAI_FAMILY.has(this.provider)) {
|
|
199
228
|
return this.callOpenAI(system, user, jsonMode, images, maxTokens, temperature);
|
|
200
229
|
}
|
|
201
|
-
if (this.provider
|
|
230
|
+
if (GOOGLE_FAMILY.has(this.provider)) {
|
|
202
231
|
return this.callGemini(system, user, jsonMode, images, maxTokens, thinkingBudget, temperature);
|
|
203
232
|
}
|
|
204
233
|
if (this.provider === "bedrock") {
|
|
@@ -281,7 +310,11 @@ Respond with valid JSON only.`;
|
|
|
281
310
|
}
|
|
282
311
|
async callGemini(system, user, jsonMode, images, maxTokens, thinkingBudget = null, temperature = null) {
|
|
283
312
|
if (!this.genaiClient) {
|
|
284
|
-
this.genaiClient = await
|
|
313
|
+
this.genaiClient = await buildGenaiClient(
|
|
314
|
+
this.cfg,
|
|
315
|
+
GEMINI_CALL_TIMEOUT_MS,
|
|
316
|
+
"gemini llm"
|
|
317
|
+
);
|
|
285
318
|
}
|
|
286
319
|
const parts = [];
|
|
287
320
|
for (const img of images ?? []) {
|