@dremio/js-sdk 0.36.1 → 0.36.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/dist/cloud/Dremio.d.ts +1 -1
- package/dist/cloud/Dremio.js +1 -1
- package/dist/cloud/Dremio.js.map +1 -1
- package/dist/cloud/ai/AIResource.d.ts +120 -5
- package/dist/cloud/ai/AIResource.js +12 -13
- package/dist/cloud/ai/AIResource.js.map +1 -1
- package/dist/cloud/ai/DremioModelProvider.d.ts +4 -3
- package/dist/cloud/ai/DremioModelProvider.js +10 -1
- package/dist/cloud/ai/DremioModelProvider.js.map +1 -1
- package/dist/cloud/ai/modelProviderCodec.d.ts +11 -64
- package/dist/cloud/ai/modelProviderCodec.js +3 -0
- package/dist/cloud/ai/modelProviderCodec.js.map +1 -1
- package/dist/enterprise/ai/AIResource.d.ts +4 -3
- package/dist/enterprise/ai/AIResource.js +18 -11
- package/dist/enterprise/ai/AIResource.js.map +1 -1
- package/dist/enterprise/ai/ModelProvider.d.ts +2 -64
- package/dist/enterprise/ai/modelProviderCodec.d.ts +6 -192
- package/dist/enterprise/ai/modelProviderConfigSchemas.d.ts +42 -193
- package/dist/enterprise/ai/modelProviderConfigSchemas.js +10 -33
- package/dist/enterprise/ai/modelProviderConfigSchemas.js.map +1 -1
- package/package.json +1 -1
package/dist/cloud/Dremio.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { OAuthApplicationsResource } from "./oauth/OAuthApplicationsResource.ts"
|
|
|
13
13
|
import { CloudsResource } from "./clouds/CloudsResource.js";
|
|
14
14
|
import { UsersResource } from "./users/UsersResource.js";
|
|
15
15
|
import { EngineRulesResource } from "./engineRules/EngineRulesResource.ts";
|
|
16
|
-
import { AIResource } from "../
|
|
16
|
+
import { AIResource } from "../cloud/ai/AIResource.js";
|
|
17
17
|
export declare class Dremio {
|
|
18
18
|
#private;
|
|
19
19
|
readonly ai: (projectId?: string) => AIResource;
|
package/dist/cloud/Dremio.js
CHANGED
|
@@ -29,7 +29,7 @@ import { OAuthApplicationsResource } from "./oauth/OAuthApplicationsResource.js"
|
|
|
29
29
|
import { CloudsResource } from "./clouds/CloudsResource.js";
|
|
30
30
|
import { UsersResource } from "./users/UsersResource.js";
|
|
31
31
|
import { EngineRulesResource } from "./engineRules/EngineRulesResource.js";
|
|
32
|
-
import { AIResource } from "../
|
|
32
|
+
import { AIResource } from "../cloud/ai/AIResource.js";
|
|
33
33
|
export class Dremio {
|
|
34
34
|
ai;
|
|
35
35
|
arctic;
|
package/dist/cloud/Dremio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dremio.js","sourceRoot":"","sources":["../../src/cloud/Dremio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAA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AI,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CACzE,CAAC;QACF,IAAI,CAAC,iBAAiB,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CACxB,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAC1E,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAC1B,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CACtF,CAAC;QACF,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,OAAO,CACtB,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CACxE,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CACxB,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAC/E,CAAC;IACJ,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport moize from \"moize\";\nimport type { Config } from \"../common/Config.ts\";\nimport { EnterpriseCatalogResource } from \"./catalog/EnterpriseCatalogResource.js\";\nimport { RolesResource } from \"../enterprise/roles/RolesResource.js\";\nimport { EnterpriseScriptsResource } from \"../enterprise/scripts/EnterpriseScriptsResource.js\";\nimport { SqlResource } from \"../oss/sql/SqlResource.js\";\nimport { ArcticResource } from \"./arctic/ArcticResource.js\";\nimport { EnginesResource } from \"./engines/EnginesResource.js\";\nimport { getResourceConfig } from \"./getResourceConfig.js\";\nimport { OrganizationsResource } from \"./organizations/OrganizationsResource.js\";\nimport { ProjectsResource } from \"./projects/ProjectsResource.js\";\nimport { CloudUsersResource } from \"./users/CloudUsersResource.js\";\nimport { JobsResource } from \"../oss/jobs/JobsResource.ts\";\nimport { OAuthApplicationsResource } from \"./oauth/OAuthApplicationsResource.ts\";\nimport { CloudsResource } from \"./clouds/CloudsResource.js\";\nimport { UsersResource } from \"./users/UsersResource.js\";\nimport { EngineRulesResource } from \"./engineRules/EngineRulesResource.ts\";\nimport { AIResource } from \"../cloud/ai/AIResource.js\";\n\nexport class Dremio {\n readonly ai: (projectId?: string) => AIResource;\n readonly arctic: (projectId: string) => ArcticResource;\n readonly catalog: (projectId: string) => EnterpriseCatalogResource;\n readonly clouds: CloudsResource;\n readonly engines: (projectId: string) => EnginesResource;\n readonly engineRules: (projectId: string) => EngineRulesResource;\n readonly jobs: (projectId: string) => JobsResource;\n readonly oauthApplications: OAuthApplicationsResource;\n readonly organizations: OrganizationsResource;\n readonly projects: ProjectsResource;\n readonly roles: (projectId: string) => RolesResource;\n readonly scripts: (projectId: string) => EnterpriseScriptsResource;\n readonly sql: (projectId: string) => SqlResource;\n readonly _users: UsersResource;\n readonly users: (projectId: string) => CloudUsersResource;\n readonly #resourceConfig: ReturnType<typeof getResourceConfig>;\n\n constructor(config: Config) {\n this.#resourceConfig = getResourceConfig(config);\n this.ai = (projectId) => new AIResource(this.#resourceConfig(projectId));\n this.arctic = moize.default(\n (projectId: string) => new ArcticResource(this.#resourceConfig(projectId)),\n );\n this.catalog = moize.default(\n (projectId: string) => new EnterpriseCatalogResource(this.#resourceConfig(projectId)),\n );\n this.clouds = new CloudsResource(this.#resourceConfig());\n this.engines = moize.default(\n (projectId: string) => new EnginesResource(this.#resourceConfig(projectId)),\n );\n this.engineRules = moize.default(\n (projectId: string) => new EngineRulesResource(this.#resourceConfig(projectId)),\n );\n this.jobs = moize.default(\n (projectId: string) => new JobsResource(this.#resourceConfig(projectId)),\n );\n this.oauthApplications = new OAuthApplicationsResource(this.#resourceConfig());\n this.organizations = new OrganizationsResource(this.#resourceConfig());\n this.projects = new ProjectsResource(this.#resourceConfig());\n this.roles = moize.default(\n (projectId: string) => new RolesResource(this.#resourceConfig(projectId)),\n );\n this.scripts = moize.default(\n (projectId: string) => new EnterpriseScriptsResource(this.#resourceConfig(projectId)),\n );\n this.sql = moize.default(\n (projectId: string) => new SqlResource(this.#resourceConfig(projectId)),\n );\n this._users = new UsersResource(this.#resourceConfig());\n this.users = moize.default(\n (projectId: string) => new CloudUsersResource(this.#resourceConfig(projectId)),\n );\n }\n\n get _resourceConfig() {\n return this.#resourceConfig;\n }\n}\n"]}
|
|
@@ -6,6 +6,8 @@ import { ModelProvider } from "../../enterprise/ai/ModelProvider.ts";
|
|
|
6
6
|
import * as z from "zod/mini";
|
|
7
7
|
import { modelProviderCreateCodec } from "./modelProviderCodec.js";
|
|
8
8
|
import { DremioModelProvider } from "./DremioModelProvider.ts";
|
|
9
|
+
import { listAvailableModels } from "../../enterprise/ai/AIResource.ts";
|
|
10
|
+
import type { SignalParam } from "../../common/Params.ts";
|
|
9
11
|
export declare class AIResource {
|
|
10
12
|
#private;
|
|
11
13
|
constructor(config: Logger & V4Config & SonarV4Config);
|
|
@@ -26,7 +28,7 @@ export declare class AIResource {
|
|
|
26
28
|
accessKeyId: string;
|
|
27
29
|
};
|
|
28
30
|
};
|
|
29
|
-
region:
|
|
31
|
+
region: string;
|
|
30
32
|
};
|
|
31
33
|
} | {
|
|
32
34
|
anthropic: Record<string, never>;
|
|
@@ -56,16 +58,126 @@ export declare class AIResource {
|
|
|
56
58
|
config: {
|
|
57
59
|
dremioProvided: Record<string, never>;
|
|
58
60
|
};
|
|
61
|
+
defaultModelName: string;
|
|
59
62
|
id: string;
|
|
60
63
|
isDefault: boolean;
|
|
61
64
|
name: string;
|
|
65
|
+
sqlModelNames: string[];
|
|
66
|
+
tag: string;
|
|
62
67
|
}> | undefined>;
|
|
63
68
|
listModelProviders(): {
|
|
64
|
-
data(): AsyncGenerator<ModelProvider | DremioModelProvider
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
data(): AsyncGenerator<import("ts-results-es").Ok<ModelProvider | DremioModelProvider> | import("ts-results-es").Err<z.core.$ZodError<{
|
|
70
|
+
name: string;
|
|
71
|
+
id: string;
|
|
72
|
+
tag: string;
|
|
73
|
+
createdBy: string;
|
|
74
|
+
modifiedBy: string;
|
|
75
|
+
config: {
|
|
76
|
+
amazonBedrock: {
|
|
77
|
+
auth: {
|
|
78
|
+
role: {
|
|
79
|
+
roleArn: string;
|
|
80
|
+
};
|
|
81
|
+
} | {
|
|
82
|
+
accessKey: {
|
|
83
|
+
accessKeyId: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
region: string;
|
|
87
|
+
};
|
|
88
|
+
} | {
|
|
89
|
+
anthropic: Record<string, never>;
|
|
90
|
+
} | {
|
|
91
|
+
azureOpenAi: {
|
|
92
|
+
auth: {
|
|
93
|
+
clientSecretAuth: {
|
|
94
|
+
azureClientId: string;
|
|
95
|
+
azureTenantId: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
resourceName: string;
|
|
99
|
+
};
|
|
100
|
+
} | {
|
|
101
|
+
googleGemini: Record<string, never>;
|
|
102
|
+
} | {
|
|
103
|
+
openAi: {
|
|
104
|
+
organizationId: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
defaultModelName: string;
|
|
108
|
+
isDefault: boolean;
|
|
109
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
110
|
+
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
111
|
+
sqlModelNames: Set<string>;
|
|
112
|
+
} | {
|
|
113
|
+
config: {
|
|
114
|
+
dremioProvided: Record<string, never>;
|
|
115
|
+
};
|
|
116
|
+
defaultModelName: string;
|
|
117
|
+
id: string;
|
|
118
|
+
isDefault: boolean;
|
|
119
|
+
name: string;
|
|
120
|
+
sqlModelNames: string[];
|
|
121
|
+
tag: string;
|
|
122
|
+
}>>, void, unknown>;
|
|
123
|
+
getPage: ({ signal }?: SignalParam) => import("ts-results-es").AsyncResult<{
|
|
124
|
+
data: (import("ts-results-es").Ok<ModelProvider | DremioModelProvider> | import("ts-results-es").Err<z.core.$ZodError<{
|
|
125
|
+
name: string;
|
|
126
|
+
id: string;
|
|
127
|
+
tag: string;
|
|
128
|
+
createdBy: string;
|
|
129
|
+
modifiedBy: string;
|
|
130
|
+
config: {
|
|
131
|
+
amazonBedrock: {
|
|
132
|
+
auth: {
|
|
133
|
+
role: {
|
|
134
|
+
roleArn: string;
|
|
135
|
+
};
|
|
136
|
+
} | {
|
|
137
|
+
accessKey: {
|
|
138
|
+
accessKeyId: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
region: string;
|
|
142
|
+
};
|
|
143
|
+
} | {
|
|
144
|
+
anthropic: Record<string, never>;
|
|
145
|
+
} | {
|
|
146
|
+
azureOpenAi: {
|
|
147
|
+
auth: {
|
|
148
|
+
clientSecretAuth: {
|
|
149
|
+
azureClientId: string;
|
|
150
|
+
azureTenantId: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
resourceName: string;
|
|
154
|
+
};
|
|
155
|
+
} | {
|
|
156
|
+
googleGemini: Record<string, never>;
|
|
157
|
+
} | {
|
|
158
|
+
openAi: {
|
|
159
|
+
organizationId: string;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
defaultModelName: string;
|
|
163
|
+
isDefault: boolean;
|
|
164
|
+
createdAt: import("temporal-polyfill").Temporal.Instant;
|
|
165
|
+
modifiedAt: import("temporal-polyfill").Temporal.Instant;
|
|
166
|
+
sqlModelNames: Set<string>;
|
|
167
|
+
} | {
|
|
168
|
+
config: {
|
|
169
|
+
dremioProvided: Record<string, never>;
|
|
170
|
+
};
|
|
171
|
+
defaultModelName: string;
|
|
172
|
+
id: string;
|
|
173
|
+
isDefault: boolean;
|
|
174
|
+
name: string;
|
|
175
|
+
sqlModelNames: string[];
|
|
176
|
+
tag: string;
|
|
177
|
+
}>>)[];
|
|
67
178
|
}, import("../index.ts").HttpError>;
|
|
68
179
|
};
|
|
180
|
+
listAvailableModels(...args: Parameters<ReturnType<typeof listAvailableModels>>): import("ts-results-es").AsyncResult<Set<string>, import("../index.ts").HttpError>;
|
|
69
181
|
retrieveModelProvider(id: string): import("ts-results-es").AsyncResult<ModelProvider | DremioModelProvider, import("../index.ts").HttpError | z.core.$ZodError<{
|
|
70
182
|
name: string;
|
|
71
183
|
id: string;
|
|
@@ -83,7 +195,7 @@ export declare class AIResource {
|
|
|
83
195
|
accessKeyId: string;
|
|
84
196
|
};
|
|
85
197
|
};
|
|
86
|
-
region:
|
|
198
|
+
region: string;
|
|
87
199
|
};
|
|
88
200
|
} | {
|
|
89
201
|
anthropic: Record<string, never>;
|
|
@@ -113,9 +225,12 @@ export declare class AIResource {
|
|
|
113
225
|
config: {
|
|
114
226
|
dremioProvided: Record<string, never>;
|
|
115
227
|
};
|
|
228
|
+
defaultModelName: string;
|
|
116
229
|
id: string;
|
|
117
230
|
isDefault: boolean;
|
|
118
231
|
name: string;
|
|
232
|
+
sqlModelNames: string[];
|
|
233
|
+
tag: string;
|
|
119
234
|
}> | undefined>;
|
|
120
235
|
/**
|
|
121
236
|
* Sends a chat message to the Dremio AI Agent and returns an Observable containing
|
|
@@ -22,6 +22,8 @@ import * as z from "zod/mini";
|
|
|
22
22
|
import { dremioProvidedSchema, modelProviderCreateCodec, modelProviderRetrieveCodec, safeDecodeModelProvider, } from "./modelProviderCodec.js";
|
|
23
23
|
import { modelProviderRetrieveCodec as baseModelProviderRetrieveCodec } from "../../enterprise/ai/modelProviderCodec.js";
|
|
24
24
|
import { DremioModelProvider } from "./DremioModelProvider.js";
|
|
25
|
+
import { safeParseResultToResult } from "../../common/safeParseResultToResult.js";
|
|
26
|
+
import { listAvailableModels } from "../../enterprise/ai/AIResource.js";
|
|
25
27
|
export class AIResource {
|
|
26
28
|
#config;
|
|
27
29
|
constructor(config) {
|
|
@@ -43,28 +45,22 @@ export class AIResource {
|
|
|
43
45
|
.andThen((entity) => safeDecodeModelProvider(this.#config, entity));
|
|
44
46
|
}
|
|
45
47
|
listModelProviders() {
|
|
46
|
-
const getPage = () => {
|
|
48
|
+
const getPage = ({ signal } = {}) => {
|
|
47
49
|
return this.#config
|
|
48
50
|
.v4Request("model-provider/config", {
|
|
49
51
|
headers: {
|
|
50
52
|
Accept: "application/json",
|
|
51
53
|
},
|
|
54
|
+
signal,
|
|
52
55
|
})
|
|
53
56
|
.map((res) => res.json())
|
|
54
57
|
.map((response) => ({
|
|
55
|
-
data: response.configs.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.#config.logger?.error(new Error(`Failed to parse model provider`, { cause: parseResult.error }));
|
|
58
|
+
data: response.configs.map((entity) => safeParseResultToResult(z.safeDecode(modelProviderRetrieveCodec, entity)).map((properties) => {
|
|
59
|
+
if ("dremioProvided" in properties.config) {
|
|
60
|
+
return new DremioModelProvider(this.#config, properties);
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
accum.push(new DremioModelProvider(this.#config, parseResult.data));
|
|
63
|
-
}
|
|
64
|
-
accum.push(new ModelProvider(this.#config, parseResult.data));
|
|
65
|
-
}
|
|
66
|
-
return accum;
|
|
67
|
-
}, []),
|
|
62
|
+
return new ModelProvider(this.#config, properties);
|
|
63
|
+
})),
|
|
68
64
|
}));
|
|
69
65
|
};
|
|
70
66
|
return {
|
|
@@ -74,6 +70,9 @@ export class AIResource {
|
|
|
74
70
|
getPage,
|
|
75
71
|
};
|
|
76
72
|
}
|
|
73
|
+
listAvailableModels(...args) {
|
|
74
|
+
return listAvailableModels(this.#config)(...args);
|
|
75
|
+
}
|
|
77
76
|
retrieveModelProvider(id) {
|
|
78
77
|
return this.#config
|
|
79
78
|
.v4Request(`model-provider/config/${id}`, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIResource.js","sourceRoot":"","sources":["../../../src/cloud/ai/AIResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,GAExB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,0BAA0B,IAAI,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AACzH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"AIResource.js","sourceRoot":"","sources":["../../../src/cloud/ai/AIResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;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,CAAC,CAAC,CAAC,CAAC;IAC/E,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { map } from \"rxjs\";\nimport { ChatSession } from \"../../enterprise/ai/chat/ChatSession.ts\";\nimport type { UserChatMessage } from \"../../enterprise/ai/chat/UserChatMessage.ts\";\nimport { AgentChatResponse } from \"../../enterprise/ai/chat/AgentChatResponse.ts\";\nimport type { Logger, SonarV4Config, V4Config } from \"../../common/Config.ts\";\nimport { fromTextEventStream } from \"../../common/fromTextEventStream.ts\";\nimport { ModelProvider } from \"../../enterprise/ai/ModelProvider.ts\";\nimport * as z from \"zod/mini\";\nimport {\n dremioProvidedSchema,\n modelProviderCreateCodec,\n modelProviderRetrieveCodec,\n safeDecodeModelProvider,\n type SafeDecodeResultWithoutDremioLLM,\n} from \"./modelProviderCodec.js\";\nimport { modelProviderRetrieveCodec as baseModelProviderRetrieveCodec } from \"../../enterprise/ai/modelProviderCodec.ts\";\nimport { DremioModelProvider } from \"./DremioModelProvider.ts\";\nimport { safeParseResultToResult } from \"../../common/safeParseResultToResult.ts\";\nimport { listAvailableModels } from \"../../enterprise/ai/AIResource.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport class AIResource {\n #config: Logger & V4Config & SonarV4Config;\n\n constructor(config: Logger & V4Config & SonarV4Config) {\n this.#config = config;\n }\n\n createModelProvider(properties: z.output<typeof modelProviderCreateCodec>) {\n const body = z.encode(modelProviderCreateCodec, properties);\n return this.#config\n .v4Request(`model-provider/config`, {\n body: JSON.stringify(body),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"POST\",\n })\n .map((res) => res.json() as Promise<z.input<typeof modelProviderRetrieveCodec>>)\n .andThen(\n (entity) =>\n safeDecodeModelProvider(this.#config, entity) as SafeDecodeResultWithoutDremioLLM,\n );\n }\n\n listModelProviders() {\n const getPage = ({ signal }: SignalParam = {}) => {\n return this.#config\n .v4Request(\"model-provider/config\", {\n headers: {\n Accept: \"application/json\",\n },\n signal,\n })\n .map(\n (res) => res.json() as Promise<{ configs: z.input<typeof modelProviderRetrieveCodec>[] }>,\n )\n .map((response) => ({\n data: response.configs.map((entity) =>\n safeParseResultToResult(z.safeDecode(modelProviderRetrieveCodec, entity)).map(\n (properties) => {\n if (\"dremioProvided\" in properties.config) {\n return new DremioModelProvider(\n this.#config,\n properties as z.infer<typeof dremioProvidedSchema>,\n );\n }\n return new ModelProvider(\n this.#config,\n properties as z.output<typeof baseModelProviderRetrieveCodec>,\n );\n },\n ),\n ),\n }));\n };\n return {\n async *data() {\n yield* (await getPage().promise).map((response) => response.data).unwrap();\n },\n getPage,\n };\n }\n\n listAvailableModels(...args: Parameters<ReturnType<typeof listAvailableModels>>) {\n return listAvailableModels(this.#config)(...args);\n }\n\n retrieveModelProvider(id: string) {\n return this.#config\n .v4Request(`model-provider/config/${id}`, {\n headers: {\n Accept: \"application/json\",\n },\n })\n .map((res) => res.json() as Promise<z.input<typeof modelProviderRetrieveCodec>>)\n .andThen((entity) => safeDecodeModelProvider(this.#config, entity));\n }\n\n /**\n * Sends a chat message to the Dremio AI Agent and returns an Observable containing\n * Agent replies.\n */\n sendChatMessage(chatSession: ChatSession) {\n return (chatMessage: UserChatMessage) =>\n fromTextEventStream(({ signal }) =>\n this.#config\n .sonarV4Request(\"agent\", {\n body: JSON.stringify({\n message: chatMessage.toString(),\n sessionId: chatSession.sessionId,\n } satisfies {\n message: string;\n modelProviderId?: string;\n sessionId?: string;\n }),\n headers: {\n Accept: \"text/event-stream\",\n \"Content-Type\": \"application/json\",\n },\n method: \"POST\",\n signal,\n })\n .promise.then((result) => {\n if (result.isErr()) {\n throw result.error;\n }\n return result.value;\n }),\n ).pipe(map((event) => AgentChatResponse.fromJSON(JSON.parse(event.data))));\n }\n}\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as z from "zod/mini";
|
|
2
2
|
import type { V4Config } from "../../common/Config.ts";
|
|
3
3
|
import { dremioProvidedSchema } from "./modelProviderCodec.js";
|
|
4
|
+
type DremioProviderConstructorProperties = z.infer<typeof dremioProvidedSchema>;
|
|
4
5
|
export declare class DremioModelProvider implements DremioModelProviderProperties {
|
|
5
6
|
#private;
|
|
6
|
-
id:
|
|
7
|
-
isDefault:
|
|
8
|
-
constructor(config: V4Config, properties:
|
|
7
|
+
readonly id: DremioProviderConstructorProperties["id"];
|
|
8
|
+
readonly isDefault: DremioProviderConstructorProperties["isDefault"];
|
|
9
|
+
constructor(config: V4Config, properties: DremioProviderConstructorProperties);
|
|
9
10
|
setDefault(): import("ts-results-es").AsyncResult<DremioModelProvider, import("../index.ts").HttpError>;
|
|
10
11
|
}
|
|
11
12
|
type DremioModelProviderProperties = Pick<z.infer<typeof dremioProvidedSchema>, "id" | "isDefault">;
|
|
@@ -18,11 +18,17 @@ import { dremioProvidedSchema } from "./modelProviderCodec.js";
|
|
|
18
18
|
export class DremioModelProvider {
|
|
19
19
|
id;
|
|
20
20
|
isDefault;
|
|
21
|
+
#defaultModelName;
|
|
22
|
+
#sqlModelNames;
|
|
23
|
+
#tag;
|
|
21
24
|
#config;
|
|
22
25
|
constructor(config, properties) {
|
|
26
|
+
this.#defaultModelName = properties.defaultModelName;
|
|
23
27
|
this.id = properties.id;
|
|
24
28
|
this.isDefault = properties.isDefault;
|
|
25
29
|
this.#config = config;
|
|
30
|
+
this.#sqlModelNames = properties.sqlModelNames;
|
|
31
|
+
this.#tag = properties.tag;
|
|
26
32
|
}
|
|
27
33
|
setDefault() {
|
|
28
34
|
return this.#config
|
|
@@ -31,16 +37,19 @@ export class DremioModelProvider {
|
|
|
31
37
|
config: {
|
|
32
38
|
dremioProvided: {},
|
|
33
39
|
},
|
|
40
|
+
defaultModelName: this.#defaultModelName,
|
|
34
41
|
id: this.id,
|
|
35
42
|
isDefault: true,
|
|
36
43
|
name: "Dremio",
|
|
44
|
+
sqlModelNames: this.#sqlModelNames,
|
|
45
|
+
tag: this.#tag,
|
|
37
46
|
}),
|
|
38
47
|
headers: {
|
|
39
48
|
Accept: "application/json",
|
|
40
49
|
"Content-Type": "application/json",
|
|
41
50
|
},
|
|
42
51
|
keepalive: true,
|
|
43
|
-
method: "
|
|
52
|
+
method: "PUT",
|
|
44
53
|
})
|
|
45
54
|
.map((res) => res.json())
|
|
46
55
|
.map((entity) => new DremioModelProvider(this.#config, z.parse(dremioProvidedSchema, entity)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DremioModelProvider.js","sourceRoot":"","sources":["../../../src/cloud/ai/DremioModelProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"DremioModelProvider.js","sourceRoot":"","sources":["../../../src/cloud/ai/DremioModelProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,MAAM,OAAO,mBAAmB;IACrB,EAAE,CAA4C;IAC9C,SAAS,CAAmD;IAC5D,iBAAiB,CAA0D;IAC3E,cAAc,CAAuD;IACrE,IAAI,CAA6C;IAE1D,OAAO,CAAW;IAElB,YAAY,MAAgB,EAAE,UAA+C;QAC3E,IAAI,CAAC,iBAAiB,GAAG,UAAU,CAAC,gBAAgB,CAAC;QACrD,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QAEtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC;IAC7B,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,yBAAyB,IAAI,CAAC,EAAE,EAAE,EAAE;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,MAAM,EAAE;oBACN,cAAc,EAAE,EAAE;iBACnB;gBACD,gBAAgB,EAAE,IAAI,CAAC,iBAAiB;gBACxC,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,SAAS,EAAE,IAAI;gBACf,IAAI,EAAE,QAAQ;gBACd,aAAa,EAAE,IAAI,CAAC,cAAc;gBAClC,GAAG,EAAE,IAAI,CAAC,IAAI;aACf,CAAC;YACF,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAmD,CAAC;aACzE,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CACzF,CAAC;IACN,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { V4Config } from \"../../common/Config.ts\";\nimport { dremioProvidedSchema } from \"./modelProviderCodec.js\";\n\ntype DremioProviderConstructorProperties = z.infer<typeof dremioProvidedSchema>;\nexport class DremioModelProvider implements DremioModelProviderProperties {\n readonly id: DremioProviderConstructorProperties[\"id\"];\n readonly isDefault: DremioProviderConstructorProperties[\"isDefault\"];\n readonly #defaultModelName: DremioProviderConstructorProperties[\"defaultModelName\"];\n readonly #sqlModelNames: DremioProviderConstructorProperties[\"sqlModelNames\"];\n readonly #tag: DremioProviderConstructorProperties[\"tag\"];\n\n #config: V4Config;\n\n constructor(config: V4Config, properties: DremioProviderConstructorProperties) {\n this.#defaultModelName = properties.defaultModelName;\n this.id = properties.id;\n this.isDefault = properties.isDefault;\n\n this.#config = config;\n this.#sqlModelNames = properties.sqlModelNames;\n this.#tag = properties.tag;\n }\n\n setDefault() {\n return this.#config\n .v4Request(`model-provider/config/${this.id}`, {\n body: JSON.stringify({\n config: {\n dremioProvided: {},\n },\n defaultModelName: this.#defaultModelName,\n id: this.id,\n isDefault: true,\n name: \"Dremio\",\n sqlModelNames: this.#sqlModelNames,\n tag: this.#tag,\n }),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<z.infer<typeof dremioProvidedSchema>>)\n .map(\n (entity) => new DremioModelProvider(this.#config, z.parse(dremioProvidedSchema, entity)),\n );\n }\n}\n\ntype DremioModelProviderProperties = Pick<z.infer<typeof dremioProvidedSchema>, \"id\" | \"isDefault\">;\n"]}
|
|
@@ -9,9 +9,12 @@ export declare const dremioProvidedSchema: z.ZodMiniObject<{
|
|
|
9
9
|
config: z.ZodMiniObject<{
|
|
10
10
|
dremioProvided: z.ZodMiniObject<Record<never, z.core.SomeType>, z.core.$strip>;
|
|
11
11
|
}, z.core.$strict>;
|
|
12
|
+
defaultModelName: z.ZodMiniString<string>;
|
|
12
13
|
id: z.ZodMiniString<string>;
|
|
13
14
|
isDefault: z.ZodMiniBoolean<boolean>;
|
|
14
15
|
name: z.ZodMiniString<string>;
|
|
16
|
+
sqlModelNames: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
17
|
+
tag: z.ZodMiniString<string>;
|
|
15
18
|
}, z.core.$strip>;
|
|
16
19
|
export declare const modelProviderRetrieveCodec: z.ZodMiniCodec<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
17
20
|
createdAt: z.ZodMiniString<string>;
|
|
@@ -35,38 +38,7 @@ export declare const modelProviderRetrieveCodec: z.ZodMiniCodec<z.ZodMiniUnion<r
|
|
|
35
38
|
roleArn: z.ZodMiniString<string>;
|
|
36
39
|
}, z.core.$strict>;
|
|
37
40
|
}, z.core.$strict>]>;
|
|
38
|
-
region: z.
|
|
39
|
-
"ap-east-2": "ap-east-2";
|
|
40
|
-
"ap-northeast-1": "ap-northeast-1";
|
|
41
|
-
"ap-northeast-2": "ap-northeast-2";
|
|
42
|
-
"ap-northeast-3": "ap-northeast-3";
|
|
43
|
-
"ap-south-1": "ap-south-1";
|
|
44
|
-
"ap-south-2": "ap-south-2";
|
|
45
|
-
"ap-southeast-1": "ap-southeast-1";
|
|
46
|
-
"ap-southeast-2": "ap-southeast-2";
|
|
47
|
-
"ap-southeast-3": "ap-southeast-3";
|
|
48
|
-
"ap-southeast-4": "ap-southeast-4";
|
|
49
|
-
"ap-southeast-5": "ap-southeast-5";
|
|
50
|
-
"ap-southeast-7": "ap-southeast-7";
|
|
51
|
-
"ca-central-1": "ca-central-1";
|
|
52
|
-
"eu-central-1": "eu-central-1";
|
|
53
|
-
"eu-central-2": "eu-central-2";
|
|
54
|
-
"eu-north-1": "eu-north-1";
|
|
55
|
-
"eu-south-1": "eu-south-1";
|
|
56
|
-
"eu-south-2": "eu-south-2";
|
|
57
|
-
"eu-west-1": "eu-west-1";
|
|
58
|
-
"eu-west-2": "eu-west-2";
|
|
59
|
-
"eu-west-3": "eu-west-3";
|
|
60
|
-
"il-central-1": "il-central-1";
|
|
61
|
-
"me-central-1": "me-central-1";
|
|
62
|
-
"sa-east-1": "sa-east-1";
|
|
63
|
-
"us-east-1": "us-east-1";
|
|
64
|
-
"us-east-2": "us-east-2";
|
|
65
|
-
"us-gov-east-1": "us-gov-east-1";
|
|
66
|
-
"us-gov-west-1": "us-gov-west-1";
|
|
67
|
-
"us-west-1": "us-west-1";
|
|
68
|
-
"us-west-2": "us-west-2";
|
|
69
|
-
}>;
|
|
41
|
+
region: z.ZodMiniString<string>;
|
|
70
42
|
}, z.core.$strict>;
|
|
71
43
|
}, z.core.$strict>, z.ZodMiniObject<{
|
|
72
44
|
anthropic: z.ZodMiniObject<{}, z.core.$strict>;
|
|
@@ -91,9 +63,12 @@ export declare const modelProviderRetrieveCodec: z.ZodMiniCodec<z.ZodMiniUnion<r
|
|
|
91
63
|
config: z.ZodMiniObject<{
|
|
92
64
|
dremioProvided: z.ZodMiniObject<Record<never, z.core.SomeType>, z.core.$strip>;
|
|
93
65
|
}, z.core.$strict>;
|
|
66
|
+
defaultModelName: z.ZodMiniString<string>;
|
|
94
67
|
id: z.ZodMiniString<string>;
|
|
95
68
|
isDefault: z.ZodMiniBoolean<boolean>;
|
|
96
69
|
name: z.ZodMiniString<string>;
|
|
70
|
+
sqlModelNames: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
71
|
+
tag: z.ZodMiniString<string>;
|
|
97
72
|
}, z.core.$strip>]>, z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
98
73
|
name: z.ZodMiniString<string>;
|
|
99
74
|
id: z.ZodMiniString<string>;
|
|
@@ -111,38 +86,7 @@ export declare const modelProviderRetrieveCodec: z.ZodMiniCodec<z.ZodMiniUnion<r
|
|
|
111
86
|
roleArn: z.ZodMiniString<string>;
|
|
112
87
|
}, z.core.$strict>;
|
|
113
88
|
}, z.core.$strict>]>;
|
|
114
|
-
region: z.
|
|
115
|
-
"ap-east-2": "ap-east-2";
|
|
116
|
-
"ap-northeast-1": "ap-northeast-1";
|
|
117
|
-
"ap-northeast-2": "ap-northeast-2";
|
|
118
|
-
"ap-northeast-3": "ap-northeast-3";
|
|
119
|
-
"ap-south-1": "ap-south-1";
|
|
120
|
-
"ap-south-2": "ap-south-2";
|
|
121
|
-
"ap-southeast-1": "ap-southeast-1";
|
|
122
|
-
"ap-southeast-2": "ap-southeast-2";
|
|
123
|
-
"ap-southeast-3": "ap-southeast-3";
|
|
124
|
-
"ap-southeast-4": "ap-southeast-4";
|
|
125
|
-
"ap-southeast-5": "ap-southeast-5";
|
|
126
|
-
"ap-southeast-7": "ap-southeast-7";
|
|
127
|
-
"ca-central-1": "ca-central-1";
|
|
128
|
-
"eu-central-1": "eu-central-1";
|
|
129
|
-
"eu-central-2": "eu-central-2";
|
|
130
|
-
"eu-north-1": "eu-north-1";
|
|
131
|
-
"eu-south-1": "eu-south-1";
|
|
132
|
-
"eu-south-2": "eu-south-2";
|
|
133
|
-
"eu-west-1": "eu-west-1";
|
|
134
|
-
"eu-west-2": "eu-west-2";
|
|
135
|
-
"eu-west-3": "eu-west-3";
|
|
136
|
-
"il-central-1": "il-central-1";
|
|
137
|
-
"me-central-1": "me-central-1";
|
|
138
|
-
"sa-east-1": "sa-east-1";
|
|
139
|
-
"us-east-1": "us-east-1";
|
|
140
|
-
"us-east-2": "us-east-2";
|
|
141
|
-
"us-gov-east-1": "us-gov-east-1";
|
|
142
|
-
"us-gov-west-1": "us-gov-west-1";
|
|
143
|
-
"us-west-1": "us-west-1";
|
|
144
|
-
"us-west-2": "us-west-2";
|
|
145
|
-
}>;
|
|
89
|
+
region: z.ZodMiniString<string>;
|
|
146
90
|
}, z.core.$strict>;
|
|
147
91
|
}, z.core.$strict>, z.ZodMiniObject<{
|
|
148
92
|
anthropic: z.ZodMiniObject<{}, z.core.$strict>;
|
|
@@ -172,9 +116,12 @@ export declare const modelProviderRetrieveCodec: z.ZodMiniCodec<z.ZodMiniUnion<r
|
|
|
172
116
|
config: z.ZodMiniObject<{
|
|
173
117
|
dremioProvided: z.ZodMiniObject<Record<never, z.core.SomeType>, z.core.$strip>;
|
|
174
118
|
}, z.core.$strict>;
|
|
119
|
+
defaultModelName: z.ZodMiniString<string>;
|
|
175
120
|
id: z.ZodMiniString<string>;
|
|
176
121
|
isDefault: z.ZodMiniBoolean<boolean>;
|
|
177
122
|
name: z.ZodMiniString<string>;
|
|
123
|
+
sqlModelNames: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
124
|
+
tag: z.ZodMiniString<string>;
|
|
178
125
|
}, z.core.$strip>]>>;
|
|
179
126
|
export declare function safeDecodeModelProvider(config: V4Config, entity: z.input<typeof modelProviderRetrieveCodec>): Result<DremioModelProvider | ModelProvider, z.core.util.SafeParseResult<z.output<typeof modelProviderRetrieveCodec>>["error"]>;
|
|
180
127
|
export type SafeDecodeResultWithoutDremioLLM = Result<ModelProvider, z.core.util.SafeParseResult<z.output<typeof modelProviderRetrieveCodec>>["error"]>;
|
|
@@ -23,9 +23,12 @@ export const dremioProvidedSchema = z.object({
|
|
|
23
23
|
config: z.strictObject({
|
|
24
24
|
dremioProvided: z.object(),
|
|
25
25
|
}),
|
|
26
|
+
defaultModelName: z.string(),
|
|
26
27
|
id: z.string(),
|
|
27
28
|
isDefault: z.boolean(),
|
|
28
29
|
name: z.string(),
|
|
30
|
+
sqlModelNames: z.array(z.string()),
|
|
31
|
+
tag: z.string(),
|
|
29
32
|
});
|
|
30
33
|
export const modelProviderRetrieveCodec = z.codec(z.union([baseModelProviderRetrieveCodec.def.in, dremioProvidedSchema]), z.union([baseModelProviderRetrieveCodec.def.out, dremioProvidedSchema]), {
|
|
31
34
|
decode(v) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modelProviderCodec.js","sourceRoot":"","sources":["../../../src/cloud/ai/modelProviderCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,0BAA0B,IAAI,8BAA8B,EAC5D,wBAAwB,GACzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,CAAC;AAE9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,YAAY,CAAC;QACrB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;KAC3B,CAAC;IACF,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"modelProviderCodec.js","sourceRoot":"","sources":["../../../src/cloud/ai/modelProviderCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,0BAA0B,IAAI,8BAA8B,EAC5D,wBAAwB,GACzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,CAAC;AAE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,EAAE,MAAM,CAAC,CAAC;IAEtE,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,gBAAgB,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjD,OAAO,EAAE,CACP,IAAI,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,IAA4C,CAAC,CAC3F,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,CACP,IAAI,aAAa,CACf,MAAM,EACN,YAAY,CAAC,IAAuD,CACrE,CACF,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport {\n modelProviderCreateCodec,\n modelProviderRetrieveCodec as baseModelProviderRetrieveCodec,\n modelProviderUpdateCodec,\n} from \"../../enterprise/ai/modelProviderCodec.ts\";\nimport { Err, Ok, Result } from \"ts-results-es\";\nimport { DremioModelProvider } from \"./DremioModelProvider.ts\";\nimport type { V4Config } from \"../../common/Config.ts\";\nimport { ModelProvider } from \"../interfaces.ts\";\n\nexport { modelProviderCreateCodec, modelProviderUpdateCodec };\n\nexport const dremioProvidedSchema = z.object({\n config: z.strictObject({\n dremioProvided: z.object(),\n }),\n defaultModelName: z.string(),\n id: z.string(),\n isDefault: z.boolean(),\n name: z.string(),\n sqlModelNames: z.array(z.string()),\n tag: z.string(),\n});\n\nexport const modelProviderRetrieveCodec = z.codec(\n z.union([baseModelProviderRetrieveCodec.def.in, dremioProvidedSchema]),\n z.union([baseModelProviderRetrieveCodec.def.out, dremioProvidedSchema]),\n {\n decode(v) {\n if (\"dremioProvided\" in v.config) {\n return v as z.infer<typeof dremioProvidedSchema>;\n }\n\n return z.decode(\n baseModelProviderRetrieveCodec,\n v as z.input<typeof baseModelProviderRetrieveCodec>,\n );\n },\n encode(v) {\n if (\"dremioProvided\" in v.config) {\n return v as z.infer<typeof dremioProvidedSchema>;\n }\n\n return z.encode(\n baseModelProviderRetrieveCodec,\n v as z.output<typeof baseModelProviderRetrieveCodec>,\n );\n },\n },\n);\n\nexport function safeDecodeModelProvider(\n config: V4Config,\n entity: z.input<typeof modelProviderRetrieveCodec>,\n): Result<\n DremioModelProvider | ModelProvider,\n z.core.util.SafeParseResult<z.output<typeof modelProviderRetrieveCodec>>[\"error\"]\n> {\n const decodeResult = z.safeDecode(modelProviderRetrieveCodec, entity);\n\n if (decodeResult.success) {\n if (\"dremioProvided\" in decodeResult.data.config) {\n return Ok(\n new DremioModelProvider(config, decodeResult.data as z.infer<typeof dremioProvidedSchema>),\n );\n }\n return Ok(\n new ModelProvider(\n config,\n decodeResult.data as z.output<typeof baseModelProviderRetrieveCodec>,\n ),\n );\n }\n\n return Err(decodeResult.error);\n}\n\nexport type SafeDecodeResultWithoutDremioLLM = Result<\n ModelProvider,\n z.core.util.SafeParseResult<z.output<typeof modelProviderRetrieveCodec>>[\"error\"]\n>;\n"]}
|
|
@@ -6,12 +6,13 @@ import { ModelProvider } from "./ModelProvider.ts";
|
|
|
6
6
|
import * as z from "zod/mini";
|
|
7
7
|
import { modelProviderCreateCodec } from "./modelProviderCodec.js";
|
|
8
8
|
import type { SignalParam } from "../../common/Params.ts";
|
|
9
|
-
import
|
|
9
|
+
import { listModelsPropertiesSchema } from "./modelProviderConfigSchemas.js";
|
|
10
10
|
import { Err, Ok } from "ts-results-es";
|
|
11
11
|
import type { HttpError } from "../../common/HttpError.ts";
|
|
12
12
|
import { Problem } from "../../common/Problem.ts";
|
|
13
13
|
import { AgentChatExchange } from "./chat/eventWrappers/AgentChatExchange.ts";
|
|
14
14
|
import { ChatSessionClient } from "./chat/ChatSessionClient.ts";
|
|
15
|
+
export declare function listAvailableModels(config: V4Config): (properties: z.infer<typeof listModelsPropertiesSchema>, { signal }?: SignalParam) => import("ts-results-es").AsyncResult<Set<string>, HttpError>;
|
|
15
16
|
export declare class AIResource {
|
|
16
17
|
#private;
|
|
17
18
|
constructor(config: Logger & V4Config & SonarV4Config);
|
|
@@ -34,7 +35,7 @@ export declare class AIResource {
|
|
|
34
35
|
accessKeyId: string;
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
|
-
region:
|
|
38
|
+
region: string;
|
|
38
39
|
};
|
|
39
40
|
} | {
|
|
40
41
|
anthropic: Record<string, never>;
|
|
@@ -79,7 +80,7 @@ export declare class AIResource {
|
|
|
79
80
|
accessKeyId: string;
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
|
-
region:
|
|
83
|
+
region: string;
|
|
83
84
|
};
|
|
84
85
|
} | {
|
|
85
86
|
anthropic: Record<string, never>;
|