@arcgis/ai-agents 5.1.0-next.101 → 5.1.0-next.103
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/agents/arcgisKnowledge/context/arcgisKnowledgeContext.d.ts +5 -4
- package/dist/agents/arcgisKnowledge/context/getArcgisKnowledgeContext.d.ts +3 -2
- package/dist/agents/arcgisKnowledge/tools/addRecords/core.d.ts +2 -2
- package/dist/agents/arcgisKnowledge/tools/generateCypher/core.d.ts +2 -1
- package/dist/agents/arcgisKnowledge/tools/generateCypher/types.d.ts +5 -0
- package/dist/agents/arcgisKnowledge/utils/dataTransformationUtils.d.ts +6 -0
- package/dist/agents/arcgisKnowledge/utils/mapUtils.d.ts +4 -0
- package/dist/agents/arcgisKnowledge/utils/queryUtils.d.ts +26 -8
- package/dist/arcgis_knowledge_current_map_context-CfNPKOjr.js +7 -0
- package/dist/index.js +1427 -1241
- package/package.json +2 -2
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { default as KnowledgeGraph } from '@arcgis/core/rest/knowledgeGraph/KnowledgeGraph.js';
|
|
2
2
|
import { default as LinkChartView } from '@arcgis/core/views/LinkChartView.js';
|
|
3
|
+
import { default as MapView } from '@arcgis/core/views/MapView.js';
|
|
3
4
|
/**
|
|
4
5
|
* Context required by the Knowledge Link Chart agent.
|
|
5
6
|
* Supplied by the application via an agent `getContext()` provider.
|
|
6
7
|
*/
|
|
7
8
|
export type ArcgisKnowledgeContext = {
|
|
8
9
|
knowledgeGraph: KnowledgeGraph;
|
|
9
|
-
|
|
10
|
+
view?: never;
|
|
10
11
|
} | {
|
|
11
|
-
|
|
12
|
+
view: LinkChartView | MapView;
|
|
12
13
|
knowledgeGraph?: never;
|
|
13
14
|
};
|
|
14
|
-
export declare const arcgisKnowledgeContextRequiredKeys: readonly ["
|
|
15
|
-
export declare const serviceContextKeys: readonly ["knowledgeGraph", "
|
|
15
|
+
export declare const arcgisKnowledgeContextRequiredKeys: readonly ["view"];
|
|
16
|
+
export declare const serviceContextKeys: readonly ["knowledgeGraph", "view"];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { RunnableConfig } from '@langchain/core/runnables';
|
|
2
2
|
import { default as KnowledgeGraph } from '@arcgis/core/rest/knowledgeGraph/KnowledgeGraph.js';
|
|
3
3
|
import { default as LinkChartView } from '@arcgis/core/views/LinkChartView.js';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { default as MapView } from '@arcgis/core/views/MapView.js';
|
|
5
|
+
export declare function getViewContext(config?: RunnableConfig): {
|
|
6
|
+
view: LinkChartView | MapView;
|
|
6
7
|
};
|
|
7
8
|
export declare function getKnowledgeGraphContext(config?: RunnableConfig): Promise<{
|
|
8
9
|
knowledgeGraph: KnowledgeGraph;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RunnableConfig } from '@langchain/core/runnables';
|
|
2
2
|
import { default as KnowledgeGraph } from '@arcgis/core/rest/knowledgeGraph/KnowledgeGraph.js';
|
|
3
|
-
import {
|
|
4
|
-
export declare function executeAddRecords(prompt: string, knowledgeGraph: KnowledgeGraph, graphQueryServiceUrl: string,
|
|
3
|
+
import { ArcgisKnowledgeContext } from '../../context/arcgisKnowledgeContext';
|
|
4
|
+
export declare function executeAddRecords(prompt: string, knowledgeGraph: KnowledgeGraph, graphQueryServiceUrl: string, context: ArcgisKnowledgeContext, config?: RunnableConfig): Promise<string>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { default as DataModel } from '@arcgis/core/rest/knowledgeGraph/DataModel.js';
|
|
2
2
|
import { RunnableConfig } from '@langchain/core/runnables';
|
|
3
|
+
import { GraphQueryRetryContext } from './types';
|
|
3
4
|
export declare function executeGenerateCypher(prompt: string, dataModel: DataModel, graphQueryServiceUrl: string, config?: RunnableConfig): Promise<string>;
|
|
4
|
-
export declare function getCypherFromPrompt(prompt: string, dataModel: DataModel, graphQueryServiceUrl: string, config?: RunnableConfig): Promise<{
|
|
5
|
+
export declare function getCypherFromPrompt(prompt: string, dataModel: DataModel, graphQueryServiceUrl: string, config?: RunnableConfig, retryContext?: GraphQueryRetryContext): Promise<{
|
|
5
6
|
graphQuery: string;
|
|
6
7
|
explanation: string;
|
|
7
8
|
}>;
|
|
@@ -3,6 +3,12 @@ import { GraphAnyValue } from '@arcgis/core/rest/knowledgeGraph/GraphAnyValue.js
|
|
|
3
3
|
import { default as GraphNamedObject } from '@arcgis/core/rest/knowledgeGraph/GraphNamedObject.js';
|
|
4
4
|
import { default as KnowledgeGraph } from '@arcgis/core/rest/knowledgeGraph/KnowledgeGraph.js';
|
|
5
5
|
import { default as WebLinkChart } from '@arcgis/core/WebLinkChart.js';
|
|
6
|
+
import { default as WebMap } from '@arcgis/core/WebMap.js';
|
|
6
7
|
export declare function extractGraphNamedObjectsFromQueryValueRecursive(resultValue: GraphAnyValue, results: Map<string, IdTypePair>): void;
|
|
7
8
|
export declare function forEachGraphNamedObjectInQueryValueRecursive(resultValue: GraphAnyValue, callback: (graphNamedObject: GraphNamedObject) => void): void;
|
|
8
9
|
export declare function getAllIdTypePairsFromLinkChart(linkChart: WebLinkChart, knowledgeGraph: KnowledgeGraph): IdTypePair[];
|
|
10
|
+
export declare function getAllIdTypePairsAndDynamicTypesFromMap(map: WebMap): {
|
|
11
|
+
allNamedTypesFullyDynamic: boolean;
|
|
12
|
+
idTypePairs: IdTypePair[];
|
|
13
|
+
dynamicTypes: string[];
|
|
14
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as LinkChartView } from '@arcgis/core/views/LinkChartView.js';
|
|
2
|
+
import { default as MapView } from '@arcgis/core/views/MapView.js';
|
|
3
|
+
export declare function isMapValid(mapView: MapView): void;
|
|
4
|
+
export declare function isMapView(view: LinkChartView | MapView | undefined): boolean;
|
|
@@ -3,31 +3,49 @@ import { RequestOptions } from '@arcgis/core/request/types.js';
|
|
|
3
3
|
import { default as GraphNamedObject } from '@arcgis/core/rest/knowledgeGraph/GraphNamedObject.js';
|
|
4
4
|
import { default as GraphQueryResultHeader } from '@arcgis/core/rest/knowledgeGraph/GraphQueryResultHeader.js';
|
|
5
5
|
import { GraphAnyValue } from '@arcgis/core/rest/knowledgeGraph/GraphAnyValue.js';
|
|
6
|
-
import {
|
|
6
|
+
import { RunnableConfig } from '@langchain/core/runnables';
|
|
7
|
+
export declare const MAX_GRAPH_QUERY_ATTEMPTS = 3;
|
|
7
8
|
export declare function truncateGraphNamedObjectStringProperties(record: GraphNamedObject, maxLength?: number): GraphNamedObject;
|
|
8
|
-
type
|
|
9
|
+
type GenerateAndExecuteFailureResult = {
|
|
9
10
|
type: "aborted";
|
|
11
|
+
errorMessage: string;
|
|
12
|
+
graphQuery?: string;
|
|
13
|
+
explanation?: string;
|
|
10
14
|
} | {
|
|
11
|
-
type: "error";
|
|
15
|
+
type: "execution-error";
|
|
16
|
+
errorMessage: string;
|
|
17
|
+
error: unknown;
|
|
18
|
+
graphQuery: string;
|
|
19
|
+
explanation: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "generation-error";
|
|
12
22
|
errorMessage: string;
|
|
13
23
|
error: unknown;
|
|
14
24
|
} | {
|
|
25
|
+
type: "timeout";
|
|
26
|
+
errorMessage: string;
|
|
27
|
+
graphQuery: string;
|
|
28
|
+
explanation: string;
|
|
29
|
+
};
|
|
30
|
+
type GenerateAndExecuteResult<T> = GenerateAndExecuteFailureResult | {
|
|
15
31
|
type: "success";
|
|
32
|
+
graphQuery: string;
|
|
33
|
+
explanation: string;
|
|
16
34
|
rowLimitReached: boolean;
|
|
17
35
|
resultHeader: GraphQueryResultHeader;
|
|
18
36
|
processedResult: T;
|
|
19
|
-
} | {
|
|
20
|
-
type: "timeout";
|
|
21
37
|
};
|
|
22
|
-
export declare
|
|
38
|
+
export declare function generateAndExecuteCypherQueryAndReduce<T>({ prompt, kg, graphQueryServiceUrl, targetStructure, targetStructureReducer, requestOptions, queryRowLimit, queryTimeoutMs, config, }: {
|
|
39
|
+
prompt: string;
|
|
23
40
|
kg: KnowledgeGraph;
|
|
24
|
-
|
|
41
|
+
graphQueryServiceUrl: string;
|
|
25
42
|
targetStructure: T;
|
|
26
43
|
targetStructureReducer: (prev: T, nextRow: GraphAnyValue[]) => T;
|
|
27
44
|
requestOptions?: RequestOptions;
|
|
28
45
|
queryRowLimit?: number;
|
|
29
46
|
queryTimeoutMs?: number;
|
|
30
|
-
|
|
47
|
+
config?: RunnableConfig;
|
|
48
|
+
}): Promise<GenerateAndExecuteResult<T>>;
|
|
31
49
|
type RunGraphSearchResult = {
|
|
32
50
|
type: "error";
|
|
33
51
|
errorMessage: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const e = `## Additional System Context
|
|
2
|
+
|
|
3
|
+
In addition to the user's inquiry prompt that precedes this system context, the current map has entities and relationships on it already, in the format of an array of objects containing identifiers and typeNames or type names that contain all entities or relationships of that type, in case this is needed for query generation (for example 'Add all records that are connected to people on this map to the map'). If the user is asking for a query that acts on 'the current map', 'my map', or similar then the cypher query should be filtered by the ids. For example, 'Match (n:Person)-[\\r]->(m) WHERE id(n) IN [\\'identifier1','identifier2'] return r, m. Curly braces (the '{' and '}' characters) are often part of identifier strings and should not be stripped out - the process of filtering by ids should not be altering the id strings. The entities and relationships that are on the current map are as follows:
|
|
4
|
+
`;
|
|
5
|
+
export {
|
|
6
|
+
e as default
|
|
7
|
+
};
|