@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.
Files changed (151) hide show
  1. package/README.md +39 -34
  2. package/dist/browser/api/agentsContext.d.ts.map +1 -1
  3. package/dist/browser/api/agentsContext.js +7 -4
  4. package/dist/browser/api/agentsContext.js.map +1 -1
  5. package/dist/browser/api/operations.d.ts +3 -3
  6. package/dist/browser/api/operations.d.ts.map +1 -1
  7. package/dist/browser/api/operations.js +14 -14
  8. package/dist/browser/api/operations.js.map +1 -1
  9. package/dist/browser/api/poller.d.ts +7 -2
  10. package/dist/browser/api/poller.d.ts.map +1 -1
  11. package/dist/browser/api/poller.js +31 -9
  12. package/dist/browser/api/poller.js.map +1 -1
  13. package/dist/browser/api/runs/operations.d.ts +12 -7
  14. package/dist/browser/api/runs/operations.d.ts.map +1 -1
  15. package/dist/browser/api/runs/operations.js +59 -9
  16. package/dist/browser/api/runs/operations.js.map +1 -1
  17. package/dist/browser/api/runs/options.d.ts +2 -1
  18. package/dist/browser/api/runs/options.d.ts.map +1 -1
  19. package/dist/browser/api/runs/options.js.map +1 -1
  20. package/dist/browser/classic/runs/index.d.ts +4 -1
  21. package/dist/browser/classic/runs/index.d.ts.map +1 -1
  22. package/dist/browser/classic/runs/index.js +2 -1
  23. package/dist/browser/classic/runs/index.js.map +1 -1
  24. package/dist/browser/constants.d.ts +1 -1
  25. package/dist/browser/constants.js +1 -1
  26. package/dist/browser/constants.js.map +1 -1
  27. package/dist/browser/models/models.d.ts +6 -2
  28. package/dist/browser/models/models.d.ts.map +1 -1
  29. package/dist/browser/models/models.js +8 -0
  30. package/dist/browser/models/models.js.map +1 -1
  31. package/dist/browser/models/streamingModels.d.ts +1 -67
  32. package/dist/browser/models/streamingModels.d.ts.map +1 -1
  33. package/dist/browser/models/streamingModels.js +1 -72
  34. package/dist/browser/models/streamingModels.js.map +1 -1
  35. package/dist/browser/utils.d.ts +20 -1
  36. package/dist/browser/utils.d.ts.map +1 -1
  37. package/dist/browser/utils.js +33 -1
  38. package/dist/browser/utils.js.map +1 -1
  39. package/dist/commonjs/api/agentsContext.d.ts.map +1 -1
  40. package/dist/commonjs/api/agentsContext.js +7 -4
  41. package/dist/commonjs/api/agentsContext.js.map +1 -1
  42. package/dist/commonjs/api/operations.d.ts +3 -3
  43. package/dist/commonjs/api/operations.d.ts.map +1 -1
  44. package/dist/commonjs/api/operations.js +18 -18
  45. package/dist/commonjs/api/operations.js.map +1 -1
  46. package/dist/commonjs/api/poller.d.ts +7 -2
  47. package/dist/commonjs/api/poller.d.ts.map +1 -1
  48. package/dist/commonjs/api/poller.js +32 -9
  49. package/dist/commonjs/api/poller.js.map +1 -1
  50. package/dist/commonjs/api/runs/operations.d.ts +12 -7
  51. package/dist/commonjs/api/runs/operations.d.ts.map +1 -1
  52. package/dist/commonjs/api/runs/operations.js +58 -6
  53. package/dist/commonjs/api/runs/operations.js.map +1 -1
  54. package/dist/commonjs/api/runs/options.d.ts +2 -1
  55. package/dist/commonjs/api/runs/options.d.ts.map +1 -1
  56. package/dist/commonjs/api/runs/options.js.map +1 -1
  57. package/dist/commonjs/classic/runs/index.d.ts +4 -1
  58. package/dist/commonjs/classic/runs/index.d.ts.map +1 -1
  59. package/dist/commonjs/classic/runs/index.js +1 -0
  60. package/dist/commonjs/classic/runs/index.js.map +1 -1
  61. package/dist/commonjs/constants.d.ts +1 -1
  62. package/dist/commonjs/constants.js +1 -1
  63. package/dist/commonjs/constants.js.map +1 -1
  64. package/dist/commonjs/models/models.d.ts +6 -2
  65. package/dist/commonjs/models/models.d.ts.map +1 -1
  66. package/dist/commonjs/models/models.js +8 -0
  67. package/dist/commonjs/models/models.js.map +1 -1
  68. package/dist/commonjs/models/streamingModels.d.ts +1 -67
  69. package/dist/commonjs/models/streamingModels.d.ts.map +1 -1
  70. package/dist/commonjs/models/streamingModels.js +0 -73
  71. package/dist/commonjs/models/streamingModels.js.map +1 -1
  72. package/dist/commonjs/tsdoc-metadata.json +1 -1
  73. package/dist/commonjs/utils.d.ts +20 -1
  74. package/dist/commonjs/utils.d.ts.map +1 -1
  75. package/dist/commonjs/utils.js +33 -1
  76. package/dist/commonjs/utils.js.map +1 -1
  77. package/dist/esm/api/agentsContext.d.ts.map +1 -1
  78. package/dist/esm/api/agentsContext.js +7 -4
  79. package/dist/esm/api/agentsContext.js.map +1 -1
  80. package/dist/esm/api/operations.d.ts +3 -3
  81. package/dist/esm/api/operations.d.ts.map +1 -1
  82. package/dist/esm/api/operations.js +14 -14
  83. package/dist/esm/api/operations.js.map +1 -1
  84. package/dist/esm/api/poller.d.ts +7 -2
  85. package/dist/esm/api/poller.d.ts.map +1 -1
  86. package/dist/esm/api/poller.js +31 -9
  87. package/dist/esm/api/poller.js.map +1 -1
  88. package/dist/esm/api/runs/operations.d.ts +12 -7
  89. package/dist/esm/api/runs/operations.d.ts.map +1 -1
  90. package/dist/esm/api/runs/operations.js +59 -9
  91. package/dist/esm/api/runs/operations.js.map +1 -1
  92. package/dist/esm/api/runs/options.d.ts +2 -1
  93. package/dist/esm/api/runs/options.d.ts.map +1 -1
  94. package/dist/esm/api/runs/options.js.map +1 -1
  95. package/dist/esm/classic/runs/index.d.ts +4 -1
  96. package/dist/esm/classic/runs/index.d.ts.map +1 -1
  97. package/dist/esm/classic/runs/index.js +2 -1
  98. package/dist/esm/classic/runs/index.js.map +1 -1
  99. package/dist/esm/constants.d.ts +1 -1
  100. package/dist/esm/constants.js +1 -1
  101. package/dist/esm/constants.js.map +1 -1
  102. package/dist/esm/models/models.d.ts +6 -2
  103. package/dist/esm/models/models.d.ts.map +1 -1
  104. package/dist/esm/models/models.js +8 -0
  105. package/dist/esm/models/models.js.map +1 -1
  106. package/dist/esm/models/streamingModels.d.ts +1 -67
  107. package/dist/esm/models/streamingModels.d.ts.map +1 -1
  108. package/dist/esm/models/streamingModels.js +1 -72
  109. package/dist/esm/models/streamingModels.js.map +1 -1
  110. package/dist/esm/utils.d.ts +20 -1
  111. package/dist/esm/utils.d.ts.map +1 -1
  112. package/dist/esm/utils.js +33 -1
  113. package/dist/esm/utils.js.map +1 -1
  114. package/dist/react-native/api/agentsContext.d.ts.map +1 -1
  115. package/dist/react-native/api/agentsContext.js +7 -4
  116. package/dist/react-native/api/agentsContext.js.map +1 -1
  117. package/dist/react-native/api/operations.d.ts +3 -3
  118. package/dist/react-native/api/operations.d.ts.map +1 -1
  119. package/dist/react-native/api/operations.js +14 -14
  120. package/dist/react-native/api/operations.js.map +1 -1
  121. package/dist/react-native/api/poller.d.ts +7 -2
  122. package/dist/react-native/api/poller.d.ts.map +1 -1
  123. package/dist/react-native/api/poller.js +31 -9
  124. package/dist/react-native/api/poller.js.map +1 -1
  125. package/dist/react-native/api/runs/operations.d.ts +12 -7
  126. package/dist/react-native/api/runs/operations.d.ts.map +1 -1
  127. package/dist/react-native/api/runs/operations.js +59 -9
  128. package/dist/react-native/api/runs/operations.js.map +1 -1
  129. package/dist/react-native/api/runs/options.d.ts +2 -1
  130. package/dist/react-native/api/runs/options.d.ts.map +1 -1
  131. package/dist/react-native/api/runs/options.js.map +1 -1
  132. package/dist/react-native/classic/runs/index.d.ts +4 -1
  133. package/dist/react-native/classic/runs/index.d.ts.map +1 -1
  134. package/dist/react-native/classic/runs/index.js +2 -1
  135. package/dist/react-native/classic/runs/index.js.map +1 -1
  136. package/dist/react-native/constants.d.ts +1 -1
  137. package/dist/react-native/constants.js +1 -1
  138. package/dist/react-native/constants.js.map +1 -1
  139. package/dist/react-native/models/models.d.ts +6 -2
  140. package/dist/react-native/models/models.d.ts.map +1 -1
  141. package/dist/react-native/models/models.js +8 -0
  142. package/dist/react-native/models/models.js.map +1 -1
  143. package/dist/react-native/models/streamingModels.d.ts +1 -67
  144. package/dist/react-native/models/streamingModels.d.ts.map +1 -1
  145. package/dist/react-native/models/streamingModels.js +1 -72
  146. package/dist/react-native/models/streamingModels.js.map +1 -1
  147. package/dist/react-native/utils.d.ts +20 -1
  148. package/dist/react-native/utils.d.ts.map +1 -1
  149. package/dist/react-native/utils.js +33 -1
  150. package/dist/react-native/utils.js.map +1 -1
  151. 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,EACL,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,gDAAgD;AAChD,oBAAY,iBAAiB;IAC3B,6FAA6F;IAC7F,aAAa,mBAAmB;CACjC;AAED,6CAA6C;AAC7C,oBAAY,cAAc;IACxB,wFAAwF;IACxF,gBAAgB,uBAAuB;IAEvC,kGAAkG;IAClG,eAAe,sBAAsB;IAErC,uGAAuG;IACvG,mBAAmB,2BAA2B;IAE9C,2GAA2G;IAC3G,uBAAuB,+BAA+B;IAEtD,sFAAsF;IACtF,kBAAkB,yBAAyB;IAE3C,+EAA+E;IAC/E,eAAe,sBAAsB;IAErC,sGAAsG;IACtG,mBAAmB,0BAA0B;IAE7C,sFAAsF;IACtF,kBAAkB,yBAAyB;IAE3C,oFAAoF;IACpF,gBAAgB,uBAAuB;CACxC;AAED,kDAAkD;AAClD,oBAAY,kBAAkB;IAC5B,kGAAkG;IAClG,oBAAoB,4BAA4B;IAEhD,0GAA0G;IAC1G,uBAAuB,gCAAgC;IAEvD,wGAAwG;IACxG,kBAAkB,0BAA0B;IAE5C,yFAAyF;IACzF,sBAAsB,8BAA8B;IAEpD,kFAAkF;IAClF,mBAAmB,2BAA2B;IAE9C,yFAAyF;IACzF,sBAAsB,8BAA8B;IAEpD,uFAAuF;IACvF,oBAAoB,4BAA4B;CACjD;AAED,iDAAiD;AACjD,oBAAY,kBAAkB;IAC5B,gGAAgG;IAChG,oBAAoB,2BAA2B;IAE/C,+GAA+G;IAC/G,uBAAuB,+BAA+B;IAEtD,uGAAuG;IACvG,kBAAkB,yBAAyB;IAE3C,8FAA8F;IAC9F,sBAAsB,6BAA6B;IAEnD,gGAAgG;IAChG,uBAAuB,8BAA8B;CACtD;AAED,qEAAqE;AACrE,oBAAY,UAAU;IACpB,sFAAsF;IACtF,KAAK,UAAU;CAChB;AAED,gEAAgE;AAChE,oBAAY,SAAS;IACnB,0CAA0C;IAC1C,IAAI,SAAS;CACd;AAED,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"}
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"}
@@ -1,75 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- /** Thread operation related streaming events */
4
- export var ThreadStreamEvent;
5
- (function (ThreadStreamEvent) {
6
- /** Event sent when a new thread is created. The data of this event is of type AgentThread */
7
- ThreadStreamEvent["ThreadCreated"] = "thread.created";
8
- })(ThreadStreamEvent || (ThreadStreamEvent = {}));
9
- /** Run operation related streaming events */
10
- export var RunStreamEvent;
11
- (function (RunStreamEvent) {
12
- /** Event sent when a new run is created. The data of this event is of type ThreadRun */
13
- RunStreamEvent["ThreadRunCreated"] = "thread.run.created";
14
- /** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */
15
- RunStreamEvent["ThreadRunQueued"] = "thread.run.queued";
16
- /** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */
17
- RunStreamEvent["ThreadRunInProgress"] = "thread.run.in_progress";
18
- /** Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun */
19
- RunStreamEvent["ThreadRunRequiresAction"] = "thread.run.requires_action";
20
- /** Event sent when a run is completed. The data of this event is of type ThreadRun */
21
- RunStreamEvent["ThreadRunCompleted"] = "thread.run.completed";
22
- /** Event sent when a run fails. The data of this event is of type ThreadRun */
23
- RunStreamEvent["ThreadRunFailed"] = "thread.run.failed";
24
- /** Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun */
25
- RunStreamEvent["ThreadRunCancelling"] = "thread.run.cancelling";
26
- /** Event sent when a run is cancelled. The data of this event is of type ThreadRun */
27
- RunStreamEvent["ThreadRunCancelled"] = "thread.run.cancelled";
28
- /** Event sent when a run is expired. The data of this event is of type ThreadRun */
29
- RunStreamEvent["ThreadRunExpired"] = "thread.run.expired";
30
- })(RunStreamEvent || (RunStreamEvent = {}));
31
- /** Run step operation related streaming events */
32
- export var RunStepStreamEvent;
33
- (function (RunStepStreamEvent) {
34
- /** Event sent when a new thread run step is created. The data of this event is of type RunStep */
35
- RunStepStreamEvent["ThreadRunStepCreated"] = "thread.run.step.created";
36
- /** Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep */
37
- RunStepStreamEvent["ThreadRunStepInProgress"] = "thread.run.step.in_progress";
38
- /** Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk */
39
- RunStepStreamEvent["ThreadRunStepDelta"] = "thread.run.step.delta";
40
- /** Event sent when a run step is completed. The data of this event is of type RunStep */
41
- RunStepStreamEvent["ThreadRunStepCompleted"] = "thread.run.step.completed";
42
- /** Event sent when a run step fails. The data of this event is of type RunStep */
43
- RunStepStreamEvent["ThreadRunStepFailed"] = "thread.run.step.failed";
44
- /** Event sent when a run step is cancelled. The data of this event is of type RunStep */
45
- RunStepStreamEvent["ThreadRunStepCancelled"] = "thread.run.step.cancelled";
46
- /** Event sent when a run step is expired. The data of this event is of type RunStep */
47
- RunStepStreamEvent["ThreadRunStepExpired"] = "thread.run.step.expired";
48
- })(RunStepStreamEvent || (RunStepStreamEvent = {}));
49
- /** Message operation related streaming events */
50
- export var MessageStreamEvent;
51
- (function (MessageStreamEvent) {
52
- /** Event sent when a new message is created. The data of this event is of type ThreadMessage */
53
- MessageStreamEvent["ThreadMessageCreated"] = "thread.message.created";
54
- /** Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage */
55
- MessageStreamEvent["ThreadMessageInProgress"] = "thread.message.in_progress";
56
- /** Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk */
57
- MessageStreamEvent["ThreadMessageDelta"] = "thread.message.delta";
58
- /** Event sent when a message is completed. The data of this event is of type ThreadMessage */
59
- MessageStreamEvent["ThreadMessageCompleted"] = "thread.message.completed";
60
- /** Event sent before a message is completed. The data of this event is of type ThreadMessage */
61
- MessageStreamEvent["ThreadMessageIncomplete"] = "thread.message.incomplete";
62
- })(MessageStreamEvent || (MessageStreamEvent = {}));
63
- /** Terminal event indicating a server side error while streaming. */
64
- export var ErrorEvent;
65
- (function (ErrorEvent) {
66
- /** Event sent when an error occurs, such as an internal server error or a timeout. */
67
- ErrorEvent["Error"] = "error";
68
- })(ErrorEvent || (ErrorEvent = {}));
69
- /** Terminal event indicating the successful end of a stream. */
70
- export var DoneEvent;
71
- (function (DoneEvent) {
72
- /** Event sent when the stream is done. */
73
- DoneEvent["Done"] = "done";
74
- })(DoneEvent || (DoneEvent = {}));
3
+ export {};
75
4
  //# sourceMappingURL=streamingModels.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"streamingModels.js","sourceRoot":"","sources":["../../../src/models/streamingModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgDlC,gDAAgD;AAChD,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,6FAA6F;IAC7F,qDAAgC,CAAA;AAClC,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED,6CAA6C;AAC7C,MAAM,CAAN,IAAY,cA2BX;AA3BD,WAAY,cAAc;IACxB,wFAAwF;IACxF,yDAAuC,CAAA;IAEvC,kGAAkG;IAClG,uDAAqC,CAAA;IAErC,uGAAuG;IACvG,gEAA8C,CAAA;IAE9C,2GAA2G;IAC3G,wEAAsD,CAAA;IAEtD,sFAAsF;IACtF,6DAA2C,CAAA;IAE3C,+EAA+E;IAC/E,uDAAqC,CAAA;IAErC,sGAAsG;IACtG,+DAA6C,CAAA;IAE7C,sFAAsF;IACtF,6DAA2C,CAAA;IAE3C,oFAAoF;IACpF,yDAAuC,CAAA;AACzC,CAAC,EA3BW,cAAc,KAAd,cAAc,QA2BzB;AAED,kDAAkD;AAClD,MAAM,CAAN,IAAY,kBAqBX;AArBD,WAAY,kBAAkB;IAC5B,kGAAkG;IAClG,sEAAgD,CAAA;IAEhD,0GAA0G;IAC1G,6EAAuD,CAAA;IAEvD,wGAAwG;IACxG,kEAA4C,CAAA;IAE5C,yFAAyF;IACzF,0EAAoD,CAAA;IAEpD,kFAAkF;IAClF,oEAA8C,CAAA;IAE9C,yFAAyF;IACzF,0EAAoD,CAAA;IAEpD,uFAAuF;IACvF,sEAAgD,CAAA;AAClD,CAAC,EArBW,kBAAkB,KAAlB,kBAAkB,QAqB7B;AAED,iDAAiD;AACjD,MAAM,CAAN,IAAY,kBAeX;AAfD,WAAY,kBAAkB;IAC5B,gGAAgG;IAChG,qEAA+C,CAAA;IAE/C,+GAA+G;IAC/G,4EAAsD,CAAA;IAEtD,uGAAuG;IACvG,iEAA2C,CAAA;IAE3C,8FAA8F;IAC9F,yEAAmD,CAAA;IAEnD,gGAAgG;IAChG,2EAAqD,CAAA;AACvD,CAAC,EAfW,kBAAkB,KAAlB,kBAAkB,QAe7B;AAED,qEAAqE;AACrE,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,sFAAsF;IACtF,6BAAe,CAAA;AACjB,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED,gEAAgE;AAChE,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,0CAA0C;IAC1C,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\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/** Thread operation related streaming events */\nexport enum ThreadStreamEvent {\n /** Event sent when a new thread is created. The data of this event is of type AgentThread */\n ThreadCreated = \"thread.created\",\n}\n\n/** Run operation related streaming events */\nexport enum RunStreamEvent {\n /** Event sent when a new run is created. The data of this event is of type ThreadRun */\n ThreadRunCreated = \"thread.run.created\",\n\n /** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */\n ThreadRunQueued = \"thread.run.queued\",\n\n /** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */\n ThreadRunInProgress = \"thread.run.in_progress\",\n\n /** Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun */\n ThreadRunRequiresAction = \"thread.run.requires_action\",\n\n /** Event sent when a run is completed. The data of this event is of type ThreadRun */\n ThreadRunCompleted = \"thread.run.completed\",\n\n /** Event sent when a run fails. The data of this event is of type ThreadRun */\n ThreadRunFailed = \"thread.run.failed\",\n\n /** Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun */\n ThreadRunCancelling = \"thread.run.cancelling\",\n\n /** Event sent when a run is cancelled. The data of this event is of type ThreadRun */\n ThreadRunCancelled = \"thread.run.cancelled\",\n\n /** Event sent when a run is expired. The data of this event is of type ThreadRun */\n ThreadRunExpired = \"thread.run.expired\",\n}\n\n/** Run step operation related streaming events */\nexport enum RunStepStreamEvent {\n /** Event sent when a new thread run step is created. The data of this event is of type RunStep */\n ThreadRunStepCreated = \"thread.run.step.created\",\n\n /** Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep */\n ThreadRunStepInProgress = \"thread.run.step.in_progress\",\n\n /** Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk */\n ThreadRunStepDelta = \"thread.run.step.delta\",\n\n /** Event sent when a run step is completed. The data of this event is of type RunStep */\n ThreadRunStepCompleted = \"thread.run.step.completed\",\n\n /** Event sent when a run step fails. The data of this event is of type RunStep */\n ThreadRunStepFailed = \"thread.run.step.failed\",\n\n /** Event sent when a run step is cancelled. The data of this event is of type RunStep */\n ThreadRunStepCancelled = \"thread.run.step.cancelled\",\n\n /** Event sent when a run step is expired. The data of this event is of type RunStep */\n ThreadRunStepExpired = \"thread.run.step.expired\",\n}\n\n/** Message operation related streaming events */\nexport enum MessageStreamEvent {\n /** Event sent when a new message is created. The data of this event is of type ThreadMessage */\n ThreadMessageCreated = \"thread.message.created\",\n\n /** Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage */\n ThreadMessageInProgress = \"thread.message.in_progress\",\n\n /** Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk */\n ThreadMessageDelta = \"thread.message.delta\",\n\n /** Event sent when a message is completed. The data of this event is of type ThreadMessage */\n ThreadMessageCompleted = \"thread.message.completed\",\n\n /** Event sent before a message is completed. The data of this event is of type ThreadMessage */\n ThreadMessageIncomplete = \"thread.message.incomplete\",\n}\n\n/** Terminal event indicating a server side error while streaming. */\nexport enum ErrorEvent {\n /** Event sent when an error occurs, such as an internal server error or a timeout. */\n Error = \"error\",\n}\n\n/** Terminal event indicating the successful end of a stream. */\nexport enum DoneEvent {\n /** Event sent when the stream is done. */\n Done = \"done\",\n}\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"]}
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"]}
@@ -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,EACjC,MAAM,YAAY,CAAC;AAEpB;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EACvD,MAAM,EAAE,cAAc,GAAG,gBAAgB,GAAG,mBAAmB,EAC/D,IAAI,EAAE,MAAM,GACX,MAAM,IAAI,CAAC,CAEb;AAED,2DAA2D;AAC3D,oBAAY,kBAAkB;IAC5B,iCAAiC;IACjC,aAAa,mBAAmB;IAChC,4BAA4B;IAC5B,eAAe,qBAAqB;IACpC,sBAAsB;IACtB,mBAAmB,yBAAyB;IAC5C,0BAA0B;IAC1B,aAAa,mBAAmB;IAChC,8BAA8B;IAC9B,gBAAgB,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AM,EACzB,SAAS,EAAE,MAAM,GAChB;QAAE,UAAU,EAAE,2BAA2B,CAAC;QAAC,SAAS,EAAE,aAAa,CAAA;KAAE;IAOxE;;;;;;OAMG;IACH,cAAc,CAAC,yBAAyB,EAAE,yBAAyB,GAAG;QACpE,UAAU,EAAE,qBAAqB,CAAC;KACnC;IAMD;;;;;;OAMG;IACH,oBAAoB,CAAC,oBAAoB,EAAE,gCAAgC,EAAE,GAAG;QAC9E,UAAU,EAAE,2BAA2B,CAAC;KACzC;IAMD;;;;;;;OAOG;IACH,qBAAqB,CACnB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB;QAAE,UAAU,EAAE,4BAA4B,CAAA;KAAE;IAM/C;;;;;OAKG;IACH,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG;QAAE,UAAU,EAAE,6BAA6B,CAAA;KAAE;IAMlF;;;;;;OAMG;IACH,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG;QAAE,UAAU,EAAE,wBAAwB,CAAA;KAAE;CAK3F"}
@@ -84,11 +84,13 @@ export class ToolUtility {
84
84
  *
85
85
  */
86
86
  static createBingGroundingTool(searchConfigurations) {
87
+ // Ensure searchConfigurations is an array even if it's undefined
88
+ const configs = searchConfigurations || [];
87
89
  return {
88
90
  definition: {
89
91
  type: "bing_grounding",
90
92
  bingGrounding: {
91
- searchConfigurations: searchConfigurations.map((searchConfiguration) => ({
93
+ searchConfigurations: configs.map((searchConfiguration) => ({
92
94
  connectionId: searchConfiguration.connectionId,
93
95
  market: searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.market,
94
96
  setLang: searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.setLang,
@@ -177,6 +179,23 @@ export class ToolUtility {
177
179
  },
178
180
  };
179
181
  }
182
+ /**
183
+ * Creates a connected agent tool
184
+ *
185
+ * @returns An object containing the definition for the connected agent tool.
186
+ */
187
+ static createConnectedAgentTool(id, name, description) {
188
+ return {
189
+ definition: {
190
+ type: "connected_agent",
191
+ connectedAgent: {
192
+ id: id,
193
+ name: name,
194
+ description: description,
195
+ },
196
+ },
197
+ };
198
+ }
180
199
  /**
181
200
  * Creates a Microsoft Fabric tool
182
201
  *
@@ -320,6 +339,19 @@ export class ToolSet {
320
339
  this.toolDefinitions.push(tool.definition);
321
340
  return tool;
322
341
  }
342
+ /**
343
+ * Adds a connected agent tool to the tool set.
344
+ *
345
+ * @param id - The ID of the connected agent.
346
+ * @param name - The name of the connected agent.
347
+ * @param description - The description of the connected agent.
348
+ * @returns An object containing the definition for the connected agent tool
349
+ */
350
+ addConnectedAgentTool(id, name, description) {
351
+ const tool = ToolUtility.createConnectedAgentTool(id, name, description);
352
+ this.toolDefinitions.push(tool.definition);
353
+ return tool;
354
+ }
323
355
  /**
324
356
  * Adds a Microsoft Fabric tool to the tool set.
325
357
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA2BlC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAA+D,EAC/D,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAN,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,KAAlB,kBAAkB,QAW7B;AAED,MAAM,OAAO,GAAG;IACd,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,kBAAkB;IACpC,oBAAoB,EAAE,qBAAqB;IAC3C,cAAc,EAAE,eAAe;I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ClE,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CAAC,yBAAoD;QAGjE,MAAM,IAAI,GAAG,WAAW,CAAC,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;;;;;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","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;AA4BlC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAA+D,EAC/D,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAN,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,KAAlB,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,MAAM,OAAO,WAAW;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACzB,QAA4B,EAC5B,aA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A6B,CAAC,YAAY,CAAC,CAAC;QACrE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;CACF","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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/ai-agents",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "Azure AI Agents client library.",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -95,7 +95,6 @@
95
95
  "scripts": {
96
96
  "build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
97
97
  "build:samples": "echo skipped",
98
- "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test",
99
98
  "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ",
100
99
  "clean": "dev-tool run vendored rimraf --glob dist dist-* test-dist temp types *.tgz *.log",
101
100
  "copy:yaml": "copy tsp-location.yaml .\\src\\generated\\tsp-location.yaml",
@@ -103,21 +102,16 @@
103
102
  "extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./review && dev-tool run extract-api",
104
103
  "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ",
105
104
  "generate": "dev-tool run vendored rimraf ./src/generated && dev-tool run vendored mkdirp ./src/generated && npm run copy:yaml && npm run tsp:update && dev-tool run vendored rimraf ./src/generated/test && dev-tool run vendored rimraf ./src/generated/tsp-location.yaml",
106
- "integration-test": "npm run integration-test:node && npm run integration-test:browser",
107
- "integration-test:browser": "npm run unit-test:browser --no-test-proxy",
108
- "integration-test:node": "npm run unit-test:node --no-test-proxy",
105
+ "generate-samples": "dev-tool samples publish -f",
109
106
  "lint": "eslint package.json api-extractor.json src test",
110
107
  "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
111
108
  "pack": "npm pack 2>&1",
112
- "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run unit-test:browser && npm run integration-test",
113
- "test:browser": "npm run clean && npm run unit-test:browser && npm run integration-test:browser",
114
- "test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node",
109
+ "test": "npm run test:node && npm run test:browser",
110
+ "test:browser": "dev-tool run build-test && dev-tool run test:vitest --browser",
111
+ "test:node": "dev-tool run test:vitest",
112
+ "test:node:esm": "dev-tool run test:vitest --esm --no-test-proxy",
115
113
  "tsp:update": "tsp-client update -o ./src/generated",
116
- "unit-test": "npm run unit-test:node && npm run unit-test:browser",
117
- "unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser",
118
- "unit-test:node": "dev-tool run test:vitest",
119
- "update-snippets": "dev-tool run update-snippets",
120
- "generate-samples": "dev-tool samples publish -f"
114
+ "update-snippets": "dev-tool run update-snippets"
121
115
  },
122
116
  "exports": {
123
117
  "./package.json": "./package.json",