@arcgis/ai-components 5.2.0-next.120 → 5.2.0-next.121
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/agent-utils/LLMAgent.js +2 -0
- package/dist/agents/runtime/skill/createSkillAgent.js +115 -131
- package/dist/cdn/2DYOTV7W.js +4 -0
- package/dist/cdn/2WT4JANT.js +2 -0
- package/dist/cdn/{2NODROJN.js → 3F5EZZSG.js} +20 -24
- package/dist/cdn/4V3Q7XGS.js +2 -0
- package/dist/cdn/5GALSAQF.js +3 -0
- package/dist/cdn/72KYGCIU.js +2 -0
- package/dist/cdn/75OPJOCY.js +2 -0
- package/dist/cdn/7D6POJJA.js +2 -0
- package/dist/cdn/{SLR75R32.js → 7HVK7G55.js} +1 -1
- package/dist/cdn/7L6LPWRH.js +2 -0
- package/dist/cdn/7TAIUEMW.js +2 -0
- package/dist/cdn/{C2W6MBDB.js → D3E5NSY3.js} +1 -1
- package/dist/cdn/ESPC6NTI.js +68 -0
- package/dist/cdn/{HTB76P2C.js → EWO73MJA.js} +1 -1
- package/dist/cdn/{EIZR3Q5O.js → FGQLS3UX.js} +1 -1
- package/dist/cdn/FOZAOJCM.js +2 -0
- package/dist/cdn/GZDI2LAT.js +2 -0
- package/dist/cdn/H4ERKWFA.js +2 -0
- package/dist/cdn/{7W7KWR5O.js → H5AVPDSE.js} +4 -4
- package/dist/cdn/{2I2FHPHR.js → HDAMDEYL.js} +6 -6
- package/dist/cdn/JE55XX2C.js +2 -0
- package/dist/cdn/K36XPG2M.js +2 -0
- package/dist/cdn/KDE5MMMR.js +2 -0
- package/dist/cdn/{ZGZX7GR5.js → KONQTXBJ.js} +1 -1
- package/dist/cdn/{J4YHT55S.js → MCZJD3A4.js} +1 -1
- package/dist/cdn/MNZAQM3Q.js +3 -0
- package/dist/cdn/NHZRDYLP.js +2 -0
- package/dist/cdn/NYFV4A6L.js +3 -0
- package/dist/cdn/OGYNTGNM.js +2 -0
- package/dist/cdn/PGIXKPTW.js +2 -0
- package/dist/cdn/PTEKX5TX.js +2 -0
- package/dist/cdn/PUHPFUCU.js +2 -0
- package/dist/cdn/{GKWMAWFZ.js → QDOKDRBB.js} +1 -1
- package/dist/cdn/TGZBLBEJ.js +2 -0
- package/dist/cdn/{K7BUBCK7.js → UBKYXKMW.js} +1 -1
- package/dist/cdn/UXECAKJ7.js +2 -0
- package/dist/cdn/WXOKGQ4D.js +2 -0
- package/dist/cdn/Y364LLPN.js +2 -0
- package/dist/cdn/YBSY32EU.js +2 -0
- package/dist/cdn/{CF2V3NER.js → ZLLVPKDN.js} +35 -35
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/assets/agents/t9n/messages.ar.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.bg.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.ca.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.cs.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.da.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.de.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.el.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.es.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.et.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.fi.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.fr.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.he.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.hr.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.hu.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.id.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.it.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.ja.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.ko.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.lt.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.lv.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.nl.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.no.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.pl.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.pt-BR.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.pt-PT.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.ro.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.ru.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.sk.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.sl.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.sr.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.sv.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.th.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.tr.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.uk.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.vi.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.zh-CN.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.zh-TW.json +1 -0
- package/dist/cdn/assets/orchestrator/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +54 -52
- package/dist/chunks/aiFactory.js +59 -41
- package/dist/chunks/arcgisKnowledgeGraph.js +4 -2
- package/dist/chunks/dataExplorationAgent.js +1 -1
- package/dist/chunks/generateLayerDescriptions.js +160 -156
- package/dist/chunks/layerStylingGraph.js +2 -0
- package/dist/chunks/orchestrator.js +325 -295
- package/dist/components/arcgis-assistant/customElement.d.ts +1 -1
- package/dist/components/arcgis-assistant/customElement.js +113 -112
- package/dist/components/arcgis-assistant-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +5 -4
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/utils/index.js +38 -36
- package/package.json +7 -7
- package/dist/cdn/5BBXNT75.js +0 -66
- package/dist/cdn/5HBAJ57P.js +0 -2
- package/dist/cdn/5MK44FNO.js +0 -2
- package/dist/cdn/6ECRQVHY.js +0 -2
- package/dist/cdn/AUDVUNF3.js +0 -2
- package/dist/cdn/BJUX4AYP.js +0 -2
- package/dist/cdn/COH3QXWG.js +0 -4
- package/dist/cdn/CPQGLQGY.js +0 -2
- package/dist/cdn/CT2ZOYNX.js +0 -2
- package/dist/cdn/DNV3L5M6.js +0 -2
- package/dist/cdn/EDVH3G5A.js +0 -2
- package/dist/cdn/HWGAJ4WN.js +0 -2
- package/dist/cdn/IHRX74QJ.js +0 -2
- package/dist/cdn/LRH2ZPVW.js +0 -2
- package/dist/cdn/OTOQL3QM.js +0 -3
- package/dist/cdn/R74ZHFA6.js +0 -2
- package/dist/cdn/RGVC76RW.js +0 -2
- package/dist/cdn/RIN3RP7D.js +0 -3
- package/dist/cdn/SWVRA77H.js +0 -2
- package/dist/cdn/TLQ75QXG.js +0 -2
- package/dist/cdn/TPF5Z277.js +0 -3
- package/dist/cdn/UIIVUHXL.js +0 -2
- package/dist/cdn/UWZQWGZP.js +0 -2
- package/dist/cdn/UXYYH6XF.js +0 -2
- package/dist/cdn/XUYARLRP.js +0 -2
- package/dist/cdn/XV3DHHYJ.js +0 -2
- package/dist/cdn/Y2BCEVV6.js +0 -2
- package/dist/cdn/YJ4MZOVC.js +0 -2
- package/dist/cdn/YXIPCGGP.js +0 -2
- package/dist/cdn/YYFKFPSN.js +0 -2
|
@@ -1,115 +1,118 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { Annotation as
|
|
3
|
-
import { b as
|
|
2
|
+
import { Annotation as d } from "@langchain/langgraph/web";
|
|
3
|
+
import { b as P, r as w, m as q, c as N } from "./baseAgentState.js";
|
|
4
4
|
import l, { z as s } from "zod";
|
|
5
|
-
import { ChatPromptTemplate as
|
|
5
|
+
import { ChatPromptTemplate as I, SystemMessagePromptTemplate as O } from "@langchain/core/prompts";
|
|
6
6
|
import { s as g } from "./index.js";
|
|
7
|
-
import { AIMessage as
|
|
8
|
-
import { createAgent as
|
|
9
|
-
import { c as
|
|
10
|
-
const
|
|
11
|
-
agentExecutionContext:
|
|
12
|
-
default:
|
|
13
|
-
reducer:
|
|
7
|
+
import { AIMessage as U, isAIMessage as V, isToolMessage as $ } from "@langchain/core/messages";
|
|
8
|
+
import { createAgent as z, summarizationMiddleware as W, modelCallLimitMiddleware as B } from "langchain";
|
|
9
|
+
import { g as G, a as H, c as T, E as J } from "./aiFactory.js";
|
|
10
|
+
const xe = d.Root({
|
|
11
|
+
agentExecutionContext: d({
|
|
12
|
+
default: N,
|
|
13
|
+
reducer: q
|
|
14
14
|
}),
|
|
15
|
-
currentIntent:
|
|
15
|
+
currentIntent: d({
|
|
16
16
|
default: () => "none",
|
|
17
|
-
reducer:
|
|
17
|
+
reducer: w
|
|
18
18
|
}),
|
|
19
|
-
routing:
|
|
19
|
+
routing: d({
|
|
20
20
|
default: () => ({ mode: "auto" }),
|
|
21
|
-
reducer:
|
|
21
|
+
reducer: w
|
|
22
22
|
}),
|
|
23
|
-
lastExecutedAgent:
|
|
23
|
+
lastExecutedAgent: d({
|
|
24
24
|
default: () => "",
|
|
25
|
-
reducer:
|
|
25
|
+
reducer: w
|
|
26
26
|
}),
|
|
27
|
-
requiresFollowUp:
|
|
27
|
+
requiresFollowUp: d({
|
|
28
28
|
default: () => !0,
|
|
29
|
-
reducer:
|
|
29
|
+
reducer: w
|
|
30
30
|
}),
|
|
31
|
-
stepCount:
|
|
31
|
+
stepCount: d({
|
|
32
32
|
default: () => 0,
|
|
33
33
|
reducer: (e, t) => t ?? e + 1
|
|
34
34
|
}),
|
|
35
|
-
finalOutputMessage:
|
|
35
|
+
finalOutputMessage: d({
|
|
36
36
|
default: () => "",
|
|
37
|
-
reducer:
|
|
37
|
+
reducer: P
|
|
38
38
|
})
|
|
39
|
-
}),
|
|
39
|
+
}), L = (e) => {
|
|
40
40
|
if (!e || typeof e != "object" || !("services" in e))
|
|
41
41
|
return !1;
|
|
42
42
|
const t = e.services;
|
|
43
43
|
return !!t && typeof t == "object" && "agentRegistry" in t;
|
|
44
|
-
},
|
|
44
|
+
}, K = (e) => {
|
|
45
45
|
const t = e?.configurable;
|
|
46
|
-
return
|
|
47
|
-
},
|
|
46
|
+
return L(t) ? t : void 0;
|
|
47
|
+
}, Q = (e, t, o) => {
|
|
48
48
|
const n = e[t];
|
|
49
|
-
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((
|
|
50
|
-
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
49
|
+
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, r) => {
|
|
50
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(r.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== o ? ". Note that variables only represent file names one level deep." : ""))));
|
|
51
51
|
});
|
|
52
|
-
},
|
|
53
|
-
const { agent: t, messages:
|
|
52
|
+
}, M = async (e) => (await Q(/* @__PURE__ */ Object.assign({ "./field_descriptions_prompt.md": () => import("./field_descriptions_prompt.js"), "./intent_prompt.md": () => import("./intent_prompt.js"), "./layer_descriptions_prompt.md": () => import("./layer_descriptions_prompt.js") }), `./${e}.md`, 2)).default, X = async (e) => {
|
|
53
|
+
const { agent: t, messages: o, config: n } = e;
|
|
54
54
|
return { structuredResponse: (await t.invoke(
|
|
55
55
|
{
|
|
56
|
-
messages:
|
|
56
|
+
messages: o
|
|
57
57
|
},
|
|
58
58
|
n
|
|
59
59
|
)).structuredResponse };
|
|
60
|
-
},
|
|
60
|
+
}, Y = s.object({
|
|
61
61
|
id: s.string().min(1),
|
|
62
62
|
name: s.string().min(1),
|
|
63
63
|
description: s.string().min(1)
|
|
64
64
|
});
|
|
65
|
-
s.array(
|
|
66
|
-
const
|
|
67
|
-
const t = e.map((n) => n.id),
|
|
65
|
+
s.array(Y);
|
|
66
|
+
const k = (e) => JSON.stringify(e, null, 2), Z = (e) => {
|
|
67
|
+
const t = e.map((n) => n.id), o = s.enum(t);
|
|
68
68
|
return s.object({
|
|
69
|
-
intent:
|
|
69
|
+
intent: o.nullable(),
|
|
70
70
|
assignedTask: s.string().nullable(),
|
|
71
71
|
requiresFollowUp: s.boolean()
|
|
72
72
|
});
|
|
73
|
-
},
|
|
74
|
-
const
|
|
73
|
+
}, we = async (e, t) => {
|
|
74
|
+
const o = K(t), n = await G({
|
|
75
|
+
path: "./assets/orchestrator/t9n",
|
|
76
|
+
locale: H(t)
|
|
77
|
+
});
|
|
75
78
|
if (t?.signal?.aborted)
|
|
76
|
-
return await g({ text:
|
|
79
|
+
return await g({ text: n.runCancelled }, t), {
|
|
77
80
|
...e,
|
|
78
81
|
currentIntent: "none",
|
|
79
|
-
finalOutputMessage:
|
|
82
|
+
finalOutputMessage: n.runCancelled,
|
|
80
83
|
requiresFollowUp: !1
|
|
81
84
|
};
|
|
82
85
|
try {
|
|
83
|
-
await g({ text:
|
|
84
|
-
const r =
|
|
86
|
+
await g({ text: n.routingToAgent }, t);
|
|
87
|
+
const r = o.services.agentRegistry?.list() ?? [], a = r.map(({ agent: u }) => ({
|
|
85
88
|
id: u.id,
|
|
86
89
|
name: u.name,
|
|
87
90
|
description: u.description
|
|
88
91
|
}));
|
|
89
|
-
if (!
|
|
90
|
-
return await g({ text:
|
|
92
|
+
if (!a.length)
|
|
93
|
+
return await g({ text: n.noAgentsRegisteredTrace }, t), {
|
|
91
94
|
...e,
|
|
92
95
|
currentIntent: "none",
|
|
93
|
-
finalOutputMessage:
|
|
96
|
+
finalOutputMessage: n.noAgentsRegisteredMessage
|
|
94
97
|
};
|
|
95
|
-
const
|
|
96
|
-
registeredAgents:
|
|
97
|
-
priorSteps:
|
|
98
|
+
const c = await M("intent_prompt"), m = k(a), p = Z(a), f = {
|
|
99
|
+
registeredAgents: m,
|
|
100
|
+
priorSteps: k(e.agentExecutionContext.priorSteps),
|
|
98
101
|
userRequest: e.agentExecutionContext.userRequest
|
|
99
|
-
},
|
|
100
|
-
model: await
|
|
102
|
+
}, E = await I.fromTemplate(c).format(f), F = z({
|
|
103
|
+
model: await T({
|
|
101
104
|
modelTier: "fast",
|
|
102
105
|
config: t
|
|
103
106
|
}),
|
|
104
107
|
tools: [],
|
|
105
|
-
systemPrompt:
|
|
106
|
-
responseFormat:
|
|
108
|
+
systemPrompt: E,
|
|
109
|
+
responseFormat: p,
|
|
107
110
|
middleware: [
|
|
108
111
|
// Preserve recent conversation context while summarizing older messages
|
|
109
112
|
// to control token usage without losing important intent signals.
|
|
110
113
|
// The trigger and keep parameters can be tuned based on token limits and behavior.
|
|
111
|
-
|
|
112
|
-
model: await
|
|
114
|
+
W({
|
|
115
|
+
model: await T({
|
|
113
116
|
modelTier: "fast",
|
|
114
117
|
config: t
|
|
115
118
|
}),
|
|
@@ -118,28 +121,29 @@ const I = (e) => JSON.stringify(e, null, 2), Q = (e) => {
|
|
|
118
121
|
}),
|
|
119
122
|
// Enforce no loop/retry.
|
|
120
123
|
// 1 usual LLM call and 1 optional summarization call.
|
|
121
|
-
|
|
124
|
+
B({ runLimit: 2 })
|
|
122
125
|
]
|
|
123
|
-
}), { structuredResponse: R } = await
|
|
124
|
-
agent:
|
|
126
|
+
}), { structuredResponse: R } = await X({
|
|
127
|
+
agent: F,
|
|
125
128
|
messages: e.agentExecutionContext.messages,
|
|
126
129
|
config: t
|
|
127
|
-
}),
|
|
130
|
+
}), h = p.parse(
|
|
128
131
|
R ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
|
|
129
|
-
), x =
|
|
132
|
+
), x = h.intent ?? "none", _ = {
|
|
130
133
|
...e,
|
|
131
134
|
currentIntent: x,
|
|
132
|
-
requiresFollowUp:
|
|
135
|
+
requiresFollowUp: h.requiresFollowUp,
|
|
133
136
|
agentExecutionContext: {
|
|
134
137
|
...e.agentExecutionContext,
|
|
135
|
-
assignedTask:
|
|
138
|
+
assignedTask: h.assignedTask ?? ""
|
|
136
139
|
}
|
|
137
140
|
};
|
|
138
141
|
if (x === "none") {
|
|
139
|
-
const u =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
const u = n.noMatchingAgentMessage.replace(
|
|
143
|
+
"{agentNames}",
|
|
144
|
+
r.map(({ agent: j }) => j.name).join(", ")
|
|
145
|
+
);
|
|
146
|
+
return await g({ text: n.noMatchingAgentTrace }, t), {
|
|
143
147
|
...e,
|
|
144
148
|
currentIntent: x,
|
|
145
149
|
requiresFollowUp: !1,
|
|
@@ -147,7 +151,7 @@ Please ask a question that can be answered by one of these agents.`;
|
|
|
147
151
|
agentExecutionContext: {
|
|
148
152
|
...e.agentExecutionContext,
|
|
149
153
|
assignedTask: "",
|
|
150
|
-
messages: [...e.agentExecutionContext.messages, new
|
|
154
|
+
messages: [...e.agentExecutionContext.messages, new U(u)],
|
|
151
155
|
priorSteps: [
|
|
152
156
|
...e.agentExecutionContext.priorSteps ?? [],
|
|
153
157
|
{
|
|
@@ -162,29 +166,29 @@ Please ask a question that can be answered by one of these agents.`;
|
|
|
162
166
|
}
|
|
163
167
|
return await g(
|
|
164
168
|
{
|
|
165
|
-
text:
|
|
166
|
-
Task Assigned: ${f.assignedTask ?? ""}
|
|
167
|
-
Requires Follow-Up: ${f.requiresFollowUp}`
|
|
169
|
+
text: n.agentPicked.replace("{intent}", x).replace("{assignedTask}", h.assignedTask ?? "").replace("{requiresFollowUp}", String(h.requiresFollowUp))
|
|
168
170
|
},
|
|
169
171
|
t
|
|
170
|
-
),
|
|
171
|
-
} catch (
|
|
172
|
-
throw await g({ text:
|
|
172
|
+
), _;
|
|
173
|
+
} catch (i) {
|
|
174
|
+
throw await g({ text: n.intentDetectionErrorTrace }, t), new Error(
|
|
175
|
+
n.intentDetectionError.replace("{error}", i instanceof Error ? i.message : String(i))
|
|
176
|
+
);
|
|
173
177
|
}
|
|
174
|
-
},
|
|
178
|
+
}, ee = "0.1", y = 1536, te = "openai", ne = J.default, se = `Name: {name}
|
|
175
179
|
Title: {title}
|
|
176
|
-
Description: {description}`,
|
|
180
|
+
Description: {description}`, ie = `Name: {name}
|
|
177
181
|
Alias: {alias}
|
|
178
|
-
Description: {description}`,
|
|
179
|
-
schemaVersion: s.literal(
|
|
182
|
+
Description: {description}`, be = s.object({
|
|
183
|
+
schemaVersion: s.literal(ee),
|
|
180
184
|
modified: s.number().int().nonnegative(),
|
|
181
185
|
embeddings: s.object({
|
|
182
|
-
modelProvider: s.literal(
|
|
183
|
-
model: s.literal(
|
|
184
|
-
dimensions: s.literal(
|
|
186
|
+
modelProvider: s.literal(te),
|
|
187
|
+
model: s.literal(ne),
|
|
188
|
+
dimensions: s.literal(y),
|
|
185
189
|
templates: s.object({
|
|
186
|
-
layer: s.string().default(
|
|
187
|
-
field: s.string().default(
|
|
190
|
+
layer: s.string().default(se),
|
|
191
|
+
field: s.string().default(ie)
|
|
188
192
|
})
|
|
189
193
|
}),
|
|
190
194
|
layers: s.array(
|
|
@@ -193,135 +197,135 @@ Description: {description}`, we = s.object({
|
|
|
193
197
|
name: s.string().min(1),
|
|
194
198
|
title: s.string().catch(""),
|
|
195
199
|
description: s.string().catch(""),
|
|
196
|
-
vector: s.array(s.number()).length(
|
|
197
|
-
message: `Layer vector must be exactly ${
|
|
200
|
+
vector: s.array(s.number()).length(y, {
|
|
201
|
+
message: `Layer vector must be exactly ${y} dimensions`
|
|
198
202
|
}),
|
|
199
203
|
fields: s.array(
|
|
200
204
|
s.object({
|
|
201
205
|
name: s.string().min(1),
|
|
202
206
|
alias: s.string().catch(""),
|
|
203
207
|
description: s.string().catch(""),
|
|
204
|
-
vector: s.array(s.number()).length(
|
|
205
|
-
message: `Field vector must be exactly ${
|
|
208
|
+
vector: s.array(s.number()).length(y, {
|
|
209
|
+
message: `Field vector must be exactly ${y} dimensions`
|
|
206
210
|
})
|
|
207
211
|
})
|
|
208
212
|
)
|
|
209
213
|
})
|
|
210
214
|
).default([])
|
|
211
|
-
}),
|
|
215
|
+
}), oe = (e) => {
|
|
212
216
|
const t = /* @__PURE__ */ new Set();
|
|
213
217
|
for (const n of e)
|
|
214
|
-
if (
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
+
if (V(n)) {
|
|
219
|
+
const i = n;
|
|
220
|
+
i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((r) => {
|
|
221
|
+
r.id && t.add(r.id);
|
|
218
222
|
});
|
|
219
223
|
}
|
|
220
224
|
return e.filter((n) => {
|
|
221
|
-
if (
|
|
222
|
-
const
|
|
223
|
-
return t.has(
|
|
225
|
+
if ($(n)) {
|
|
226
|
+
const i = n;
|
|
227
|
+
return t.has(i.tool_call_id);
|
|
224
228
|
}
|
|
225
229
|
return !0;
|
|
226
230
|
});
|
|
227
|
-
},
|
|
228
|
-
const
|
|
229
|
-
return
|
|
230
|
-
},
|
|
231
|
-
const { promptText: t, modelTier:
|
|
232
|
-
return
|
|
233
|
-
},
|
|
234
|
-
const { promptText: t, modelTier:
|
|
231
|
+
}, v = (e, t) => {
|
|
232
|
+
const o = O.fromTemplate(e);
|
|
233
|
+
return I.fromMessages([o, ...t]);
|
|
234
|
+
}, re = async (e) => {
|
|
235
|
+
const { promptText: t, modelTier: o, messages: n, config: i } = e, r = v(t, n ?? []), a = await T({ modelTier: o, config: i });
|
|
236
|
+
return r.pipe(a);
|
|
237
|
+
}, Me = async (e) => {
|
|
238
|
+
const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, config: r } = e, c = await (await re({
|
|
235
239
|
promptText: t,
|
|
236
|
-
modelTier:
|
|
240
|
+
modelTier: o,
|
|
237
241
|
messages: n,
|
|
238
|
-
config:
|
|
239
|
-
})).invoke(
|
|
242
|
+
config: r
|
|
243
|
+
})).invoke(i ?? {}, r);
|
|
240
244
|
return typeof c == "string" ? c : c.text;
|
|
241
|
-
},
|
|
242
|
-
const { promptText: t, modelTier:
|
|
243
|
-
return await c.pipe(
|
|
244
|
-
},
|
|
245
|
-
const { promptText: t, modelTier:
|
|
246
|
-
return await m.pipe(
|
|
247
|
-
},
|
|
245
|
+
}, S = async (e) => {
|
|
246
|
+
const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, schema: r, config: a } = e, c = v(t, n ?? []), p = (await T({ modelTier: o, config: a })).withStructuredOutput(r);
|
|
247
|
+
return await c.pipe(p).invoke(i ?? {}, a);
|
|
248
|
+
}, ve = async (e) => {
|
|
249
|
+
const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, tools: r, config: a } = e, c = r.length > 0 ? oe(n ?? []) : n ?? [], m = v(t, c), p = await T({ modelTier: o, config: a });
|
|
250
|
+
return await m.pipe(p.bindTools(r)).invoke(i ?? {}, a);
|
|
251
|
+
}, ae = l.object({
|
|
248
252
|
name: l.string(),
|
|
249
253
|
description: l.string(),
|
|
250
254
|
valueType: l.string(),
|
|
251
255
|
alias: l.string()
|
|
252
|
-
}),
|
|
253
|
-
fields: l.array(
|
|
254
|
-
}),
|
|
255
|
-
const
|
|
256
|
-
return !!(
|
|
256
|
+
}), ce = l.object({
|
|
257
|
+
fields: l.array(ae)
|
|
258
|
+
}), A = (e, t) => e.getFieldAlias(t) ?? void 0, b = (e, t) => A(e, t.name) ?? t.alias ?? "", le = (e, t) => {
|
|
259
|
+
const o = A(e, t.name);
|
|
260
|
+
return !!(o && o !== (t.alias ?? ""));
|
|
257
261
|
};
|
|
258
|
-
function
|
|
259
|
-
const
|
|
262
|
+
function C(e, t) {
|
|
263
|
+
const o = /* @__PURE__ */ new Map();
|
|
260
264
|
for (const n of e.fields) {
|
|
261
|
-
const
|
|
265
|
+
const i = t.fields.find((m) => m.name === n.name), r = b(e, n), a = le(e, n), c = {
|
|
262
266
|
name: n.name,
|
|
263
267
|
type: n.type,
|
|
264
|
-
alias: a ?
|
|
265
|
-
description:
|
|
266
|
-
valueType:
|
|
268
|
+
alias: a ? r : i?.alias ?? r,
|
|
269
|
+
description: i?.description ?? n.description ?? "",
|
|
270
|
+
valueType: i?.valueType ?? n.valueType ?? "",
|
|
267
271
|
domain: e.getFieldDomain(n.name) ?? void 0
|
|
268
272
|
};
|
|
269
|
-
|
|
273
|
+
o.set(n.name, c);
|
|
270
274
|
}
|
|
271
|
-
return
|
|
275
|
+
return o;
|
|
272
276
|
}
|
|
273
|
-
const
|
|
274
|
-
const
|
|
275
|
-
const { name: c, type: m, description:
|
|
276
|
-
return [`Name: ${c}`, `Type: ${m}`, `Alias: ${
|
|
277
|
+
const ke = async (e) => {
|
|
278
|
+
const o = await M("field_descriptions_prompt"), n = e.fields.filter((a) => !(b(e, a) && a.description)).map((a) => {
|
|
279
|
+
const { name: c, type: m, description: p } = a, f = b(e, a);
|
|
280
|
+
return [`Name: ${c}`, `Type: ${m}`, `Alias: ${f}`, `Description: ${p ?? "N/A"}`].join(", ");
|
|
277
281
|
}).join(`
|
|
278
282
|
`);
|
|
279
283
|
if (n.length === 0)
|
|
280
|
-
return
|
|
281
|
-
const
|
|
284
|
+
return C(e, { fields: [] });
|
|
285
|
+
const i = {
|
|
282
286
|
existingItemTitle: e.portalItem?.title,
|
|
283
287
|
existingItemDescription: e.portalItem?.description,
|
|
284
288
|
existingLayerTitle: e.title,
|
|
285
289
|
existingLayerDescription: e.portalItem?.description,
|
|
286
290
|
fieldInformation: n
|
|
287
|
-
},
|
|
288
|
-
promptText:
|
|
289
|
-
schema:
|
|
290
|
-
inputVariables:
|
|
291
|
+
}, r = await S({
|
|
292
|
+
promptText: o,
|
|
293
|
+
schema: ce,
|
|
294
|
+
inputVariables: i
|
|
291
295
|
});
|
|
292
|
-
return
|
|
293
|
-
},
|
|
296
|
+
return C(e, r);
|
|
297
|
+
}, me = l.object({
|
|
294
298
|
title: l.string(),
|
|
295
299
|
description: l.string(),
|
|
296
300
|
name: l.string().nullable()
|
|
297
|
-
}),
|
|
298
|
-
const n = await
|
|
299
|
-
fieldInformation: JSON.stringify(
|
|
301
|
+
}), Ce = async (e, t) => {
|
|
302
|
+
const n = await M("layer_descriptions_prompt"), i = Array.from(t.values()), r = {
|
|
303
|
+
fieldInformation: JSON.stringify(i, null, 2),
|
|
300
304
|
existingLayerTitle: e.title,
|
|
301
305
|
existingLayerDescription: e.portalItem?.description,
|
|
302
306
|
existingLayerSnippet: e.portalItem?.snippet,
|
|
303
307
|
layerGeometryType: e.geometryType
|
|
304
308
|
};
|
|
305
|
-
return { ...await
|
|
309
|
+
return { ...await S({
|
|
306
310
|
promptText: n,
|
|
307
|
-
schema:
|
|
308
|
-
inputVariables:
|
|
311
|
+
schema: me,
|
|
312
|
+
inputVariables: r
|
|
309
313
|
}), name: e.title ?? null };
|
|
310
314
|
};
|
|
311
315
|
export {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
316
|
+
xe as D,
|
|
317
|
+
be as W,
|
|
318
|
+
Me as a,
|
|
319
|
+
we as b,
|
|
320
|
+
ke as c,
|
|
321
|
+
Ce as d,
|
|
322
|
+
y as e,
|
|
323
|
+
ie as f,
|
|
324
|
+
K as g,
|
|
325
|
+
te as h,
|
|
326
|
+
ve as i,
|
|
327
|
+
S as j,
|
|
328
|
+
se as l,
|
|
329
|
+
ne as m,
|
|
330
|
+
ee as s
|
|
327
331
|
};
|
|
@@ -7,6 +7,8 @@ import "@arcgis/toolkit/string";
|
|
|
7
7
|
import { i as v } from "./generateLayerDescriptions.js";
|
|
8
8
|
import "@langchain/core/messages";
|
|
9
9
|
import { s } from "./index.js";
|
|
10
|
+
import "@arcgis/toolkit/intl";
|
|
11
|
+
import "./runtime.js";
|
|
10
12
|
import "@langchain/core/callbacks/base";
|
|
11
13
|
import "@langchain/openai";
|
|
12
14
|
import "@arcgis/core/config.js";
|