@promptlycms/prompts 0.1.2 → 0.2.0-canary.1db6dca

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 CHANGED
@@ -3,8 +3,9 @@
3
3
  TypeScript SDK for the [Promptly CMS](https://promptlycms.com) API. Stop hardcoding prompts in your codebase — manage them in a purpose-built CMS with versioning and instant publishing, then fetch them at runtime with full type safety.
4
4
 
5
5
  - **Zero hardcoded prompts** — fetch prompts at runtime; update wording, models, and settings from the [CMS](https://promptlycms.com) without code changes or redeploys
6
- - **Runtime client** — `getPrompt()` and `getPrompts()` with full TypeScript support
7
- - **Codegen CLI** — generates typed template variables via declaration merging
6
+ - **Runtime client** — `getPrompt()`, `getPrompts()`, `getComposer()`, and `getComposers()` with full TypeScript support
7
+ - **Composers** — fetch multi-segment documents that combine static HTML with prompt references, then assemble AI-generated output with `formatComposer()`
8
+ - **Codegen CLI** — generates typed template variables and composer types via declaration merging
8
9
  - **AI SDK integration** — destructure directly into [Vercel AI SDK](https://ai-sdk.dev/) `generateText` / `streamText`
9
10
  - **Any AI provider** — supports [all providers](https://ai-sdk.dev/providers/ai-sdk-providers#provider-support) supported by the Vercel AI SDK
10
11
  - **Structured output** — Zod schemas built from CMS-defined output schemas
@@ -46,7 +47,7 @@ PROMPTLY_API_KEY=pk_live_...
46
47
  npx promptly generate
47
48
  ```
48
49
 
49
- This fetches all your prompts from the API and generates a `promptly-env.d.ts` file in your project root with typed autocomplete for every prompt ID and its template variables.
50
+ This fetches all your prompts and composers from the API and generates a `promptly-env.d.ts` file in your project root with typed autocomplete for every prompt ID, composer ID, template variables, and prompt names.
50
51
 
51
52
  ```bash
52
53
  # Custom output path
@@ -135,6 +136,49 @@ const { text } = await generateText({
135
136
 
136
137
  The model configured in the CMS is auto-resolved to the correct AI SDK provider.
137
138
 
139
+ ## Fetching composers
140
+
141
+ A composer is a document template that combines static HTML segments with prompt references. Fetch a composer and use `compose()` to run all prompts and assemble the output in one call:
142
+
143
+ ```typescript
144
+ import { generateText } from 'ai';
145
+
146
+ const composer = await promptly.getComposer('my-composer-id', {
147
+ input: { text: 'Hello world', targetLang: 'French' },
148
+ });
149
+
150
+ // One line — runs all prompts in parallel, assembles the output
151
+ const output = await composer.compose(generateText);
152
+ ```
153
+
154
+ Override parameters per prompt:
155
+
156
+ ```typescript
157
+ const output = await composer.compose((prompt) =>
158
+ generateText({ ...prompt, maxTokens: 500 })
159
+ );
160
+ ```
161
+
162
+ For full control, use the manual flow with named prompts and `formatComposer()`:
163
+
164
+ ```typescript
165
+ const { introPrompt, reviewPrompt, formatComposer } = composer;
166
+
167
+ const output = formatComposer({
168
+ introPrompt: await generateText(introPrompt),
169
+ reviewPrompt: await generateText(reviewPrompt),
170
+ });
171
+ ```
172
+
173
+ Batch fetch multiple composers in parallel:
174
+
175
+ ```typescript
176
+ const [first, second] = await promptly.getComposers([
177
+ { composerId: 'comp-a', input: { name: 'Dan' } },
178
+ { composerId: 'comp-b', input: { topic: 'AI' } },
179
+ ]);
180
+ ```
181
+
138
182
  ## Model auto-detection
139
183
 
140
184
  The SDK automatically resolves models configured in the CMS to the correct AI SDK provider based on the model name prefix:
@@ -146,7 +190,7 @@ The SDK automatically resolves models configured in the CMS to the correct AI SD
146
190
  | `gemini-*` | Google | `@ai-sdk/google` |
147
191
  | `mistral-*`, `mixtral-*`, `codestral-*` | Mistral | `@ai-sdk/mistral` |
148
192
 
149
- CMS model display names (e.g. `claude-sonnet-4.5`) are mapped to their full API model IDs automatically.
193
+ CMS model display names (e.g. `claude-sonnet-4.6`) are mapped to their full API model IDs automatically.
150
194
 
151
195
  ### Custom model resolver
152
196
 
@@ -157,7 +201,7 @@ import { anthropic } from '@ai-sdk/anthropic';
157
201
 
158
202
  const promptly = createPromptlyClient({
159
203
  apiKey: process.env.PROMPTLY_API_KEY,
160
- model: (modelId) => anthropic('claude-sonnet-4-5-20250929'),
204
+ model: (modelId) => anthropic('claude-sonnet-4-6'),
161
205
  });
162
206
  ```
163
207
 
@@ -187,7 +231,7 @@ declare module '@promptlycms/prompts' {
187
231
  }
188
232
  ```
189
233
 
190
- With this file present, `getPrompt()` and `getPrompts()` return typed `userMessage` functions with autocomplete. Unknown prompt IDs fall back to `Record<string, string>`.
234
+ With this file present, `getPrompt()` and `getPrompts()` return typed `userMessage` functions with autocomplete. `getComposer()` and `getComposers()` get typed `input` and named prompt properties. Unknown IDs fall back to `Record<string, string>`.
191
235
 
192
236
  Add the generated file to version control so types are available without running codegen in CI. Re-run `npx promptly generate` whenever you add, remove, or rename template variables in the CMS.
193
237
 
@@ -221,7 +265,7 @@ try {
221
265
  | `baseUrl` | `string` | No | API base URL (default: `https://api.promptlycms.com`) |
222
266
  | `model` | `(modelId: string) => LanguageModel` | No | Custom model resolver — overrides auto-detection |
223
267
 
224
- Returns a `PromptlyClient` with `getPrompt()` and `getPrompts()` methods.
268
+ Returns a `PromptlyClient` with `getPrompt()`, `getPrompts()`, `getComposer()`, and `getComposers()` methods.
225
269
 
226
270
  ### `client.getPrompt(promptId, options?)`
227
271
 
@@ -235,6 +279,19 @@ Fetch a single prompt. Returns `PromptResult` with typed `userMessage` when code
235
279
 
236
280
  Fetch multiple prompts in parallel. Accepts `PromptRequest[]` and returns a typed tuple matching the input order.
237
281
 
282
+ ### `client.getComposer(composerId, options?)`
283
+
284
+ Fetch a single composer. Returns `ComposerResult` with named prompt properties, a `prompts` array, and `formatComposer()`.
285
+
286
+ | Option | Type | Description |
287
+ |-----------|---------------------------|----------------------|
288
+ | `input` | `Record<string, string>` | Template variables to interpolate |
289
+ | `version` | `string` | Specific version to fetch (default: latest) |
290
+
291
+ ### `client.getComposers(entries)`
292
+
293
+ Fetch multiple composers in parallel. Accepts `ComposerRequest[]` and returns results in the same order.
294
+
238
295
  ### `@promptlycms/prompts/schema`
239
296
 
240
297
  Subpath export for working with Zod schemas from CMS schema fields:
package/dist/cli.js CHANGED
@@ -65,6 +65,7 @@ var detectProviderName = (modelId) => {
65
65
  }
66
66
  return void 0;
67
67
  };
68
+ var toCamelCase = (name) => name.replace(/[^a-zA-Z0-9]+(.)/g, (_, char) => char.toUpperCase()).replace(/^[A-Z]/, (char) => char.toLowerCase());
68
69
 
69
70
  // src/cli/generate.ts
70
71
  var PROVIDER_PACKAGES = {
@@ -98,6 +99,50 @@ var fetchAllPrompts = async (apiKey, baseUrl) => {
98
99
  }
99
100
  return response.json();
100
101
  };
102
+ var fetchAllComposers = async (apiKey, baseUrl) => {
103
+ const url = new URL("/composers", baseUrl ?? DEFAULT_BASE_URL);
104
+ url.searchParams.set("include_versions", "true");
105
+ const response = await fetch(url.toString(), {
106
+ headers: {
107
+ Authorization: `Bearer ${apiKey}`
108
+ }
109
+ });
110
+ if (!response.ok) {
111
+ throw await createErrorFromResponse(response);
112
+ }
113
+ return response.json();
114
+ };
115
+ var extractComposerVariables = (composer) => {
116
+ const vars = /* @__PURE__ */ new Set();
117
+ for (const segment of composer.segments) {
118
+ if (segment.type !== "prompt") {
119
+ continue;
120
+ }
121
+ if (!segment.userMessage) {
122
+ continue;
123
+ }
124
+ for (const v of extractTemplateVariables(segment.userMessage)) {
125
+ vars.add(v);
126
+ }
127
+ }
128
+ return [...vars];
129
+ };
130
+ var extractComposerPromptNames = (composer) => {
131
+ const seen = /* @__PURE__ */ new Set();
132
+ const names = [];
133
+ for (const segment of composer.segments) {
134
+ if (segment.type !== "prompt") {
135
+ continue;
136
+ }
137
+ const camelName = toCamelCase(segment.promptName);
138
+ if (seen.has(camelName)) {
139
+ continue;
140
+ }
141
+ seen.add(camelName);
142
+ names.push(camelName);
143
+ }
144
+ return names;
145
+ };
101
146
  var compareSemver = (a, b) => {
102
147
  const pa = a.split(".").map(Number);
103
148
  const pb = b.split(".").map(Number);
@@ -209,7 +254,7 @@ var generateMappedTypeBlock = (group, indent) => {
209
254
  }
210
255
  return lines;
211
256
  };
212
- var generateTypeDeclaration = (prompts) => {
257
+ var generateTypeDeclaration = (prompts, composers = []) => {
213
258
  const lines = [
214
259
  "// Auto-generated by @promptlycms/prompts \u2014 do not edit",
215
260
  "import '@promptlycms/prompts';",
@@ -243,27 +288,91 @@ var generateTypeDeclaration = (prompts) => {
243
288
  }
244
289
  }
245
290
  lines.push(" }");
291
+ if (composers.length > 0) {
292
+ lines.push(" interface ComposerVariableMap {");
293
+ for (const composer of composers) {
294
+ const variables = extractComposerVariables(composer);
295
+ const versions = ["'latest'"];
296
+ if (composer.publishedVersions) {
297
+ for (const pv of composer.publishedVersions) {
298
+ versions.push(`'${pv.version}'`);
299
+ }
300
+ } else {
301
+ versions.push(`'${composer.version}'`);
302
+ }
303
+ lines.push(` '${composer.composerId}': {`);
304
+ if (versions.length === 1) {
305
+ if (variables.length === 0) {
306
+ lines.push(` [V in ${versions[0]}]: Record<string, never>;`);
307
+ } else {
308
+ lines.push(` [V in ${versions[0]}]: {`);
309
+ for (const v of variables) {
310
+ lines.push(` ${v}: string;`);
311
+ }
312
+ lines.push(" };");
313
+ }
314
+ } else {
315
+ const versionUnion = versions.join(" | ");
316
+ if (variables.length === 0) {
317
+ lines.push(` [V in ${versionUnion}]: Record<string, never>;`);
318
+ } else {
319
+ lines.push(` [V in ${versionUnion}]: {`);
320
+ for (const v of variables) {
321
+ lines.push(` ${v}: string;`);
322
+ }
323
+ lines.push(" };");
324
+ }
325
+ }
326
+ lines.push(" };");
327
+ }
328
+ lines.push(" }");
329
+ lines.push(" interface ComposerPromptMap {");
330
+ for (const composer of composers) {
331
+ const names = extractComposerPromptNames(composer);
332
+ if (names.length === 0) {
333
+ lines.push(` '${composer.composerId}': never;`);
334
+ } else {
335
+ const union = names.map((n) => `'${n}'`).join(" | ");
336
+ lines.push(` '${composer.composerId}': ${union};`);
337
+ }
338
+ }
339
+ lines.push(" }");
340
+ }
246
341
  lines.push("}");
247
342
  lines.push("");
248
343
  return lines.join("\n");
249
344
  };
250
- var warnMissingProviders = (prompts) => {
345
+ var warnMissingProviders = (prompts, composers = []) => {
251
346
  const require2 = createRequire(import.meta.url);
252
347
  const needed = /* @__PURE__ */ new Map();
253
- for (const prompt of prompts) {
254
- const provider = detectProviderName(prompt.config.model);
348
+ const trackModel = (modelId, label) => {
349
+ const provider = detectProviderName(modelId);
255
350
  if (!provider) {
256
- continue;
351
+ return;
257
352
  }
258
353
  const pkg = PROVIDER_PACKAGES[provider];
259
354
  if (!pkg) {
260
- continue;
355
+ return;
261
356
  }
262
357
  const existing = needed.get(pkg);
263
358
  if (existing) {
264
- existing.push(prompt.promptName);
359
+ existing.push(label);
265
360
  } else {
266
- needed.set(pkg, [prompt.promptName]);
361
+ needed.set(pkg, [label]);
362
+ }
363
+ };
364
+ for (const prompt of prompts) {
365
+ trackModel(prompt.config.model, prompt.promptName);
366
+ }
367
+ for (const composer of composers) {
368
+ for (const segment of composer.segments) {
369
+ if (segment.type !== "prompt") {
370
+ continue;
371
+ }
372
+ const modelId = segment.config.model;
373
+ if (modelId) {
374
+ trackModel(modelId, `${composer.composerName}/${segment.promptName}`);
375
+ }
267
376
  }
268
377
  }
269
378
  for (const [pkg, promptNames] of needed) {
@@ -278,14 +387,22 @@ var warnMissingProviders = (prompts) => {
278
387
  }
279
388
  };
280
389
  var generate = async (apiKey, outputPath, baseUrl) => {
281
- const prompts = await fetchAllPrompts(apiKey, baseUrl);
282
- if (prompts.length === 0) {
283
- console.log(" No prompts found for this API key.");
390
+ const [prompts, composers] = await Promise.all([
391
+ fetchAllPrompts(apiKey, baseUrl),
392
+ fetchAllComposers(apiKey, baseUrl).catch(() => [])
393
+ ]);
394
+ if (prompts.length === 0 && composers.length === 0) {
395
+ console.log(" No prompts or composers found for this API key.");
284
396
  return;
285
397
  }
286
- console.log(` Found ${prompts.length} prompt(s)`);
287
- warnMissingProviders(prompts);
288
- const content = generateTypeDeclaration(prompts);
398
+ if (prompts.length > 0) {
399
+ console.log(` Found ${prompts.length} prompt(s)`);
400
+ }
401
+ if (composers.length > 0) {
402
+ console.log(` Found ${composers.length} composer(s)`);
403
+ }
404
+ warnMissingProviders(prompts, composers);
405
+ const content = generateTypeDeclaration(prompts, composers);
289
406
  await writeFile(outputPath, content, "utf-8");
290
407
  console.log(` Generated ${outputPath}`);
291
408
  };
@@ -355,7 +472,7 @@ var formatPromptlyError = (error) => {
355
472
  var generateCommand = defineCommand({
356
473
  meta: {
357
474
  name: "generate",
358
- description: "Generate typed TypeScript declarations from Promptly CMS prompts"
475
+ description: "Generate typed TypeScript declarations from Promptly CMS prompts and composers"
359
476
  },
360
477
  args: {
361
478
  output: {
package/dist/index.cjs CHANGED
@@ -33,7 +33,9 @@ __export(src_exports, {
33
33
  PromptlyError: () => PromptlyError,
34
34
  createPromptlyClient: () => createPromptlyClient,
35
35
  getSdkModelId: () => getSdkModelId,
36
- interpolate: () => interpolate
36
+ interpolate: () => interpolate,
37
+ interpolateStaticSegment: () => interpolateStaticSegment,
38
+ toCamelCase: () => toCamelCase
37
39
  });
38
40
  module.exports = __toCommonJS(src_exports);
39
41
 
@@ -76,6 +78,7 @@ var DEFAULT_BASE_URL = "https://api.promptlycms.com";
76
78
  var MODEL_ID_MAP = {
77
79
  // Anthropic: CMS display IDs → API model IDs
78
80
  "claude-opus-4.6": "claude-opus-4-6-20250917",
81
+ "claude-sonnet-4.6": "claude-sonnet-4-6",
79
82
  "claude-sonnet-4.5": "claude-sonnet-4-5-20250929",
80
83
  "claude-haiku-4.5": "claude-haiku-4-5-20251001",
81
84
  "claude-opus-4": "claude-opus-4-20250514",
@@ -179,6 +182,26 @@ var createModelResolver = (config) => {
179
182
  );
180
183
  };
181
184
  };
185
+ var toCamelCase = (name) => name.replace(/[^a-zA-Z0-9]+(.)/g, (_, char) => char.toUpperCase()).replace(/^[A-Z]/, (char) => char.toLowerCase());
186
+ var VARIABLE_REF_REGEX = /<span[^>]*\sdata-variable-ref(?:="[^"]*")?[^>]*\sdata-field-path="([^"]+)"[^>]*><\/span>/g;
187
+ var VARIABLE_REF_ALT_REGEX = /<span[^>]*\sdata-field-path="([^"]+)"[^>]*\sdata-variable-ref(?:="[^"]*")?[^>]*><\/span>/g;
188
+ var MUSTACHE_REGEX = /\{\{(\w[\w.]*)\}\}/g;
189
+ var interpolateStaticSegment = (content, input) => {
190
+ let result = content;
191
+ result = result.replace(
192
+ VARIABLE_REF_REGEX,
193
+ (_, fieldPath) => input[fieldPath] ?? ""
194
+ );
195
+ result = result.replace(
196
+ VARIABLE_REF_ALT_REGEX,
197
+ (_, fieldPath) => input[fieldPath] ?? ""
198
+ );
199
+ result = result.replace(
200
+ MUSTACHE_REGEX,
201
+ (_, fieldPath) => input[fieldPath] ?? ""
202
+ );
203
+ return result;
204
+ };
182
205
  var createPromptlyClient = (config) => {
183
206
  const apiKey = config?.apiKey ?? process.env.PROMPTLY_API_KEY;
184
207
  if (!apiKey) {
@@ -223,12 +246,119 @@ var createPromptlyClient = (config) => {
223
246
  );
224
247
  return results;
225
248
  };
226
- return { getPrompt, getPrompts };
249
+ const fetchComposer = async (composerId, options) => {
250
+ const url = new URL(`/composers/${composerId}`, baseUrl);
251
+ if (options?.version) {
252
+ url.searchParams.set("version", options.version);
253
+ }
254
+ const response = await fetch(url.toString(), {
255
+ headers: {
256
+ Authorization: `Bearer ${apiKey}`
257
+ }
258
+ });
259
+ if (!response.ok) {
260
+ throw await createErrorFromResponse(response);
261
+ }
262
+ return response.json();
263
+ };
264
+ const getComposer = async (composerId, options) => {
265
+ const response = await fetchComposer(composerId, options);
266
+ const input = options?.input ?? {};
267
+ const promptsByName = /* @__PURE__ */ new Map();
268
+ const promptsOrdered = [];
269
+ const processedSegments = [];
270
+ for (const segment of response.segments) {
271
+ if (segment.type === "static") {
272
+ processedSegments.push({
273
+ type: "static",
274
+ content: interpolateStaticSegment(segment.content, input)
275
+ });
276
+ continue;
277
+ }
278
+ const camelName = toCamelCase(segment.promptName);
279
+ if (!promptsByName.has(camelName)) {
280
+ const segmentConfig = segment.config;
281
+ const model = await modelResolver(segmentConfig.model ?? "");
282
+ const userMessage = segment.userMessage ? interpolate(segment.userMessage, input) : "";
283
+ const temperature = segmentConfig.temperature ?? 0.7;
284
+ const composerPrompt = {
285
+ model,
286
+ system: segment.systemMessage ?? void 0,
287
+ prompt: userMessage,
288
+ temperature,
289
+ promptId: segment.promptId,
290
+ promptName: segment.promptName
291
+ };
292
+ promptsByName.set(camelName, composerPrompt);
293
+ promptsOrdered.push(composerPrompt);
294
+ }
295
+ processedSegments.push({ type: "prompt", camelName });
296
+ }
297
+ const formatComposer = (results) => {
298
+ const parts = [];
299
+ for (const seg of processedSegments) {
300
+ if (seg.type === "static") {
301
+ parts.push(seg.content);
302
+ continue;
303
+ }
304
+ const val = results[seg.camelName];
305
+ if (val === void 0) {
306
+ continue;
307
+ }
308
+ parts.push(typeof val === "string" ? val : val.text);
309
+ }
310
+ return parts.join("");
311
+ };
312
+ const compose = async (generate) => {
313
+ const entries = [...promptsByName.entries()];
314
+ const results = await Promise.all(
315
+ entries.map(([, prompt]) => generate(prompt))
316
+ );
317
+ const resultMap = {};
318
+ entries.forEach(([name], i) => {
319
+ resultMap[name] = results[i] ?? "";
320
+ });
321
+ return formatComposer(resultMap);
322
+ };
323
+ const result = {
324
+ composerId: response.composerId,
325
+ composerName: response.composerName,
326
+ version: response.version,
327
+ config: response.config,
328
+ segments: response.segments,
329
+ prompts: promptsOrdered,
330
+ formatComposer,
331
+ compose
332
+ };
333
+ for (const [name, prompt] of promptsByName) {
334
+ result[name] = prompt;
335
+ }
336
+ return result;
337
+ };
338
+ const getComposers = async (entries) => {
339
+ const results = await Promise.all(
340
+ entries.map(
341
+ (entry) => getComposer(entry.composerId, {
342
+ input: entry.input,
343
+ version: entry.version
344
+ })
345
+ )
346
+ );
347
+ return results;
348
+ };
349
+ return {
350
+ getPrompt,
351
+ getPrompts,
352
+ getComposer,
353
+ getComposers
354
+ };
227
355
  };
228
356
  // Annotate the CommonJS export names for ESM import in node:
229
357
  0 && (module.exports = {
230
358
  PromptlyError,
231
359
  createPromptlyClient,
232
360
  getSdkModelId,
233
- interpolate
361
+ interpolate,
362
+ interpolateStaticSegment,
363
+ toCamelCase
234
364
  });
package/dist/index.d.cts CHANGED
@@ -1,9 +1,11 @@
1
- import { P as PromptlyClientConfig, a as PromptlyClient, E as ErrorCode } from './types-BbNpKJej.cjs';
2
- export { b as ErrorResponse, G as GetOptions, c as PromptConfig, d as PromptId, e as PromptMessage, f as PromptRequest, g as PromptResponse, h as PromptResult, i as PromptVariableMap, j as PromptVersion, k as PublishedVersion, S as SchemaField, l as SchemaFieldParams, V as ValidationRule } from './types-BbNpKJej.cjs';
1
+ import { P as PromptlyClientConfig, a as PromptlyClient, E as ErrorCode } from './types-DyMq5QKO.cjs';
2
+ export { C as ComposerConfig, b as ComposerFormatFn, c as ComposerGenerateFn, d as ComposerId, e as ComposerInputFor, f as ComposerPrompt, g as ComposerPromptMap, h as ComposerPromptNamesFor, i as ComposerPromptSegment, j as ComposerRequest, k as ComposerResponse, l as ComposerResult, m as ComposerSegment, n as ComposerStaticSegment, o as ComposerVariableMap, p as ComposerVersion, q as ErrorResponse, F as FormatInput, G as GetComposerOptions, r as GetOptions, s as PromptConfig, t as PromptId, u as PromptMessage, v as PromptRequest, w as PromptResponse, x as PromptResult, y as PromptVariableMap, z as PromptVersion, A as PublishedVersion, S as SchemaField, B as SchemaFieldParams, V as ValidationRule } from './types-DyMq5QKO.cjs';
3
3
  import 'ai';
4
4
 
5
5
  declare const getSdkModelId: (modelId: string) => string;
6
6
  declare const interpolate: (template: string, variables: Record<string, string>) => string;
7
+ declare const toCamelCase: (name: string) => string;
8
+ declare const interpolateStaticSegment: (content: string, input: Record<string, string>) => string;
7
9
  declare const createPromptlyClient: (config?: PromptlyClientConfig) => PromptlyClient;
8
10
 
9
11
  declare class PromptlyError extends Error {
@@ -14,4 +16,4 @@ declare class PromptlyError extends Error {
14
16
  constructor(message: string, code: ErrorCode, status: number, usage?: unknown, upgradeUrl?: string);
15
17
  }
16
18
 
17
- export { ErrorCode, PromptlyClient, PromptlyClientConfig, PromptlyError, createPromptlyClient, getSdkModelId, interpolate };
19
+ export { ErrorCode, PromptlyClient, PromptlyClientConfig, PromptlyError, createPromptlyClient, getSdkModelId, interpolate, interpolateStaticSegment, toCamelCase };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- import { P as PromptlyClientConfig, a as PromptlyClient, E as ErrorCode } from './types-BbNpKJej.js';
2
- export { b as ErrorResponse, G as GetOptions, c as PromptConfig, d as PromptId, e as PromptMessage, f as PromptRequest, g as PromptResponse, h as PromptResult, i as PromptVariableMap, j as PromptVersion, k as PublishedVersion, S as SchemaField, l as SchemaFieldParams, V as ValidationRule } from './types-BbNpKJej.js';
1
+ import { P as PromptlyClientConfig, a as PromptlyClient, E as ErrorCode } from './types-DyMq5QKO.js';
2
+ export { C as ComposerConfig, b as ComposerFormatFn, c as ComposerGenerateFn, d as ComposerId, e as ComposerInputFor, f as ComposerPrompt, g as ComposerPromptMap, h as ComposerPromptNamesFor, i as ComposerPromptSegment, j as ComposerRequest, k as ComposerResponse, l as ComposerResult, m as ComposerSegment, n as ComposerStaticSegment, o as ComposerVariableMap, p as ComposerVersion, q as ErrorResponse, F as FormatInput, G as GetComposerOptions, r as GetOptions, s as PromptConfig, t as PromptId, u as PromptMessage, v as PromptRequest, w as PromptResponse, x as PromptResult, y as PromptVariableMap, z as PromptVersion, A as PublishedVersion, S as SchemaField, B as SchemaFieldParams, V as ValidationRule } from './types-DyMq5QKO.js';
3
3
  import 'ai';
4
4
 
5
5
  declare const getSdkModelId: (modelId: string) => string;
6
6
  declare const interpolate: (template: string, variables: Record<string, string>) => string;
7
+ declare const toCamelCase: (name: string) => string;
8
+ declare const interpolateStaticSegment: (content: string, input: Record<string, string>) => string;
7
9
  declare const createPromptlyClient: (config?: PromptlyClientConfig) => PromptlyClient;
8
10
 
9
11
  declare class PromptlyError extends Error {
@@ -14,4 +16,4 @@ declare class PromptlyError extends Error {
14
16
  constructor(message: string, code: ErrorCode, status: number, usage?: unknown, upgradeUrl?: string);
15
17
  }
16
18
 
17
- export { ErrorCode, PromptlyClient, PromptlyClientConfig, PromptlyError, createPromptlyClient, getSdkModelId, interpolate };
19
+ export { ErrorCode, PromptlyClient, PromptlyClientConfig, PromptlyError, createPromptlyClient, getSdkModelId, interpolate, interpolateStaticSegment, toCamelCase };