@azure/ai-agents 1.0.0-beta.2 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -34
- package/dist/browser/api/agentsContext.d.ts.map +1 -1
- package/dist/browser/api/agentsContext.js +7 -4
- package/dist/browser/api/agentsContext.js.map +1 -1
- package/dist/browser/api/operations.d.ts +3 -3
- package/dist/browser/api/operations.d.ts.map +1 -1
- package/dist/browser/api/operations.js +14 -14
- package/dist/browser/api/operations.js.map +1 -1
- package/dist/browser/api/poller.d.ts +7 -2
- package/dist/browser/api/poller.d.ts.map +1 -1
- package/dist/browser/api/poller.js +31 -9
- package/dist/browser/api/poller.js.map +1 -1
- package/dist/browser/api/runs/operations.d.ts +12 -7
- package/dist/browser/api/runs/operations.d.ts.map +1 -1
- package/dist/browser/api/runs/operations.js +59 -9
- package/dist/browser/api/runs/operations.js.map +1 -1
- package/dist/browser/api/runs/options.d.ts +2 -1
- package/dist/browser/api/runs/options.d.ts.map +1 -1
- package/dist/browser/api/runs/options.js.map +1 -1
- package/dist/browser/classic/runs/index.d.ts +4 -1
- package/dist/browser/classic/runs/index.d.ts.map +1 -1
- package/dist/browser/classic/runs/index.js +2 -1
- package/dist/browser/classic/runs/index.js.map +1 -1
- package/dist/browser/constants.d.ts +1 -1
- package/dist/browser/constants.js +1 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/models/models.d.ts +6 -2
- package/dist/browser/models/models.d.ts.map +1 -1
- package/dist/browser/models/models.js +8 -0
- package/dist/browser/models/models.js.map +1 -1
- package/dist/browser/models/streamingModels.d.ts +1 -67
- package/dist/browser/models/streamingModels.d.ts.map +1 -1
- package/dist/browser/models/streamingModels.js +1 -72
- package/dist/browser/models/streamingModels.js.map +1 -1
- package/dist/browser/utils.d.ts +20 -1
- package/dist/browser/utils.d.ts.map +1 -1
- package/dist/browser/utils.js +33 -1
- package/dist/browser/utils.js.map +1 -1
- package/dist/commonjs/api/agentsContext.d.ts.map +1 -1
- package/dist/commonjs/api/agentsContext.js +7 -4
- package/dist/commonjs/api/agentsContext.js.map +1 -1
- package/dist/commonjs/api/operations.d.ts +3 -3
- package/dist/commonjs/api/operations.d.ts.map +1 -1
- package/dist/commonjs/api/operations.js +18 -18
- package/dist/commonjs/api/operations.js.map +1 -1
- package/dist/commonjs/api/poller.d.ts +7 -2
- package/dist/commonjs/api/poller.d.ts.map +1 -1
- package/dist/commonjs/api/poller.js +32 -9
- package/dist/commonjs/api/poller.js.map +1 -1
- package/dist/commonjs/api/runs/operations.d.ts +12 -7
- package/dist/commonjs/api/runs/operations.d.ts.map +1 -1
- package/dist/commonjs/api/runs/operations.js +58 -6
- package/dist/commonjs/api/runs/operations.js.map +1 -1
- package/dist/commonjs/api/runs/options.d.ts +2 -1
- package/dist/commonjs/api/runs/options.d.ts.map +1 -1
- package/dist/commonjs/api/runs/options.js.map +1 -1
- package/dist/commonjs/classic/runs/index.d.ts +4 -1
- package/dist/commonjs/classic/runs/index.d.ts.map +1 -1
- package/dist/commonjs/classic/runs/index.js +1 -0
- package/dist/commonjs/classic/runs/index.js.map +1 -1
- package/dist/commonjs/constants.d.ts +1 -1
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/models/models.d.ts +6 -2
- package/dist/commonjs/models/models.d.ts.map +1 -1
- package/dist/commonjs/models/models.js +8 -0
- package/dist/commonjs/models/models.js.map +1 -1
- package/dist/commonjs/models/streamingModels.d.ts +1 -67
- package/dist/commonjs/models/streamingModels.d.ts.map +1 -1
- package/dist/commonjs/models/streamingModels.js +0 -73
- package/dist/commonjs/models/streamingModels.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/utils.d.ts +20 -1
- package/dist/commonjs/utils.d.ts.map +1 -1
- package/dist/commonjs/utils.js +33 -1
- package/dist/commonjs/utils.js.map +1 -1
- package/dist/esm/api/agentsContext.d.ts.map +1 -1
- package/dist/esm/api/agentsContext.js +7 -4
- package/dist/esm/api/agentsContext.js.map +1 -1
- package/dist/esm/api/operations.d.ts +3 -3
- package/dist/esm/api/operations.d.ts.map +1 -1
- package/dist/esm/api/operations.js +14 -14
- package/dist/esm/api/operations.js.map +1 -1
- package/dist/esm/api/poller.d.ts +7 -2
- package/dist/esm/api/poller.d.ts.map +1 -1
- package/dist/esm/api/poller.js +31 -9
- package/dist/esm/api/poller.js.map +1 -1
- package/dist/esm/api/runs/operations.d.ts +12 -7
- package/dist/esm/api/runs/operations.d.ts.map +1 -1
- package/dist/esm/api/runs/operations.js +59 -9
- package/dist/esm/api/runs/operations.js.map +1 -1
- package/dist/esm/api/runs/options.d.ts +2 -1
- package/dist/esm/api/runs/options.d.ts.map +1 -1
- package/dist/esm/api/runs/options.js.map +1 -1
- package/dist/esm/classic/runs/index.d.ts +4 -1
- package/dist/esm/classic/runs/index.d.ts.map +1 -1
- package/dist/esm/classic/runs/index.js +2 -1
- package/dist/esm/classic/runs/index.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/models/models.d.ts +6 -2
- package/dist/esm/models/models.d.ts.map +1 -1
- package/dist/esm/models/models.js +8 -0
- package/dist/esm/models/models.js.map +1 -1
- package/dist/esm/models/streamingModels.d.ts +1 -67
- package/dist/esm/models/streamingModels.d.ts.map +1 -1
- package/dist/esm/models/streamingModels.js +1 -72
- package/dist/esm/models/streamingModels.js.map +1 -1
- package/dist/esm/utils.d.ts +20 -1
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/utils.js +33 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/react-native/api/agentsContext.d.ts.map +1 -1
- package/dist/react-native/api/agentsContext.js +7 -4
- package/dist/react-native/api/agentsContext.js.map +1 -1
- package/dist/react-native/api/operations.d.ts +3 -3
- package/dist/react-native/api/operations.d.ts.map +1 -1
- package/dist/react-native/api/operations.js +14 -14
- package/dist/react-native/api/operations.js.map +1 -1
- package/dist/react-native/api/poller.d.ts +7 -2
- package/dist/react-native/api/poller.d.ts.map +1 -1
- package/dist/react-native/api/poller.js +31 -9
- package/dist/react-native/api/poller.js.map +1 -1
- package/dist/react-native/api/runs/operations.d.ts +12 -7
- package/dist/react-native/api/runs/operations.d.ts.map +1 -1
- package/dist/react-native/api/runs/operations.js +59 -9
- package/dist/react-native/api/runs/operations.js.map +1 -1
- package/dist/react-native/api/runs/options.d.ts +2 -1
- package/dist/react-native/api/runs/options.d.ts.map +1 -1
- package/dist/react-native/api/runs/options.js.map +1 -1
- package/dist/react-native/classic/runs/index.d.ts +4 -1
- package/dist/react-native/classic/runs/index.d.ts.map +1 -1
- package/dist/react-native/classic/runs/index.js +2 -1
- package/dist/react-native/classic/runs/index.js.map +1 -1
- package/dist/react-native/constants.d.ts +1 -1
- package/dist/react-native/constants.js +1 -1
- package/dist/react-native/constants.js.map +1 -1
- package/dist/react-native/models/models.d.ts +6 -2
- package/dist/react-native/models/models.d.ts.map +1 -1
- package/dist/react-native/models/models.js +8 -0
- package/dist/react-native/models/models.js.map +1 -1
- package/dist/react-native/models/streamingModels.d.ts +1 -67
- package/dist/react-native/models/streamingModels.d.ts.map +1 -1
- package/dist/react-native/models/streamingModels.js +1 -72
- package/dist/react-native/models/streamingModels.js.map +1 -1
- package/dist/react-native/utils.d.ts +20 -1
- package/dist/react-native/utils.d.ts.map +1 -1
- package/dist/react-native/utils.js +33 -1
- package/dist/react-native/utils.js.map +1 -1
- package/package.json +7 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentStreamEvent, AgentThread, MessageDeltaChunk, RunStep, RunStepDeltaChunk, ThreadMessage, ThreadRun } from "./models.js";
|
|
1
|
+
import type { AgentStreamEvent, AgentThread, MessageDeltaChunk, RunStep, RunStepDeltaChunk, ThreadMessage, ThreadRun } from "./models.js";
|
|
2
2
|
/**
|
|
3
3
|
Each event in a server-sent events stream has an `event` and `data` property:
|
|
4
4
|
*
|
|
@@ -26,72 +26,6 @@ export interface AgentEventMessage {
|
|
|
26
26
|
}
|
|
27
27
|
/** Represents a stream event data in the agent. */
|
|
28
28
|
export type AgentEventStreamData = AgentThread | ThreadRun | RunStep | ThreadMessage | MessageDeltaChunk | RunStepDeltaChunk | string;
|
|
29
|
-
/** Thread operation related streaming events */
|
|
30
|
-
export declare enum ThreadStreamEvent {
|
|
31
|
-
/** Event sent when a new thread is created. The data of this event is of type AgentThread */
|
|
32
|
-
ThreadCreated = "thread.created"
|
|
33
|
-
}
|
|
34
|
-
/** Run operation related streaming events */
|
|
35
|
-
export declare enum RunStreamEvent {
|
|
36
|
-
/** Event sent when a new run is created. The data of this event is of type ThreadRun */
|
|
37
|
-
ThreadRunCreated = "thread.run.created",
|
|
38
|
-
/** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */
|
|
39
|
-
ThreadRunQueued = "thread.run.queued",
|
|
40
|
-
/** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */
|
|
41
|
-
ThreadRunInProgress = "thread.run.in_progress",
|
|
42
|
-
/** Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun */
|
|
43
|
-
ThreadRunRequiresAction = "thread.run.requires_action",
|
|
44
|
-
/** Event sent when a run is completed. The data of this event is of type ThreadRun */
|
|
45
|
-
ThreadRunCompleted = "thread.run.completed",
|
|
46
|
-
/** Event sent when a run fails. The data of this event is of type ThreadRun */
|
|
47
|
-
ThreadRunFailed = "thread.run.failed",
|
|
48
|
-
/** Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun */
|
|
49
|
-
ThreadRunCancelling = "thread.run.cancelling",
|
|
50
|
-
/** Event sent when a run is cancelled. The data of this event is of type ThreadRun */
|
|
51
|
-
ThreadRunCancelled = "thread.run.cancelled",
|
|
52
|
-
/** Event sent when a run is expired. The data of this event is of type ThreadRun */
|
|
53
|
-
ThreadRunExpired = "thread.run.expired"
|
|
54
|
-
}
|
|
55
|
-
/** Run step operation related streaming events */
|
|
56
|
-
export declare enum RunStepStreamEvent {
|
|
57
|
-
/** Event sent when a new thread run step is created. The data of this event is of type RunStep */
|
|
58
|
-
ThreadRunStepCreated = "thread.run.step.created",
|
|
59
|
-
/** Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep */
|
|
60
|
-
ThreadRunStepInProgress = "thread.run.step.in_progress",
|
|
61
|
-
/** Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk */
|
|
62
|
-
ThreadRunStepDelta = "thread.run.step.delta",
|
|
63
|
-
/** Event sent when a run step is completed. The data of this event is of type RunStep */
|
|
64
|
-
ThreadRunStepCompleted = "thread.run.step.completed",
|
|
65
|
-
/** Event sent when a run step fails. The data of this event is of type RunStep */
|
|
66
|
-
ThreadRunStepFailed = "thread.run.step.failed",
|
|
67
|
-
/** Event sent when a run step is cancelled. The data of this event is of type RunStep */
|
|
68
|
-
ThreadRunStepCancelled = "thread.run.step.cancelled",
|
|
69
|
-
/** Event sent when a run step is expired. The data of this event is of type RunStep */
|
|
70
|
-
ThreadRunStepExpired = "thread.run.step.expired"
|
|
71
|
-
}
|
|
72
|
-
/** Message operation related streaming events */
|
|
73
|
-
export declare enum MessageStreamEvent {
|
|
74
|
-
/** Event sent when a new message is created. The data of this event is of type ThreadMessage */
|
|
75
|
-
ThreadMessageCreated = "thread.message.created",
|
|
76
|
-
/** Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage */
|
|
77
|
-
ThreadMessageInProgress = "thread.message.in_progress",
|
|
78
|
-
/** Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk */
|
|
79
|
-
ThreadMessageDelta = "thread.message.delta",
|
|
80
|
-
/** Event sent when a message is completed. The data of this event is of type ThreadMessage */
|
|
81
|
-
ThreadMessageCompleted = "thread.message.completed",
|
|
82
|
-
/** Event sent before a message is completed. The data of this event is of type ThreadMessage */
|
|
83
|
-
ThreadMessageIncomplete = "thread.message.incomplete"
|
|
84
|
-
}
|
|
85
|
-
/** Terminal event indicating a server side error while streaming. */
|
|
86
|
-
export declare enum ErrorEvent {
|
|
87
|
-
/** Event sent when an error occurs, such as an internal server error or a timeout. */
|
|
88
|
-
Error = "error"
|
|
89
|
-
}
|
|
90
|
-
/** Terminal event indicating the successful end of a stream. */
|
|
91
|
-
export declare enum DoneEvent {
|
|
92
|
-
/** Event sent when the stream is done. */
|
|
93
|
-
Done = "done"
|
|
94
|
-
}
|
|
95
29
|
/** Represents a stream of agent event message. */
|
|
96
30
|
export interface AgentEventMessageStream extends AsyncDisposable, AsyncIterable<AgentEventMessage> {
|
|
97
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamingModels.d.ts","sourceRoot":"","sources":["../../../src/models/streamingModels.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"streamingModels.d.ts","sourceRoot":"","sources":["../../../src/models/streamingModels.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,iBAAiB,EACjB,aAAa,EACb,SAAS,EACV,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,iBAAiB;IAChC,kKAAkK;IAClK,IAAI,EAAE,oBAAoB,CAAC;IAC3B,6BAA6B;IAC7B,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAAC;CAClC;AAED,mDAAmD;AACnD,MAAM,MAAM,oBAAoB,GAC5B,WAAW,GACX,SAAS,GACT,OAAO,GACP,aAAa,GACb,iBAAiB,GACjB,iBAAiB,GACjB,MAAM,CAAC;AAEX,kDAAkD;AAClD,MAAM,WAAW,uBACf,SAAQ,eAAe,EACrB,aAAa,CAAC,iBAAiB,CAAC;CAAG;AAEvC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,SAAS,CAAC,GAAG;IACtD;;;OAGG;IACH,MAAM,EAAE,MAAM,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAChD,CAAC"}
|
|
@@ -2,77 +2,4 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.DoneEvent = exports.ErrorEvent = exports.MessageStreamEvent = exports.RunStepStreamEvent = exports.RunStreamEvent = exports.ThreadStreamEvent = void 0;
|
|
6
|
-
/** Thread operation related streaming events */
|
|
7
|
-
var ThreadStreamEvent;
|
|
8
|
-
(function (ThreadStreamEvent) {
|
|
9
|
-
/** Event sent when a new thread is created. The data of this event is of type AgentThread */
|
|
10
|
-
ThreadStreamEvent["ThreadCreated"] = "thread.created";
|
|
11
|
-
})(ThreadStreamEvent || (exports.ThreadStreamEvent = ThreadStreamEvent = {}));
|
|
12
|
-
/** Run operation related streaming events */
|
|
13
|
-
var RunStreamEvent;
|
|
14
|
-
(function (RunStreamEvent) {
|
|
15
|
-
/** Event sent when a new run is created. The data of this event is of type ThreadRun */
|
|
16
|
-
RunStreamEvent["ThreadRunCreated"] = "thread.run.created";
|
|
17
|
-
/** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */
|
|
18
|
-
RunStreamEvent["ThreadRunQueued"] = "thread.run.queued";
|
|
19
|
-
/** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */
|
|
20
|
-
RunStreamEvent["ThreadRunInProgress"] = "thread.run.in_progress";
|
|
21
|
-
/** Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun */
|
|
22
|
-
RunStreamEvent["ThreadRunRequiresAction"] = "thread.run.requires_action";
|
|
23
|
-
/** Event sent when a run is completed. The data of this event is of type ThreadRun */
|
|
24
|
-
RunStreamEvent["ThreadRunCompleted"] = "thread.run.completed";
|
|
25
|
-
/** Event sent when a run fails. The data of this event is of type ThreadRun */
|
|
26
|
-
RunStreamEvent["ThreadRunFailed"] = "thread.run.failed";
|
|
27
|
-
/** Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun */
|
|
28
|
-
RunStreamEvent["ThreadRunCancelling"] = "thread.run.cancelling";
|
|
29
|
-
/** Event sent when a run is cancelled. The data of this event is of type ThreadRun */
|
|
30
|
-
RunStreamEvent["ThreadRunCancelled"] = "thread.run.cancelled";
|
|
31
|
-
/** Event sent when a run is expired. The data of this event is of type ThreadRun */
|
|
32
|
-
RunStreamEvent["ThreadRunExpired"] = "thread.run.expired";
|
|
33
|
-
})(RunStreamEvent || (exports.RunStreamEvent = RunStreamEvent = {}));
|
|
34
|
-
/** Run step operation related streaming events */
|
|
35
|
-
var RunStepStreamEvent;
|
|
36
|
-
(function (RunStepStreamEvent) {
|
|
37
|
-
/** Event sent when a new thread run step is created. The data of this event is of type RunStep */
|
|
38
|
-
RunStepStreamEvent["ThreadRunStepCreated"] = "thread.run.step.created";
|
|
39
|
-
/** Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep */
|
|
40
|
-
RunStepStreamEvent["ThreadRunStepInProgress"] = "thread.run.step.in_progress";
|
|
41
|
-
/** Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk */
|
|
42
|
-
RunStepStreamEvent["ThreadRunStepDelta"] = "thread.run.step.delta";
|
|
43
|
-
/** Event sent when a run step is completed. The data of this event is of type RunStep */
|
|
44
|
-
RunStepStreamEvent["ThreadRunStepCompleted"] = "thread.run.step.completed";
|
|
45
|
-
/** Event sent when a run step fails. The data of this event is of type RunStep */
|
|
46
|
-
RunStepStreamEvent["ThreadRunStepFailed"] = "thread.run.step.failed";
|
|
47
|
-
/** Event sent when a run step is cancelled. The data of this event is of type RunStep */
|
|
48
|
-
RunStepStreamEvent["ThreadRunStepCancelled"] = "thread.run.step.cancelled";
|
|
49
|
-
/** Event sent when a run step is expired. The data of this event is of type RunStep */
|
|
50
|
-
RunStepStreamEvent["ThreadRunStepExpired"] = "thread.run.step.expired";
|
|
51
|
-
})(RunStepStreamEvent || (exports.RunStepStreamEvent = RunStepStreamEvent = {}));
|
|
52
|
-
/** Message operation related streaming events */
|
|
53
|
-
var MessageStreamEvent;
|
|
54
|
-
(function (MessageStreamEvent) {
|
|
55
|
-
/** Event sent when a new message is created. The data of this event is of type ThreadMessage */
|
|
56
|
-
MessageStreamEvent["ThreadMessageCreated"] = "thread.message.created";
|
|
57
|
-
/** Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage */
|
|
58
|
-
MessageStreamEvent["ThreadMessageInProgress"] = "thread.message.in_progress";
|
|
59
|
-
/** Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk */
|
|
60
|
-
MessageStreamEvent["ThreadMessageDelta"] = "thread.message.delta";
|
|
61
|
-
/** Event sent when a message is completed. The data of this event is of type ThreadMessage */
|
|
62
|
-
MessageStreamEvent["ThreadMessageCompleted"] = "thread.message.completed";
|
|
63
|
-
/** Event sent before a message is completed. The data of this event is of type ThreadMessage */
|
|
64
|
-
MessageStreamEvent["ThreadMessageIncomplete"] = "thread.message.incomplete";
|
|
65
|
-
})(MessageStreamEvent || (exports.MessageStreamEvent = MessageStreamEvent = {}));
|
|
66
|
-
/** Terminal event indicating a server side error while streaming. */
|
|
67
|
-
var ErrorEvent;
|
|
68
|
-
(function (ErrorEvent) {
|
|
69
|
-
/** Event sent when an error occurs, such as an internal server error or a timeout. */
|
|
70
|
-
ErrorEvent["Error"] = "error";
|
|
71
|
-
})(ErrorEvent || (exports.ErrorEvent = ErrorEvent = {}));
|
|
72
|
-
/** Terminal event indicating the successful end of a stream. */
|
|
73
|
-
var DoneEvent;
|
|
74
|
-
(function (DoneEvent) {
|
|
75
|
-
/** Event sent when the stream is done. */
|
|
76
|
-
DoneEvent["Done"] = "done";
|
|
77
|
-
})(DoneEvent || (exports.DoneEvent = DoneEvent = {}));
|
|
78
5
|
//# sourceMappingURL=streamingModels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamingModels.js","sourceRoot":"","sources":["../../../src/models/streamingModels.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"streamingModels.js","sourceRoot":"","sources":["../../../src/models/streamingModels.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AgentStreamEvent,\n AgentThread,\n MessageDeltaChunk,\n RunStep,\n RunStepDeltaChunk,\n ThreadMessage,\n ThreadRun,\n} from \"./models.js\";\n\n/**\nEach event in a server-sent events stream has an `event` and `data` property:\n* \n* @example\n* ``` ts\n* event: thread.created\n* data: {\"id\": \"thread_123\", \"object\": \"thread\", ...}\n* ``` \n* \n* We emit events whenever a new object is created, transitions to a new state, or is being\n* streamed in parts (deltas). For example, we emit `thread.run.created` when a new run\n* is created, `thread.run.completed` when a run completes, and so on. When an Agent chooses\n* to create a message during a run, we emit a `thread.message.created event`, a\n* `thread.message.in_progress` event, many `thread.message.delta` events, and finally a\n* `thread.message.completed` event.\n* \n* We may add additional events over time, so we recommend handling unknown events gracefully\n* in your code.\n**/\nexport interface AgentEventMessage {\n /** The data of the event. The data can be of type AgentThreadOutput, ThreadRunOutput, RunStepOutput, ThreadMessageOutput, MessageDeltaChunk,RunStepDeltaChunk */\n data: AgentEventStreamData;\n /** The type of the event. */\n event: AgentStreamEvent | string;\n}\n\n/** Represents a stream event data in the agent. */\nexport type AgentEventStreamData =\n | AgentThread\n | ThreadRun\n | RunStep\n | ThreadMessage\n | MessageDeltaChunk\n | RunStepDeltaChunk\n | string;\n\n/** Represents a stream of agent event message. */\nexport interface AgentEventMessageStream\n extends AsyncDisposable,\n AsyncIterable<AgentEventMessage> {}\n\n/**\n * Agent run response with support to stream.\n */\nexport type AgentRunResponse = PromiseLike<ThreadRun> & {\n /**\n * Function to start streaming the agent event messages.\n * @returns A promise that resolves to an AgentEventMessageStream.\n */\n stream: () => Promise<AgentEventMessageStream>;\n};\n"]}
|
package/dist/commonjs/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AzureAISearchToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, FunctionDefinition, FunctionToolDefinition, OpenApiToolDefinition, RequiredAction, RequiredToolCall, ToolDefinition, ToolDefinitionUnion, ToolResources, VectorStoreConfigurations, VectorStoreDataSource, OpenApiFunctionDefinition, AISearchIndexResource, BingGroundingToolDefinition, MicrosoftFabricToolDefinition, BingCustomSearchToolDefinition, BingCustomSearchConfiguration, SharepointToolDefinition, BingGroundingSearchConfiguration } from "./index.js";
|
|
1
|
+
import type { AzureAISearchToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, FunctionDefinition, FunctionToolDefinition, OpenApiToolDefinition, RequiredAction, RequiredToolCall, ToolDefinition, ToolDefinitionUnion, ToolResources, VectorStoreConfigurations, VectorStoreDataSource, OpenApiFunctionDefinition, AISearchIndexResource, BingGroundingToolDefinition, MicrosoftFabricToolDefinition, BingCustomSearchToolDefinition, BingCustomSearchConfiguration, SharepointToolDefinition, BingGroundingSearchConfiguration, ConnectedAgentToolDefinition } from "./index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Determines if the given output is of the specified type.
|
|
4
4
|
*
|
|
@@ -106,6 +106,14 @@ export declare class ToolUtility {
|
|
|
106
106
|
definition: AzureAISearchToolDefinition;
|
|
107
107
|
resources: ToolResources;
|
|
108
108
|
};
|
|
109
|
+
/**
|
|
110
|
+
* Creates a connected agent tool
|
|
111
|
+
*
|
|
112
|
+
* @returns An object containing the definition for the connected agent tool.
|
|
113
|
+
*/
|
|
114
|
+
static createConnectedAgentTool(id: string, name: string, description: string): {
|
|
115
|
+
definition: ConnectedAgentToolDefinition;
|
|
116
|
+
};
|
|
109
117
|
/**
|
|
110
118
|
* Creates a Microsoft Fabric tool
|
|
111
119
|
*
|
|
@@ -212,6 +220,17 @@ export declare class ToolSet {
|
|
|
212
220
|
addBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {
|
|
213
221
|
definition: BingGroundingToolDefinition;
|
|
214
222
|
};
|
|
223
|
+
/**
|
|
224
|
+
* Adds a connected agent tool to the tool set.
|
|
225
|
+
*
|
|
226
|
+
* @param id - The ID of the connected agent.
|
|
227
|
+
* @param name - The name of the connected agent.
|
|
228
|
+
* @param description - The description of the connected agent.
|
|
229
|
+
* @returns An object containing the definition for the connected agent tool
|
|
230
|
+
*/
|
|
231
|
+
addConnectedAgentTool(id: string, name: string, description: string): {
|
|
232
|
+
definition: ConnectedAgentToolDefinition;
|
|
233
|
+
};
|
|
215
234
|
/**
|
|
216
235
|
* Adds a Microsoft Fabric tool to the tool set.
|
|
217
236
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,EACxB,+BAA+B,EAC/B,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,wBAAwB,EACxB,gCAAgC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,EACxB,+BAA+B,EAC/B,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,6BAA6B,EAC7B,8BAA8B,EAC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ility {
|
|
|
88
88
|
*
|
|
89
89
|
*/
|
|
90
90
|
static createBingGroundingTool(searchConfigurations) {
|
|
91
|
+
// Ensure searchConfigurations is an array even if it's undefined
|
|
92
|
+
const configs = searchConfigurations || [];
|
|
91
93
|
return {
|
|
92
94
|
definition: {
|
|
93
95
|
type: "bing_grounding",
|
|
94
96
|
bingGrounding: {
|
|
95
|
-
searchConfigurations:
|
|
97
|
+
searchConfigurations: configs.map((searchConfiguration) => ({
|
|
96
98
|
connectionId: searchConfiguration.connectionId,
|
|
97
99
|
market: searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.market,
|
|
98
100
|
setLang: searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.setLang,
|
|
@@ -181,6 +183,23 @@ class ToolUtility {
|
|
|
181
183
|
},
|
|
182
184
|
};
|
|
183
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Creates a connected agent tool
|
|
188
|
+
*
|
|
189
|
+
* @returns An object containing the definition for the connected agent tool.
|
|
190
|
+
*/
|
|
191
|
+
static createConnectedAgentTool(id, name, description) {
|
|
192
|
+
return {
|
|
193
|
+
definition: {
|
|
194
|
+
type: "connected_agent",
|
|
195
|
+
connectedAgent: {
|
|
196
|
+
id: id,
|
|
197
|
+
name: name,
|
|
198
|
+
description: description,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
}
|
|
184
203
|
/**
|
|
185
204
|
* Creates a Microsoft Fabric tool
|
|
186
205
|
*
|
|
@@ -325,6 +344,19 @@ class ToolSet {
|
|
|
325
344
|
this.toolDefinitions.push(tool.definition);
|
|
326
345
|
return tool;
|
|
327
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Adds a connected agent tool to the tool set.
|
|
349
|
+
*
|
|
350
|
+
* @param id - The ID of the connected agent.
|
|
351
|
+
* @param name - The name of the connected agent.
|
|
352
|
+
* @param description - The description of the connected agent.
|
|
353
|
+
* @returns An object containing the definition for the connected agent tool
|
|
354
|
+
*/
|
|
355
|
+
addConnectedAgentTool(id, name, description) {
|
|
356
|
+
const tool = ToolUtility.createConnectedAgentTool(id, name, description);
|
|
357
|
+
this.toolDefinitions.push(tool.definition);
|
|
358
|
+
return tool;
|
|
359
|
+
}
|
|
328
360
|
/**
|
|
329
361
|
* Adds a Microsoft Fabric tool to the tool set.
|
|
330
362
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAmClC,wCAKC;AAbD;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,MAA+D,EAC/D,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,iCAAiC;IACjC,sDAAgC,CAAA;IAChC,4BAA4B;IAC5B,0DAAoC,CAAA;IACpC,sBAAsB;IACtB,kEAA4C,CAAA;IAC5C,0BAA0B;IAC1B,sDAAgC,CAAA;IAChC,8BAA8B;IAC9B,6DAAuC,CAAA;AACzC,CAAC,EAXW,kBAAkB,kCAAlB,kBAAkB,QAW7B;AAED,MAAM,OAAO,GAAG;IACd,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,kBAAkB;IACpC,oBAAoB,EAAE,qBAAqB;IAC3C,cAAc,EAAE,eAAe;IAC/B,kBAAkB,EAAE,kBAAkB;CACvC,CAAC;AAEF;;GAEG;AACH,MAAa,WAAW;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACzB,QAA4B,EAC5B,aAAuB;QAEvB,OAAO;YACL,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE;oBACnB,WAAW,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,C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IAAI,GAAG,WAAW,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;QACvE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,YAAoB;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,0BAA0B,CAAC,YAAoB;QAC7C,MAAM,IAAI,GAAG,WAAW,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC;QACrE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAtID,0BAsIC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AzureAISearchToolDefinition,\n CodeInterpreterToolDefinition,\n FileSearchToolDefinition,\n FileSearchToolDefinitionDetails,\n FunctionDefinition,\n FunctionToolDefinition,\n OpenApiToolDefinition,\n RequiredAction,\n RequiredToolCall,\n ToolDefinition,\n ToolDefinitionUnion,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n OpenApiFunctionDefinition,\n AISearchIndexResource,\n BingGroundingToolDefinition,\n MicrosoftFabricToolDefinition,\n BingCustomSearchToolDefinition,\n BingCustomSearchConfiguration,\n SharepointToolDefinition,\n BingGroundingSearchConfiguration,\n} from \"./index.js\";\n\n/**\n * Determines if the given output is of the specified type.\n *\n * @typeParam T - The type to check against, which extends one of the possible output parent types.\n * @param output - The action to check, which can be of type `RequiredAction`, `RequiredToolCall`, or `ToolDefinitionUnion`.\n * @param type - The type to check the action against.\n * @returns A boolean indicating whether the action is of the specified type.\n */\nexport function isOutputOfType<T extends { type: string }>(\n output: RequiredAction | RequiredToolCall | ToolDefinitionUnion,\n type: string,\n): output is T {\n return output.type === type;\n}\n\n/** Types of connection tools used to configure an agent */\nexport enum connectionToolType {\n /** Bing grounding search tool */\n BingGrounding = \"bing_grounding\",\n /** Microsoft Fabric tool */\n MicrosoftFabric = \"fabric_dataagent\",\n /** Sharepoint tool */\n SharepointGrounding = \"sharepoint_grounding\",\n /** Azure Function tool */\n AzureFunction = \"azure_function\",\n /** Bing custom search tool */\n BingCustomSearch = \"bing_custom_search\",\n}\n\nconst toolMap = {\n bing_grounding: \"bingGrounding\",\n fabric_dataagent: \"fabric_dataagent\",\n sharepoint_grounding: \"sharepointGrounding\",\n azure_function: \"azureFunction\",\n bing_custom_search: \"bingCustomSearch\",\n};\n\n/**\n * Utility class for creating various tools.\n */\nexport class ToolUtility {\n /**\n * Creates a connection tool\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n * @returns An object containing the definition for the connection tool\n */\n static createConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinitionUnion } {\n return {\n definition: {\n type: toolType,\n [toolMap[toolType]]: {\n connections: connectionIds.map((connectionId) => ({ connectionId: connectionId })),\n },\n },\n };\n }\n\n /**\n * Creates a sharepoint grounding search tool\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n *\n */\n static createSharepointGroundingTool(connectionId: string): {\n definition: SharepointToolDefinition;\n } {\n return {\n definition: {\n type: \"sharepoint_grounding\",\n sharepointGrounding: {\n connectionList: [\n {\n connectionId: connectionId,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a bing grounding search tool\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n *\n */\n static createBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n return {\n definition: {\n type: \"bing_grounding\",\n bingGrounding: {\n searchConfigurations: searchConfigurations.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n market: searchConfiguration?.market,\n setLang: searchConfiguration?.setLang,\n count: searchConfiguration?.count,\n freshness: searchConfiguration?.freshness,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a bing custom search tool\n *\n * @param searchConfigurations - The ID of bing search connection and instanceName.\n *\n * @returns An object containing the definition and resources for the bing custom search tool\n */\n\n static createBingCustomSearchTool(searchConfigurations: BingCustomSearchConfiguration[]): {\n definition: BingCustomSearchToolDefinition;\n } {\n return {\n definition: {\n type: \"bing_custom_search\",\n bingCustomSearch: {\n searchConfigurations: searchConfigurations.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n instanceName: searchConfiguration.instanceName,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a file search tool\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n static createFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"file_search\", fileSearch: definitionDetails },\n resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } },\n };\n }\n\n /**\n * Creates a code interpreter tool\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool.\n */\n static createCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n if (fileIds && dataSources) {\n throw new Error(\"Cannot specify both fileIds and dataSources\");\n }\n\n return {\n definition: { type: \"code_interpreter\" },\n resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },\n };\n }\n\n /**\n * Creates an Azure AI search tool\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool.\n */\n static createAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n options?: AISearchIndexResource,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexList: [\n {\n indexConnectionId: indexConnectionId,\n indexName: indexName,\n queryType: options?.queryType,\n topK: options?.topK,\n filter: options?.filter,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a Microsoft Fabric tool\n *\n * @param connectionIds - A list of the IDs of the Fabric connections to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n static createFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n return {\n definition: {\n type: \"fabric_dataagent\",\n fabricDataagent: {\n connectionList: [{ connectionId: connectionId }],\n },\n },\n };\n }\n\n /**\n * Creates a function tool\n *\n * @param functionDefinition - The function definition to use.\n *\n * @returns An object containing the definition for the function tool.\n */\n static createFunctionTool(functionDefinition: FunctionDefinition): {\n definition: FunctionToolDefinition;\n } {\n return {\n definition: {\n type: \"function\",\n function: functionDefinition,\n },\n };\n }\n\n /**\n * Creates an OpenApi tool\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool.\n */\n static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n return {\n definition: {\n type: \"openapi\",\n openapi: {\n name: openApiFunctionDefinition.name,\n spec: openApiFunctionDefinition.spec,\n description: openApiFunctionDefinition.description,\n auth: openApiFunctionDefinition.auth,\n defaultParams: openApiFunctionDefinition.defaultParams,\n },\n },\n };\n }\n}\n/**\n * Represents a set of tools with their definitions and resources.\n */\nexport class ToolSet {\n /** A list of tool definitions that have been added to the tool set. */\n toolDefinitions: ToolDefinition[] = [];\n\n /** A collection of resources associated with the tools in the tool set. */\n toolResources: ToolResources = {};\n\n /**\n * Adds a connection tool to the tool set.\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n *\n * @returns An object containing the definition for the connection tool\n */\n addConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinition } {\n const tool = ToolUtility.createConnectionTool(toolType, connectionIds);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a file search tool to the tool set.\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n addFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createFileSearchTool(vectorStoreIds, vectorStores, definitionDetails);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds a code interpreter tool to the tool set.\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool\n */\n addCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createCodeInterpreterTool(fileIds, dataSources);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an Azure AI search tool to the tool set.\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool\n */\n addAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureAISearchTool(indexConnectionId, indexName);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an OpenApi tool to the tool set.\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool\n */\n addOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n const tool = ToolUtility.createOpenApiTool(openApiFunctionDefinition);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a bing grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n */\n addBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n const tool = ToolUtility.createBingGroundingTool(searchConfigurations);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a Microsoft Fabric tool to the tool set.\n *\n * @param connectionId - The ID of the Fabric connection to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n addFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n const tool = ToolUtility.createFabricTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds sharepoint grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n */\n addSharepointGroundingTool(connectionId: string): { definition: SharepointToolDefinition } {\n const tool = ToolUtility.createSharepointGroundingTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAoClC,wCAKC;AAbD;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,MAA+D,EAC/D,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,iCAAiC;IACjC,sDAAgC,CAAA;IAChC,4BAA4B;IAC5B,0DAAoC,CAAA;IACpC,sBAAsB;IACtB,kEAA4C,CAAA;IAC5C,0BAA0B;IAC1B,sDAAgC,CAAA;IAChC,8BAA8B;IAC9B,6DAAuC,CAAA;AACzC,CAAC,EAXW,kBAAkB,kCAAlB,kBAAkB,QAW7B;AAED,MAAM,OAAO,GAAG;IACd,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,kBAAkB;IACpC,oBAAoB,EAAE,qBAAqB;IAC3C,cAAc,EAAE,eAAe;IAC/B,kBAAkB,EAAE,kBAAkB;CACvC,CAAC;AAEF;;GAEG;AACH,MAAa,WAAW;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACzB,QAA4B,EAC5B,aAAuB;QAEvB,OAAO;YACL,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE;oBACnB,WAAW,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC;iBACnF;aACF;SACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAA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AAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;QACtE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB,CAAC,oBAAwD;QAG3E,MAAM,IAAI,GAAG,WAAW,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;QACvE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,qBAAqB,CACnB,EAAU,EACV,IAAY,EACZ,WAAmB;QAEnB,MAAM,IAAI,GAAG,WAAW,CAAC,wBAAwB,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACzE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,YAAoB;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,0BAA0B,CAAC,YAAoB;QAC7C,MAAM,IAAI,GAAG,WAAW,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC;QACrE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAxJD,0BAwJC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AzureAISearchToolDefinition,\n CodeInterpreterToolDefinition,\n FileSearchToolDefinition,\n FileSearchToolDefinitionDetails,\n FunctionDefinition,\n FunctionToolDefinition,\n OpenApiToolDefinition,\n RequiredAction,\n RequiredToolCall,\n ToolDefinition,\n ToolDefinitionUnion,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n OpenApiFunctionDefinition,\n AISearchIndexResource,\n BingGroundingToolDefinition,\n MicrosoftFabricToolDefinition,\n BingCustomSearchToolDefinition,\n BingCustomSearchConfiguration,\n SharepointToolDefinition,\n BingGroundingSearchConfiguration,\n ConnectedAgentToolDefinition,\n} from \"./index.js\";\n\n/**\n * Determines if the given output is of the specified type.\n *\n * @typeParam T - The type to check against, which extends one of the possible output parent types.\n * @param output - The action to check, which can be of type `RequiredAction`, `RequiredToolCall`, or `ToolDefinitionUnion`.\n * @param type - The type to check the action against.\n * @returns A boolean indicating whether the action is of the specified type.\n */\nexport function isOutputOfType<T extends { type: string }>(\n output: RequiredAction | RequiredToolCall | ToolDefinitionUnion,\n type: string,\n): output is T {\n return output.type === type;\n}\n\n/** Types of connection tools used to configure an agent */\nexport enum connectionToolType {\n /** Bing grounding search tool */\n BingGrounding = \"bing_grounding\",\n /** Microsoft Fabric tool */\n MicrosoftFabric = \"fabric_dataagent\",\n /** Sharepoint tool */\n SharepointGrounding = \"sharepoint_grounding\",\n /** Azure Function tool */\n AzureFunction = \"azure_function\",\n /** Bing custom search tool */\n BingCustomSearch = \"bing_custom_search\",\n}\n\nconst toolMap = {\n bing_grounding: \"bingGrounding\",\n fabric_dataagent: \"fabric_dataagent\",\n sharepoint_grounding: \"sharepointGrounding\",\n azure_function: \"azureFunction\",\n bing_custom_search: \"bingCustomSearch\",\n};\n\n/**\n * Utility class for creating various tools.\n */\nexport class ToolUtility {\n /**\n * Creates a connection tool\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n * @returns An object containing the definition for the connection tool\n */\n static createConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinitionUnion } {\n return {\n definition: {\n type: toolType,\n [toolMap[toolType]]: {\n connections: connectionIds.map((connectionId) => ({ connectionId: connectionId })),\n },\n },\n };\n }\n\n /**\n * Creates a sharepoint grounding search tool\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n *\n */\n static createSharepointGroundingTool(connectionId: string): {\n definition: SharepointToolDefinition;\n } {\n return {\n definition: {\n type: \"sharepoint_grounding\",\n sharepointGrounding: {\n connectionList: [\n {\n connectionId: connectionId,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a bing grounding search tool\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n *\n */\n static createBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n // Ensure searchConfigurations is an array even if it's undefined\n const configs = searchConfigurations || [];\n return {\n definition: {\n type: \"bing_grounding\",\n bingGrounding: {\n searchConfigurations: configs.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n market: searchConfiguration?.market,\n setLang: searchConfiguration?.setLang,\n count: searchConfiguration?.count,\n freshness: searchConfiguration?.freshness,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a bing custom search tool\n *\n * @param searchConfigurations - The ID of bing search connection and instanceName.\n *\n * @returns An object containing the definition and resources for the bing custom search tool\n */\n\n static createBingCustomSearchTool(searchConfigurations: BingCustomSearchConfiguration[]): {\n definition: BingCustomSearchToolDefinition;\n } {\n return {\n definition: {\n type: \"bing_custom_search\",\n bingCustomSearch: {\n searchConfigurations: searchConfigurations.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n instanceName: searchConfiguration.instanceName,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a file search tool\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n static createFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"file_search\", fileSearch: definitionDetails },\n resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } },\n };\n }\n\n /**\n * Creates a code interpreter tool\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool.\n */\n static createCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n if (fileIds && dataSources) {\n throw new Error(\"Cannot specify both fileIds and dataSources\");\n }\n\n return {\n definition: { type: \"code_interpreter\" },\n resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },\n };\n }\n\n /**\n * Creates an Azure AI search tool\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool.\n */\n static createAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n options?: AISearchIndexResource,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexList: [\n {\n indexConnectionId: indexConnectionId,\n indexName: indexName,\n queryType: options?.queryType,\n topK: options?.topK,\n filter: options?.filter,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a connected agent tool\n *\n * @returns An object containing the definition for the connected agent tool.\n */\n static createConnectedAgentTool(\n id: string,\n name: string,\n description: string,\n ): { definition: ConnectedAgentToolDefinition } {\n return {\n definition: {\n type: \"connected_agent\",\n connectedAgent: {\n id: id,\n name: name,\n description: description,\n },\n },\n };\n }\n\n /**\n * Creates a Microsoft Fabric tool\n *\n * @param connectionIds - A list of the IDs of the Fabric connections to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n static createFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n return {\n definition: {\n type: \"fabric_dataagent\",\n fabricDataagent: {\n connectionList: [{ connectionId: connectionId }],\n },\n },\n };\n }\n\n /**\n * Creates a function tool\n *\n * @param functionDefinition - The function definition to use.\n *\n * @returns An object containing the definition for the function tool.\n */\n static createFunctionTool(functionDefinition: FunctionDefinition): {\n definition: FunctionToolDefinition;\n } {\n return {\n definition: {\n type: \"function\",\n function: functionDefinition,\n },\n };\n }\n\n /**\n * Creates an OpenApi tool\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool.\n */\n static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n return {\n definition: {\n type: \"openapi\",\n openapi: {\n name: openApiFunctionDefinition.name,\n spec: openApiFunctionDefinition.spec,\n description: openApiFunctionDefinition.description,\n auth: openApiFunctionDefinition.auth,\n defaultParams: openApiFunctionDefinition.defaultParams,\n },\n },\n };\n }\n}\n/**\n * Represents a set of tools with their definitions and resources.\n */\nexport class ToolSet {\n /** A list of tool definitions that have been added to the tool set. */\n toolDefinitions: ToolDefinition[] = [];\n\n /** A collection of resources associated with the tools in the tool set. */\n toolResources: ToolResources = {};\n\n /**\n * Adds a connection tool to the tool set.\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n *\n * @returns An object containing the definition for the connection tool\n */\n addConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinition } {\n const tool = ToolUtility.createConnectionTool(toolType, connectionIds);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a file search tool to the tool set.\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n addFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createFileSearchTool(vectorStoreIds, vectorStores, definitionDetails);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds a code interpreter tool to the tool set.\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool\n */\n addCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createCodeInterpreterTool(fileIds, dataSources);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an Azure AI search tool to the tool set.\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool\n */\n addAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureAISearchTool(indexConnectionId, indexName);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an OpenApi tool to the tool set.\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool\n */\n addOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n const tool = ToolUtility.createOpenApiTool(openApiFunctionDefinition);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a bing grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n */\n addBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n const tool = ToolUtility.createBingGroundingTool(searchConfigurations);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a connected agent tool to the tool set.\n *\n * @param id - The ID of the connected agent.\n * @param name - The name of the connected agent.\n * @param description - The description of the connected agent.\n * @returns An object containing the definition for the connected agent tool\n */\n addConnectedAgentTool(\n id: string,\n name: string,\n description: string,\n ): { definition: ConnectedAgentToolDefinition } {\n const tool = ToolUtility.createConnectedAgentTool(id, name, description);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a Microsoft Fabric tool to the tool set.\n *\n * @param connectionId - The ID of the Fabric connection to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n addFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n const tool = ToolUtility.createFabricTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds sharepoint grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n */\n addSharepointGroundingTool(connectionId: string): { definition: SharepointToolDefinition } {\n const tool = ToolUtility.createSharepointGroundingTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentsContext.d.ts","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAa,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAmB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnF,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C,iDAAiD;IACjD,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,0CAA0C;AAC1C,MAAM,WAAW,0BAA2B,SAAQ,aAAa;IAC/D,iDAAiD;IACjD,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAC1B,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,aAAa,GAAG,eAAe,EAC3C,OAAO,GAAE,0BAA+B,GACvC,aAAa,
|
|
1
|
+
{"version":3,"file":"agentsContext.d.ts","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAa,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAmB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnF,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C,iDAAiD;IACjD,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,0CAA0C;AAC1C,MAAM,WAAW,0BAA2B,SAAQ,aAAa;IAC/D,iDAAiD;IACjD,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAC1B,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,aAAa,GAAG,eAAe,EAC3C,OAAO,GAAE,0BAA+B,GACvC,aAAa,CA4Cf"}
|
|
@@ -7,7 +7,7 @@ import { isKeyCredential } from "@azure/core-auth";
|
|
|
7
7
|
export function createAgents(endpointParam, credential, options = {}) {
|
|
8
8
|
var _a, _b, _c, _d, _e, _f;
|
|
9
9
|
const prefixFromOptions = (_a = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix;
|
|
10
|
-
const userAgentInfo = `azsdk-js-ai-agents/1.0.0-beta.
|
|
10
|
+
const userAgentInfo = `azsdk-js-ai-agents/1.0.0-beta.4`;
|
|
11
11
|
const userAgentPrefix = prefixFromOptions
|
|
12
12
|
? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
|
|
13
13
|
: `azsdk-js-api ${userAgentInfo}`;
|
|
@@ -29,12 +29,15 @@ export function createAgents(endpointParam, credential, options = {}) {
|
|
|
29
29
|
clientContext.pipeline.addPolicy({
|
|
30
30
|
name: "ClientApiVersionPolicy",
|
|
31
31
|
sendRequest: (req, next) => {
|
|
32
|
+
var _a;
|
|
32
33
|
// Use the apiVersion defined in request url directly
|
|
33
34
|
// Append one if there is no apiVersion and we have one at client options
|
|
34
35
|
const url = new URL(req.url);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const defaultApiVersion = (_a = url.searchParams.get("api-version")) !== null && _a !== void 0 ? _a : apiVersion;
|
|
37
|
+
// remove api-version from url
|
|
38
|
+
url.searchParams.delete("api-version");
|
|
39
|
+
// add api-version to url
|
|
40
|
+
req.url = `${url.toString()}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${defaultApiVersion}`;
|
|
38
41
|
return next(req);
|
|
39
42
|
},
|
|
40
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentsContext.js","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAiB,eAAe,EAAmB,MAAM,kBAAkB,CAAC;AAenF,MAAM,UAAU,YAAY,CAC1B,aAAqB,EACrB,UAA2C,EAC3C,UAAsC,EAA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ation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { KeyCredential, isKeyCredential, TokenCredential } from \"@azure/core-auth\";\n\nexport interface AgentsContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion: string;\n}\n\n/** Optional parameters for the client. */\nexport interface AgentsClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\nexport function createAgents(\n endpointParam: string,\n credential: KeyCredential | TokenCredential,\n options: AgentsClientOptionalParams = {},\n): AgentsContext {\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-ai-agents/1.0.0-beta.4`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://ai.azure.com/.default\"],\n },\n };\n const clientContext = getClient(endpointParam, credential, updatedOptions);\n\n if (isKeyCredential(credential)) {\n clientContext.pipeline.addPolicy({\n name: \"customKeyCredentialPolicy\",\n sendRequest(request, next) {\n request.headers.set(\"Authorization\", \"Bearer \" + credential.key);\n return next(request);\n },\n });\n }\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"2025-05-15-preview\";\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n const defaultApiVersion = url.searchParams.get(\"api-version\") ?? apiVersion;\n // remove api-version from url\n url.searchParams.delete(\"api-version\");\n // add api-version to url\n req.url = `${url.toString()}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${defaultApiVersion}`;\n return next(req);\n },\n });\n return { ...clientContext, apiVersion } as AgentsContext;\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AgentsContext as Client } from "./index.js";
|
|
2
|
-
import { Agent, _AgentsPagedResultAgent, AgentDeletionStatus, ThreadRun } from "../models/models.js";
|
|
2
|
+
import { Agent, _AgentsPagedResultAgent, AgentDeletionStatus, ThreadRun, ToolOutput } from "../models/models.js";
|
|
3
3
|
import { CreateThreadAndRunOptionalParams, DeleteAgentOptionalParams, UpdateAgentOptionalParams, GetAgentOptionalParams, ListAgentsOptionalParams, CreateAgentOptionalParams } from "./options.js";
|
|
4
4
|
import { PagedAsyncIterableIterator } from "../static-helpers/pagingHelpers.js";
|
|
5
5
|
import { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
6
6
|
import { AgentEventMessageStream, AgentRunResponse } from "../models/streamingModels.js";
|
|
7
|
-
import { RunsCreateRunOptionalParams, RunsSubmitToolOutputsToRunOptionalParams } from "./runs/options.js";
|
|
7
|
+
import type { RunsCreateRunOptionalParams, RunsSubmitToolOutputsToRunOptionalParams } from "./runs/options.js";
|
|
8
8
|
export declare function _createThreadAndRunSend(context: Client, assistantId: string, options?: CreateThreadAndRunOptionalParams): StreamableMethod;
|
|
9
9
|
export declare function _createThreadAndRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun>;
|
|
10
10
|
/** Creates a new agent thread and immediately starts a run using that new thread. */
|
|
@@ -33,5 +33,5 @@ export declare function createAgent(context: Client, model: string, options?: Cr
|
|
|
33
33
|
export declare function createRunStreaming(context: Client, assistantId: string, threadId: string, options?: RunsCreateRunOptionalParams): Promise<AgentEventMessageStream>;
|
|
34
34
|
/** Create a thread and run and stream the events */
|
|
35
35
|
export declare function createThreadAndRunStreaming(context: Client, assistantId: string, options?: CreateThreadAndRunOptionalParams): Promise<AgentEventMessageStream>;
|
|
36
|
-
export declare function submitToolOutputsToRunStreaming(context: Client, threadId: string, runId: string, options?: RunsSubmitToolOutputsToRunOptionalParams): Promise<AgentEventMessageStream>;
|
|
36
|
+
export declare function submitToolOutputsToRunStreaming(context: Client, threadId: string, runId: string, toolOutputs: ToolOutput[], options?: RunsSubmitToolOutputsToRunOptionalParams): Promise<AgentEventMessageStream>;
|
|
37
37
|
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/api/operations.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAIL,KAAK,EAEL,uBAAuB,EAEvB,mBAAmB,EAMnB,SAAS,
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/api/operations.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAIL,KAAK,EAEL,uBAAuB,EAEvB,mBAAmB,EAMnB,SAAS,EAQT,UAAU,EACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gCAAgC,EAChC,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,0BAA0B,EAE3B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EAGtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,uBAAuB,EAEvB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,2BAA2B,EAC3B,wCAAwC,EACzC,MAAM,mBAAmB,CAAC;AAO3B,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,W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AE,wCAAiE,GACzE,OAAO,CAAC,uBAAuB,CAAC,CAMlC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
4
|
-
import { toolResourcesSerializer, toolDefinitionUnionArraySerializer, agentsResponseFormatOptionSerializer, agentDeserializer, _agentsPagedResultAgentDeserializer, agentDeletionStatusDeserializer, agentThreadCreationOptionsSerializer, updateToolResourcesOptionsSerializer, truncationObjectSerializer, agentsToolChoiceOptionSerializer, threadRunDeserializer, } from "../models/models.js";
|
|
4
|
+
import { toolResourcesSerializer, toolDefinitionUnionArraySerializer, agentsResponseFormatOptionSerializer, agentDeserializer, _agentsPagedResultAgentDeserializer, agentDeletionStatusDeserializer, agentThreadCreationOptionsSerializer, updateToolResourcesOptionsSerializer, truncationObjectSerializer, agentsToolChoiceOptionSerializer, threadRunDeserializer, MessageStreamEvent, RunStepStreamEvent, RunStreamEvent, ThreadStreamEvent, runStepDeserializer, threadMessageDeserializer, } from "../models/models.js";
|
|
5
5
|
import { buildPagedAsyncIterator, } from "../static-helpers/pagingHelpers.js";
|
|
6
6
|
import { expandUrlTemplate } from "../static-helpers/urlTemplate.js";
|
|
7
7
|
import { createRestError, operationOptionsToRequestParameters, } from "@azure-rest/core-client";
|
|
8
|
-
import { MessageStreamEvent, RunStepStreamEvent, RunStreamEvent, ThreadStreamEvent, } from "../models/streamingModels.js";
|
|
9
8
|
import { createSseStream } from "@azure/core-sse";
|
|
10
9
|
import { isNodeLike } from "@azure/core-util";
|
|
11
10
|
import { logger } from "../logger.js";
|
|
12
|
-
import { _createRunSend } from "./runs/operations.js";
|
|
11
|
+
import { _createRunSend, _submitToolOutputsToRunSend } from "./runs/operations.js";
|
|
13
12
|
export function _createThreadAndRunSend(context, assistantId, options = { requestOptions: {} }) {
|
|
14
13
|
var _a, _b;
|
|
15
14
|
const path = expandUrlTemplate("/threads/runs{?api%2Dversion}", {
|
|
@@ -244,11 +243,14 @@ function toAsyncIterable(stream) {
|
|
|
244
243
|
function deserializeEventData(event) {
|
|
245
244
|
try {
|
|
246
245
|
const jsonData = JSON.parse(event.data);
|
|
246
|
+
if (Object.values(RunStreamEvent).includes(event.event)) {
|
|
247
|
+
return threadRunDeserializer(jsonData);
|
|
248
|
+
}
|
|
247
249
|
switch (event.event) {
|
|
248
250
|
case MessageStreamEvent.ThreadMessageDelta:
|
|
249
|
-
return jsonData;
|
|
251
|
+
return threadMessageDeserializer(jsonData);
|
|
250
252
|
case RunStepStreamEvent.ThreadRunStepDelta:
|
|
251
|
-
return jsonData;
|
|
253
|
+
return runStepDeserializer(jsonData);
|
|
252
254
|
default: {
|
|
253
255
|
for (const { events } of handlers) {
|
|
254
256
|
if (events.includes(event.event)) {
|
|
@@ -282,18 +284,16 @@ async function processStream(streamResponse) {
|
|
|
282
284
|
}
|
|
283
285
|
/** Create a run and stream the events */
|
|
284
286
|
export async function createRunStreaming(context, assistantId, threadId, options = { requestOptions: {} }) {
|
|
285
|
-
options
|
|
286
|
-
return processStream(_createRunSend(context, threadId, assistantId,
|
|
287
|
+
const streamOptions = Object.assign(Object.assign({}, options), { stream: true });
|
|
288
|
+
return processStream(_createRunSend(context, threadId, assistantId, streamOptions));
|
|
287
289
|
}
|
|
288
290
|
/** Create a thread and run and stream the events */
|
|
289
291
|
export async function createThreadAndRunStreaming(context, assistantId, options = { requestOptions: {} }) {
|
|
290
|
-
options
|
|
291
|
-
return processStream(_createThreadAndRunSend(context, assistantId,
|
|
292
|
+
const streamOptions = Object.assign(Object.assign({}, options), { stream: true });
|
|
293
|
+
return processStream(_createThreadAndRunSend(context, assistantId, streamOptions));
|
|
292
294
|
}
|
|
293
|
-
export async function submitToolOutputsToRunStreaming(context, threadId, runId, options = { requestOptions: {} }) {
|
|
294
|
-
options
|
|
295
|
-
return processStream(context
|
|
296
|
-
.path("/threads/{threadId}/runs/{runId}/submit_tool_outputs", threadId, runId)
|
|
297
|
-
.post(options));
|
|
295
|
+
export async function submitToolOutputsToRunStreaming(context, threadId, runId, toolOutputs, options = { requestOptions: {} }) {
|
|
296
|
+
const streamOptions = Object.assign(Object.assign({}, options), { stream: true });
|
|
297
|
+
return processStream(_submitToolOutputsToRunSend(context, threadId, runId, toolOutputs, streamOptions));
|
|
298
298
|
}
|
|
299
299
|
//# sourceMappingURL=operations.js.map
|