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.
- package/CHANGELOG.md +14 -0
- package/README.md +17 -17
- package/client.d.mts +4 -4
- package/client.d.ts +4 -4
- package/client.js +32 -32
- package/client.mjs +30 -30
- package/core/api-promise.d.mts +2 -2
- package/core/api-promise.d.ts +2 -2
- package/core/error.d.mts +2 -2
- package/core/error.d.ts +2 -2
- package/core/error.js +4 -4
- package/core/error.mjs +2 -2
- package/core/resource.d.mts +3 -3
- package/core/resource.d.ts +3 -3
- package/index.d.mts +3 -3
- package/index.d.ts +3 -3
- package/index.js +4 -4
- package/index.mjs +3 -3
- package/internal/parse.d.mts +2 -2
- package/internal/parse.d.ts +2 -2
- package/internal/shims.js +1 -1
- package/internal/shims.mjs +1 -1
- package/internal/uploads.d.mts +4 -4
- package/internal/uploads.d.ts +4 -4
- package/internal/utils/base64.js +2 -2
- package/internal/utils/base64.mjs +3 -3
- package/internal/utils/log.d.mts +3 -3
- package/internal/utils/log.d.ts +3 -3
- package/internal/utils/path.js +1 -1
- package/internal/utils/path.mjs +2 -2
- package/internal/utils/values.js +5 -5
- package/internal/utils/values.mjs +6 -6
- package/package.json +1 -1
- package/resources/prompt-adaptation.d.mts +9 -6
- package/resources/prompt-adaptation.d.mts.map +1 -1
- package/resources/prompt-adaptation.d.ts +9 -6
- package/resources/prompt-adaptation.d.ts.map +1 -1
- package/src/client.ts +12 -12
- package/src/core/api-promise.ts +4 -4
- package/src/core/error.ts +2 -2
- package/src/core/resource.ts +3 -3
- package/src/index.ts +3 -3
- package/src/internal/parse.ts +2 -2
- package/src/internal/shims.ts +1 -1
- package/src/internal/uploads.ts +5 -5
- package/src/internal/utils/base64.ts +3 -3
- package/src/internal/utils/log.ts +3 -3
- package/src/internal/utils/path.ts +2 -2
- package/src/internal/utils/values.ts +6 -6
- package/src/resources/prompt-adaptation.ts +7 -4
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- 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
|
|
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:
|
|
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:
|
|
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 {
|
|
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
|
|
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 {
|
|
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
|
|
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
|
|
50
|
+
throw new NotDiamondError(`${name} must be an integer`);
|
|
51
51
|
}
|
|
52
52
|
if (n < 0) {
|
|
53
|
-
throw new
|
|
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
|
|
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
|
|
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
|
|
411
|
-
*
|
|
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]:
|
|
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.
|
|
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.
|
|
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.
|
|
1
|
+
export declare const VERSION = "2.1.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.
|
|
1
|
+
export const VERSION = '2.1.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|