@promptlycms/prompts 0.1.2 → 0.2.0-canary.2e499dc
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/README.md +64 -7
- package/dist/cli.js +132 -15
- package/dist/index.cjs +133 -3
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +130 -2
- package/dist/schema.d.cts +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/types-DyMq5QKO.d.cts +198 -0
- package/dist/types-DyMq5QKO.d.ts +198 -0
- package/package.json +14 -14
- package/dist/types-BbNpKJej.d.cts +0 -118
- package/dist/types-BbNpKJej.d.ts +0 -118
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import * as ai from 'ai';
|
|
2
|
-
|
|
3
|
-
type ValidationRule = {
|
|
4
|
-
id: string;
|
|
5
|
-
type: string;
|
|
6
|
-
message: string;
|
|
7
|
-
value: string;
|
|
8
|
-
transform?: string;
|
|
9
|
-
keyType?: string;
|
|
10
|
-
valueType?: string;
|
|
11
|
-
discriminator?: string;
|
|
12
|
-
cases?: Record<string, SchemaField[]>;
|
|
13
|
-
};
|
|
14
|
-
type SchemaFieldParams = {
|
|
15
|
-
coerce?: boolean;
|
|
16
|
-
description?: string;
|
|
17
|
-
enumValues?: string[];
|
|
18
|
-
unionTypes?: string[];
|
|
19
|
-
elementType?: string;
|
|
20
|
-
keyType?: string;
|
|
21
|
-
valueType?: string;
|
|
22
|
-
isTuple?: boolean;
|
|
23
|
-
tupleTypes?: string[];
|
|
24
|
-
isStrict?: boolean;
|
|
25
|
-
isPassthrough?: boolean;
|
|
26
|
-
isDiscriminatedUnion?: boolean;
|
|
27
|
-
discriminator?: string;
|
|
28
|
-
discriminatedUnion?: {
|
|
29
|
-
discriminator: string;
|
|
30
|
-
cases: Record<string, {
|
|
31
|
-
value: string;
|
|
32
|
-
fields: SchemaField[];
|
|
33
|
-
}>;
|
|
34
|
-
};
|
|
35
|
-
stringOptions?: {
|
|
36
|
-
datetime?: {
|
|
37
|
-
offset?: boolean;
|
|
38
|
-
precision?: number;
|
|
39
|
-
};
|
|
40
|
-
ip?: {
|
|
41
|
-
version?: 'v4' | 'v6';
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
type SchemaField = {
|
|
46
|
-
id: string;
|
|
47
|
-
name: string;
|
|
48
|
-
type: string;
|
|
49
|
-
validations: ValidationRule[];
|
|
50
|
-
params: SchemaFieldParams;
|
|
51
|
-
};
|
|
52
|
-
type PromptConfig = {
|
|
53
|
-
schema: SchemaField[];
|
|
54
|
-
model: string;
|
|
55
|
-
temperature: number;
|
|
56
|
-
inputData: unknown;
|
|
57
|
-
inputDataRootName: string | null;
|
|
58
|
-
};
|
|
59
|
-
type PublishedVersion = {
|
|
60
|
-
version: string;
|
|
61
|
-
userMessage: string;
|
|
62
|
-
};
|
|
63
|
-
type PromptResponse = {
|
|
64
|
-
promptId: string;
|
|
65
|
-
promptName: string;
|
|
66
|
-
version: string;
|
|
67
|
-
systemMessage: string;
|
|
68
|
-
userMessage: string;
|
|
69
|
-
config: PromptConfig;
|
|
70
|
-
publishedVersions?: PublishedVersion[];
|
|
71
|
-
};
|
|
72
|
-
interface PromptVariableMap {
|
|
73
|
-
}
|
|
74
|
-
type PromptId = keyof PromptVariableMap | (string & {});
|
|
75
|
-
type PromptVersion<Id extends string> = Id extends keyof PromptVariableMap ? Exclude<keyof PromptVariableMap[Id], 'latest'> : string;
|
|
76
|
-
type VariablesFor<Id extends string, Ver extends string = 'latest'> = Id extends keyof PromptVariableMap ? Ver extends keyof PromptVariableMap[Id] ? PromptVariableMap[Id][Ver] : Record<string, string> : Record<string, string>;
|
|
77
|
-
type PromptMessage<V extends Record<string, string> = Record<string, string>> = {
|
|
78
|
-
(variables: V): string;
|
|
79
|
-
toString(): string;
|
|
80
|
-
};
|
|
81
|
-
type PromptResult<V extends Record<string, string> = Record<string, string>> = Omit<PromptResponse, 'userMessage'> & {
|
|
82
|
-
userMessage: PromptMessage<V>;
|
|
83
|
-
temperature: number;
|
|
84
|
-
model: ai.LanguageModel;
|
|
85
|
-
};
|
|
86
|
-
type PromptRequest = {
|
|
87
|
-
promptId: string;
|
|
88
|
-
version?: string;
|
|
89
|
-
};
|
|
90
|
-
type GetPromptsResults<T extends readonly PromptRequest[]> = {
|
|
91
|
-
[K in keyof T]: T[K] extends {
|
|
92
|
-
promptId: infer Id extends string;
|
|
93
|
-
version: infer Ver extends string;
|
|
94
|
-
} ? PromptResult<VariablesFor<Id, Ver>> : T[K] extends {
|
|
95
|
-
promptId: infer Id extends string;
|
|
96
|
-
} ? PromptResult<VariablesFor<Id, 'latest'>> : PromptResult;
|
|
97
|
-
};
|
|
98
|
-
type ErrorCode = 'UNAUTHORIZED' | 'INVALID_KEY' | 'NOT_FOUND' | 'VERSION_NOT_FOUND' | 'BAD_REQUEST' | 'USAGE_LIMIT_EXCEEDED';
|
|
99
|
-
type ErrorResponse = {
|
|
100
|
-
error: string;
|
|
101
|
-
code: ErrorCode;
|
|
102
|
-
usage?: unknown;
|
|
103
|
-
upgradeUrl?: string;
|
|
104
|
-
};
|
|
105
|
-
type PromptlyClientConfig = {
|
|
106
|
-
apiKey?: string;
|
|
107
|
-
baseUrl?: string;
|
|
108
|
-
model?: (modelId: string) => ai.LanguageModel;
|
|
109
|
-
};
|
|
110
|
-
type GetOptions<V extends string = string> = {
|
|
111
|
-
version?: V;
|
|
112
|
-
};
|
|
113
|
-
type PromptlyClient = {
|
|
114
|
-
getPrompt: <T extends string, V extends PromptVersion<T> | 'latest' = 'latest'>(promptId: T, options?: GetOptions<V>) => Promise<PromptResult<VariablesFor<T, V>>>;
|
|
115
|
-
getPrompts: <const T extends readonly PromptRequest[]>(entries: T) => Promise<GetPromptsResults<T>>;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export type { ErrorCode as E, GetOptions as G, PromptlyClientConfig as P, SchemaField as S, ValidationRule as V, PromptlyClient as a, ErrorResponse as b, PromptConfig as c, PromptId as d, PromptMessage as e, PromptRequest as f, PromptResponse as g, PromptResult as h, PromptVariableMap as i, PromptVersion as j, PublishedVersion as k, SchemaFieldParams as l };
|
package/dist/types-BbNpKJej.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import * as ai from 'ai';
|
|
2
|
-
|
|
3
|
-
type ValidationRule = {
|
|
4
|
-
id: string;
|
|
5
|
-
type: string;
|
|
6
|
-
message: string;
|
|
7
|
-
value: string;
|
|
8
|
-
transform?: string;
|
|
9
|
-
keyType?: string;
|
|
10
|
-
valueType?: string;
|
|
11
|
-
discriminator?: string;
|
|
12
|
-
cases?: Record<string, SchemaField[]>;
|
|
13
|
-
};
|
|
14
|
-
type SchemaFieldParams = {
|
|
15
|
-
coerce?: boolean;
|
|
16
|
-
description?: string;
|
|
17
|
-
enumValues?: string[];
|
|
18
|
-
unionTypes?: string[];
|
|
19
|
-
elementType?: string;
|
|
20
|
-
keyType?: string;
|
|
21
|
-
valueType?: string;
|
|
22
|
-
isTuple?: boolean;
|
|
23
|
-
tupleTypes?: string[];
|
|
24
|
-
isStrict?: boolean;
|
|
25
|
-
isPassthrough?: boolean;
|
|
26
|
-
isDiscriminatedUnion?: boolean;
|
|
27
|
-
discriminator?: string;
|
|
28
|
-
discriminatedUnion?: {
|
|
29
|
-
discriminator: string;
|
|
30
|
-
cases: Record<string, {
|
|
31
|
-
value: string;
|
|
32
|
-
fields: SchemaField[];
|
|
33
|
-
}>;
|
|
34
|
-
};
|
|
35
|
-
stringOptions?: {
|
|
36
|
-
datetime?: {
|
|
37
|
-
offset?: boolean;
|
|
38
|
-
precision?: number;
|
|
39
|
-
};
|
|
40
|
-
ip?: {
|
|
41
|
-
version?: 'v4' | 'v6';
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
type SchemaField = {
|
|
46
|
-
id: string;
|
|
47
|
-
name: string;
|
|
48
|
-
type: string;
|
|
49
|
-
validations: ValidationRule[];
|
|
50
|
-
params: SchemaFieldParams;
|
|
51
|
-
};
|
|
52
|
-
type PromptConfig = {
|
|
53
|
-
schema: SchemaField[];
|
|
54
|
-
model: string;
|
|
55
|
-
temperature: number;
|
|
56
|
-
inputData: unknown;
|
|
57
|
-
inputDataRootName: string | null;
|
|
58
|
-
};
|
|
59
|
-
type PublishedVersion = {
|
|
60
|
-
version: string;
|
|
61
|
-
userMessage: string;
|
|
62
|
-
};
|
|
63
|
-
type PromptResponse = {
|
|
64
|
-
promptId: string;
|
|
65
|
-
promptName: string;
|
|
66
|
-
version: string;
|
|
67
|
-
systemMessage: string;
|
|
68
|
-
userMessage: string;
|
|
69
|
-
config: PromptConfig;
|
|
70
|
-
publishedVersions?: PublishedVersion[];
|
|
71
|
-
};
|
|
72
|
-
interface PromptVariableMap {
|
|
73
|
-
}
|
|
74
|
-
type PromptId = keyof PromptVariableMap | (string & {});
|
|
75
|
-
type PromptVersion<Id extends string> = Id extends keyof PromptVariableMap ? Exclude<keyof PromptVariableMap[Id], 'latest'> : string;
|
|
76
|
-
type VariablesFor<Id extends string, Ver extends string = 'latest'> = Id extends keyof PromptVariableMap ? Ver extends keyof PromptVariableMap[Id] ? PromptVariableMap[Id][Ver] : Record<string, string> : Record<string, string>;
|
|
77
|
-
type PromptMessage<V extends Record<string, string> = Record<string, string>> = {
|
|
78
|
-
(variables: V): string;
|
|
79
|
-
toString(): string;
|
|
80
|
-
};
|
|
81
|
-
type PromptResult<V extends Record<string, string> = Record<string, string>> = Omit<PromptResponse, 'userMessage'> & {
|
|
82
|
-
userMessage: PromptMessage<V>;
|
|
83
|
-
temperature: number;
|
|
84
|
-
model: ai.LanguageModel;
|
|
85
|
-
};
|
|
86
|
-
type PromptRequest = {
|
|
87
|
-
promptId: string;
|
|
88
|
-
version?: string;
|
|
89
|
-
};
|
|
90
|
-
type GetPromptsResults<T extends readonly PromptRequest[]> = {
|
|
91
|
-
[K in keyof T]: T[K] extends {
|
|
92
|
-
promptId: infer Id extends string;
|
|
93
|
-
version: infer Ver extends string;
|
|
94
|
-
} ? PromptResult<VariablesFor<Id, Ver>> : T[K] extends {
|
|
95
|
-
promptId: infer Id extends string;
|
|
96
|
-
} ? PromptResult<VariablesFor<Id, 'latest'>> : PromptResult;
|
|
97
|
-
};
|
|
98
|
-
type ErrorCode = 'UNAUTHORIZED' | 'INVALID_KEY' | 'NOT_FOUND' | 'VERSION_NOT_FOUND' | 'BAD_REQUEST' | 'USAGE_LIMIT_EXCEEDED';
|
|
99
|
-
type ErrorResponse = {
|
|
100
|
-
error: string;
|
|
101
|
-
code: ErrorCode;
|
|
102
|
-
usage?: unknown;
|
|
103
|
-
upgradeUrl?: string;
|
|
104
|
-
};
|
|
105
|
-
type PromptlyClientConfig = {
|
|
106
|
-
apiKey?: string;
|
|
107
|
-
baseUrl?: string;
|
|
108
|
-
model?: (modelId: string) => ai.LanguageModel;
|
|
109
|
-
};
|
|
110
|
-
type GetOptions<V extends string = string> = {
|
|
111
|
-
version?: V;
|
|
112
|
-
};
|
|
113
|
-
type PromptlyClient = {
|
|
114
|
-
getPrompt: <T extends string, V extends PromptVersion<T> | 'latest' = 'latest'>(promptId: T, options?: GetOptions<V>) => Promise<PromptResult<VariablesFor<T, V>>>;
|
|
115
|
-
getPrompts: <const T extends readonly PromptRequest[]>(entries: T) => Promise<GetPromptsResults<T>>;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export type { ErrorCode as E, GetOptions as G, PromptlyClientConfig as P, SchemaField as S, ValidationRule as V, PromptlyClient as a, ErrorResponse as b, PromptConfig as c, PromptId as d, PromptMessage as e, PromptRequest as f, PromptResponse as g, PromptResult as h, PromptVariableMap as i, PromptVersion as j, PublishedVersion as k, SchemaFieldParams as l };
|