notdiamond 2.0.0 → 2.1.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +17 -17
  3. package/client.d.mts +4 -4
  4. package/client.d.ts +4 -4
  5. package/client.js +32 -32
  6. package/client.mjs +30 -30
  7. package/core/api-promise.d.mts +2 -2
  8. package/core/api-promise.d.ts +2 -2
  9. package/core/error.d.mts +2 -2
  10. package/core/error.d.ts +2 -2
  11. package/core/error.js +4 -4
  12. package/core/error.mjs +2 -2
  13. package/core/resource.d.mts +3 -3
  14. package/core/resource.d.ts +3 -3
  15. package/index.d.mts +3 -3
  16. package/index.d.ts +3 -3
  17. package/index.js +4 -4
  18. package/index.mjs +3 -3
  19. package/internal/parse.d.mts +2 -2
  20. package/internal/parse.d.ts +2 -2
  21. package/internal/shims.js +1 -1
  22. package/internal/shims.mjs +1 -1
  23. package/internal/uploads.d.mts +4 -4
  24. package/internal/uploads.d.ts +4 -4
  25. package/internal/utils/base64.js +2 -2
  26. package/internal/utils/base64.mjs +3 -3
  27. package/internal/utils/log.d.mts +3 -3
  28. package/internal/utils/log.d.ts +3 -3
  29. package/internal/utils/path.js +1 -1
  30. package/internal/utils/path.mjs +2 -2
  31. package/internal/utils/values.js +5 -5
  32. package/internal/utils/values.mjs +6 -6
  33. package/package.json +1 -1
  34. package/resources/prompt-adaptation.d.mts +9 -6
  35. package/resources/prompt-adaptation.d.mts.map +1 -1
  36. package/resources/prompt-adaptation.d.ts +9 -6
  37. package/resources/prompt-adaptation.d.ts.map +1 -1
  38. package/src/client.ts +12 -12
  39. package/src/core/api-promise.ts +4 -4
  40. package/src/core/error.ts +2 -2
  41. package/src/core/resource.ts +3 -3
  42. package/src/index.ts +3 -3
  43. package/src/internal/parse.ts +2 -2
  44. package/src/internal/shims.ts +1 -1
  45. package/src/internal/uploads.ts +5 -5
  46. package/src/internal/utils/base64.ts +3 -3
  47. package/src/internal/utils/log.ts +3 -3
  48. package/src/internal/utils/path.ts +2 -2
  49. package/src/internal/utils/values.ts +6 -6
  50. package/src/resources/prompt-adaptation.ts +7 -4
  51. package/src/version.ts +1 -1
  52. package/version.d.mts +1 -1
  53. package/version.d.ts +1 -1
  54. package/version.js +1 -1
  55. package/version.mjs +1 -1
@@ -1,7 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { hasOwn } from './values';
4
- import { type Notdiamond } from '../../client';
4
+ import { type NotDiamond } from '../../client';
5
5
  import { RequestOptions } from '../request-options';
6
6
 
7
7
  type LogFn = (message: string, ...rest: unknown[]) => void;
@@ -24,7 +24,7 @@ const levelNumbers = {
24
24
  export const parseLogLevel = (
25
25
  maybeLevel: string | undefined,
26
26
  sourceName: string,
27
- client: Notdiamond,
27
+ client: NotDiamond,
28
28
  ): LogLevel | undefined => {
29
29
  if (!maybeLevel) {
30
30
  return undefined;
@@ -60,7 +60,7 @@ const noopLogger = {
60
60
 
61
61
  let cachedLoggers = /* @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();
62
62
 
63
- export function loggerFor(client: Notdiamond): Logger {
63
+ export function loggerFor(client: NotDiamond): Logger {
64
64
  const logger = client.logger;
65
65
  const logLevel = client.logLevel ?? 'off';
66
66
  if (!logger) {
@@ -1,4 +1,4 @@
1
- import { NotdiamondError } from '../../core/error';
1
+ import { NotDiamondError } from '../../core/error';
2
2
 
3
3
  /**
4
4
  * Percent-encode everything that isn't safe to have in a path without encoding safe chars.
@@ -72,7 +72,7 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
72
72
  return acc + spaces + arrows;
73
73
  }, '');
74
74
 
75
- throw new NotdiamondError(
75
+ throw new NotDiamondError(
76
76
  `Path parameters result in path with invalid segments:\n${invalidSegments
77
77
  .map((e) => e.error)
78
78
  .join('\n')}\n${path}\n${underline}`,
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { NotdiamondError } from '../../core/error';
3
+ import { NotDiamondError } from '../../core/error';
4
4
 
5
5
  // https://url.spec.whatwg.org/#url-scheme-string
6
6
  const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
@@ -39,7 +39,7 @@ export function isObj(obj: unknown): obj is Record<string, unknown> {
39
39
 
40
40
  export const ensurePresent = <T>(value: T | null | undefined): T => {
41
41
  if (value == null) {
42
- throw new NotdiamondError(`Expected a value to be given but received ${value} instead.`);
42
+ throw new NotDiamondError(`Expected a value to be given but received ${value} instead.`);
43
43
  }
44
44
 
45
45
  return value;
@@ -47,10 +47,10 @@ export const ensurePresent = <T>(value: T | null | undefined): T => {
47
47
 
48
48
  export const validatePositiveInteger = (name: string, n: unknown): number => {
49
49
  if (typeof n !== 'number' || !Number.isInteger(n)) {
50
- throw new NotdiamondError(`${name} must be an integer`);
50
+ throw new NotDiamondError(`${name} must be an integer`);
51
51
  }
52
52
  if (n < 0) {
53
- throw new NotdiamondError(`${name} must be a positive integer`);
53
+ throw new NotDiamondError(`${name} must be a positive integer`);
54
54
  }
55
55
  return n;
56
56
  };
@@ -59,14 +59,14 @@ export const coerceInteger = (value: unknown): number => {
59
59
  if (typeof value === 'number') return Math.round(value);
60
60
  if (typeof value === 'string') return parseInt(value, 10);
61
61
 
62
- throw new NotdiamondError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
62
+ throw new NotDiamondError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
63
63
  };
64
64
 
65
65
  export const coerceFloat = (value: unknown): number => {
66
66
  if (typeof value === 'number') return value;
67
67
  if (typeof value === 'string') return parseFloat(value);
68
68
 
69
- throw new NotdiamondError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
69
+ throw new NotDiamondError(`Could not coerce ${value} (type: ${typeof value}) into a number`);
70
70
  };
71
71
 
72
72
  export const coerceBoolean = (value: unknown): boolean => {
@@ -297,8 +297,9 @@ export interface GoldenRecord {
297
297
  * - **processing**: Job is currently being executed
298
298
  * - **completed**: Job finished successfully and results are available
299
299
  * - **failed**: Job encountered an error and did not complete
300
+ * - **cancelled**: Job was cancelled due to a restart operation
300
301
  */
301
- export type JobStatus = 'created' | 'queued' | 'processing' | 'completed' | 'failed';
302
+ export type JobStatus = 'created' | 'queued' | 'processing' | 'completed' | 'failed' | 'cancelled';
302
303
 
303
304
  /**
304
305
  * Model for specifying an LLM provider in API requests.
@@ -407,10 +408,10 @@ export interface PromptAdaptationGetAdaptResultsResponse {
407
408
  evaluation_metric?: string | null;
408
409
 
409
410
  /**
410
- * Metrics for the LLM requests made during the adaptation run (e.g.,
411
- * total_requests, avg_latency)
411
+ * Metrics for the LLM requests made during the adaptation run. List of {model:
412
+ * str, num_requests: int}.
412
413
  */
413
- llm_request_metrics?: { [key: string]: number };
414
+ llm_request_metrics?: Array<{ [key: string]: unknown }> | null;
414
415
 
415
416
  /**
416
417
  * Baseline results for the origin model in prompt adaptation.
@@ -486,6 +487,7 @@ export namespace PromptAdaptationGetAdaptResultsResponse {
486
487
  * - **processing**: Job is currently being executed
487
488
  * - **completed**: Job finished successfully and results are available
488
489
  * - **failed**: Job encountered an error and did not complete
490
+ * - **cancelled**: Job was cancelled due to a restart operation
489
491
  */
490
492
  result_status?: PromptAdaptationAPI.JobStatus | null;
491
493
 
@@ -542,6 +544,7 @@ export namespace PromptAdaptationGetAdaptResultsResponse {
542
544
  * - **processing**: Job is currently being executed
543
545
  * - **completed**: Job finished successfully and results are available
544
546
  * - **failed**: Job encountered an error and did not complete
547
+ * - **cancelled**: Job was cancelled due to a restart operation
545
548
  */
546
549
  result_status?: PromptAdaptationAPI.JobStatus | null;
547
550
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.0.0'; // x-release-please-version
1
+ export const VERSION = '2.1.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.0";
1
+ export declare const VERSION = "2.1.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.0";
1
+ export declare const VERSION = "2.1.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.0.0'; // x-release-please-version
4
+ exports.VERSION = '2.1.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.0.0'; // x-release-please-version
1
+ export const VERSION = '2.1.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map