@dremio/js-sdk 0.39.1 → 0.40.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/cloud/ai/AIResource.d.ts +2 -2
- package/dist/cloud/ai/AIResource.js +2 -2
- package/dist/cloud/ai/AIResource.js.map +1 -1
- package/dist/cloud/ai/index.d.ts +1 -1
- package/dist/cloud/ai/index.js +1 -1
- package/dist/cloud/ai/index.js.map +1 -1
- package/dist/cloud/ai/modelProviderCodec.d.ts +1 -1
- package/dist/cloud/ai/modelProviderCodec.js +1 -1
- package/dist/cloud/ai/modelProviderCodec.js.map +1 -1
- package/dist/enterprise/ai/AIResource.d.ts +4 -4
- package/dist/enterprise/ai/AIResource.js +4 -4
- package/dist/enterprise/ai/AIResource.js.map +1 -1
- package/dist/enterprise/ai/chat/ChatSession.d.ts +22 -7
- package/dist/enterprise/ai/chat/ChatSession.js +57 -22
- package/dist/enterprise/ai/chat/ChatSession.js.map +1 -1
- package/dist/enterprise/ai/chat/ChatSessionClient.d.ts +1 -4
- package/dist/enterprise/ai/chat/ChatSessionClient.js +9 -12
- package/dist/enterprise/ai/chat/ChatSessionClient.js.map +1 -1
- package/dist/enterprise/ai/chat/eventWrappers/AgentChatExchange.d.ts +1 -1
- package/dist/enterprise/ai/chat/eventWrappers/AgentChatExchange.js.map +1 -1
- package/dist/enterprise/ai/chat/{AgentChatPartialResponse.d.ts → eventWrappers/AgentChatPartialResponse.d.ts} +9 -3
- package/dist/enterprise/ai/chat/{AgentChatPartialResponse.js → eventWrappers/AgentChatPartialResponse.js} +1 -1
- package/dist/enterprise/ai/chat/eventWrappers/AgentChatPartialResponse.js.map +1 -0
- package/dist/enterprise/ai/chat/{AgentChatResponse.d.ts → eventWrappers/AgentChatResponse.d.ts} +5 -5
- package/dist/enterprise/ai/chat/{AgentChatResponse.js → eventWrappers/AgentChatResponse.js} +10 -10
- package/dist/enterprise/ai/chat/eventWrappers/AgentChatResponse.js.map +1 -0
- package/dist/enterprise/ai/chat/eventWrappers/AgentToolCall.d.ts +3 -3
- package/dist/enterprise/ai/chat/eventWrappers/AgentToolCall.js +3 -3
- package/dist/enterprise/ai/chat/eventWrappers/AgentToolCall.js.map +1 -1
- package/dist/enterprise/ai/chat/eventWrappers/AgentToolCallGroup.d.ts +3 -3
- package/dist/enterprise/ai/chat/eventWrappers/AgentToolCallGroup.js.map +1 -1
- package/dist/enterprise/ai/chat/index.d.ts +6 -6
- package/dist/enterprise/ai/chat/index.js +6 -6
- package/dist/enterprise/ai/chat/index.js.map +1 -1
- package/dist/enterprise/ai/chat/methods/sendChatMessage.d.ts +2 -2
- package/dist/enterprise/ai/chat/methods/sendChatMessage.js +3 -3
- package/dist/enterprise/ai/chat/methods/sendChatMessage.js.map +1 -1
- package/dist/enterprise/ai/chat/responseContent/AgentErrorResponseContent.js.map +1 -0
- package/dist/enterprise/ai/chat/responseContent/AgentModelResponseContent.js.map +1 -0
- package/dist/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.js.map +1 -0
- package/dist/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.js.map +1 -0
- package/dist/enterprise/ai/index.d.ts +1 -1
- package/dist/enterprise/ai/index.js +1 -1
- package/dist/enterprise/ai/index.js.map +1 -1
- package/dist/enterprise/ai/{ModelProvider.d.ts → modelProvider/ModelProvider.d.ts} +5 -5
- package/dist/enterprise/ai/{ModelProvider.js → modelProvider/ModelProvider.js} +1 -1
- package/dist/enterprise/ai/modelProvider/ModelProvider.js.map +1 -0
- package/dist/enterprise/ai/modelProvider/modelProviderCodec.js.map +1 -0
- package/dist/enterprise/ai/modelProvider/modelProviderConfigSchemas.js.map +1 -0
- package/dist-iife/cloud.js +16119 -0
- package/dist-iife/community.js +13750 -0
- package/dist-iife/enterprise.js +17041 -0
- package/package.json +23 -7
- package/dist/enterprise/ai/ModelProvider.js.map +0 -1
- package/dist/enterprise/ai/chat/AgentChatPartialResponse.js.map +0 -1
- package/dist/enterprise/ai/chat/AgentChatResponse.js.map +0 -1
- package/dist/enterprise/ai/chat/AgentErrorResponseContent.js.map +0 -1
- package/dist/enterprise/ai/chat/AgentModelResponseContent.js.map +0 -1
- package/dist/enterprise/ai/chat/AgentToolRequestResponseContent.js.map +0 -1
- package/dist/enterprise/ai/chat/AgentToolResultResponseContent.js.map +0 -1
- package/dist/enterprise/ai/modelProviderCodec.js.map +0 -1
- package/dist/enterprise/ai/modelProviderConfigSchemas.js.map +0 -1
- /package/dist/enterprise/ai/chat/{AgentErrorResponseContent.d.ts → responseContent/AgentErrorResponseContent.d.ts} +0 -0
- /package/dist/enterprise/ai/chat/{AgentErrorResponseContent.js → responseContent/AgentErrorResponseContent.js} +0 -0
- /package/dist/enterprise/ai/chat/{AgentModelResponseContent.d.ts → responseContent/AgentModelResponseContent.d.ts} +0 -0
- /package/dist/enterprise/ai/chat/{AgentModelResponseContent.js → responseContent/AgentModelResponseContent.js} +0 -0
- /package/dist/enterprise/ai/chat/{AgentToolRequestResponseContent.d.ts → responseContent/AgentToolRequestResponseContent.d.ts} +0 -0
- /package/dist/enterprise/ai/chat/{AgentToolRequestResponseContent.js → responseContent/AgentToolRequestResponseContent.js} +0 -0
- /package/dist/enterprise/ai/chat/{AgentToolResultResponseContent.d.ts → responseContent/AgentToolResultResponseContent.d.ts} +0 -0
- /package/dist/enterprise/ai/chat/{AgentToolResultResponseContent.js → responseContent/AgentToolResultResponseContent.js} +0 -0
- /package/dist/enterprise/ai/{modelProviderCodec.d.ts → modelProvider/modelProviderCodec.d.ts} +0 -0
- /package/dist/enterprise/ai/{modelProviderCodec.js → modelProvider/modelProviderCodec.js} +0 -0
- /package/dist/enterprise/ai/{modelProviderConfigSchemas.d.ts → modelProvider/modelProviderConfigSchemas.d.ts} +0 -0
- /package/dist/enterprise/ai/{modelProviderConfigSchemas.js → modelProvider/modelProviderConfigSchemas.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatSession } from "
|
|
1
|
+
import { ChatSession } from "../ChatSession.ts";
|
|
2
2
|
import * as z from "zod/mini";
|
|
3
3
|
declare const agentPartialResponseTypeSchema: z.ZodMiniEnum<{
|
|
4
4
|
delta: "delta";
|
|
@@ -16,9 +16,12 @@ export declare class AgentChatPartialResponse {
|
|
|
16
16
|
content: string;
|
|
17
17
|
id: string;
|
|
18
18
|
session: {
|
|
19
|
+
createdAt: string;
|
|
20
|
+
id: string;
|
|
19
21
|
modelName: string;
|
|
20
22
|
modelProviderId: string;
|
|
21
|
-
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
title?: string | undefined;
|
|
22
25
|
};
|
|
23
26
|
type: "delta" | "end" | "start";
|
|
24
27
|
};
|
|
@@ -28,9 +31,12 @@ export declare class AgentChatPartialResponse {
|
|
|
28
31
|
content: z.ZodMiniString<string>;
|
|
29
32
|
id: z.ZodMiniString<string>;
|
|
30
33
|
session: z.ZodMiniObject<{
|
|
34
|
+
createdAt: z.ZodMiniString<string>;
|
|
35
|
+
id: z.ZodMiniString<string>;
|
|
31
36
|
modelName: z.ZodMiniString<string>;
|
|
32
37
|
modelProviderId: z.ZodMiniString<string>;
|
|
33
|
-
|
|
38
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
39
|
+
updatedAt: z.ZodMiniString<string>;
|
|
34
40
|
}, z.core.$strip>;
|
|
35
41
|
type: z.ZodMiniEnum<{
|
|
36
42
|
delta: "delta";
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { nanoid } from "nanoid/non-secure";
|
|
17
|
-
import { ChatSession } from "
|
|
17
|
+
import { ChatSession } from "../ChatSession.js";
|
|
18
18
|
import * as z from "zod/mini";
|
|
19
19
|
const agentPartialResponseTypeSchema = z.enum(["delta", "end", "start"]);
|
|
20
20
|
export class AgentChatPartialResponse {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentChatPartialResponse.js","sourceRoot":"","sources":["../../../../../src/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AC,CAAC;IAC/D,CAAC;IAED,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CACpB,CAAC,CAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACjC,IAAI,EAAE,8BAA8B;KACrC,CAAC,EACF,CAAC,CAAC,UAAU,CAAC,wBAAwB,CAAC,EACtC;QACE,MAAM,CAAC,CAAC;YACN,OAAO,IAAI,wBAAwB,CACjC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,EAC/B,CAAC,CAAC,IAAI,EACN,CAAC,CAAC,OAAO,EACT,CAAC,CAAC,EAAE,CACL,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,CAAC;YACN,OAAO;gBACL,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,EAAE,EAAE,CAAC,CAAC,EAAE;gBACR,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE;gBAC3B,IAAI,EAAE,CAAC,CAAC,IAAI;aACJ,CAAC;QACb,CAAC;KACF,CACF,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 { nanoid } from \"nanoid/non-secure\";\nimport { ChatSession } from \"../ChatSession.ts\";\nimport * as z from \"zod/mini\";\n\nconst agentPartialResponseTypeSchema = z.enum([\"delta\", \"end\", \"start\"]);\n\nexport class AgentChatPartialResponse {\n readonly id = nanoid();\n readonly session: ChatSession;\n readonly content: string;\n readonly type: z.infer<typeof agentPartialResponseTypeSchema>;\n\n constructor(\n chatSession: AgentChatPartialResponse[\"session\"],\n type: AgentChatPartialResponse[\"type\"],\n content: AgentChatPartialResponse[\"content\"],\n id?: AgentChatPartialResponse[\"id\"],\n ) {\n this.session = chatSession;\n this.type = type;\n this.content = content;\n\n if (id) {\n this.id = id;\n }\n }\n\n concat(next: AgentChatPartialResponse) {\n return new AgentChatPartialResponse(\n this.session,\n next.type,\n this.content + next.content,\n this.id,\n );\n }\n\n toJSON() {\n return z.encode(AgentChatPartialResponse.codec, this);\n }\n\n get isComplete() {\n return this.type === \"end\";\n }\n\n static fromJSON(data: unknown) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any\n return z.decode(AgentChatPartialResponse.codec, data as any);\n }\n\n static codec = z.codec(\n z.object({\n content: z.string(),\n id: z.string(),\n session: ChatSession.codec.def.in,\n type: agentPartialResponseTypeSchema,\n }),\n z.instanceof(AgentChatPartialResponse),\n {\n decode(v) {\n return new AgentChatPartialResponse(\n ChatSession.fromJSON(v.session),\n v.type,\n v.content,\n v.id,\n );\n },\n encode(v) {\n return {\n content: v.content,\n id: v.id,\n session: v.session.toJSON(),\n type: v.type,\n } as const;\n },\n },\n );\n}\n"]}
|
package/dist/enterprise/ai/chat/{AgentChatResponse.d.ts → eventWrappers/AgentChatResponse.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AgentErrorResponseContent } from "
|
|
2
|
-
import { AgentModelResponseContent } from "
|
|
3
|
-
import { AgentToolRequestResponseContent } from "
|
|
4
|
-
import { AgentToolResultResponseContent } from "
|
|
5
|
-
import { ChatSession } from "
|
|
1
|
+
import { AgentErrorResponseContent } from "../responseContent/AgentErrorResponseContent.ts";
|
|
2
|
+
import { AgentModelResponseContent } from "../responseContent/AgentModelResponseContent.ts";
|
|
3
|
+
import { AgentToolRequestResponseContent } from "../responseContent/AgentToolRequestResponseContent.ts";
|
|
4
|
+
import { AgentToolResultResponseContent } from "../responseContent/AgentToolResultResponseContent.ts";
|
|
5
|
+
import { ChatSession } from "../ChatSession.ts";
|
|
6
6
|
import * as z from "zod/mini";
|
|
7
7
|
import { Temporal } from "temporal-polyfill";
|
|
8
8
|
export declare class AgentChatResponse<T extends AgentResponseContent> {
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { nanoid } from "nanoid/non-secure";
|
|
17
|
-
import { AgentErrorResponseContent } from "
|
|
18
|
-
import { AgentModelResponseContent } from "
|
|
19
|
-
import { AgentToolRequestResponseContent } from "
|
|
20
|
-
import { AgentToolResultResponseContent } from "
|
|
21
|
-
import { ChatSession } from "
|
|
17
|
+
import { AgentErrorResponseContent } from "../responseContent/AgentErrorResponseContent.js";
|
|
18
|
+
import { AgentModelResponseContent } from "../responseContent/AgentModelResponseContent.js";
|
|
19
|
+
import { AgentToolRequestResponseContent } from "../responseContent/AgentToolRequestResponseContent.js";
|
|
20
|
+
import { AgentToolResultResponseContent } from "../responseContent/AgentToolResultResponseContent.js";
|
|
21
|
+
import { ChatSession } from "../ChatSession.js";
|
|
22
22
|
import * as z from "zod/mini";
|
|
23
23
|
import { Temporal } from "temporal-polyfill";
|
|
24
|
-
import { chatEventSchema } from "
|
|
24
|
+
import { chatEventSchema } from "../chatEventSchema.js";
|
|
25
25
|
export class AgentChatResponse {
|
|
26
26
|
createdAt = Temporal.Now.instant();
|
|
27
27
|
id = nanoid();
|
|
@@ -75,7 +75,7 @@ export class AgentChatResponse {
|
|
|
75
75
|
modelProviderId: chatEvent.modelProviderId,
|
|
76
76
|
}),
|
|
77
77
|
...("sessionId" in chatEvent && {
|
|
78
|
-
|
|
78
|
+
id: chatEvent.sessionId,
|
|
79
79
|
}),
|
|
80
80
|
});
|
|
81
81
|
return new AgentChatResponse(chatSession, content, "createdAt" in chatEvent
|
|
@@ -98,7 +98,7 @@ export class AgentChatResponse {
|
|
|
98
98
|
modelProviderId: agentResponse.session.modelProviderId || "",
|
|
99
99
|
name: agentResponse.content.name,
|
|
100
100
|
result: agentResponse.content.result,
|
|
101
|
-
sessionId: agentResponse.session.
|
|
101
|
+
sessionId: agentResponse.session.id,
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
else if (agentResponse.content instanceof AgentToolRequestResponseContent) {
|
|
@@ -114,7 +114,7 @@ export class AgentChatResponse {
|
|
|
114
114
|
modelName: agentResponse.session.modelName || "",
|
|
115
115
|
modelProviderId: agentResponse.session.modelProviderId || "",
|
|
116
116
|
name: agentResponse.content.name,
|
|
117
|
-
sessionId: agentResponse.session.
|
|
117
|
+
sessionId: agentResponse.session.id,
|
|
118
118
|
summarizedTitle: agentResponse.content.summarizedTitle || undefined,
|
|
119
119
|
};
|
|
120
120
|
}
|
|
@@ -128,7 +128,7 @@ export class AgentChatResponse {
|
|
|
128
128
|
modelProviderId: agentResponse.session.modelProviderId || "",
|
|
129
129
|
name: agentResponse.content.name,
|
|
130
130
|
result: agentResponse.content.result,
|
|
131
|
-
sessionId: agentResponse.session.
|
|
131
|
+
sessionId: agentResponse.session.id,
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentChatResponse.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/eventWrappers/AgentChatResponse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAC;AACxG,OAAO,EAAE,8BAA8B,EAAE,MAAM,sDAAsD,CAAC;AACtG,OAAO,EAAE,WAAW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U,EAAE,aAAa,CAAC,OAAO,CAAC,UAAU,IAAI,SAAS;oBACzD,SAAS,EAAE,SAAS;oBACpB,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE;oBAChD,eAAe,EAAE,aAAa,CAAC,OAAO,CAAC,eAAe,IAAI,EAAE;oBAC5D,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,IAAI;oBAChC,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,EAAG;oBACpC,eAAe,EAAE,aAAa,CAAC,OAAO,CAAC,eAAe,IAAI,SAAS;iBACvC,CAAC;YACjC,CAAC;iBAAM,IAAI,aAAa,CAAC,OAAO,YAAY,8BAA8B,EAAE,CAAC;gBAC3E,OAAO;oBACL,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM;oBACpC,SAAS,EAAE,cAAc;oBACzB,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,UAAU,IAAI,SAAS;oBACzD,SAAS,EAAE,SAAS;oBACpB,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE;oBAChD,eAAe,EAAE,aAAa,CAAC,OAAO,CAAC,eAAe,IAAI,EAAE;oBAC5D,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,IAAI;oBAChC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM;oBACpC,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,EAAG;iBACR,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;KACF,CAAC,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 { nanoid } from \"nanoid/non-secure\";\nimport { AgentErrorResponseContent } from \"../responseContent/AgentErrorResponseContent.ts\";\nimport { AgentModelResponseContent } from \"../responseContent/AgentModelResponseContent.ts\";\nimport { AgentToolRequestResponseContent } from \"../responseContent/AgentToolRequestResponseContent.ts\";\nimport { AgentToolResultResponseContent } from \"../responseContent/AgentToolResultResponseContent.ts\";\nimport { ChatSession } from \"../ChatSession.ts\";\nimport * as z from \"zod/mini\";\nimport { Temporal } from \"temporal-polyfill\";\nimport { chatEventSchema, type ChatEvent } from \"../chatEventSchema.ts\";\n\nexport class AgentChatResponse<T extends AgentResponseContent> {\n readonly createdAt = Temporal.Now.instant();\n readonly id = nanoid();\n readonly session: ChatSession;\n readonly content: T;\n\n constructor(chatSession: ChatSession, content: T, createdAt?: Temporal.Instant, id?: string) {\n this.session = chatSession;\n this.content = content;\n\n if (createdAt) {\n this.createdAt = createdAt;\n }\n\n if (id) {\n this.id = id;\n }\n }\n\n /**\n * Creates a copy of the AgentResponse with a different content property.\n * Preserves the original message's ID\n */\n replaceContent<R extends AgentResponseContent>(content: R): AgentChatResponse<R> {\n return new AgentChatResponse(this.session, content, this.createdAt, this.id);\n }\n\n toJSON() {\n return z.encode(AgentChatResponse.codec, this);\n }\n\n static fromJSON(data: unknown) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any\n return z.decode(AgentChatResponse.codec, data as any);\n }\n\n static codec = z.codec(chatEventSchema, z.instanceof(AgentChatResponse), {\n decode(chatEvent) {\n const chatSession = ChatSession.new();\n const content = (() => {\n switch (chatEvent.chunkType) {\n case \"error\":\n return new AgentErrorResponseContent(chatEvent.message);\n case \"model\":\n return new AgentModelResponseContent(chatEvent.name, chatEvent.result);\n case \"toolRequest\": {\n return new AgentToolRequestResponseContent(\n chatEvent.callId,\n chatEvent.name,\n Object.keys(chatEvent.arguments)\n .sort()\n .map((key) => chatEvent.arguments[key]!),\n chatEvent.summarizedTitle || null,\n chatEvent.commentary || null,\n );\n }\n case \"toolResponse\":\n return new AgentToolResultResponseContent(\n chatEvent.callId,\n chatEvent.name,\n chatEvent.result,\n );\n }\n })();\n chatSession.assign({\n ...(\"modelName\" in chatEvent && { modelName: chatEvent.modelName }),\n ...(\"modelProviderId\" in chatEvent && {\n modelProviderId: chatEvent.modelProviderId,\n }),\n ...(\"sessionId\" in chatEvent && {\n id: chatEvent.sessionId,\n }),\n });\n return new AgentChatResponse(\n chatSession,\n content,\n \"createdAt\" in chatEvent\n ? Temporal.Instant.from(chatEvent.createdAt)\n : Temporal.Now.instant(),\n );\n },\n encode(agentResponse) {\n const createdAt = agentResponse.createdAt?.toString();\n\n if (agentResponse.content instanceof AgentErrorResponseContent) {\n return {\n chunkType: \"error\",\n ...agentResponse.content,\n } as const satisfies ChatEvent;\n } else if (agentResponse.content instanceof AgentModelResponseContent) {\n return {\n chunkType: \"model\",\n createdAt: createdAt,\n modelName: agentResponse.session.modelName || \"\",\n modelProviderId: agentResponse.session.modelProviderId || \"\",\n name: agentResponse.content.name,\n result: agentResponse.content.result,\n sessionId: agentResponse.session.id!,\n } as const satisfies ChatEvent;\n } else if (agentResponse.content instanceof AgentToolRequestResponseContent) {\n return {\n arguments: agentResponse.content.arguments.reduce(\n (accum, curr, i) => {\n accum[`arg${i}`] = curr;\n return accum;\n },\n {} as Record<string, unknown>,\n ) as Record<string, z.core.util.JSONType>,\n callId: agentResponse.content.callId,\n chunkType: \"toolRequest\",\n commentary: agentResponse.content.commentary || undefined,\n createdAt: createdAt,\n modelName: agentResponse.session.modelName || \"\",\n modelProviderId: agentResponse.session.modelProviderId || \"\",\n name: agentResponse.content.name,\n sessionId: agentResponse.session.id!,\n summarizedTitle: agentResponse.content.summarizedTitle || undefined,\n } as const satisfies ChatEvent;\n } else if (agentResponse.content instanceof AgentToolResultResponseContent) {\n return {\n callId: agentResponse.content.callId,\n chunkType: \"toolResponse\",\n commentary: agentResponse.content.commentary || undefined,\n createdAt: createdAt,\n modelName: agentResponse.session.modelName || \"\",\n modelProviderId: agentResponse.session.modelProviderId || \"\",\n name: agentResponse.content.name,\n result: agentResponse.content.result,\n sessionId: agentResponse.session.id!,\n } as const satisfies ChatEvent;\n } else {\n throw new Error(\"Unknown content type\");\n }\n },\n });\n}\n\nexport type AgentResponseContent =\n | AgentErrorResponseContent\n | AgentModelResponseContent\n | AgentToolRequestResponseContent\n | AgentToolResultResponseContent;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AgentChatResponse } from "
|
|
2
|
-
import { AgentToolRequestResponseContent } from "../AgentToolRequestResponseContent.ts";
|
|
3
|
-
import { AgentToolResultResponseContent } from "../AgentToolResultResponseContent.ts";
|
|
1
|
+
import { AgentChatResponse } from "./AgentChatResponse.ts";
|
|
2
|
+
import { AgentToolRequestResponseContent } from "../responseContent/AgentToolRequestResponseContent.ts";
|
|
3
|
+
import { AgentToolResultResponseContent } from "../responseContent/AgentToolResultResponseContent.ts";
|
|
4
4
|
/**
|
|
5
5
|
* Pairs a tool request with its associated tool result once completed.
|
|
6
6
|
*/
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { AgentChatResponse } from "
|
|
17
|
-
import { AgentToolRequestResponseContent } from "../AgentToolRequestResponseContent.js";
|
|
18
|
-
import { AgentToolResultResponseContent } from "../AgentToolResultResponseContent.js";
|
|
16
|
+
import { AgentChatResponse } from "./AgentChatResponse.js";
|
|
17
|
+
import { AgentToolRequestResponseContent } from "../responseContent/AgentToolRequestResponseContent.js";
|
|
18
|
+
import { AgentToolResultResponseContent } from "../responseContent/AgentToolResultResponseContent.js";
|
|
19
19
|
/**
|
|
20
20
|
* Pairs a tool request with its associated tool result once completed.
|
|
21
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentToolCall.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/eventWrappers/AgentToolCall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AgentToolCall.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/eventWrappers/AgentToolCall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAC;AACxG,OAAO,EAAE,8BAA8B,EAAE,MAAM,sDAAsD,CAAC;AAEtG;;GAEG;AACH,MAAM,OAAO,aAAa;IACf,OAAO,CAAqD;IAC5D,MAAM,CAAqD;IAEpE,YAAY,OAAiC,EAAE,MAAgC;QAC7E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;IACrC,CAAC;IAED,IAAI,MAAM;QACR,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,cAAc,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACjD,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC;IACjC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC;IACnC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC;IACnC,CAAC;IAED,UAAU,CAAC,QAA2D;QACpE,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IAED,MAAM;QACJ,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE;SACnB,CAAC;IACf,CAAC;CACF;AAED,MAAM,UAAU,aAAa,CAC3B,OAAgB;IAEhB,OAAO,CACL,OAAO,YAAY,iBAAiB;QACpC,OAAO,CAAC,OAAO,YAAY,+BAA+B,CAC3D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,OAAgB;IAEhB,OAAO,CACL,OAAO,YAAY,iBAAiB;QACpC,OAAO,CAAC,OAAO,YAAY,8BAA8B,CAC1D,CAAC;AACJ,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 { AgentChatResponse } from \"./AgentChatResponse.ts\";\nimport { AgentToolRequestResponseContent } from \"../responseContent/AgentToolRequestResponseContent.ts\";\nimport { AgentToolResultResponseContent } from \"../responseContent/AgentToolResultResponseContent.ts\";\n\n/**\n * Pairs a tool request with its associated tool result once completed.\n */\nexport class AgentToolCall {\n readonly request: AgentChatResponse<AgentToolRequestResponseContent>;\n readonly result?: AgentChatResponse<AgentToolResultResponseContent>;\n\n constructor(request: AgentToolCall[\"request\"], result?: AgentToolCall[\"result\"]) {\n this.request = request;\n this.result = result;\n }\n\n get id() {\n return this.request.content.callId;\n }\n\n get status() {\n if (!this.result) {\n return \"pending\";\n }\n\n if (\"errorMessage\" in this.result.content.result) {\n return \"error\";\n }\n\n return \"success\";\n }\n\n get isError() {\n return this.status === \"error\";\n }\n\n get isPending() {\n return this.status === \"pending\";\n }\n\n get isSuccess() {\n return this.status === \"success\";\n }\n\n withResult(response: AgentChatResponse<AgentToolResultResponseContent>) {\n return new AgentToolCall(this.request, response);\n }\n\n toJSON() {\n return {\n id: this.id,\n request: this.request.toJSON(),\n result: this.result?.toJSON(),\n } as unknown;\n }\n}\n\nexport function isToolRequest(\n message: unknown,\n): message is AgentChatResponse<AgentToolRequestResponseContent> {\n return (\n message instanceof AgentChatResponse &&\n message.content instanceof AgentToolRequestResponseContent\n );\n}\n\nexport function isToolResult(\n message: unknown,\n): message is AgentChatResponse<AgentToolResultResponseContent> {\n return (\n message instanceof AgentChatResponse &&\n message.content instanceof AgentToolResultResponseContent\n );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgentToolCall } from "./AgentToolCall.ts";
|
|
2
|
-
import type { AgentChatResponse } from "
|
|
3
|
-
import type { AgentToolRequestResponseContent } from "../AgentToolRequestResponseContent.ts";
|
|
4
|
-
import type { AgentToolResultResponseContent } from "../AgentToolResultResponseContent.ts";
|
|
2
|
+
import type { AgentChatResponse } from "./AgentChatResponse.ts";
|
|
3
|
+
import type { AgentToolRequestResponseContent } from "../responseContent/AgentToolRequestResponseContent.ts";
|
|
4
|
+
import type { AgentToolResultResponseContent } from "../responseContent/AgentToolResultResponseContent.ts";
|
|
5
5
|
/**
|
|
6
6
|
* Contains a collection of `AgentToolCall` associated with an `AgentChatExchange`.
|
|
7
7
|
* As tool calls stream in, this class is updated immutably but maintains
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentToolCallGroup.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/eventWrappers/AgentTool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J,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;SAC/D,CAAC;IACJ,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 { nanoid } from \"nanoid/non-secure\";\nimport { AgentToolCall } from \"./AgentToolCall.ts\";\nimport type { AgentChatResponse } from \"
|
|
1
|
+
{"version":3,"file":"AgentToolCallGroup.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/eventWrappers/AgentToolCallGroup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IACpB,EAAE,GAAG,MAAM,EAAE,CAAC;IACd,SAAS,CAAkB;IAEpC,YAAY,SAA0C,EAAE,EAA6B;QACnF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,EAAE,EAAE,CAAC;YACP,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,CAAC;IACH,CAAC;IAED,UAAU,CAAC,WAA+D;QACxE,OAAO,IAAI,kBAAkB,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED,SAAS,CAAC,UAA6D;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAC/C,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,UAAU,CAAC,OAAO,CAAC,MAAM,CACxD,CAAC;QAEF,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,YAAY,CAAE,CAAC;QAElD,OAAO,IAAI,kBAAkB,CAC3B;YACE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC;YACxC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC;YAC/B,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC;SAC1C,EACD,IAAI,CAAC,EAAE,CACR,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;SAC/D,CAAC;IACJ,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 { nanoid } from \"nanoid/non-secure\";\nimport { AgentToolCall } from \"./AgentToolCall.ts\";\nimport type { AgentChatResponse } from \"./AgentChatResponse.ts\";\nimport type { AgentToolRequestResponseContent } from \"../responseContent/AgentToolRequestResponseContent.ts\";\nimport type { AgentToolResultResponseContent } from \"../responseContent/AgentToolResultResponseContent.ts\";\n\n/**\n * Contains a collection of `AgentToolCall` associated with an `AgentChatExchange`.\n * As tool calls stream in, this class is updated immutably but maintains\n * a stable `.id` property.\n */\nexport class AgentToolCallGroup {\n readonly id = nanoid();\n readonly toolCalls: AgentToolCall[];\n\n constructor(toolCalls: AgentToolCallGroup[\"toolCalls\"], id?: AgentToolCallGroup[\"id\"]) {\n this.toolCalls = toolCalls;\n if (id) {\n this.id = id;\n }\n }\n\n addRequest(toolRequest: AgentChatResponse<AgentToolRequestResponseContent>) {\n return new AgentToolCallGroup([...this.toolCalls, new AgentToolCall(toolRequest)], this.id);\n }\n\n addResult(toolResult: AgentChatResponse<AgentToolResultResponseContent>) {\n const requestIndex = this.toolCalls.findLastIndex(\n (toolCall) => toolCall.id === toolResult.content.callId,\n );\n\n if (requestIndex === -1) {\n return this;\n }\n\n const toolCall = this.toolCalls.at(requestIndex)!;\n\n return new AgentToolCallGroup(\n [\n ...this.toolCalls.slice(0, requestIndex),\n toolCall.withResult(toolResult),\n ...this.toolCalls.slice(requestIndex + 1),\n ],\n this.id,\n );\n }\n\n toJSON() {\n return {\n id: this.id,\n toolCalls: this.toolCalls.map((toolCall) => toolCall.toJSON()),\n };\n }\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ChatSessionClient } from "./ChatSessionClient.ts";
|
|
2
2
|
export type { ChatSessionClient };
|
|
3
|
-
export * from "./AgentErrorResponseContent.ts";
|
|
4
|
-
export * from "./AgentModelResponseContent.ts";
|
|
5
|
-
export * from "./AgentChatPartialResponse.ts";
|
|
6
|
-
export * from "./AgentChatResponse.ts";
|
|
7
|
-
export * from "./AgentToolRequestResponseContent.ts";
|
|
8
|
-
export * from "./AgentToolResultResponseContent.ts";
|
|
3
|
+
export * from "./responseContent/AgentErrorResponseContent.ts";
|
|
4
|
+
export * from "./responseContent/AgentModelResponseContent.ts";
|
|
5
|
+
export * from "./eventWrappers/AgentChatPartialResponse.ts";
|
|
6
|
+
export * from "./eventWrappers/AgentChatResponse.ts";
|
|
7
|
+
export * from "./responseContent/AgentToolRequestResponseContent.ts";
|
|
8
|
+
export * from "./responseContent/AgentToolResultResponseContent.ts";
|
|
9
9
|
export * from "./ChatSession.ts";
|
|
10
10
|
export * from "./UserChatMessage.ts";
|
|
11
11
|
export * from "./UserChatMessageContent.ts";
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export * from "./AgentErrorResponseContent.js";
|
|
17
|
-
export * from "./AgentModelResponseContent.js";
|
|
18
|
-
export * from "./AgentChatPartialResponse.js";
|
|
19
|
-
export * from "./AgentChatResponse.js";
|
|
20
|
-
export * from "./AgentToolRequestResponseContent.js";
|
|
21
|
-
export * from "./AgentToolResultResponseContent.js";
|
|
16
|
+
export * from "./responseContent/AgentErrorResponseContent.js";
|
|
17
|
+
export * from "./responseContent/AgentModelResponseContent.js";
|
|
18
|
+
export * from "./eventWrappers/AgentChatPartialResponse.js";
|
|
19
|
+
export * from "./eventWrappers/AgentChatResponse.js";
|
|
20
|
+
export * from "./responseContent/AgentToolRequestResponseContent.js";
|
|
21
|
+
export * from "./responseContent/AgentToolResultResponseContent.js";
|
|
22
22
|
export * from "./ChatSession.js";
|
|
23
23
|
export * from "./UserChatMessage.js";
|
|
24
24
|
export * from "./UserChatMessageContent.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/chat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/chat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,sCAAsC,CAAC;AACrD,cAAc,sDAAsD,CAAC;AACrE,cAAc,qDAAqD,CAAC;AACpE,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,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 type { ChatSessionClient } from \"./ChatSessionClient.ts\";\nexport type { ChatSessionClient };\n\nexport * from \"./responseContent/AgentErrorResponseContent.ts\";\nexport * from \"./responseContent/AgentModelResponseContent.ts\";\nexport * from \"./eventWrappers/AgentChatPartialResponse.ts\";\nexport * from \"./eventWrappers/AgentChatResponse.ts\";\nexport * from \"./responseContent/AgentToolRequestResponseContent.ts\";\nexport * from \"./responseContent/AgentToolResultResponseContent.ts\";\nexport * from \"./ChatSession.ts\";\nexport * from \"./UserChatMessage.ts\";\nexport * from \"./UserChatMessageContent.ts\";\nexport * from \"./eventWrappers/AgentChatExchange.ts\";\nexport * from \"./eventWrappers/AgentEndTurn.ts\";\nexport * from \"./eventWrappers/AgentToolCall.ts\";\nexport * from \"./eventWrappers/AgentToolCallGroup.ts\";\n"]}
|
|
@@ -4,7 +4,7 @@ import { Problem } from "../../../../common/Problem.ts";
|
|
|
4
4
|
import type { ChatSession } from "../ChatSession.ts";
|
|
5
5
|
import type { UserChatMessage } from "../UserChatMessage.ts";
|
|
6
6
|
import { Err, Ok } from "ts-results-es";
|
|
7
|
-
import { AgentChatResponse } from "../AgentChatResponse.ts";
|
|
7
|
+
import { AgentChatResponse } from "../eventWrappers/AgentChatResponse.ts";
|
|
8
8
|
type SendChatMessageProblemCodes = "https://api.dremio.dev/problems/ai-agent/chat/agent-disabled" | "https://api.dremio.dev/problems/ai-agent/chat/input-too-large" | "https://api.dremio.dev/problems/ai-agent/chat/model-provider-not-found" | "https://api.dremio.dev/problems/ai-agent/chat/no-default-model-provider" | "https://api.dremio.dev/problems/ai-agent/chat/no-model-provider-privilege" | "https://api.dremio.dev/problems/ai-agent/chat/preview-disabled" | "https://api.dremio.dev/problems/ai-agent/chat/rate-limit-exceeded";
|
|
9
|
-
export declare const createSendChatMessage: (config: SonarV4Config) => (chatSession: ChatSession, userChatMessage: UserChatMessage) => import("rxjs").Observable<Ok<AgentChatResponse<import("../AgentChatResponse.ts").AgentResponseContent>> | Err<HttpError | Problem<SendChatMessageProblemCodes, undefined>>>;
|
|
9
|
+
export declare const createSendChatMessage: (config: SonarV4Config) => (chatSession: ChatSession, userChatMessage: UserChatMessage) => import("rxjs").Observable<Ok<AgentChatResponse<import("../eventWrappers/AgentChatResponse.ts").AgentResponseContent>> | Err<HttpError | Problem<SendChatMessageProblemCodes, undefined>>>;
|
|
10
10
|
export {};
|
|
@@ -17,7 +17,7 @@ import { catchError, map, of, share, tap } from "rxjs";
|
|
|
17
17
|
import { fromTextEventStream } from "../../../../common/fromTextEventStream.js";
|
|
18
18
|
import { Problem } from "../../../../common/Problem.js";
|
|
19
19
|
import { Err, Ok } from "ts-results-es";
|
|
20
|
-
import { AgentChatResponse } from "../AgentChatResponse.js";
|
|
20
|
+
import { AgentChatResponse } from "../eventWrappers/AgentChatResponse.js";
|
|
21
21
|
import * as z from "zod/mini";
|
|
22
22
|
function refineChatErrors(e) {
|
|
23
23
|
if (e.body instanceof Problem) {
|
|
@@ -30,7 +30,7 @@ export const createSendChatMessage = (config) => function sendChatMessage(chatSe
|
|
|
30
30
|
.sonarV4Request("agent", {
|
|
31
31
|
body: JSON.stringify(z.parse(sendChatMessageBodySchema, {
|
|
32
32
|
message: userChatMessage.toString(),
|
|
33
|
-
sessionId: chatSession.
|
|
33
|
+
sessionId: chatSession.id,
|
|
34
34
|
})),
|
|
35
35
|
headers: {
|
|
36
36
|
Accept: "text/event-stream",
|
|
@@ -46,7 +46,7 @@ export const createSendChatMessage = (config) => function sendChatMessage(chatSe
|
|
|
46
46
|
return result.value;
|
|
47
47
|
})).pipe(map((event) => Ok(AgentChatResponse.fromJSON(JSON.parse(event.data)))), tap((agentChatResponse) => {
|
|
48
48
|
if (agentChatResponse.isOk()) {
|
|
49
|
-
chatSession.assign(agentChatResponse.value.session);
|
|
49
|
+
chatSession.assign(agentChatResponse.value.session.toJSON());
|
|
50
50
|
}
|
|
51
51
|
}), catchError((e) => of(Err(refineChatErrors(e)))), share());
|
|
52
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendChatMessage.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/methods/sendChatMessage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAGxD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sendChatMessage.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/methods/sendChatMessage.ts"],"names":[],"mappings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AC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CAClE,CAAC,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 { catchError, map, of, share, tap } from \"rxjs\";\nimport type { SonarV4Config } from \"../../../../common/Config.ts\";\nimport { fromTextEventStream } from \"../../../../common/fromTextEventStream.ts\";\nimport type { HttpError } from \"../../../../common/HttpError.ts\";\nimport { Problem } from \"../../../../common/Problem.ts\";\nimport type { ChatSession } from \"../ChatSession.ts\";\nimport type { UserChatMessage } from \"../UserChatMessage.ts\";\nimport { Err, Ok } from \"ts-results-es\";\nimport { AgentChatResponse } from \"../eventWrappers/AgentChatResponse.ts\";\nimport * as z from \"zod/mini\";\n\ntype SendChatMessageProblemCodes =\n | \"https://api.dremio.dev/problems/ai-agent/chat/agent-disabled\"\n | \"https://api.dremio.dev/problems/ai-agent/chat/input-too-large\"\n | \"https://api.dremio.dev/problems/ai-agent/chat/model-provider-not-found\"\n | \"https://api.dremio.dev/problems/ai-agent/chat/no-default-model-provider\"\n | \"https://api.dremio.dev/problems/ai-agent/chat/no-model-provider-privilege\"\n | \"https://api.dremio.dev/problems/ai-agent/chat/preview-disabled\"\n | \"https://api.dremio.dev/problems/ai-agent/chat/rate-limit-exceeded\";\n\nfunction refineChatErrors(e: HttpError) {\n if (e.body instanceof Problem) {\n return e.body as Problem<SendChatMessageProblemCodes>;\n }\n return e;\n}\n\nexport const createSendChatMessage = (config: SonarV4Config) =>\n function sendChatMessage(chatSession: ChatSession, userChatMessage: UserChatMessage) {\n return fromTextEventStream(({ signal }) =>\n config\n .sonarV4Request(\"agent\", {\n body: JSON.stringify(\n z.parse(sendChatMessageBodySchema, {\n message: userChatMessage.toString(),\n sessionId: chatSession.id,\n }),\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(\n map((event) => Ok(AgentChatResponse.fromJSON(JSON.parse(event.data)))),\n tap((agentChatResponse) => {\n if (agentChatResponse.isOk()) {\n chatSession.assign(agentChatResponse.value.session.toJSON());\n }\n }),\n catchError((e: HttpError) => of(Err(refineChatErrors(e)))),\n share(),\n );\n };\n\nconst sendChatMessageBodySchema = z.strictObject({\n message: z.string().check(z.trim(), z.minLength(1)),\n modelName: z.optional(z.string().check(z.trim(), z.minLength(1))),\n modelProviderId: z.optional(z.string().check(z.trim(), z.minLength(1))),\n sessionId: z.optional(z.string().check(z.trim(), z.minLength(1))),\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentErrorResponseContent.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/responseContent/AgentErrorResponseContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,OAAO,yBAAyB;IAC3B,OAAO,CAAS;IAEzB,YAAY,OAA6C;QACvD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,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\nexport class AgentErrorResponseContent {\n readonly message: string;\n\n constructor(message: AgentErrorResponseContent[\"message\"]) {\n this.message = message;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentModelResponseContent.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/responseContent/AgentModelResponseContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,OAAO,yBAAyB;IAI3B,IAAI,CAAI;IACR,MAAM,CAAI;IAEnB,YAAY,IAAO,EAAE,MAAS;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,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 type { z } from \"zod/mini\";\n\nexport class AgentModelResponseContent<\n N extends string = string,\n R extends Record<string, z.core.util.JSONType> = Record<string, z.core.util.JSONType>,\n> {\n readonly name: N;\n readonly result: R;\n\n constructor(name: N, result: R) {\n this.name = name;\n this.result = result;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentToolRequestResponseContent.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/responseContent/AgentToolRequestResponseContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,OAAO,+BAA+B;IACjC,SAAS,CAAyB;IAClC,MAAM,CAAS;IACf,UAAU,GAAkB,IAAI,CAAC;IACjC,IAAI,CAAS;IACb,eAAe,GAAkB,IAAI,CAAC;IAE/C,YACE,MAAiD,EACjD,IAA6C,EAC7C,aAA2D,EAC3D,eAAmE,EACnE,UAAyD;QAEzD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC;QAE/B,IAAI,eAAe,EAAE,CAAC;YACpB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACzC,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC/B,CAAC;IACH,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\";\n\nexport class AgentToolRequestResponseContent {\n readonly arguments: z.core.util.JSONType[];\n readonly callId: string;\n readonly commentary: string | null = null;\n readonly name: string;\n readonly summarizedTitle: string | null = null;\n\n constructor(\n callId: AgentToolRequestResponseContent[\"callId\"],\n name: AgentToolRequestResponseContent[\"name\"],\n toolArguments: AgentToolRequestResponseContent[\"arguments\"],\n summarizedTitle: AgentToolRequestResponseContent[\"summarizedTitle\"],\n commentary: AgentToolRequestResponseContent[\"commentary\"],\n ) {\n this.callId = callId;\n this.name = name;\n this.arguments = toolArguments;\n\n if (summarizedTitle) {\n this.summarizedTitle = summarizedTitle;\n }\n\n if (commentary) {\n this.commentary = commentary;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentToolResultResponseContent.js","sourceRoot":"","sources":["../../../../../src/enterprise/ai/chat/responseContent/AgentToolResultResponseContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,OAAO,8BAA8B;IAChC,MAAM,CAAS;IACf,UAAU,GAAkB,IAAI,CAAC;IACjC,IAAI,CAAS;IACb,MAAM,CAAuC;IAEtD,YACE,MAAgD,EAChD,IAA4C,EAC5C,MAAgD,EAChD,UAAmB;QAEnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC/B,CAAC;IACH,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\";\n\nexport class AgentToolResultResponseContent {\n readonly callId: string;\n readonly commentary: string | null = null;\n readonly name: string;\n readonly result: Record<string, z.core.util.JSONType>;\n\n constructor(\n callId: AgentToolResultResponseContent[\"callId\"],\n name: AgentToolResultResponseContent[\"name\"],\n result: AgentToolResultResponseContent[\"result\"],\n commentary?: string,\n ) {\n this.callId = callId;\n this.name = name;\n this.result = result;\n\n if (commentary) {\n this.commentary = commentary;\n }\n }\n}\n"]}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ModelProvider } from "./ModelProvider.js";
|
|
16
|
+
import { ModelProvider } from "./modelProvider/ModelProvider.js";
|
|
17
17
|
export * from "./chat/index.js";
|
|
18
18
|
export { ModelProvider };
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/enterprise/ai/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/enterprise/ai/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,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 { ModelProvider } from \"./modelProvider/ModelProvider.ts\";\nexport * from \"./chat/index.ts\";\nexport { ModelProvider };\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { V4Config } from "
|
|
1
|
+
import type { V4Config } from "../../../common/Config.ts";
|
|
2
2
|
import * as z from "zod/mini";
|
|
3
3
|
import { modelProviderRetrieveCodec, modelProviderUpdateCodec } from "./modelProviderCodec.ts";
|
|
4
|
-
import { VersionConflictError } from "
|
|
4
|
+
import { VersionConflictError } from "../../../common/problems.ts";
|
|
5
5
|
export declare class ModelProvider implements Omit<ModelProviderProperties, "tag"> {
|
|
6
6
|
#private;
|
|
7
7
|
readonly config: ModelProviderProperties["config"];
|
|
@@ -15,9 +15,9 @@ export declare class ModelProvider implements Omit<ModelProviderProperties, "tag
|
|
|
15
15
|
readonly name: ModelProviderProperties["name"];
|
|
16
16
|
readonly sqlModelNames: ModelProviderProperties["sqlModelNames"];
|
|
17
17
|
constructor(config: V4Config, properties: z.output<typeof modelProviderRetrieveCodec>);
|
|
18
|
-
delete(): import("ts-results-es").AsyncResult<void, import("
|
|
19
|
-
setDefault(): import("ts-results-es").AsyncResult<ModelProvider, VersionConflictError | import("
|
|
20
|
-
update(fields: Partial<z.output<typeof modelProviderUpdateCodec>>): import("ts-results-es").AsyncResult<ModelProvider, VersionConflictError | import("
|
|
18
|
+
delete(): import("ts-results-es").AsyncResult<void, import("../../index.ts").HttpError>;
|
|
19
|
+
setDefault(): import("ts-results-es").AsyncResult<ModelProvider, VersionConflictError | import("../../index.ts").HttpError>;
|
|
20
|
+
update(fields: Partial<z.output<typeof modelProviderUpdateCodec>>): import("ts-results-es").AsyncResult<ModelProvider, VersionConflictError | import("../../index.ts").HttpError>;
|
|
21
21
|
static createSchema: z.ZodMiniObject<{
|
|
22
22
|
name: z.ZodMiniString<string>;
|
|
23
23
|
config: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import * as z from "zod/mini";
|
|
17
17
|
import { modelProviderCreateCodec, modelProviderRetrieveCodec, modelProviderUpdateCodec, } from "./modelProviderCodec.js";
|
|
18
|
-
import { VersionConflictError } from "
|
|
18
|
+
import { VersionConflictError } from "../../../common/problems.js";
|
|
19
19
|
export class ModelProvider {
|
|
20
20
|
config;
|
|
21
21
|
createdAt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelProvider.js","sourceRoot":"","sources":["../../../../src/enterprise/ai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0B,EAAE,MAAM,CAAC,CAAC,CAC1F;aACA,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;YACd,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACvB,OAAO,IAAI,oBAAoB,EAAE,CAAC;YACpC,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,YAAY,GAAG,wBAAwB,CAAC,GAAG,CAAC,GAAG,CAAC;IACvD,MAAM,CAAC,YAAY,GAAG,wBAAwB,CAAC,GAAG,CAAC,GAAG,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 type { V4Config } from \"../../../common/Config.ts\";\nimport * as z from \"zod/mini\";\nimport {\n modelProviderCreateCodec,\n modelProviderRetrieveCodec,\n modelProviderUpdateCodec,\n} from \"./modelProviderCodec.ts\";\nimport { VersionConflictError } from \"../../../common/problems.ts\";\n\nexport class ModelProvider implements Omit<ModelProviderProperties, \"tag\"> {\n readonly config: ModelProviderProperties[\"config\"];\n readonly createdAt: ModelProviderProperties[\"createdAt\"];\n readonly createdBy: ModelProviderProperties[\"createdBy\"];\n readonly defaultModelName: ModelProviderProperties[\"defaultModelName\"];\n readonly id: ModelProviderProperties[\"id\"];\n readonly isDefault: ModelProviderProperties[\"isDefault\"];\n readonly modifiedAt: ModelProviderProperties[\"modifiedAt\"];\n readonly modifiedBy: ModelProviderProperties[\"modifiedBy\"];\n readonly name: ModelProviderProperties[\"name\"];\n readonly sqlModelNames: ModelProviderProperties[\"sqlModelNames\"];\n\n readonly #config: V4Config;\n readonly #tag: string;\n\n constructor(config: V4Config, properties: z.output<typeof modelProviderRetrieveCodec>) {\n this.config = properties.config;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.defaultModelName = properties.defaultModelName;\n this.id = properties.id;\n this.isDefault = properties.isDefault;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.sqlModelNames = properties.sqlModelNames;\n\n this.#config = config;\n this.#tag = properties.tag;\n }\n\n delete() {\n return this.#config\n .v4Request(`model-provider/config/${this.id}`, {\n keepalive: true,\n method: \"DELETE\",\n })\n .map(() => undefined as void);\n }\n\n setDefault() {\n return this.update({ isDefault: true });\n }\n\n update(fields: Partial<z.output<typeof modelProviderUpdateCodec>>) {\n const body = z.encode(modelProviderUpdateCodec, {\n config: fields.config ?? this.config,\n defaultModelName: fields.defaultModelName ?? this.defaultModelName,\n isDefault: fields.isDefault ?? this.isDefault,\n name: fields.name ?? this.name,\n sqlModelNames: fields.sqlModelNames ?? this.sqlModelNames,\n });\n\n return this.#config\n .v4Request(`model-provider/config/${this.id}`, {\n body: JSON.stringify({ ...body, tag: this.#tag }),\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.input<typeof modelProviderRetrieveCodec>>)\n .map(\n (entity) => new ModelProvider(this.#config, z.decode(modelProviderRetrieveCodec, entity)),\n )\n .mapErr((val) => {\n if (val.status === 409) {\n return new VersionConflictError();\n }\n return val;\n });\n }\n\n static createSchema = modelProviderCreateCodec.def.out;\n static updateSchema = modelProviderUpdateCodec.def.out;\n}\n\ntype ModelProviderProperties = z.output<typeof modelProviderRetrieveCodec>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelProviderCodec.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/modelProvider/modelProviderCodec.ts"],"names":[],"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yright (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 amazonBedrockModelProviderConfigRetrieveSchema,\n amazonBedrockModelProviderConfigSchema,\n amazonBedrockModelProviderConfigUpdateSchema,\n anthropicModelProviderConfigRetrieveSchema,\n anthropicModelProviderConfigSchema,\n azureOpenAiModelProviderConfigRetrieveSchema,\n azureOpenAiModelProviderConfigSchema,\n azureOpenAiModelProviderConfigUpdateSchema,\n googleGeminiModelProviderConfigRetrieveSchema,\n googleGeminiModelProviderConfigSchema,\n openAiModelProviderConfigRetrieveSchema,\n openAiModelProviderConfigSchema,\n} from \"./modelProviderConfigSchemas.ts\";\nimport { Temporal } from \"temporal-polyfill\";\n\nconst modelProviderBaseSchema = z.object({\n createdAt: z.string().check(z.iso.datetime()),\n createdBy: z.string(),\n defaultModelName: z.string(),\n id: z.string(),\n isDefault: z.boolean(),\n modifiedAt: z.string().check(z.iso.datetime()),\n modifiedBy: z.string(),\n // eslint-disable-next-line regexp/prefer-w, regexp/use-ignore-case\n name: z.string().check(z.regex(/^[a-zA-Z0-9_-]+$/)),\n sqlModelNames: z.array(z.string()),\n tag: z.string(),\n});\n\nconst modelProviderRetrieveInSchema = z.extend(modelProviderBaseSchema, {\n config: z.union([\n z.strictObject({\n amazonBedrock: amazonBedrockModelProviderConfigRetrieveSchema,\n }),\n z.strictObject({\n anthropic: anthropicModelProviderConfigRetrieveSchema,\n }),\n z.strictObject({\n azureOpenAi: azureOpenAiModelProviderConfigRetrieveSchema,\n }),\n z.strictObject({\n googleGemini: googleGeminiModelProviderConfigRetrieveSchema,\n }),\n z.strictObject({\n openAi: openAiModelProviderConfigRetrieveSchema,\n }),\n ]),\n});\n\nconst modelProviderCreateInSchema = z.extend(\n z.pick(modelProviderBaseSchema, {\n defaultModelName: true,\n isDefault: true,\n name: true,\n sqlModelNames: true,\n }),\n {\n config: z.union([\n z.strictObject({\n amazonBedrock: amazonBedrockModelProviderConfigSchema,\n }),\n z.strictObject({\n anthropic: anthropicModelProviderConfigSchema,\n }),\n z.strictObject({\n azureOpenAi: azureOpenAiModelProviderConfigSchema,\n }),\n z.strictObject({\n googleGemini: googleGeminiModelProviderConfigSchema,\n }),\n z.strictObject({\n openAi: openAiModelProviderConfigSchema,\n }),\n ]),\n },\n);\n\nconst modelProviderUpdateInSchema = z.extend(\n z.omit(modelProviderCreateInSchema, { config: true }),\n {\n config: z.union([\n z.strictObject({\n amazonBedrock: amazonBedrockModelProviderConfigUpdateSchema,\n }),\n z.strictObject({\n anthropic: z.partial(anthropicModelProviderConfigSchema),\n }),\n z.strictObject({\n azureOpenAi: azureOpenAiModelProviderConfigUpdateSchema,\n }),\n z.strictObject({\n googleGemini: z.partial(googleGeminiModelProviderConfigSchema),\n }),\n z.strictObject({\n openAi: z.partial(openAiModelProviderConfigSchema),\n }),\n ]),\n },\n);\n\nexport const modelProviderRetrieveCodec = z.codec(\n modelProviderRetrieveInSchema,\n z.extend(\n z.omit(modelProviderRetrieveInSchema, {\n createdAt: true,\n modifiedAt: true,\n sqlModelNames: true,\n }),\n {\n createdAt: z.instanceof(Temporal.Instant),\n modifiedAt: z.instanceof(Temporal.Instant),\n sqlModelNames: z.set(z.string()),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n createdAt: Temporal.Instant.from(v.createdAt),\n modifiedAt: Temporal.Instant.from(v.modifiedAt),\n sqlModelNames: new Set(v.sqlModelNames),\n };\n },\n encode(v) {\n return {\n ...v,\n createdAt: v.createdAt.toString(),\n modifiedAt: v.modifiedAt.toString(),\n sqlModelNames: Array.from(v.sqlModelNames),\n };\n },\n },\n);\n\nexport const modelProviderCreateCodec = z.codec(\n modelProviderCreateInSchema,\n z.extend(\n z.omit(modelProviderCreateInSchema, {\n sqlModelNames: true,\n }),\n {\n sqlModelNames: z.set(z.string()),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n sqlModelNames: new Set(v.sqlModelNames),\n };\n },\n encode(v) {\n return {\n ...v,\n sqlModelNames: Array.from(v.sqlModelNames),\n };\n },\n },\n);\n\nexport const modelProviderUpdateCodec = z.codec(\n modelProviderUpdateInSchema,\n z.extend(z.omit(modelProviderUpdateInSchema, { sqlModelNames: true }), {\n sqlModelNames: z.set(z.string()),\n }),\n {\n decode(v) {\n return {\n ...v,\n sqlModelNames: new Set(v.sqlModelNames),\n };\n },\n encode(v) {\n return {\n ...v,\n sqlModelNames: Array.from(v.sqlModelNames),\n };\n },\n },\n);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelProviderConfigSchemas.js","sourceRoot":"","sources":["../../../../src/enterprise/ai/modelProvider/modelProviderConfigSchemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AAEpD,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;QAClB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;KAC5B,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sCAAsC,GA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M,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC;IAChD,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,sBAAsB;KAC/B,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;KAC9B,CAAC;CACH,CAAC,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\";\n\n/**\n * Amazon Bedrock\n */\nexport const amazonBedrockRegionSchema = z.string();\n\nconst amazonBedrockAccessKeyAuth = z.object({\n accessKey: z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.string(),\n }),\n});\n\nconst amazonBedrockRoleAuth = z.object({\n role: z.object({\n roleArn: z.string(),\n }),\n});\n\nexport const amazonBedrockModelProviderConfigSchema = z.object({\n auth: z.union([amazonBedrockAccessKeyAuth, amazonBedrockRoleAuth]),\n region: amazonBedrockRegionSchema,\n});\n\nexport const amazonBedrockModelProviderConfigRetrieveSchema = z.object({\n auth: z.union([\n z.object({\n accessKey: z.omit(amazonBedrockAccessKeyAuth.shape.accessKey, { secretAccessKey: true }),\n }),\n amazonBedrockRoleAuth,\n ]),\n region: amazonBedrockRegionSchema,\n});\n\nexport const amazonBedrockModelProviderConfigUpdateSchema = z.object({\n auth: z.optional(\n z.union([\n z.object({\n accessKey: z.extend(\n z.omit(amazonBedrockAccessKeyAuth.shape.accessKey, { secretAccessKey: true }),\n {\n secretAccessKey: z.optional(\n amazonBedrockAccessKeyAuth.shape.accessKey.shape.secretAccessKey,\n ),\n },\n ),\n }),\n amazonBedrockRoleAuth,\n ]),\n ),\n region: z.optional(amazonBedrockRegionSchema),\n});\n\n/**\n * Anthropic\n */\nexport const anthropicModelProviderConfigSchema = z.object({\n accessKey: z.string(),\n});\n\n/**\n * Azure OpenAI\n */\nconst azureOpenAiAuth = z.object({\n clientSecretAuth: z.object({\n azureClientId: z.string(),\n azureClientSecret: z.string(),\n azureTenantId: z.string(),\n }),\n});\n\nexport const azureOpenAiModelProviderConfigSchema = z.object({\n auth: z.object(azureOpenAiAuth.shape),\n resourceName: z.string(),\n});\n\nexport const azureOpenAiModelProviderConfigRetrieveSchema = z.object({\n auth: z.object({\n clientSecretAuth: z.omit(azureOpenAiAuth.shape.clientSecretAuth, { azureClientSecret: true }),\n }),\n resourceName: z.string(),\n});\n\nexport const azureOpenAiModelProviderConfigUpdateSchema = z.object({\n auth: z.optional(\n z.union([\n azureOpenAiModelProviderConfigSchema.shape.auth,\n z.object({\n clientSecretAuth: z.extend(\n z.omit(azureOpenAiAuth.shape.clientSecretAuth, { azureClientSecret: true }),\n {\n azureClientSecret: z.optional(\n azureOpenAiAuth.shape.clientSecretAuth.shape.azureClientSecret,\n ),\n },\n ),\n }),\n ]),\n ),\n resourceName: z.string(),\n});\n\nexport const anthropicModelProviderConfigRetrieveSchema = z.object({});\n\n/**\n * Google Gemini\n */\nexport const googleGeminiModelProviderConfigSchema = z.object({\n accessKey: z.string(),\n});\n\nexport const googleGeminiModelProviderConfigRetrieveSchema = z.object({});\n\n/**\n * OpenAI\n */\nexport const openAiModelProviderConfigSchema = z.object({\n accessKey: z.string(),\n organizationId: z.string(),\n region: z.optional(z.enum([\"GLOBAL\", \"US\", \"EU\"])),\n});\n\nexport const openAiModelProviderConfigRetrieveSchema = z.object({\n organizationId: z.string(),\n region: z.enum([\"GLOBAL\", \"US\", \"EU\"]),\n});\n\nconst listModelsAccessSchema = z.union([\n z.strictObject({\n amazonBedrock: amazonBedrockModelProviderConfigSchema,\n }),\n z.strictObject({\n anthropic: anthropicModelProviderConfigSchema,\n }),\n z.strictObject({\n azureOpenAi: azureOpenAiModelProviderConfigSchema,\n }),\n z.strictObject({\n googleGemini: googleGeminiModelProviderConfigSchema,\n }),\n z.strictObject({\n openAi: openAiModelProviderConfigSchema,\n }),\n]);\n\nexport const listModelsPropertiesSchema = z.union([\n z.object({\n access: listModelsAccessSchema,\n }),\n z.object({\n modelProviderName: z.string(),\n }),\n]);\n"]}
|