@meetkai/mka1 0.51.9 → 0.51.11

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 (117) hide show
  1. package/README.md +230 -227
  2. package/bin/mcp-server.js +374 -208
  3. package/bin/mcp-server.js.map +13 -9
  4. package/dist/commonjs/funcs/servingFinetuneJobsGetMetrics.d.ts +19 -0
  5. package/dist/commonjs/funcs/servingFinetuneJobsGetMetrics.d.ts.map +1 -0
  6. package/dist/commonjs/funcs/servingFinetuneJobsGetMetrics.js +137 -0
  7. package/dist/commonjs/funcs/servingFinetuneJobsGetMetrics.js.map +1 -0
  8. package/dist/commonjs/lib/config.d.ts +2 -2
  9. package/dist/commonjs/lib/config.js +2 -2
  10. package/dist/commonjs/lib/config.js.map +1 -1
  11. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  12. package/dist/commonjs/mcp-server/mcp-server.js.map +1 -1
  13. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  14. package/dist/commonjs/mcp-server/server.js +3 -1
  15. package/dist/commonjs/mcp-server/server.js.map +1 -1
  16. package/dist/commonjs/mcp-server/tools/servingFinetuneJobsGetMetrics.d.ts +8 -0
  17. package/dist/commonjs/mcp-server/tools/servingFinetuneJobsGetMetrics.d.ts.map +1 -0
  18. package/dist/commonjs/mcp-server/tools/servingFinetuneJobsGetMetrics.js +64 -0
  19. package/dist/commonjs/mcp-server/tools/servingFinetuneJobsGetMetrics.js.map +1 -0
  20. package/dist/commonjs/models/components/finetunejobcreate.d.ts +1 -1
  21. package/dist/commonjs/models/components/index.d.ts +1 -0
  22. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  23. package/dist/commonjs/models/components/index.js +1 -0
  24. package/dist/commonjs/models/components/index.js.map +1 -1
  25. package/dist/commonjs/models/components/trainingmetricpoint.d.ts +34 -0
  26. package/dist/commonjs/models/components/trainingmetricpoint.d.ts.map +1 -0
  27. package/dist/commonjs/models/components/trainingmetricpoint.js +62 -0
  28. package/dist/commonjs/models/components/trainingmetricpoint.js.map +1 -0
  29. package/dist/commonjs/models/operations/getfinetunemetrics.d.ts +22 -0
  30. package/dist/commonjs/models/operations/getfinetunemetrics.d.ts.map +1 -0
  31. package/dist/commonjs/models/operations/getfinetunemetrics.js +71 -0
  32. package/dist/commonjs/models/operations/getfinetunemetrics.js.map +1 -0
  33. package/dist/commonjs/models/operations/index.d.ts +1 -0
  34. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  35. package/dist/commonjs/models/operations/index.js +1 -0
  36. package/dist/commonjs/models/operations/index.js.map +1 -1
  37. package/dist/commonjs/react-query/index.d.ts +1 -0
  38. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  39. package/dist/commonjs/react-query/index.js +1 -0
  40. package/dist/commonjs/react-query/index.js.map +1 -1
  41. package/dist/commonjs/react-query/servingFinetuneJobsGetMetrics.core.d.ts +15 -0
  42. package/dist/commonjs/react-query/servingFinetuneJobsGetMetrics.core.d.ts.map +1 -0
  43. package/dist/commonjs/react-query/servingFinetuneJobsGetMetrics.core.js +36 -0
  44. package/dist/commonjs/react-query/servingFinetuneJobsGetMetrics.core.js.map +1 -0
  45. package/dist/commonjs/react-query/servingFinetuneJobsGetMetrics.d.ts +39 -0
  46. package/dist/commonjs/react-query/servingFinetuneJobsGetMetrics.d.ts.map +1 -0
  47. package/dist/commonjs/react-query/servingFinetuneJobsGetMetrics.js +60 -0
  48. package/dist/commonjs/react-query/servingFinetuneJobsGetMetrics.js.map +1 -0
  49. package/dist/commonjs/sdk/finetunejobs.d.ts +7 -0
  50. package/dist/commonjs/sdk/finetunejobs.d.ts.map +1 -1
  51. package/dist/commonjs/sdk/finetunejobs.js +10 -0
  52. package/dist/commonjs/sdk/finetunejobs.js.map +1 -1
  53. package/dist/esm/funcs/servingFinetuneJobsGetMetrics.d.ts +19 -0
  54. package/dist/esm/funcs/servingFinetuneJobsGetMetrics.d.ts.map +1 -0
  55. package/dist/esm/funcs/servingFinetuneJobsGetMetrics.js +101 -0
  56. package/dist/esm/funcs/servingFinetuneJobsGetMetrics.js.map +1 -0
  57. package/dist/esm/lib/config.d.ts +2 -2
  58. package/dist/esm/lib/config.js +2 -2
  59. package/dist/esm/lib/config.js.map +1 -1
  60. package/dist/esm/mcp-server/mcp-server.js +1 -1
  61. package/dist/esm/mcp-server/mcp-server.js.map +1 -1
  62. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  63. package/dist/esm/mcp-server/server.js +3 -1
  64. package/dist/esm/mcp-server/server.js.map +1 -1
  65. package/dist/esm/mcp-server/tools/servingFinetuneJobsGetMetrics.d.ts +8 -0
  66. package/dist/esm/mcp-server/tools/servingFinetuneJobsGetMetrics.d.ts.map +1 -0
  67. package/dist/esm/mcp-server/tools/servingFinetuneJobsGetMetrics.js +28 -0
  68. package/dist/esm/mcp-server/tools/servingFinetuneJobsGetMetrics.js.map +1 -0
  69. package/dist/esm/models/components/finetunejobcreate.d.ts +1 -1
  70. package/dist/esm/models/components/index.d.ts +1 -0
  71. package/dist/esm/models/components/index.d.ts.map +1 -1
  72. package/dist/esm/models/components/index.js +1 -0
  73. package/dist/esm/models/components/index.js.map +1 -1
  74. package/dist/esm/models/components/trainingmetricpoint.d.ts +34 -0
  75. package/dist/esm/models/components/trainingmetricpoint.d.ts.map +1 -0
  76. package/dist/esm/models/components/trainingmetricpoint.js +24 -0
  77. package/dist/esm/models/components/trainingmetricpoint.js.map +1 -0
  78. package/dist/esm/models/operations/getfinetunemetrics.d.ts +22 -0
  79. package/dist/esm/models/operations/getfinetunemetrics.d.ts.map +1 -0
  80. package/dist/esm/models/operations/getfinetunemetrics.js +33 -0
  81. package/dist/esm/models/operations/getfinetunemetrics.js.map +1 -0
  82. package/dist/esm/models/operations/index.d.ts +1 -0
  83. package/dist/esm/models/operations/index.d.ts.map +1 -1
  84. package/dist/esm/models/operations/index.js +1 -0
  85. package/dist/esm/models/operations/index.js.map +1 -1
  86. package/dist/esm/react-query/index.d.ts +1 -0
  87. package/dist/esm/react-query/index.d.ts.map +1 -1
  88. package/dist/esm/react-query/index.js +1 -0
  89. package/dist/esm/react-query/index.js.map +1 -1
  90. package/dist/esm/react-query/servingFinetuneJobsGetMetrics.core.d.ts +15 -0
  91. package/dist/esm/react-query/servingFinetuneJobsGetMetrics.core.d.ts.map +1 -0
  92. package/dist/esm/react-query/servingFinetuneJobsGetMetrics.core.js +31 -0
  93. package/dist/esm/react-query/servingFinetuneJobsGetMetrics.core.js.map +1 -0
  94. package/dist/esm/react-query/servingFinetuneJobsGetMetrics.d.ts +39 -0
  95. package/dist/esm/react-query/servingFinetuneJobsGetMetrics.d.ts.map +1 -0
  96. package/dist/esm/react-query/servingFinetuneJobsGetMetrics.js +50 -0
  97. package/dist/esm/react-query/servingFinetuneJobsGetMetrics.js.map +1 -0
  98. package/dist/esm/sdk/finetunejobs.d.ts +7 -0
  99. package/dist/esm/sdk/finetunejobs.d.ts.map +1 -1
  100. package/dist/esm/sdk/finetunejobs.js +10 -0
  101. package/dist/esm/sdk/finetunejobs.js.map +1 -1
  102. package/jsr.json +1 -1
  103. package/package.json +1 -1
  104. package/src/funcs/servingFinetuneJobsGetMetrics.ts +199 -0
  105. package/src/lib/config.ts +2 -2
  106. package/src/mcp-server/mcp-server.ts +1 -1
  107. package/src/mcp-server/server.ts +3 -1
  108. package/src/mcp-server/tools/servingFinetuneJobsGetMetrics.ts +37 -0
  109. package/src/models/components/finetunejobcreate.ts +1 -1
  110. package/src/models/components/index.ts +1 -0
  111. package/src/models/components/trainingmetricpoint.ts +68 -0
  112. package/src/models/operations/getfinetunemetrics.ts +69 -0
  113. package/src/models/operations/index.ts +1 -0
  114. package/src/react-query/index.ts +1 -0
  115. package/src/react-query/servingFinetuneJobsGetMetrics.core.ts +78 -0
  116. package/src/react-query/servingFinetuneJobsGetMetrics.ts +144 -0
  117. package/src/sdk/finetunejobs.ts +18 -0
@@ -0,0 +1,199 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { SDKCore } from "../core.js";
7
+ import { encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
9
+ import * as M from "../lib/matchers.js";
10
+ import { compactMap } from "../lib/primitives.js";
11
+ import { safeParse } from "../lib/schemas.js";
12
+ import { RequestOptions } from "../lib/sdks.js";
13
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
14
+ import { pathToFunc } from "../lib/url.js";
15
+ import * as components from "../models/components/index.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../models/errors/httpclienterrors.js";
23
+ import * as errors from "../models/errors/index.js";
24
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
+ import { SDKError } from "../models/errors/sdkerror.js";
26
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
27
+ import * as operations from "../models/operations/index.js";
28
+ import { APICall, APIPromise } from "../types/async.js";
29
+ import { Result } from "../types/fp.js";
30
+
31
+ /**
32
+ * Training metrics
33
+ *
34
+ * @remarks
35
+ * Return the training metric series (loss, learning rate, ...) pushed by the training run.
36
+ */
37
+ export function servingFinetuneJobsGetMetrics(
38
+ client: SDKCore,
39
+ request: operations.GetFinetuneMetricsRequest,
40
+ options?: RequestOptions,
41
+ ): APIPromise<
42
+ Result<
43
+ Array<components.TrainingMetricPoint>,
44
+ | errors.ServingError
45
+ | errors.ServingHTTPValidationError
46
+ | SDKError
47
+ | ResponseValidationError
48
+ | ConnectionError
49
+ | RequestAbortedError
50
+ | RequestTimeoutError
51
+ | InvalidRequestError
52
+ | UnexpectedClientError
53
+ | SDKValidationError
54
+ >
55
+ > {
56
+ return new APIPromise($do(
57
+ client,
58
+ request,
59
+ options,
60
+ ));
61
+ }
62
+
63
+ async function $do(
64
+ client: SDKCore,
65
+ request: operations.GetFinetuneMetricsRequest,
66
+ options?: RequestOptions,
67
+ ): Promise<
68
+ [
69
+ Result<
70
+ Array<components.TrainingMetricPoint>,
71
+ | errors.ServingError
72
+ | errors.ServingHTTPValidationError
73
+ | SDKError
74
+ | ResponseValidationError
75
+ | ConnectionError
76
+ | RequestAbortedError
77
+ | RequestTimeoutError
78
+ | InvalidRequestError
79
+ | UnexpectedClientError
80
+ | SDKValidationError
81
+ >,
82
+ APICall,
83
+ ]
84
+ > {
85
+ const parsed = safeParse(
86
+ request,
87
+ (value) => operations.GetFinetuneMetricsRequest$outboundSchema.parse(value),
88
+ "Input validation failed",
89
+ );
90
+ if (!parsed.ok) {
91
+ return [parsed, { status: "invalid" }];
92
+ }
93
+ const payload = parsed.value;
94
+ const body = null;
95
+
96
+ const pathParams = {
97
+ job_id: encodeSimple("job_id", payload.job_id, {
98
+ explode: false,
99
+ charEncoding: "percent",
100
+ }),
101
+ };
102
+ const path = pathToFunc("/api/v1/serving/finetune-jobs/{job_id}/metrics")(
103
+ pathParams,
104
+ );
105
+
106
+ const headers = new Headers(compactMap({
107
+ Accept: "application/json",
108
+ "X-On-Behalf-Of": encodeSimple(
109
+ "X-On-Behalf-Of",
110
+ payload["X-On-Behalf-Of"],
111
+ { explode: false, charEncoding: "none" },
112
+ ),
113
+ }));
114
+
115
+ const secConfig = await extractSecurity(client._options.bearerAuth);
116
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
117
+ const requestSecurity = resolveGlobalSecurity(securityInput);
118
+
119
+ const context = {
120
+ options: client._options,
121
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
122
+ operationID: "getFinetuneMetrics",
123
+ oAuth2Scopes: null,
124
+
125
+ resolvedSecurity: requestSecurity,
126
+
127
+ securitySource: client._options.bearerAuth,
128
+ retryConfig: options?.retries
129
+ || client._options.retryConfig
130
+ || {
131
+ strategy: "backoff",
132
+ backoff: {
133
+ initialInterval: 500,
134
+ maxInterval: 5000,
135
+ exponent: 1.5,
136
+ maxElapsedTime: 15000,
137
+ },
138
+ retryConnectionErrors: true,
139
+ }
140
+ || { strategy: "none" },
141
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
142
+ };
143
+
144
+ const requestRes = client._createRequest(context, {
145
+ security: requestSecurity,
146
+ method: "GET",
147
+ baseURL: options?.serverURL,
148
+ path: path,
149
+ headers: headers,
150
+ body: body,
151
+ userAgent: client._options.userAgent,
152
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
153
+ }, options);
154
+ if (!requestRes.ok) {
155
+ return [requestRes, { status: "invalid" }];
156
+ }
157
+ const req = requestRes.value;
158
+
159
+ const doResult = await client._do(req, {
160
+ context,
161
+ isErrorStatusCode: (statusCode: number) =>
162
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
163
+ retryConfig: context.retryConfig,
164
+ retryCodes: context.retryCodes,
165
+ });
166
+ if (!doResult.ok) {
167
+ return [doResult, { status: "request-error", request: req }];
168
+ }
169
+ const response = doResult.value;
170
+
171
+ const responseFields = {
172
+ HttpMeta: { Response: response, Request: req },
173
+ };
174
+
175
+ const [result] = await M.match<
176
+ Array<components.TrainingMetricPoint>,
177
+ | errors.ServingError
178
+ | errors.ServingHTTPValidationError
179
+ | SDKError
180
+ | ResponseValidationError
181
+ | ConnectionError
182
+ | RequestAbortedError
183
+ | RequestTimeoutError
184
+ | InvalidRequestError
185
+ | UnexpectedClientError
186
+ | SDKValidationError
187
+ >(
188
+ M.json(200, z.array(components.TrainingMetricPoint$inboundSchema)),
189
+ M.jsonErr([403, 404], errors.ServingError$inboundSchema),
190
+ M.jsonErr(422, errors.ServingHTTPValidationError$inboundSchema),
191
+ M.fail([401, "4XX"]),
192
+ M.fail("5XX"),
193
+ )(response, req, { extraFields: responseFields });
194
+ if (!result.ok) {
195
+ return [result, { status: "complete", request: req, response }];
196
+ }
197
+
198
+ return [result, { status: "complete", request: req, response }];
199
+ }
package/src/lib/config.ts CHANGED
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
65
65
  export const SDK_METADATA = {
66
66
  language: "typescript",
67
67
  openapiDocVersion: "1.1.0",
68
- sdkVersion: "0.51.9",
68
+ sdkVersion: "0.51.11",
69
69
  genVersion: "2.918.4",
70
- userAgent: "speakeasy-sdk/typescript 0.51.9 2.918.4 1.1.0 @meetkai/mka1",
70
+ userAgent: "speakeasy-sdk/typescript 0.51.11 2.918.4 1.1.0 @meetkai/mka1",
71
71
  } as const;
@@ -19,7 +19,7 @@ const routes = buildRouteMap({
19
19
  export const app = buildApplication(routes, {
20
20
  name: "mcp",
21
21
  versionInfo: {
22
- currentVersion: "0.51.9",
22
+ currentVersion: "0.51.11",
23
23
  },
24
24
  });
25
25
 
@@ -319,6 +319,7 @@ import { tool$servingFinetuneJobsCreate } from "./tools/servingFinetuneJobsCreat
319
319
  import { tool$servingFinetuneJobsGet } from "./tools/servingFinetuneJobsGet.js";
320
320
  import { tool$servingFinetuneJobsGetEvents } from "./tools/servingFinetuneJobsGetEvents.js";
321
321
  import { tool$servingFinetuneJobsGetLogs } from "./tools/servingFinetuneJobsGetLogs.js";
322
+ import { tool$servingFinetuneJobsGetMetrics } from "./tools/servingFinetuneJobsGetMetrics.js";
322
323
  import { tool$servingFinetuneJobsList } from "./tools/servingFinetuneJobsList.js";
323
324
  import { tool$servingFinetuneJobsListCheckpoints } from "./tools/servingFinetuneJobsListCheckpoints.js";
324
325
  import { tool$servingImagesDelete } from "./tools/servingImagesDelete.js";
@@ -359,7 +360,7 @@ export function createMCPServer(deps: {
359
360
  }) {
360
361
  const server = new McpServer({
361
362
  name: "SDK",
362
- version: "0.51.9",
363
+ version: "0.51.11",
363
364
  });
364
365
 
365
366
  const client = new SDKCore({
@@ -699,6 +700,7 @@ export function createMCPServer(deps: {
699
700
  tool(tool$servingFinetuneJobsListCheckpoints);
700
701
  tool(tool$servingFinetuneJobsGetEvents);
701
702
  tool(tool$servingFinetuneJobsGetLogs);
703
+ tool(tool$servingFinetuneJobsGetMetrics);
702
704
  tool(tool$servingImagesList);
703
705
  tool(tool$servingImagesRegister);
704
706
  tool(tool$servingImagesDelete);
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { servingFinetuneJobsGetMetrics } from "../../funcs/servingFinetuneJobsGetMetrics.js";
6
+ import * as operations from "../../models/operations/index.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ request: operations.GetFinetuneMetricsRequest$inboundSchema,
11
+ };
12
+
13
+ export const tool$servingFinetuneJobsGetMetrics: ToolDefinition<typeof args> = {
14
+ name: "serving-finetune-jobs-get-metrics",
15
+ description: `Training metrics
16
+
17
+ Return the training metric series (loss, learning rate, ...) pushed by the training run.`,
18
+ args,
19
+ tool: async (client, args, ctx) => {
20
+ const [result, apiCall] = await servingFinetuneJobsGetMetrics(
21
+ client,
22
+ args.request,
23
+ { fetchOptions: { signal: ctx.signal } },
24
+ ).$inspect();
25
+
26
+ if (!result.ok) {
27
+ return {
28
+ content: [{ type: "text", text: result.error.message }],
29
+ isError: true,
30
+ };
31
+ }
32
+
33
+ const value = result.value;
34
+
35
+ return formatResult(value, apiCall);
36
+ },
37
+ };
@@ -37,7 +37,7 @@ export type FinetuneJobCreate = {
37
37
  */
38
38
  accelerator: AcceleratorSpec;
39
39
  /**
40
- * Required unless from_checkpoint is set (then inherited from the checkpoint's parent job; supplying a contradicting value is rejected)
40
+ * A hub model id, or a registered model reference (model_...). A referenced external model trains from its underlying id; a referenced volume-backed fine-tune output warm-starts from its checkpoint (the same lineage as from_checkpoint, and mutually exclusive with it). Required unless from_checkpoint is set (then inherited from the checkpoint's parent job; supplying a contradicting value is rejected)
41
41
  */
42
42
  baseModel?: string | null | undefined;
43
43
  /**
@@ -532,6 +532,7 @@ export * from "./toolchoice.js";
532
532
  export * from "./toolchoicemode.js";
533
533
  export * from "./tooldefinition.js";
534
534
  export * from "./toplogprob.js";
535
+ export * from "./trainingmetricpoint.js";
535
536
  export * from "./transcriptionresponse.js";
536
537
  export * from "./typeaction.js";
537
538
  export * from "./update.js";
@@ -0,0 +1,68 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+
10
+ /**
11
+ * One training metric observation pushed by the training run.
12
+ */
13
+ export type TrainingMetricPoint = {
14
+ /**
15
+ * Numeric metric values keyed by name (train_loss, valid_loss, learning_rate, epoch, ...)
16
+ */
17
+ data: { [k: string]: number };
18
+ /**
19
+ * Global training step the observation was reported at
20
+ */
21
+ step?: number | null | undefined;
22
+ timestamp: Date;
23
+ };
24
+
25
+ /** @internal */
26
+ export const TrainingMetricPoint$inboundSchema: z.ZodType<
27
+ TrainingMetricPoint,
28
+ z.ZodTypeDef,
29
+ unknown
30
+ > = z.object({
31
+ data: z.record(z.number()),
32
+ step: z.nullable(z.number().int()).optional(),
33
+ timestamp: z.string().datetime({ offset: true }).transform(v => new Date(v)),
34
+ });
35
+ /** @internal */
36
+ export type TrainingMetricPoint$Outbound = {
37
+ data: { [k: string]: number };
38
+ step?: number | null | undefined;
39
+ timestamp: string;
40
+ };
41
+
42
+ /** @internal */
43
+ export const TrainingMetricPoint$outboundSchema: z.ZodType<
44
+ TrainingMetricPoint$Outbound,
45
+ z.ZodTypeDef,
46
+ TrainingMetricPoint
47
+ > = z.object({
48
+ data: z.record(z.number()),
49
+ step: z.nullable(z.number().int()).optional(),
50
+ timestamp: z.date().transform(v => v.toISOString()),
51
+ });
52
+
53
+ export function trainingMetricPointToJSON(
54
+ trainingMetricPoint: TrainingMetricPoint,
55
+ ): string {
56
+ return JSON.stringify(
57
+ TrainingMetricPoint$outboundSchema.parse(trainingMetricPoint),
58
+ );
59
+ }
60
+ export function trainingMetricPointFromJSON(
61
+ jsonString: string,
62
+ ): SafeParseResult<TrainingMetricPoint, SDKValidationError> {
63
+ return safeParse(
64
+ jsonString,
65
+ (x) => TrainingMetricPoint$inboundSchema.parse(JSON.parse(x)),
66
+ `Failed to parse 'TrainingMetricPoint' from JSON`,
67
+ );
68
+ }
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type GetFinetuneMetricsRequest = {
12
+ jobId: string;
13
+ /**
14
+ * Optional external end-user identifier forwarded by the API gateway.
15
+ */
16
+ xOnBehalfOf?: string | undefined;
17
+ };
18
+
19
+ /** @internal */
20
+ export const GetFinetuneMetricsRequest$inboundSchema: z.ZodType<
21
+ GetFinetuneMetricsRequest,
22
+ z.ZodTypeDef,
23
+ unknown
24
+ > = z.object({
25
+ job_id: z.string(),
26
+ "X-On-Behalf-Of": z.string().optional(),
27
+ }).transform((v) => {
28
+ return remap$(v, {
29
+ "job_id": "jobId",
30
+ "X-On-Behalf-Of": "xOnBehalfOf",
31
+ });
32
+ });
33
+ /** @internal */
34
+ export type GetFinetuneMetricsRequest$Outbound = {
35
+ job_id: string;
36
+ "X-On-Behalf-Of"?: string | undefined;
37
+ };
38
+
39
+ /** @internal */
40
+ export const GetFinetuneMetricsRequest$outboundSchema: z.ZodType<
41
+ GetFinetuneMetricsRequest$Outbound,
42
+ z.ZodTypeDef,
43
+ GetFinetuneMetricsRequest
44
+ > = z.object({
45
+ jobId: z.string(),
46
+ xOnBehalfOf: z.string().optional(),
47
+ }).transform((v) => {
48
+ return remap$(v, {
49
+ jobId: "job_id",
50
+ xOnBehalfOf: "X-On-Behalf-Of",
51
+ });
52
+ });
53
+
54
+ export function getFinetuneMetricsRequestToJSON(
55
+ getFinetuneMetricsRequest: GetFinetuneMetricsRequest,
56
+ ): string {
57
+ return JSON.stringify(
58
+ GetFinetuneMetricsRequest$outboundSchema.parse(getFinetuneMetricsRequest),
59
+ );
60
+ }
61
+ export function getFinetuneMetricsRequestFromJSON(
62
+ jsonString: string,
63
+ ): SafeParseResult<GetFinetuneMetricsRequest, SDKValidationError> {
64
+ return safeParse(
65
+ jsonString,
66
+ (x) => GetFinetuneMetricsRequest$inboundSchema.parse(JSON.parse(x)),
67
+ `Failed to parse 'GetFinetuneMetricsRequest' from JSON`,
68
+ );
69
+ }
@@ -146,6 +146,7 @@ export * from "./getfilesusage.js";
146
146
  export * from "./getfinetuneevents.js";
147
147
  export * from "./getfinetunejob.js";
148
148
  export * from "./getfinetunelogs.js";
149
+ export * from "./getfinetunemetrics.js";
149
150
  export * from "./getguardrails.js";
150
151
  export * from "./getimage.js";
151
152
  export * from "./getjwtfromkey.js";
@@ -312,6 +312,7 @@ export * from "./servingFinetuneJobsCreate.js";
312
312
  export * from "./servingFinetuneJobsGet.js";
313
313
  export * from "./servingFinetuneJobsGetEvents.js";
314
314
  export * from "./servingFinetuneJobsGetLogs.js";
315
+ export * from "./servingFinetuneJobsGetMetrics.js";
315
316
  export * from "./servingFinetuneJobsList.js";
316
317
  export * from "./servingFinetuneJobsListCheckpoints.js";
317
318
  export * from "./servingImagesDelete.js";
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ QueryClient,
7
+ QueryFunctionContext,
8
+ QueryKey,
9
+ } from "@tanstack/react-query";
10
+ import { SDKCore } from "../core.js";
11
+ import { servingFinetuneJobsGetMetrics } from "../funcs/servingFinetuneJobsGetMetrics.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import * as components from "../models/components/index.js";
15
+ import * as operations from "../models/operations/index.js";
16
+ import { unwrapAsync } from "../types/fp.js";
17
+ export type ServingFinetuneJobsGetMetricsQueryData = Array<
18
+ components.TrainingMetricPoint
19
+ >;
20
+
21
+ export function prefetchServingFinetuneJobsGetMetrics(
22
+ queryClient: QueryClient,
23
+ client$: SDKCore,
24
+ request: operations.GetFinetuneMetricsRequest,
25
+ options?: RequestOptions,
26
+ ): Promise<void> {
27
+ return queryClient.prefetchQuery({
28
+ ...buildServingFinetuneJobsGetMetricsQuery(
29
+ client$,
30
+ request,
31
+ options,
32
+ ),
33
+ });
34
+ }
35
+
36
+ export function buildServingFinetuneJobsGetMetricsQuery(
37
+ client$: SDKCore,
38
+ request: operations.GetFinetuneMetricsRequest,
39
+ options?: RequestOptions,
40
+ ): {
41
+ queryKey: QueryKey;
42
+ queryFn: (
43
+ context: QueryFunctionContext,
44
+ ) => Promise<ServingFinetuneJobsGetMetricsQueryData>;
45
+ } {
46
+ return {
47
+ queryKey: queryKeyServingFinetuneJobsGetMetrics(request.jobId, {
48
+ xOnBehalfOf: request.xOnBehalfOf,
49
+ }),
50
+ queryFn: async function servingFinetuneJobsGetMetricsQueryFn(
51
+ ctx,
52
+ ): Promise<ServingFinetuneJobsGetMetricsQueryData> {
53
+ const sig = combineSignals(
54
+ ctx.signal,
55
+ options?.signal,
56
+ options?.fetchOptions?.signal,
57
+ );
58
+ const mergedOptions = {
59
+ ...options?.fetchOptions,
60
+ ...options,
61
+ signal: sig,
62
+ };
63
+
64
+ return unwrapAsync(servingFinetuneJobsGetMetrics(
65
+ client$,
66
+ request,
67
+ mergedOptions,
68
+ ));
69
+ },
70
+ };
71
+ }
72
+
73
+ export function queryKeyServingFinetuneJobsGetMetrics(
74
+ jobId: string,
75
+ parameters: { xOnBehalfOf?: string | undefined },
76
+ ): QueryKey {
77
+ return ["@meetkai/mka1", "finetuneJobs", "getMetrics", jobId, parameters];
78
+ }
@@ -0,0 +1,144 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ InvalidateQueryFilters,
7
+ QueryClient,
8
+ useQuery,
9
+ UseQueryResult,
10
+ useSuspenseQuery,
11
+ UseSuspenseQueryResult,
12
+ } from "@tanstack/react-query";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import * as errors from "../models/errors/index.js";
21
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
22
+ import { SDKError } from "../models/errors/sdkerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { useSDKContext } from "./_context.js";
26
+ import {
27
+ QueryHookOptions,
28
+ SuspenseQueryHookOptions,
29
+ TupleToPrefixes,
30
+ } from "./_types.js";
31
+ import {
32
+ buildServingFinetuneJobsGetMetricsQuery,
33
+ prefetchServingFinetuneJobsGetMetrics,
34
+ queryKeyServingFinetuneJobsGetMetrics,
35
+ ServingFinetuneJobsGetMetricsQueryData,
36
+ } from "./servingFinetuneJobsGetMetrics.core.js";
37
+ export {
38
+ buildServingFinetuneJobsGetMetricsQuery,
39
+ prefetchServingFinetuneJobsGetMetrics,
40
+ queryKeyServingFinetuneJobsGetMetrics,
41
+ type ServingFinetuneJobsGetMetricsQueryData,
42
+ };
43
+
44
+ export type ServingFinetuneJobsGetMetricsQueryError =
45
+ | errors.ServingError
46
+ | errors.ServingHTTPValidationError
47
+ | SDKError
48
+ | ResponseValidationError
49
+ | ConnectionError
50
+ | RequestAbortedError
51
+ | RequestTimeoutError
52
+ | InvalidRequestError
53
+ | UnexpectedClientError
54
+ | SDKValidationError;
55
+
56
+ /**
57
+ * Training metrics
58
+ *
59
+ * @remarks
60
+ * Return the training metric series (loss, learning rate, ...) pushed by the training run.
61
+ */
62
+ export function useServingFinetuneJobsGetMetrics(
63
+ request: operations.GetFinetuneMetricsRequest,
64
+ options?: QueryHookOptions<
65
+ ServingFinetuneJobsGetMetricsQueryData,
66
+ ServingFinetuneJobsGetMetricsQueryError
67
+ >,
68
+ ): UseQueryResult<
69
+ ServingFinetuneJobsGetMetricsQueryData,
70
+ ServingFinetuneJobsGetMetricsQueryError
71
+ > {
72
+ const client = useSDKContext();
73
+ return useQuery({
74
+ ...buildServingFinetuneJobsGetMetricsQuery(
75
+ client,
76
+ request,
77
+ options,
78
+ ),
79
+ ...options,
80
+ });
81
+ }
82
+
83
+ /**
84
+ * Training metrics
85
+ *
86
+ * @remarks
87
+ * Return the training metric series (loss, learning rate, ...) pushed by the training run.
88
+ */
89
+ export function useServingFinetuneJobsGetMetricsSuspense(
90
+ request: operations.GetFinetuneMetricsRequest,
91
+ options?: SuspenseQueryHookOptions<
92
+ ServingFinetuneJobsGetMetricsQueryData,
93
+ ServingFinetuneJobsGetMetricsQueryError
94
+ >,
95
+ ): UseSuspenseQueryResult<
96
+ ServingFinetuneJobsGetMetricsQueryData,
97
+ ServingFinetuneJobsGetMetricsQueryError
98
+ > {
99
+ const client = useSDKContext();
100
+ return useSuspenseQuery({
101
+ ...buildServingFinetuneJobsGetMetricsQuery(
102
+ client,
103
+ request,
104
+ options,
105
+ ),
106
+ ...options,
107
+ });
108
+ }
109
+
110
+ export function setServingFinetuneJobsGetMetricsData(
111
+ client: QueryClient,
112
+ queryKeyBase: [
113
+ jobId: string,
114
+ parameters: { xOnBehalfOf?: string | undefined },
115
+ ],
116
+ data: ServingFinetuneJobsGetMetricsQueryData,
117
+ ): ServingFinetuneJobsGetMetricsQueryData | undefined {
118
+ const key = queryKeyServingFinetuneJobsGetMetrics(...queryKeyBase);
119
+
120
+ return client.setQueryData<ServingFinetuneJobsGetMetricsQueryData>(key, data);
121
+ }
122
+
123
+ export function invalidateServingFinetuneJobsGetMetrics(
124
+ client: QueryClient,
125
+ queryKeyBase: TupleToPrefixes<
126
+ [jobId: string, parameters: { xOnBehalfOf?: string | undefined }]
127
+ >,
128
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
129
+ ): Promise<void> {
130
+ return client.invalidateQueries({
131
+ ...filters,
132
+ queryKey: ["@meetkai/mka1", "finetuneJobs", "getMetrics", ...queryKeyBase],
133
+ });
134
+ }
135
+
136
+ export function invalidateAllServingFinetuneJobsGetMetrics(
137
+ client: QueryClient,
138
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
139
+ ): Promise<void> {
140
+ return client.invalidateQueries({
141
+ ...filters,
142
+ queryKey: ["@meetkai/mka1", "finetuneJobs", "getMetrics"],
143
+ });
144
+ }