@stack-spot/portal-network 0.135.0 → 0.136.0

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.
@@ -25,6 +25,7 @@ export type SendConversation = {
25
25
  [key: string]: any;
26
26
  } | null;
27
27
  is_azure?: boolean | null;
28
+ max_tokens?: number | null;
28
29
  };
29
30
  export type MessageRepresentation = {
30
31
  /** The role of the sender of the message (e.g., 'user', 'assistant', 'system', 'tool'). */
@@ -68,6 +69,91 @@ export type ValidationError = {
68
69
  export type HttpValidationError = {
69
70
  detail?: ValidationError[];
70
71
  };
72
+ export type ResourceName = "agents" | "deep_ks" | "autocomplete";
73
+ export type LlmModelResourceRequest = {
74
+ name: ResourceName;
75
+ is_default?: boolean;
76
+ };
77
+ export type CreateLlmModelRequest = {
78
+ display_name: string;
79
+ provider_name: string;
80
+ model_name: string;
81
+ connection_params: {
82
+ [key: string]: any;
83
+ };
84
+ resources: LlmModelResourceRequest[];
85
+ };
86
+ export type LlmProviderResponse = {
87
+ name: string;
88
+ provider_type: string;
89
+ configuration_params?: {
90
+ [key: string]: any;
91
+ } | null;
92
+ accepts_self_hosted?: boolean | null;
93
+ };
94
+ export type LlmModelConfigurationResponse = {
95
+ provider: LlmProviderResponse;
96
+ model_name: string;
97
+ connection_params: {
98
+ [key: string]: any;
99
+ } | null;
100
+ usage_params: {
101
+ [key: string]: any;
102
+ } | null;
103
+ };
104
+ export type LlmModelResourcesResponse = {
105
+ id: string;
106
+ name: string;
107
+ is_default: boolean;
108
+ };
109
+ export type LlmModelsResponse = {
110
+ id: string;
111
+ active: boolean;
112
+ display_name: string;
113
+ self_hosted: boolean;
114
+ model_configuration: LlmModelConfigurationResponse;
115
+ resources: LlmModelResourcesResponse[];
116
+ created_at: string;
117
+ updated_at: string;
118
+ updated_by: string;
119
+ };
120
+ export type OrderBy = "default" | "display_name" | "model_name" | "type" | "status";
121
+ export type OrderDir = "asc" | "desc" | "stackspot_hosted" | "self_hosted" | "active" | "inactive";
122
+ export type ToggleModelStatusRequest = {
123
+ active: boolean;
124
+ };
125
+ export type UpdateLlmModelRequest = {
126
+ display_name: string;
127
+ model_name: string;
128
+ connection_params: {
129
+ [key: string]: any;
130
+ };
131
+ resources: LlmModelResourceRequest[];
132
+ };
133
+ export type UpdateLlmModelResourceRequest = {
134
+ name: string;
135
+ is_default?: boolean;
136
+ };
137
+ export type LlmSimpleProviderResponse = {
138
+ name: string;
139
+ provider_type: string;
140
+ configuration_params: {
141
+ [key: string]: any;
142
+ };
143
+ accepts_self_hosted: boolean;
144
+ model_names: string[];
145
+ };
146
+ export type TextParam = {
147
+ "type": "text";
148
+ text: string;
149
+ };
150
+ export type UrlParam = {
151
+ url: string;
152
+ };
153
+ export type ImageParam = {
154
+ "type": "image_url";
155
+ image_url: UrlParam;
156
+ };
71
157
  export type FunctionCall = {
72
158
  /** The name of the function to call */
73
159
  name: string;
@@ -77,12 +163,18 @@ export type FunctionCall = {
77
163
  export type Message = {
78
164
  /** The role of the message (system, user, assistant, or function) */
79
165
  role: LlmRoles;
80
- /** The content of the message */
81
- content: string;
166
+ /** The content of the message, can be a string or a list of content blocks */
167
+ content?: string | (TextParam | ImageParam)[];
82
168
  /** The name of the sender (optional) */
83
169
  name?: string | null;
84
170
  /** Details of a function call (optional) */
85
171
  function_call?: FunctionCall | null;
172
+ /** Details of a function call (optional) */
173
+ tool_calls?: {
174
+ [key: string]: any;
175
+ }[] | null;
176
+ /** Tool id */
177
+ tool_call_id?: string | null;
86
178
  };
87
179
  export type FunctionParameter = {
88
180
  /** The type of the parameter */
@@ -144,93 +236,12 @@ export type ChatCompletion = {
144
236
  [key: string]: string;
145
237
  } | null;
146
238
  };
147
- export type StateType = "chat" | "planning" | "step" | "final_answer" | "tool" | "used_tools";
148
- export type StateAction = "start" | "end";
149
- export type StepTool = {
150
- /** Unique ULID identifier for the tool. LLM always sends null. */
151
- agent_tool_id: string | null;
152
- /** Unique ULID identifier for the tool. LLM always sends null. */
153
- tool_id: string | null;
154
- /** Unique ULID identifier for tool execution in a step. LLM always sends null. */
155
- tool_execution_id: string | null;
156
- /** Exact name of the function to execute. Must include a ULID and starting with 'agt_id__' */
157
- name: string | null;
158
- /** JSON string of arguments required to execute the tool. */
159
- arguments: string | null;
160
- };
161
- export type Step = {
162
- /** Unique ULID identifier for the step. LLM sends null by default. */
163
- id: string | null;
164
- /** Brief goal of the step. Use the same language provided by the user without repeating the prompt. Example.: Generate image in oil painting style */
165
- goal: string;
166
- /** List of tools to execute in parallel in this step. */
167
- tools: StepTool[] | null;
168
- };
169
- export type Plan = {
170
- /** Brief description of the expected action and the number of necessary steps (max 100 characters). */
171
- plan_goal?: string | null;
172
- /** Total number of steps, including the final response step. */
173
- total_steps?: number | null;
174
- /** List of steps to be executed, including the final user response step. */
175
- steps?: Step[] | null;
176
- };
177
- export type Score = {
178
- /** A score between 0.0 and 1.0 indicating how well the response met the user's requirements. */
179
- score: number;
180
- };
181
- export type ToolInput = {
182
- input?: {
183
- [key: string]: any;
184
- } | null;
185
- attempt: number;
186
- };
187
- export type ToolOutput = {
188
- output?: string | null;
189
- attempt: number;
190
- };
191
- export type ProcessState = {
192
- "type": StateType;
193
- action: StateAction;
194
- id?: string | null;
195
- duration?: number | null;
196
- data?: Plan | Score | ToolInput | ToolOutput | null;
197
- };
198
- export type LlmProviderResponse = {
199
- id: string;
200
- name: string;
201
- provider_type: string;
202
- };
203
- export type LlmModelConfigurationResponse = {
204
- id: string;
205
- usage_params: {
206
- [key: string]: any;
207
- } | null;
208
- model_name: string;
209
- provider: LlmProviderResponse;
210
- };
211
- export type LlmModelResourcesResponse = {
212
- id: string;
213
- model_id: string;
214
- resource_name: string;
215
- is_default: boolean;
216
- };
217
- export type LlmModelsResponse = {
218
- id: string;
219
- active: boolean;
220
- display_name: string;
221
- self_hosted: boolean;
222
- model_configuration: LlmModelConfigurationResponse;
223
- resources: LlmModelResourcesResponse[];
224
- created_at: string;
225
- updated_at: string;
226
- updated_by: string;
227
- };
228
- export type UpdateLlmModelRequest = {
229
- active: boolean;
230
- };
231
- export type UpdateLlmModelResourceRequest = {
232
- resource_name: string;
233
- is_default?: boolean;
239
+ export type ChatRequest = {
240
+ streaming: boolean;
241
+ user_prompt: string;
242
+ can_use_default_ks?: boolean;
243
+ return_ks_in_response?: boolean;
244
+ image_ids?: string[];
234
245
  };
235
246
  /**
236
247
  * Health Check
@@ -245,6 +256,19 @@ export function healthCheckHealthzGet(opts?: Oazapfts.RequestOpts) {
245
256
  ...opts
246
257
  }));
247
258
  }
259
+ /**
260
+ * Readiness Check
261
+ */
262
+ export function readinessCheckReadyzGet(opts?: Oazapfts.RequestOpts) {
263
+ return oazapfts.ok(oazapfts.fetchJson<{
264
+ status: 200;
265
+ data: any;
266
+ } | {
267
+ status: 404;
268
+ }>("/readyz", {
269
+ ...opts
270
+ }));
271
+ }
248
272
  /**
249
273
  * Handle conversation requests
250
274
  */
@@ -272,47 +296,42 @@ export function converseV0ConversationPost({ xAccountId, authorization, sendConv
272
296
  })));
273
297
  }
274
298
  /**
275
- * Execute an agent with tool orchestration
299
+ * Add Self Hosted Model
276
300
  */
277
- export function chatCompletionV1AgentAgentIdDetailModeChatCompletionsPost({ agentId, detailMode, chatCompletion }: {
278
- agentId: string;
279
- detailMode: boolean;
280
- chatCompletion: ChatCompletion;
301
+ export function addSelfHostedModelV1LlmModelsPost({ xAccountId, authorization, createLlmModelRequest }: {
302
+ xAccountId?: string | null;
303
+ authorization: string;
304
+ createLlmModelRequest: CreateLlmModelRequest;
281
305
  }, opts?: Oazapfts.RequestOpts) {
282
306
  return oazapfts.ok(oazapfts.fetchJson<{
283
307
  status: 200;
284
- data: any;
308
+ data: LlmModelsResponse;
285
309
  } | {
286
310
  status: 404;
287
311
  } | {
288
312
  status: 422;
289
313
  data: HttpValidationError;
290
- }>(`/v1/agent/${encodeURIComponent(agentId)}/${encodeURIComponent(detailMode)}/chat/completions`, oazapfts.json({
314
+ }>("/v1/llm/models", oazapfts.json({
291
315
  ...opts,
292
316
  method: "POST",
293
- body: chatCompletion
317
+ body: createLlmModelRequest,
318
+ headers: oazapfts.mergeHeaders(opts?.headers, {
319
+ "x-account-id": xAccountId,
320
+ authorization
321
+ })
294
322
  })));
295
323
  }
296
- /**
297
- * Fake For Doc
298
- */
299
- export function fakeForDocV1FakeForDocOnlyGet(opts?: Oazapfts.RequestOpts) {
300
- return oazapfts.ok(oazapfts.fetchJson<{
301
- status: 200;
302
- data: ProcessState | null;
303
- } | {
304
- status: 404;
305
- }>("/v1/fake_for_doc_only", {
306
- ...opts
307
- }));
308
- }
309
324
  /**
310
325
  * List Models
311
326
  */
312
- export function listModelsV1LlmModelsGet({ active, resource, $default, xAccountId, authorization }: {
327
+ export function listModelsV1LlmModelsGet({ active, resource, $default, orderBy, orderDir, page, pageSize, xAccountId, authorization }: {
313
328
  active?: boolean | null;
314
329
  resource?: string | null;
315
330
  $default?: boolean | null;
331
+ orderBy?: OrderBy;
332
+ orderDir?: OrderDir;
333
+ page?: number;
334
+ pageSize?: number;
316
335
  xAccountId?: string | null;
317
336
  authorization: string;
318
337
  }, opts?: Oazapfts.RequestOpts) {
@@ -327,7 +346,11 @@ export function listModelsV1LlmModelsGet({ active, resource, $default, xAccountI
327
346
  }>(`/v1/llm/models${QS.query(QS.explode({
328
347
  active,
329
348
  resource,
330
- "default": $default
349
+ "default": $default,
350
+ order_by: orderBy,
351
+ order_dir: orderDir,
352
+ page,
353
+ page_size: pageSize
331
354
  }))}`, {
332
355
  ...opts,
333
356
  headers: oazapfts.mergeHeaders(opts?.headers, {
@@ -361,13 +384,13 @@ export function getModelV1LlmModelsModelIdGet({ modelId, xAccountId, authorizati
361
384
  }));
362
385
  }
363
386
  /**
364
- * Update Model
387
+ * Toggle Model Status
365
388
  */
366
- export function updateModelV1LlmModelsModelIdPatch({ modelId, xAccountId, authorization, updateLlmModelRequest }: {
389
+ export function toggleModelStatusV1LlmModelsModelIdPatch({ modelId, xAccountId, authorization, toggleModelStatusRequest }: {
367
390
  modelId: string;
368
391
  xAccountId?: string | null;
369
392
  authorization: string;
370
- updateLlmModelRequest: UpdateLlmModelRequest;
393
+ toggleModelStatusRequest: ToggleModelStatusRequest;
371
394
  }, opts?: Oazapfts.RequestOpts) {
372
395
  return oazapfts.ok(oazapfts.fetchJson<{
373
396
  status: 200;
@@ -380,6 +403,33 @@ export function updateModelV1LlmModelsModelIdPatch({ modelId, xAccountId, author
380
403
  }>(`/v1/llm/models/${encodeURIComponent(modelId)}`, oazapfts.json({
381
404
  ...opts,
382
405
  method: "PATCH",
406
+ body: toggleModelStatusRequest,
407
+ headers: oazapfts.mergeHeaders(opts?.headers, {
408
+ "x-account-id": xAccountId,
409
+ authorization
410
+ })
411
+ })));
412
+ }
413
+ /**
414
+ * Update
415
+ */
416
+ export function updateV1LlmModelsModelIdPut({ modelId, xAccountId, authorization, updateLlmModelRequest }: {
417
+ modelId: string;
418
+ xAccountId?: string | null;
419
+ authorization: string;
420
+ updateLlmModelRequest: UpdateLlmModelRequest;
421
+ }, opts?: Oazapfts.RequestOpts) {
422
+ return oazapfts.ok(oazapfts.fetchJson<{
423
+ status: 200;
424
+ data: LlmModelsResponse;
425
+ } | {
426
+ status: 404;
427
+ } | {
428
+ status: 422;
429
+ data: HttpValidationError;
430
+ }>(`/v1/llm/models/${encodeURIComponent(modelId)}`, oazapfts.json({
431
+ ...opts,
432
+ method: "PUT",
383
433
  body: updateLlmModelRequest,
384
434
  headers: oazapfts.mergeHeaders(opts?.headers, {
385
435
  "x-account-id": xAccountId,
@@ -387,6 +437,30 @@ export function updateModelV1LlmModelsModelIdPatch({ modelId, xAccountId, author
387
437
  })
388
438
  })));
389
439
  }
440
+ /**
441
+ * Delete
442
+ */
443
+ export function deleteV1LlmModelsModelIdDelete({ modelId, xAccountId, authorization }: {
444
+ modelId: string;
445
+ xAccountId?: string | null;
446
+ authorization: string;
447
+ }, opts?: Oazapfts.RequestOpts) {
448
+ return oazapfts.ok(oazapfts.fetchJson<{
449
+ status: 204;
450
+ } | {
451
+ status: 404;
452
+ } | {
453
+ status: 422;
454
+ data: HttpValidationError;
455
+ }>(`/v1/llm/models/${encodeURIComponent(modelId)}`, {
456
+ ...opts,
457
+ method: "DELETE",
458
+ headers: oazapfts.mergeHeaders(opts?.headers, {
459
+ "x-account-id": xAccountId,
460
+ authorization
461
+ })
462
+ }));
463
+ }
390
464
  /**
391
465
  * Save Or Update Model Resources
392
466
  */
@@ -423,8 +497,7 @@ export function deleteModelResourcesV1LlmResourcesResourceIdDelete({ resourceId,
423
497
  authorization: string;
424
498
  }, opts?: Oazapfts.RequestOpts) {
425
499
  return oazapfts.ok(oazapfts.fetchJson<{
426
- status: 200;
427
- data: any;
500
+ status: 204;
428
501
  } | {
429
502
  status: 404;
430
503
  } | {
@@ -439,6 +512,32 @@ export function deleteModelResourcesV1LlmResourcesResourceIdDelete({ resourceId,
439
512
  })
440
513
  }));
441
514
  }
515
+ /**
516
+ * List Llm Providers
517
+ */
518
+ export function listLlmProvidersV1LlmProvidersGet({ acceptsSelfHosted, xAccountId, authorization }: {
519
+ acceptsSelfHosted?: boolean;
520
+ xAccountId?: string | null;
521
+ authorization: string;
522
+ }, opts?: Oazapfts.RequestOpts) {
523
+ return oazapfts.ok(oazapfts.fetchJson<{
524
+ status: 200;
525
+ data: LlmSimpleProviderResponse[];
526
+ } | {
527
+ status: 404;
528
+ } | {
529
+ status: 422;
530
+ data: HttpValidationError;
531
+ }>(`/v1/llm/providers${QS.query(QS.explode({
532
+ accepts_self_hosted: acceptsSelfHosted
533
+ }))}`, {
534
+ ...opts,
535
+ headers: oazapfts.mergeHeaders(opts?.headers, {
536
+ "x-account-id": xAccountId,
537
+ authorization
538
+ })
539
+ }));
540
+ }
442
541
  /**
443
542
  * Handle completions requests
444
543
  */
@@ -465,3 +564,30 @@ export function createCompletionsV1ChatCompletionsPost({ xAccountId, authorizati
465
564
  })
466
565
  })));
467
566
  }
567
+ /**
568
+ * Agent Chat
569
+ */
570
+ export function agentChatV1AgentAgentIdChatPost({ agentId, xAccountId, authorization, chatRequest }: {
571
+ agentId: string;
572
+ xAccountId?: string | null;
573
+ authorization: string;
574
+ chatRequest: ChatRequest;
575
+ }, opts?: Oazapfts.RequestOpts) {
576
+ return oazapfts.ok(oazapfts.fetchJson<{
577
+ status: 200;
578
+ data: any;
579
+ } | {
580
+ status: 404;
581
+ } | {
582
+ status: 422;
583
+ data: HttpValidationError;
584
+ }>(`/v1/agent/${encodeURIComponent(agentId)}/chat`, oazapfts.json({
585
+ ...opts,
586
+ method: "POST",
587
+ body: chatRequest,
588
+ headers: oazapfts.mergeHeaders(opts?.headers, {
589
+ "x-account-id": xAccountId,
590
+ authorization
591
+ })
592
+ })));
593
+ }
@@ -43,6 +43,7 @@ import {
43
43
  getAllGroupMapping,
44
44
  getAllMemberFidoCredentials,
45
45
  getAllServiceCredentialRateLimit,
46
+ getById,
46
47
  getExtensionVersion,
47
48
  getFeatures,
48
49
  getFeatures3,
@@ -724,16 +725,18 @@ class AccountClient extends ReactQueryNetworkClient {
724
725
  * Get secrets
725
726
  */
726
727
  getSecrets = this.query(findSecrets1)
728
+ /**
729
+ * Get secret by id
730
+ */
731
+ getSecret = this.query(getById)
727
732
  /**
728
733
  * Create secret
729
734
  */
730
735
  createSecret = this.mutation(createSecret)
731
-
732
736
  /**
733
737
  * Delete secret
734
738
  */
735
739
  deleteSecret = this.mutation(deleteSecret)
736
-
737
740
  /**
738
741
  * Update secret
739
742
  */
@@ -1,12 +1,11 @@
1
1
 
2
2
  import { HttpError } from '@oazapfts/runtime'
3
+ import { addSelfHostedModelV1LlmModelsPost, defaults, deleteModelResourcesV1LlmResourcesResourceIdDelete, deleteV1LlmModelsModelIdDelete, getModelV1LlmModelsModelIdGet, listLlmProvidersV1LlmProvidersGet, listModelsV1LlmModelsGet, saveOrUpdateModelResourcesV1LlmModelsModelIdResourcesPut, toggleModelStatusV1LlmModelsModelIdPatch, updateV1LlmModelsModelIdPut } from '../api/genAiInference'
3
4
  import apis from '../apis.json'
4
- import { StackspotAPIError } from '../error/StackspotAPIError'
5
- import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
6
-
7
- import { defaults, deleteModelResourcesV1LlmResourcesResourceIdDelete, getModelV1LlmModelsModelIdGet, listModelsV1LlmModelsGet, saveOrUpdateModelResourcesV1LlmModelsModelIdResourcesPut, updateModelV1LlmModelsModelIdPatch } from '../api/genAiInference'
8
5
  import { DefaultAPIError } from '../error/DefaultAPIError'
9
6
  import { inferenceDictionary } from '../error/dictionary/ai-inference'
7
+ import { StackspotAPIError } from '../error/StackspotAPIError'
8
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
10
9
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
11
10
 
12
11
  class GenAiInference extends ReactQueryNetworkClient {
@@ -22,7 +21,18 @@ class GenAiInference extends ReactQueryNetworkClient {
22
21
  * List all models.
23
22
  */
24
23
  listModels = this.query(removeAuthorizationParam(listModelsV1LlmModelsGet))
25
-
24
+ /**
25
+ * List llm providers.
26
+ */
27
+ listProviders = this.query(removeAuthorizationParam(listLlmProvidersV1LlmProvidersGet))
28
+ /**
29
+ * Creates LLM self hosted model
30
+ */
31
+ createModel = this.mutation(removeAuthorizationParam(addSelfHostedModelV1LlmModelsPost))
32
+ /**
33
+ * Deletes a LLM self hosted model
34
+ */
35
+ deleteModel = this.mutation(removeAuthorizationParam(deleteV1LlmModelsModelIdDelete))
26
36
  /**
27
37
  * Gets model by ID.
28
38
  */
@@ -31,8 +41,11 @@ class GenAiInference extends ReactQueryNetworkClient {
31
41
  /**
32
42
  * Updates model by ID.
33
43
  */
34
- updateModel = this.mutation(removeAuthorizationParam(updateModelV1LlmModelsModelIdPatch))
35
-
44
+ updateModel = this.mutation(removeAuthorizationParam(updateV1LlmModelsModelIdPut))
45
+ /**
46
+ * Toggle Model Status
47
+ */
48
+ toggleModelActive = this.mutation(removeAuthorizationParam(toggleModelStatusV1LlmModelsModelIdPatch))
36
49
  /**
37
50
  * Updates resources for a specific model ID.
38
51
  */