@vertesia/client 0.24.0-dev.202601221707

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 (339) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +110 -0
  3. package/lib/cjs/AccountApi.js +85 -0
  4. package/lib/cjs/AccountApi.js.map +1 -0
  5. package/lib/cjs/AccountsApi.js +16 -0
  6. package/lib/cjs/AccountsApi.js.map +1 -0
  7. package/lib/cjs/AnalyticsApi.js +41 -0
  8. package/lib/cjs/AnalyticsApi.js.map +1 -0
  9. package/lib/cjs/ApiKeysApi.js +63 -0
  10. package/lib/cjs/ApiKeysApi.js.map +1 -0
  11. package/lib/cjs/AppsApi.js +119 -0
  12. package/lib/cjs/AppsApi.js.map +1 -0
  13. package/lib/cjs/CommandsApi.js +19 -0
  14. package/lib/cjs/CommandsApi.js.map +1 -0
  15. package/lib/cjs/EnvironmentsApi.js +72 -0
  16. package/lib/cjs/EnvironmentsApi.js.map +1 -0
  17. package/lib/cjs/GroupsApi.js +78 -0
  18. package/lib/cjs/GroupsApi.js.map +1 -0
  19. package/lib/cjs/IamApi.js +53 -0
  20. package/lib/cjs/IamApi.js.map +1 -0
  21. package/lib/cjs/InteractionBase.js +44 -0
  22. package/lib/cjs/InteractionBase.js.map +1 -0
  23. package/lib/cjs/InteractionCatalogApi.js +64 -0
  24. package/lib/cjs/InteractionCatalogApi.js.map +1 -0
  25. package/lib/cjs/InteractionOutput.js +300 -0
  26. package/lib/cjs/InteractionOutput.js.map +1 -0
  27. package/lib/cjs/InteractionResult.example.js +57 -0
  28. package/lib/cjs/InteractionResult.example.js.map +1 -0
  29. package/lib/cjs/InteractionsApi.js +262 -0
  30. package/lib/cjs/InteractionsApi.js.map +1 -0
  31. package/lib/cjs/MCPOAuthApi.js +62 -0
  32. package/lib/cjs/MCPOAuthApi.js.map +1 -0
  33. package/lib/cjs/ProjectsApi.js +72 -0
  34. package/lib/cjs/ProjectsApi.js.map +1 -0
  35. package/lib/cjs/PromptsApi.js +133 -0
  36. package/lib/cjs/PromptsApi.js.map +1 -0
  37. package/lib/cjs/RefsApi.js +14 -0
  38. package/lib/cjs/RefsApi.js.map +1 -0
  39. package/lib/cjs/RunsApi.js +113 -0
  40. package/lib/cjs/RunsApi.js.map +1 -0
  41. package/lib/cjs/SkillsApi.js +39 -0
  42. package/lib/cjs/SkillsApi.js.map +1 -0
  43. package/lib/cjs/StreamSource.js +17 -0
  44. package/lib/cjs/StreamSource.js.map +1 -0
  45. package/lib/cjs/TrainingApi.js +54 -0
  46. package/lib/cjs/TrainingApi.js.map +1 -0
  47. package/lib/cjs/UsersApi.js +13 -0
  48. package/lib/cjs/UsersApi.js.map +1 -0
  49. package/lib/cjs/client.js +360 -0
  50. package/lib/cjs/client.js.map +1 -0
  51. package/lib/cjs/execute.js +158 -0
  52. package/lib/cjs/execute.js.map +1 -0
  53. package/lib/cjs/index.js +22 -0
  54. package/lib/cjs/index.js.map +1 -0
  55. package/lib/cjs/nodejs/NodeStreamSource.js +45 -0
  56. package/lib/cjs/nodejs/NodeStreamSource.js.map +1 -0
  57. package/lib/cjs/nodejs/index.js +18 -0
  58. package/lib/cjs/nodejs/index.js.map +1 -0
  59. package/lib/cjs/package.json +3 -0
  60. package/lib/cjs/store/AnalyzeDocApi.js +56 -0
  61. package/lib/cjs/store/AnalyzeDocApi.js.map +1 -0
  62. package/lib/cjs/store/CollectionsApi.js +131 -0
  63. package/lib/cjs/store/CollectionsApi.js.map +1 -0
  64. package/lib/cjs/store/CommandsApi.js +17 -0
  65. package/lib/cjs/store/CommandsApi.js.map +1 -0
  66. package/lib/cjs/store/DashboardApi.js +182 -0
  67. package/lib/cjs/store/DashboardApi.js.map +1 -0
  68. package/lib/cjs/store/DataApi.js +433 -0
  69. package/lib/cjs/store/DataApi.js.map +1 -0
  70. package/lib/cjs/store/EmailApi.js +103 -0
  71. package/lib/cjs/store/EmailApi.js.map +1 -0
  72. package/lib/cjs/store/EmbeddingsApi.js +29 -0
  73. package/lib/cjs/store/EmbeddingsApi.js.map +1 -0
  74. package/lib/cjs/store/FilesApi.js +237 -0
  75. package/lib/cjs/store/FilesApi.js.map +1 -0
  76. package/lib/cjs/store/ObjectsApi.js +314 -0
  77. package/lib/cjs/store/ObjectsApi.js.map +1 -0
  78. package/lib/cjs/store/PendingAsksApi.js +43 -0
  79. package/lib/cjs/store/PendingAsksApi.js.map +1 -0
  80. package/lib/cjs/store/SchedulesApi.js +103 -0
  81. package/lib/cjs/store/SchedulesApi.js.map +1 -0
  82. package/lib/cjs/store/ToolsApi.js +21 -0
  83. package/lib/cjs/store/ToolsApi.js.map +1 -0
  84. package/lib/cjs/store/TypesApi.js +57 -0
  85. package/lib/cjs/store/TypesApi.js.map +1 -0
  86. package/lib/cjs/store/WorkersApi.js +16 -0
  87. package/lib/cjs/store/WorkersApi.js.map +1 -0
  88. package/lib/cjs/store/WorkflowsApi.js +596 -0
  89. package/lib/cjs/store/WorkflowsApi.js.map +1 -0
  90. package/lib/cjs/store/client.js +81 -0
  91. package/lib/cjs/store/client.js.map +1 -0
  92. package/lib/cjs/store/errors.js +11 -0
  93. package/lib/cjs/store/errors.js.map +1 -0
  94. package/lib/cjs/store/index.js +27 -0
  95. package/lib/cjs/store/index.js.map +1 -0
  96. package/lib/cjs/store/version.js +6 -0
  97. package/lib/cjs/store/version.js.map +1 -0
  98. package/lib/esm/AccountApi.js +82 -0
  99. package/lib/esm/AccountApi.js.map +1 -0
  100. package/lib/esm/AccountsApi.js +13 -0
  101. package/lib/esm/AccountsApi.js.map +1 -0
  102. package/lib/esm/AnalyticsApi.js +38 -0
  103. package/lib/esm/AnalyticsApi.js.map +1 -0
  104. package/lib/esm/ApiKeysApi.js +59 -0
  105. package/lib/esm/ApiKeysApi.js.map +1 -0
  106. package/lib/esm/AppsApi.js +116 -0
  107. package/lib/esm/AppsApi.js.map +1 -0
  108. package/lib/esm/CommandsApi.js +16 -0
  109. package/lib/esm/CommandsApi.js.map +1 -0
  110. package/lib/esm/EnvironmentsApi.js +69 -0
  111. package/lib/esm/EnvironmentsApi.js.map +1 -0
  112. package/lib/esm/GroupsApi.js +74 -0
  113. package/lib/esm/GroupsApi.js.map +1 -0
  114. package/lib/esm/IamApi.js +47 -0
  115. package/lib/esm/IamApi.js.map +1 -0
  116. package/lib/esm/InteractionBase.js +40 -0
  117. package/lib/esm/InteractionBase.js.map +1 -0
  118. package/lib/esm/InteractionCatalogApi.js +60 -0
  119. package/lib/esm/InteractionCatalogApi.js.map +1 -0
  120. package/lib/esm/InteractionOutput.js +293 -0
  121. package/lib/esm/InteractionOutput.js.map +1 -0
  122. package/lib/esm/InteractionResult.example.js +55 -0
  123. package/lib/esm/InteractionResult.example.js.map +1 -0
  124. package/lib/esm/InteractionsApi.js +259 -0
  125. package/lib/esm/InteractionsApi.js.map +1 -0
  126. package/lib/esm/MCPOAuthApi.js +59 -0
  127. package/lib/esm/MCPOAuthApi.js.map +1 -0
  128. package/lib/esm/ProjectsApi.js +69 -0
  129. package/lib/esm/ProjectsApi.js.map +1 -0
  130. package/lib/esm/PromptsApi.js +130 -0
  131. package/lib/esm/PromptsApi.js.map +1 -0
  132. package/lib/esm/RefsApi.js +10 -0
  133. package/lib/esm/RefsApi.js.map +1 -0
  134. package/lib/esm/RunsApi.js +109 -0
  135. package/lib/esm/RunsApi.js.map +1 -0
  136. package/lib/esm/SkillsApi.js +36 -0
  137. package/lib/esm/SkillsApi.js.map +1 -0
  138. package/lib/esm/StreamSource.js +13 -0
  139. package/lib/esm/StreamSource.js.map +1 -0
  140. package/lib/esm/TrainingApi.js +51 -0
  141. package/lib/esm/TrainingApi.js.map +1 -0
  142. package/lib/esm/UsersApi.js +10 -0
  143. package/lib/esm/UsersApi.js.map +1 -0
  144. package/lib/esm/client.js +351 -0
  145. package/lib/esm/client.js.map +1 -0
  146. package/lib/esm/execute.js +118 -0
  147. package/lib/esm/execute.js.map +1 -0
  148. package/lib/esm/index.js +6 -0
  149. package/lib/esm/index.js.map +1 -0
  150. package/lib/esm/nodejs/NodeStreamSource.js +41 -0
  151. package/lib/esm/nodejs/NodeStreamSource.js.map +1 -0
  152. package/lib/esm/nodejs/index.js +2 -0
  153. package/lib/esm/nodejs/index.js.map +1 -0
  154. package/lib/esm/store/AnalyzeDocApi.js +52 -0
  155. package/lib/esm/store/AnalyzeDocApi.js.map +1 -0
  156. package/lib/esm/store/CollectionsApi.js +127 -0
  157. package/lib/esm/store/CollectionsApi.js.map +1 -0
  158. package/lib/esm/store/CommandsApi.js +13 -0
  159. package/lib/esm/store/CommandsApi.js.map +1 -0
  160. package/lib/esm/store/DashboardApi.js +178 -0
  161. package/lib/esm/store/DashboardApi.js.map +1 -0
  162. package/lib/esm/store/DataApi.js +429 -0
  163. package/lib/esm/store/DataApi.js.map +1 -0
  164. package/lib/esm/store/EmailApi.js +99 -0
  165. package/lib/esm/store/EmailApi.js.map +1 -0
  166. package/lib/esm/store/EmbeddingsApi.js +25 -0
  167. package/lib/esm/store/EmbeddingsApi.js.map +1 -0
  168. package/lib/esm/store/FilesApi.js +231 -0
  169. package/lib/esm/store/FilesApi.js.map +1 -0
  170. package/lib/esm/store/ObjectsApi.js +309 -0
  171. package/lib/esm/store/ObjectsApi.js.map +1 -0
  172. package/lib/esm/store/PendingAsksApi.js +39 -0
  173. package/lib/esm/store/PendingAsksApi.js.map +1 -0
  174. package/lib/esm/store/SchedulesApi.js +99 -0
  175. package/lib/esm/store/SchedulesApi.js.map +1 -0
  176. package/lib/esm/store/ToolsApi.js +17 -0
  177. package/lib/esm/store/ToolsApi.js.map +1 -0
  178. package/lib/esm/store/TypesApi.js +53 -0
  179. package/lib/esm/store/TypesApi.js.map +1 -0
  180. package/lib/esm/store/WorkersApi.js +12 -0
  181. package/lib/esm/store/WorkersApi.js.map +1 -0
  182. package/lib/esm/store/WorkflowsApi.js +590 -0
  183. package/lib/esm/store/WorkflowsApi.js.map +1 -0
  184. package/lib/esm/store/client.js +77 -0
  185. package/lib/esm/store/client.js.map +1 -0
  186. package/lib/esm/store/errors.js +7 -0
  187. package/lib/esm/store/errors.js.map +1 -0
  188. package/lib/esm/store/index.js +11 -0
  189. package/lib/esm/store/index.js.map +1 -0
  190. package/lib/esm/store/version.js +3 -0
  191. package/lib/esm/store/version.js.map +1 -0
  192. package/lib/tsconfig.tsbuildinfo +1 -0
  193. package/lib/types/AccountApi.d.ts +59 -0
  194. package/lib/types/AccountApi.d.ts.map +1 -0
  195. package/lib/types/AccountsApi.d.ts +7 -0
  196. package/lib/types/AccountsApi.d.ts.map +1 -0
  197. package/lib/types/AnalyticsApi.d.ts +11 -0
  198. package/lib/types/AnalyticsApi.d.ts.map +1 -0
  199. package/lib/types/ApiKeysApi.d.ts +42 -0
  200. package/lib/types/ApiKeysApi.d.ts.map +1 -0
  201. package/lib/types/AppsApi.d.ts +65 -0
  202. package/lib/types/AppsApi.d.ts.map +1 -0
  203. package/lib/types/CommandsApi.d.ts +10 -0
  204. package/lib/types/CommandsApi.d.ts.map +1 -0
  205. package/lib/types/EnvironmentsApi.d.ts +40 -0
  206. package/lib/types/EnvironmentsApi.d.ts.map +1 -0
  207. package/lib/types/GroupsApi.d.ts +65 -0
  208. package/lib/types/GroupsApi.d.ts.map +1 -0
  209. package/lib/types/IamApi.d.ts +41 -0
  210. package/lib/types/IamApi.d.ts.map +1 -0
  211. package/lib/types/InteractionBase.d.ts +22 -0
  212. package/lib/types/InteractionBase.d.ts.map +1 -0
  213. package/lib/types/InteractionCatalogApi.d.ts +36 -0
  214. package/lib/types/InteractionCatalogApi.d.ts.map +1 -0
  215. package/lib/types/InteractionOutput.d.ts +174 -0
  216. package/lib/types/InteractionOutput.d.ts.map +1 -0
  217. package/lib/types/InteractionResult.example.d.ts +6 -0
  218. package/lib/types/InteractionResult.example.d.ts.map +1 -0
  219. package/lib/types/InteractionsApi.d.ts +183 -0
  220. package/lib/types/InteractionsApi.d.ts.map +1 -0
  221. package/lib/types/MCPOAuthApi.d.ts +45 -0
  222. package/lib/types/MCPOAuthApi.d.ts.map +1 -0
  223. package/lib/types/ProjectsApi.d.ts +28 -0
  224. package/lib/types/ProjectsApi.d.ts.map +1 -0
  225. package/lib/types/PromptsApi.d.ts +106 -0
  226. package/lib/types/PromptsApi.d.ts.map +1 -0
  227. package/lib/types/RefsApi.d.ts +6 -0
  228. package/lib/types/RefsApi.d.ts.map +1 -0
  229. package/lib/types/RunsApi.d.ts +79 -0
  230. package/lib/types/RunsApi.d.ts.map +1 -0
  231. package/lib/types/SkillsApi.d.ts +26 -0
  232. package/lib/types/SkillsApi.d.ts.map +1 -0
  233. package/lib/types/StreamSource.d.ts +7 -0
  234. package/lib/types/StreamSource.d.ts.map +1 -0
  235. package/lib/types/TrainingApi.d.ts +27 -0
  236. package/lib/types/TrainingApi.d.ts.map +1 -0
  237. package/lib/types/UsersApi.d.ts +6 -0
  238. package/lib/types/UsersApi.d.ts.map +1 -0
  239. package/lib/types/client.d.ts +136 -0
  240. package/lib/types/client.d.ts.map +1 -0
  241. package/lib/types/execute.d.ts +37 -0
  242. package/lib/types/execute.d.ts.map +1 -0
  243. package/lib/types/index.d.ts +10 -0
  244. package/lib/types/index.d.ts.map +1 -0
  245. package/lib/types/nodejs/NodeStreamSource.d.ts +9 -0
  246. package/lib/types/nodejs/NodeStreamSource.d.ts.map +1 -0
  247. package/lib/types/nodejs/index.d.ts +1 -0
  248. package/lib/types/nodejs/index.d.ts.map +1 -0
  249. package/lib/types/store/AnalyzeDocApi.d.ts +17 -0
  250. package/lib/types/store/AnalyzeDocApi.d.ts.map +1 -0
  251. package/lib/types/store/CollectionsApi.d.ts +82 -0
  252. package/lib/types/store/CollectionsApi.d.ts.map +1 -0
  253. package/lib/types/store/CommandsApi.d.ts +10 -0
  254. package/lib/types/store/CommandsApi.d.ts.map +1 -0
  255. package/lib/types/store/DashboardApi.d.ts +149 -0
  256. package/lib/types/store/DashboardApi.d.ts.map +1 -0
  257. package/lib/types/store/DataApi.d.ts +392 -0
  258. package/lib/types/store/DataApi.d.ts.map +1 -0
  259. package/lib/types/store/EmailApi.d.ts +185 -0
  260. package/lib/types/store/EmailApi.d.ts.map +1 -0
  261. package/lib/types/store/EmbeddingsApi.d.ts +12 -0
  262. package/lib/types/store/EmbeddingsApi.d.ts.map +1 -0
  263. package/lib/types/store/FilesApi.d.ts +110 -0
  264. package/lib/types/store/FilesApi.d.ts.map +1 -0
  265. package/lib/types/store/ObjectsApi.d.ts +139 -0
  266. package/lib/types/store/ObjectsApi.d.ts.map +1 -0
  267. package/lib/types/store/PendingAsksApi.d.ts +79 -0
  268. package/lib/types/store/PendingAsksApi.d.ts.map +1 -0
  269. package/lib/types/store/SchedulesApi.d.ts +89 -0
  270. package/lib/types/store/SchedulesApi.d.ts.map +1 -0
  271. package/lib/types/store/ToolsApi.d.ts +13 -0
  272. package/lib/types/store/ToolsApi.d.ts.map +1 -0
  273. package/lib/types/store/TypesApi.d.ts +23 -0
  274. package/lib/types/store/TypesApi.d.ts.map +1 -0
  275. package/lib/types/store/WorkersApi.d.ts +6 -0
  276. package/lib/types/store/WorkersApi.d.ts.map +1 -0
  277. package/lib/types/store/WorkflowsApi.d.ts +167 -0
  278. package/lib/types/store/WorkflowsApi.d.ts.map +1 -0
  279. package/lib/types/store/client.d.ts +45 -0
  280. package/lib/types/store/client.d.ts.map +1 -0
  281. package/lib/types/store/errors.d.ts +4 -0
  282. package/lib/types/store/errors.d.ts.map +1 -0
  283. package/lib/types/store/index.d.ts +10 -0
  284. package/lib/types/store/index.d.ts.map +1 -0
  285. package/lib/types/store/version.d.ts +2 -0
  286. package/lib/types/store/version.d.ts.map +1 -0
  287. package/lib/vertesia-client.js +2 -0
  288. package/lib/vertesia-client.js.map +1 -0
  289. package/package.json +71 -0
  290. package/src/AccountApi.ts +96 -0
  291. package/src/AccountsApi.ts +22 -0
  292. package/src/AnalyticsApi.ts +36 -0
  293. package/src/ApiKeysApi.ts +67 -0
  294. package/src/AppsApi.ts +134 -0
  295. package/src/CommandsApi.ts +23 -0
  296. package/src/EnvironmentsApi.ts +94 -0
  297. package/src/GroupsApi.ts +92 -0
  298. package/src/IamApi.ts +70 -0
  299. package/src/InteractionBase.ts +44 -0
  300. package/src/InteractionCatalogApi.ts +72 -0
  301. package/src/InteractionOutput.test.ts +305 -0
  302. package/src/InteractionOutput.ts +328 -0
  303. package/src/InteractionResult.example.ts +72 -0
  304. package/src/InteractionsApi.ts +308 -0
  305. package/src/MCPOAuthApi.ts +67 -0
  306. package/src/ProjectsApi.ts +85 -0
  307. package/src/PromptsApi.ts +160 -0
  308. package/src/RefsApi.ts +18 -0
  309. package/src/RunsApi.ts +151 -0
  310. package/src/SkillsApi.ts +46 -0
  311. package/src/StreamSource.ts +3 -0
  312. package/src/TrainingApi.ts +71 -0
  313. package/src/UsersApi.ts +18 -0
  314. package/src/client.test.ts +99 -0
  315. package/src/client.ts +419 -0
  316. package/src/execute.ts +126 -0
  317. package/src/index.ts +10 -0
  318. package/src/nodejs/NodeStreamSource.ts +43 -0
  319. package/src/nodejs/index.ts +1 -0
  320. package/src/store/AnalyzeDocApi.ts +61 -0
  321. package/src/store/CollectionsApi.ts +166 -0
  322. package/src/store/CommandsApi.ts +15 -0
  323. package/src/store/DashboardApi.ts +216 -0
  324. package/src/store/DataApi.ts +516 -0
  325. package/src/store/EmailApi.ts +211 -0
  326. package/src/store/EmbeddingsApi.ts +39 -0
  327. package/src/store/FilesApi.ts +288 -0
  328. package/src/store/ObjectsApi.ts +432 -0
  329. package/src/store/PendingAsksApi.ts +98 -0
  330. package/src/store/SchedulesApi.ts +114 -0
  331. package/src/store/ToolsApi.ts +19 -0
  332. package/src/store/TypesApi.ts +65 -0
  333. package/src/store/WorkersApi.ts +17 -0
  334. package/src/store/WorkflowsApi.ts +752 -0
  335. package/src/store/client.ts +95 -0
  336. package/src/store/errors.ts +7 -0
  337. package/src/store/index.ts +11 -0
  338. package/src/store/version.ts +2 -0
  339. package/tsconfig.dist.json +20 -0
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Example usage of InteractionOutput
3
+ * This file demonstrates the Proxy-based approach where the result acts as both
4
+ * an array and has convenience methods.
5
+ */
6
+
7
+ import { CompletionResult } from '@llumiverse/common';
8
+ import { InteractionOutput } from './InteractionOutput.js';
9
+
10
+ // Sample data
11
+ const sampleResults: CompletionResult[] = [
12
+ { type: 'text', value: 'Hello, ' },
13
+ { type: 'text', value: 'World!' },
14
+ { type: 'json', value: { name: 'Alice', age: 30 } },
15
+ { type: 'json', value: { title: 'Engineer', level: 'Senior' } },
16
+ { type: 'image', value: 'data:image/png;base64,iVBORw0K...' }
17
+ ];
18
+
19
+ // Example 1: Using InteractionOutput.from() (Proxy approach - RECOMMENDED)
20
+ console.log('=== Example 1: Proxy Approach ===');
21
+ interface Person { name: string; age: number; }
22
+ const output = InteractionOutput.from<Person>(sampleResults);
23
+
24
+ // Works as an array
25
+ console.log('Array length:', output.length); // 5
26
+ console.log('First item:', output[0]); // { type: 'text', value: 'Hello, ' }
27
+ console.log('Types:', output.map(r => r.type)); // ['text', 'text', 'json', 'json', 'image']
28
+
29
+ // Has convenience methods
30
+ console.log('All text:', output.text); // 'Hello, World!'
31
+ console.log('First object:', output.object()); // { name: 'Alice', age: 30 } (typed as Person)
32
+ console.log('All objects:', output.objects()); // [{ name: 'Alice', age: 30 }, { title: 'Engineer', level: 'Senior' }]
33
+ console.log('First image:', output.image); // 'data:image/png;base64,iVBORw0K...'
34
+
35
+ // Override type for specific objects
36
+ interface Job { title: string; level: string; }
37
+ console.log('Second object:', output.objectAt<Job>(1)); // { title: 'Engineer', level: 'Senior' } (typed as Job)
38
+
39
+ // Example 2: Using InteractionOutput class directly
40
+ console.log('\n=== Example 2: Class Approach ===');
41
+ const wrapper = new InteractionOutput<Person>(sampleResults);
42
+
43
+ // Access through wrapper properties (no array access)
44
+ console.log('All text:', wrapper.text);
45
+ console.log('Raw results:', wrapper.results); // Original array
46
+ console.log('First object:', wrapper.object());
47
+
48
+ // Example 3: Type safety demonstration
49
+ console.log('\n=== Example 3: Type Safety ===');
50
+
51
+ interface Contract { title: string; parties: string[]; }
52
+ const contractResults: CompletionResult[] = [
53
+ { type: 'json', value: { title: 'Sales Agreement', parties: ['Alice', 'Bob'] } }
54
+ ];
55
+
56
+ const contractOutput = InteractionOutput.from<Contract>(contractResults);
57
+ const contract = contractOutput.object(); // TypeScript knows this is Contract
58
+ console.log('Contract title:', contract.title);
59
+ console.log('Parties:', contract.parties.join(', '));
60
+
61
+ // Example 4: Mixed content
62
+ console.log('\n=== Example 4: Mixed Content ===');
63
+ const mixedResults: CompletionResult[] = [
64
+ { type: 'text', value: 'Analysis complete. Results: ' },
65
+ { type: 'json', value: { score: 0.95, confidence: 'high' } },
66
+ { type: 'text', value: '\nThank you!' }
67
+ ];
68
+
69
+ const mixed = InteractionOutput.from(mixedResults);
70
+ console.log('Full text:', mixed.text); // 'Analysis complete. Results: \nThank you!'
71
+ console.log('Analysis:', mixed.object()); // { score: 0.95, confidence: 'high' }
72
+ console.log('Text parts:', mixed.texts); // ['Analysis complete. Results: ', '\nThank you!']
@@ -0,0 +1,308 @@
1
+ import { ApiTopic, ClientBase, ServerError } from "@vertesia/api-fetch-client";
2
+ import {
3
+ AsyncExecutionPayload, ComputeInteractionFacetPayload, GenerateInteractionPayload, GenerateTestDataPayload, ImprovePromptPayload,
4
+ ImprovePromptPayloadConfig,
5
+ Interaction, InteractionCreatePayload, InteractionEndpoint, InteractionEndpointQuery,
6
+ InteractionExecutionPayload, InteractionForkPayload,
7
+ InteractionPublishPayload, InteractionRef, InteractionRefWithSchema, InteractionSearchPayload, InteractionSearchQuery,
8
+ InteractionsExportPayload, InteractionTags, InteractionUpdatePayload,
9
+ RateLimitRequestPayload, RateLimitRequestResponse, ResolvedInteractionExecutionInfo
10
+ } from "@vertesia/common";
11
+ import { VertesiaClient } from "./client.js";
12
+ import { checkRateLimit, executeInteraction, executeInteractionAsync, executeInteractionByName } from "./execute.js";
13
+ import { InteractionCatalogApi } from "./InteractionCatalogApi.js";
14
+ import { EnhancedExecutionRun, EnhancedInteractionExecutionResult, enhanceExecutionRun, enhanceInteractionExecutionResult } from "./InteractionOutput.js";
15
+
16
+ export interface ComputeInteractionFacetsResponse {
17
+ tags?: { _id: string, count: number }[];
18
+ status?: { _id: string, count: number }[];
19
+ total?: { count: number }[];
20
+ }
21
+
22
+ export interface AsyncExecutionResult {
23
+ runId: string, workflowId: string
24
+ }
25
+
26
+ export default class InteractionsApi extends ApiTopic {
27
+ catalog: InteractionCatalogApi;
28
+
29
+ constructor(parent: ClientBase) {
30
+ super(parent, "/api/v1/interactions");
31
+ this.catalog = new InteractionCatalogApi(parent);
32
+ }
33
+
34
+ /**
35
+ * Get the list of all interactions in the current project
36
+ * @returns InteractionRef[]
37
+ **/
38
+ list(payload: InteractionSearchPayload = {}): Promise<InteractionRef[]> {
39
+ const query = payload.query || {} as InteractionSearchQuery;
40
+
41
+ return this.get("/", {
42
+ query: {
43
+ ...query
44
+ }
45
+ });
46
+ }
47
+ /**
48
+ * Find interactions given a mongo match query.
49
+ * You can also specify if prompts schemas are included in the result
50
+ */
51
+ listEndpoints(payload: InteractionEndpointQuery): Promise<InteractionEndpoint[]> {
52
+ return this.post("/endpoints", {
53
+ payload
54
+ });
55
+ }
56
+
57
+ /**
58
+ * List all interaction versions in the project having the given endpoint name.
59
+ * This is useful to list orphaned versions
60
+ * @param name
61
+ */
62
+ listVersionsByName(name: string): Promise<InteractionRef[]> {
63
+ return this.get(`/versions/${name}`);
64
+ }
65
+
66
+ /**
67
+ * Get the list of all interaction tags in the current project
68
+ * @param query optional query parameters to filter the tags
69
+ * @returns InteractionTags[]
70
+ **/
71
+ listTags(query?: InteractionSearchQuery): Promise<InteractionTags[]> {
72
+ return this.get("/tags", {
73
+ query: {
74
+ ...query
75
+ }
76
+ });
77
+ }
78
+
79
+ /**
80
+ * Get the list of all interactions facets
81
+ * @param payload query payload to filter facet search
82
+ * @returns ComputeInteractionFacetsResponse[]
83
+ **/
84
+ computeFacets(query: ComputeInteractionFacetPayload): Promise<ComputeInteractionFacetsResponse> {
85
+ return this.post("/facets", {
86
+ payload: query
87
+ });
88
+ }
89
+
90
+ /**
91
+ * List interaction names in the current project
92
+ * @returns
93
+ */
94
+ listNames(): Promise<{ id: string, name: string }[]> {
95
+ return this.get('/names');
96
+ }
97
+
98
+ /**
99
+ * Get the list of all interactions in the current project. Schemas will be returned too.
100
+ * @returns InteractionRefWithSchema[]
101
+ **/
102
+ export(payload: InteractionsExportPayload): Promise<InteractionRefWithSchema[]> {
103
+ return this.post('/export', { payload });
104
+ }
105
+
106
+ /**
107
+ * Create a new interaction
108
+ * @param payload InteractionCreatePayload
109
+ * @returns Interaction
110
+ * @throws ApiError
111
+ * @throws 400 if payload is invalid
112
+ * @throws 500 if interaction creation fails
113
+ **/
114
+ create(payload: InteractionCreatePayload): Promise<Interaction> {
115
+ return this.post('/', {
116
+ payload
117
+ });
118
+ }
119
+
120
+ /**
121
+ * Retrieve an existing interaction definition
122
+ * @param id of the interaction to retrieve
123
+ * @returns Interaction
124
+ **/
125
+ retrieve(id: string): Promise<Interaction> {
126
+ return this.get(`/${id}`);
127
+ }
128
+
129
+ /**
130
+ * Update an existing interaction definition
131
+ * @param id of the interaction to update
132
+ * @param payload InteractionUpdatePayload
133
+ * @returns Interaction
134
+ * @throws ApiError
135
+ * @throws 400 if payload is invalid
136
+ * @throws 500 if interaction update fails
137
+ * @throws 404 if interaction not found
138
+ **/
139
+ update(id: string, payload: InteractionUpdatePayload): Promise<Interaction> {
140
+ return this.put(`/${id}`, {
141
+ payload
142
+ });
143
+ }
144
+
145
+ /**
146
+ * Execute an interaction and return a promise which will be resolved with the executed run when
147
+ * the run completes or fails.
148
+ * If the onChunk callback is passed then the streaming of the result is enabled.
149
+ * The onChunk callback with be called with the next chunk of the result as soon as it is available.
150
+ * When all chunks are received the function will return the resolved promise
151
+ * @param id of the interaction to execute
152
+ * @param payload InteractionExecutionPayload
153
+ * @param onChunk callback to be called when the next chunk of the response is available
154
+ * @returns Promise<ExecutionRun>
155
+ * @throws ApiError
156
+ * @throws 404 if interaction not found
157
+ * @throws 400 if payload is invalid
158
+ * @throws 500 if interaction execution fails
159
+ * @throws 500 if interaction execution times out
160
+ **/
161
+ async execute<ResultT = any, ParamsT = any>(id: string, payload: InteractionExecutionPayload = {},
162
+ onChunk?: (chunk: string) => void): Promise<EnhancedInteractionExecutionResult<ResultT, ParamsT>> {
163
+ const r = await executeInteraction<ParamsT>(this.client as VertesiaClient, id, payload, onChunk).catch(err => {
164
+ if (err instanceof ServerError && err.payload?.id) {
165
+ throw err.updateDetails({ run_id: err.payload.id });
166
+ } else {
167
+ throw err;
168
+ }
169
+ });
170
+ return enhanceInteractionExecutionResult<ResultT, ParamsT>(r);
171
+ }
172
+
173
+ /**
174
+ * Same as execute but uses the interaction name selector instead of the id.
175
+ *
176
+ * A name selector is the interaction endpoint name suffixed with an optional tag or version which is starting with a `@` character.
177
+ * The special `draft` tag is used to select the draft version of the interaction. If no tag or version is specified then the latest version is selected.
178
+ * Examples of selectors:
179
+ * - `ReviewContract` - select the latest version of the ReviewContract interaction
180
+ * - `ReviewContract@1` - select the version 1 of the ReviewContract interaction
181
+ * - `ReviewContract@draft` - select the draft version of the ReviewContract interaction
182
+ * - `ReviewContract@fixed` - select the ReviewContract interaction which is tagged with 'fixed' tag.
183
+ * @param nameWithTag
184
+ * @param payload
185
+ * @param onChunk
186
+ * @returns
187
+ */
188
+ async executeByName<ResultT = any, ParamsT = any>(nameWithTag: string, payload: InteractionExecutionPayload = {},
189
+ onChunk?: (chunk: string) => void): Promise<EnhancedInteractionExecutionResult<ResultT, ParamsT>> {
190
+ const r = await executeInteractionByName<ParamsT>(this.client as VertesiaClient, nameWithTag, payload, onChunk).catch(err => {
191
+ if (err instanceof ServerError && err.payload?.id) {
192
+ throw err.updateDetails({ run_id: err.payload.id });
193
+ } else {
194
+ throw err;
195
+ }
196
+ });
197
+ return enhanceInteractionExecutionResult<ResultT, ParamsT>(r);
198
+ }
199
+
200
+ /**
201
+ * Execute an interaction in an workflow
202
+ * @param payload
203
+ * @returns
204
+ */
205
+ executeAsync(payload: AsyncExecutionPayload): Promise<AsyncExecutionResult> {
206
+ return executeInteractionAsync(this.client as VertesiaClient, payload);
207
+ }
208
+
209
+ publish(id: string, payload: InteractionPublishPayload): Promise<Interaction> {
210
+ return this.post(`/${id}/publish`, {
211
+ payload
212
+ });
213
+ }
214
+
215
+ fork(id: string, payload: InteractionForkPayload): Promise<Interaction> {
216
+ return this.post(`/${id}/fork`, {
217
+ payload
218
+ });
219
+ }
220
+
221
+ /**
222
+ * Generate Composable definition of an interaction
223
+ **/
224
+ generateInteraction(id: string, payload: GenerateInteractionPayload): Promise<any[]> {
225
+
226
+ return this.post(`${id}/generate-interaction`, {
227
+ payload
228
+ });
229
+
230
+ }
231
+
232
+ /**
233
+ * Generate Test Data for an interaction
234
+ **/
235
+ generateTestData(id: string, payload: GenerateTestDataPayload): Promise<any[]> {
236
+
237
+ return this.post(`${id}/generate-test-data`, {
238
+ payload
239
+ });
240
+ }
241
+
242
+ /**
243
+ * Suggest Improvement for a prompt
244
+ * @deprecated use suggestPromptImprovements instead
245
+ */
246
+ async suggestImprovements<ResultT = any, ParamsT = any>(id: string, payload: ImprovePromptPayloadConfig): Promise<EnhancedExecutionRun<ResultT, ParamsT>> {
247
+ const r = await this.post(`${id}/suggest-prompt-improvements`, {
248
+ payload
249
+ });
250
+ return enhanceExecutionRun<ResultT, ParamsT>(r);
251
+ }
252
+
253
+ async suggestPromptImprovements<ResultT = any, ParamsT = any>(payload: ImprovePromptPayload): Promise<EnhancedInteractionExecutionResult<ResultT, ParamsT>> {
254
+ const r = await this.post(`/improve`, {
255
+ payload
256
+ });
257
+ return enhanceInteractionExecutionResult<ResultT, ParamsT>(r);
258
+ }
259
+
260
+
261
+ /**
262
+ * List the versions of the interaction. Returns an empty array if no versions are found
263
+ * @param id
264
+ * @returns the versions list or an empty array if no versions are found
265
+ */
266
+ listVersions(id: string): Promise<InteractionRef[]> {
267
+ return this.get(`/${id}/versions`);
268
+ }
269
+
270
+ /**
271
+ * List the forks of the interaction. Returns an empty array if no forks are found
272
+ * @param id
273
+ * @returns the versions list or an empty array if no forks are found
274
+ */
275
+ listForks(id: string): Promise<InteractionRef[]> {
276
+ return this.get(`/${id}/forks`);
277
+ }
278
+
279
+ /**
280
+ * Request a time slot to execute an interaction with a given environment / model
281
+ * @param payload RateLimitRequestPayload
282
+ * @returns RateLimitRequestResponse with delay_ms
283
+ */
284
+ requestSlot(payload: RateLimitRequestPayload): Promise<RateLimitRequestResponse> {
285
+ return checkRateLimit(this.client as VertesiaClient, payload);
286
+ }
287
+
288
+ /**
289
+ * Resolve an interaction by ID or name and return the resolved execution info.
290
+ * This includes the interaction ID, name, version, tags, and the resolved
291
+ * environment/model that would be used at execution time.
292
+ *
293
+ * The nameOrId parameter can be:
294
+ * - A MongoDB ObjectId (e.g., "66b9149c26dc74d6b5187d27")
295
+ * - An endpoint name (e.g., "ReviewContract")
296
+ * - An endpoint name with version/tag (e.g., "ReviewContract@1", "ReviewContract@draft")
297
+ *
298
+ * @param nameOrId The interaction ID or name (with optional @version/@tag)
299
+ * @param options Optional environment and/or model to resolve with
300
+ * @returns ResolvedInteractionExecutionInfo with the resolved environment and model
301
+ */
302
+ resolve(nameOrId: string, options?: { environment?: string; model?: string }): Promise<ResolvedInteractionExecutionInfo> {
303
+ return this.get(`/resolve/${encodeURIComponent(nameOrId)}`, {
304
+ query: options
305
+ });
306
+ }
307
+
308
+ }
@@ -0,0 +1,67 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import type { OAuthAuthStatus, OAuthAuthorizeResponse, OAuthMetadataResponse } from "@vertesia/common";
3
+
4
+ export default class MCPOAuthApi extends ApiTopic {
5
+
6
+ constructor(parent: ClientBase) {
7
+ super(parent, "/api/v1/mcp/oauth")
8
+ }
9
+
10
+ /**
11
+ * Get OAuth authentication status for all collections in an app installation
12
+ * @param appInstallId - The app installation ID
13
+ * @returns Array of OAuth authentication statuses
14
+ */
15
+ getStatus(appInstallId: string): Promise<OAuthAuthStatus[]> {
16
+ return this.get(`/status/${appInstallId}`);
17
+ }
18
+
19
+ /**
20
+ * Get OAuth authentication status for a specific collection
21
+ * @param appInstallId - The app installation ID
22
+ * @param collectionName - The collection name
23
+ * @returns OAuth authentication status for the collection
24
+ */
25
+ getCollectionStatus(appInstallId: string, collectionName: string): Promise<OAuthAuthStatus> {
26
+ return this.get(`/status/${appInstallId}/${collectionName}`);
27
+ }
28
+
29
+ /**
30
+ * Get OAuth metadata for a specific collection
31
+ * @param appInstallId - The app installation ID
32
+ * @param collectionName - The collection name
33
+ * @returns OAuth metadata
34
+ */
35
+ getMetadata(appInstallId: string, collectionName: string): Promise<OAuthMetadataResponse> {
36
+ return this.get(`/metadata/${appInstallId}/${collectionName}`);
37
+ }
38
+
39
+ /**
40
+ * Initiate OAuth authorization flow for a specific collection
41
+ * @param appInstallId - The app installation ID
42
+ * @param collectionName - The collection name
43
+ * @returns Authorization URL to open for user authentication
44
+ */
45
+ authorize(appInstallId: string, collectionName: string): Promise<OAuthAuthorizeResponse> {
46
+ return this.get(`/authorize/${appInstallId}/${collectionName}`);
47
+ }
48
+
49
+ /**
50
+ * Disconnect OAuth authentication for an MCP server
51
+ * @param mcpServerUrl - The MCP server URL
52
+ */
53
+ disconnect(mcpServerUrl: string): Promise<void> {
54
+ return this.del(`/disconnect/${encodeURIComponent(mcpServerUrl)}`);
55
+ }
56
+
57
+ /**
58
+ * Get or refresh OAuth token for an MCP server (internal use by workflows)
59
+ * @param mcpServerUrl - The MCP server URL
60
+ * @returns Access token
61
+ */
62
+ getToken(mcpServerUrl: string): Promise<{ access_token: string }> {
63
+ return this.post('/token', {
64
+ payload: { mcp_server_url: mcpServerUrl }
65
+ });
66
+ }
67
+ }
@@ -0,0 +1,85 @@
1
+ import { ApiTopic, ClientBase, ServerError } from "@vertesia/api-fetch-client";
2
+ import { AwsConfiguration, GithubConfiguration, GladiaConfiguration, ICreateProjectPayload, MagicPdfConfiguration, Project, ProjectConfiguration, ProjectIntegrationListEntry, ProjectRef, ProjectToolInfo, SupportedIntegrations } from "@vertesia/common";
3
+
4
+ export default class ProjectsApi extends ApiTopic {
5
+ constructor(parent: ClientBase) {
6
+ super(parent, "/api/v1/projects");
7
+ }
8
+
9
+ list(account?: string[]): Promise<ProjectRef[]> {
10
+ return this.get('/', { query: { account } });
11
+ }
12
+
13
+ retrieve(projectId: string): Promise<Project> {
14
+ return this.get(`/${projectId}`);
15
+ }
16
+
17
+ create(payload: ICreateProjectPayload): Promise<Project> {
18
+ return this.post('/', {
19
+ payload
20
+ });
21
+ }
22
+
23
+ update(projectId: string, payload: Partial<Project>): Promise<Project> {
24
+ return this.put(`/${projectId}`, {
25
+ payload
26
+ });
27
+ }
28
+
29
+ updateConfiguration(projectId: string, payload: Partial<ProjectConfiguration>): Promise<ProjectConfiguration> {
30
+ return this.put(`/${projectId}/configuration`, {
31
+ payload
32
+ });
33
+ }
34
+
35
+ integrations: IntegrationsConfigurationApi = new IntegrationsConfigurationApi(this);
36
+
37
+ /**
38
+ * List all tools available in the project with their app installation info.
39
+ * Settings are only included for agent tokens (security: may contain API keys).
40
+ */
41
+ getTools(projectId: string): Promise<ProjectToolInfo[]> {
42
+ return this.get(`/${projectId}/tools`);
43
+ }
44
+
45
+ /**
46
+ * Get a specific tool by name with its app installation info.
47
+ * Returns null if the tool is not found.
48
+ */
49
+ getToolByName(projectId: string, toolName: string): Promise<ProjectToolInfo | null> {
50
+ return this.get(`/${projectId}/tools/${toolName}`).catch((err: ServerError) => {
51
+ if (err.status === 404) {
52
+ return null;
53
+ }
54
+ throw err;
55
+ });
56
+ }
57
+
58
+ }
59
+
60
+ class IntegrationsConfigurationApi extends ApiTopic {
61
+
62
+ constructor(parent: ClientBase) {
63
+ super(parent, "/");
64
+ }
65
+
66
+ list(projectId: string): Promise<ProjectIntegrationListEntry[]> {
67
+ return this.get(`/${projectId}/integrations`).then(res => res.integrations);
68
+ }
69
+
70
+ retrieve(projectId: string, integrationId: SupportedIntegrations): Promise<GladiaConfiguration | GithubConfiguration | AwsConfiguration | MagicPdfConfiguration | undefined> {
71
+ return this.get(`/${projectId}/integrations/${integrationId}`).catch(err => {
72
+ if (err.status === 404) {
73
+ return undefined;
74
+ }
75
+ throw err;
76
+ });
77
+ }
78
+
79
+ update(projectId: string, integrationId: string, payload: any): Promise<GladiaConfiguration | GithubConfiguration> {
80
+ return this.put(`/${projectId}/integrations/${integrationId}`, {
81
+ payload
82
+ });
83
+ }
84
+
85
+ }
@@ -0,0 +1,160 @@
1
+ import { ComputePromptFacetPayload, PromptSearchPayload, PromptSearchQuery, PromptTemplate, PromptTemplateForkPayload, PromptTemplateCreatePayload, PromptTemplateRef, PromptTemplateUpdatePayload } from "@vertesia/common";
2
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
3
+
4
+ export interface ComputePromptFacetsResponse {
5
+ role?: { _id: string, count: number }[];
6
+ total?: { count: number }[];
7
+ }
8
+
9
+ export default class PromptsApi extends ApiTopic {
10
+ constructor(parent: ClientBase) {
11
+ super(parent, "/api/v1/prompts")
12
+ }
13
+
14
+ /**
15
+ * Get the list of all prompt templates
16
+ * @param payload query payload to filter search
17
+ * @returns PromptTemplateRef[]
18
+ **/
19
+ list(payload: PromptSearchPayload = {}): Promise<PromptTemplateRef[]> {
20
+ const query = payload.query || {} as PromptSearchQuery;
21
+
22
+ return this.get("/", {
23
+ query: {
24
+ ...query
25
+ }
26
+ });
27
+ }
28
+
29
+ /**
30
+ * Get the list of all prompt facets
31
+ * @param payload query payload to filter facet search
32
+ * @returns ComputePromptFacetsResponse[]
33
+ **/
34
+ computeFacets(query: ComputePromptFacetPayload): Promise<ComputePromptFacetsResponse> {
35
+ return this.post("/facets", {
36
+ payload: query
37
+ });
38
+ }
39
+
40
+ /**
41
+ * Create a new prompt template
42
+ * @param payload PromptTemplateCreatePayload
43
+ * @returns PromptTemplate
44
+ * @throws ApiError
45
+ * @throws 400 if payload is invalid
46
+ * @throws 500 if creation fails
47
+ **/
48
+ create(payload: PromptTemplateCreatePayload): Promise<PromptTemplate> {
49
+ return this.post('/', {
50
+ payload
51
+ });
52
+ }
53
+
54
+ /**
55
+ * Retrieve an existing prompt template
56
+ * @param id of the prompt template to retrieve
57
+ * @returns PromptTemplate
58
+ **/
59
+ retrieve(id: string): Promise<PromptTemplate> {
60
+ return this.get(`/${id}`);
61
+ }
62
+
63
+ /**
64
+ * Update an existing prompt template
65
+ * @param id of the prompt template to update
66
+ * @param payload PromptTemplateCreatePayload
67
+ * @returns PromptTemplate
68
+ * @throws ApiError
69
+ * @throws 400 if payload is invalid
70
+ * @throws 500 if update fails
71
+ * @throws 404 if not found
72
+ **/
73
+ update(id: string, payload: PromptTemplateUpdatePayload): Promise<PromptTemplate> {
74
+ return this.put(`/${id}`, {
75
+ payload
76
+ });
77
+ }
78
+
79
+ /**
80
+ * Delete an existing prompt template
81
+ * @param id of the prompt template to delete
82
+ * @returns void
83
+ */
84
+ delete(id: string): Promise<void> {
85
+ return this.del(`/${id}`);
86
+ }
87
+
88
+ /**
89
+ * Fork an existing prompt template
90
+ * @param id of the prompt template to fork
91
+ * @param payload PromptTemplateForkPayload
92
+ * @returns Forked PromptTemplate
93
+ */
94
+ fork(id: string, payload: PromptTemplateForkPayload): Promise<PromptTemplate> {
95
+ return this.post(`/${id}/fork`, {
96
+ payload
97
+ });
98
+ }
99
+
100
+ /**
101
+ * Render a prompt template
102
+ * @param id of the prompt template to render
103
+ * @param payload that will be passed to the prompt template to generate the prompts
104
+ * @returns PromptTemplate
105
+ * @throws ApiError
106
+ * @throws 404 if not found
107
+ * @throws 400 if payload is invalid
108
+ * @throws 500 if render fails
109
+ **/
110
+ render(id: string, payload: {}): Promise<PromptTemplate> {
111
+ return this.post(`/${id}/render`, {
112
+ payload
113
+ });
114
+ }
115
+
116
+ /**
117
+ * Get options for a field
118
+ * @param field name to get options for
119
+ * @returns string[]
120
+ */
121
+ options(field: string): Promise<string[]> {
122
+ return this.get(`/options/${field}`);
123
+ }
124
+
125
+ /**
126
+ * List the versions of the prompt template. Returns an empty array if no versions are found
127
+ * @param id
128
+ * @returns the versions list or an empty array if no versions are found
129
+ */
130
+ listVersions(id: string): Promise<PromptTemplateRef[]> {
131
+ return this.get(`/${id}/versions`);
132
+ }
133
+
134
+
135
+ /**
136
+ * Retrieve list of interactions that use the prompt template
137
+ */
138
+ listInteractions(id: string): Promise<ListInteractionsResponse> {
139
+ return this.get(`/${id}/interactions`);
140
+ }
141
+
142
+ /**
143
+ * List the forks of the prompt. Returns an empty array if no forks are found
144
+ * @param id of the prompt to search forks
145
+ * @returns the versions list or an empty array if no forks are found
146
+ */
147
+ listForks(id: string): Promise<PromptTemplateRef[]> {
148
+ return this.get(`/${id}/forks`);
149
+ }
150
+
151
+ }
152
+
153
+ export interface ListInteractionsResponse {
154
+ prompt: string,
155
+ interactions: {
156
+ id: string,
157
+ name: string,
158
+ versions: string[],
159
+ }[]
160
+ }