@prompty/core 2.0.0-alpha.6 → 2.0.0-alpha.7
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/dist/index.cjs +163 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -32
- package/dist/index.d.ts +89 -32
- package/dist/index.js +162 -76
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2223,19 +2223,33 @@ declare class Steering {
|
|
|
2223
2223
|
}
|
|
2224
2224
|
|
|
2225
2225
|
/**
|
|
2226
|
-
*
|
|
2226
|
+
* Execution pipeline — two top-level APIs plus building blocks.
|
|
2227
2227
|
*
|
|
2228
2228
|
* ```
|
|
2229
|
-
* invoke(prompt, inputs) →
|
|
2229
|
+
* invoke(prompt, inputs) → one-shot: load + prepare + execute + process
|
|
2230
|
+
* ├── load(path) → file → agent (when path given)
|
|
2230
2231
|
* ├── prepare(agent, inputs) → template → wire format
|
|
2231
2232
|
* │ ├── render(agent, inputs) → template + inputs → rendered string
|
|
2232
2233
|
* │ └── parse(agent, rendered) → rendered string → Message[]
|
|
2233
|
-
*
|
|
2234
|
-
*
|
|
2235
|
-
*
|
|
2234
|
+
* ├── Executor.execute(...) → messages → raw LLM response
|
|
2235
|
+
* └── Processor.process(...) → raw response → clean result
|
|
2236
|
+
*
|
|
2237
|
+
* turn(agent, inputs, options?) → conversational round-trip
|
|
2238
|
+
* ├── prepare(agent, inputs) → template → wire format
|
|
2239
|
+
* ├── Executor.execute(...) → LLM call
|
|
2240
|
+
* ├── [toolCalls → Executor]* → agent loop (when tools provided)
|
|
2241
|
+
* └── Processor.process(...) → final result extraction
|
|
2242
|
+
*
|
|
2243
|
+
* run(agent, messages, options?) → standalone: execute + process
|
|
2244
|
+
* ├── Executor.execute(...) → messages → raw LLM response
|
|
2245
|
+
* └── Processor.process(...) → raw response → clean result
|
|
2236
2246
|
* ```
|
|
2237
2247
|
*
|
|
2238
|
-
*
|
|
2248
|
+
* `invoke` = "call this prompty like a function" (one-shot, embeddings, tool JSON).
|
|
2249
|
+
* `turn` = "one round of a conversation" (thread history, turn numbering, tool loops).
|
|
2250
|
+
* `run` = standalone building block for advanced users.
|
|
2251
|
+
*
|
|
2252
|
+
* Each step is independently traced. Users can bring their own
|
|
2239
2253
|
* Renderer, Parser, Executor, Processor via the registry.
|
|
2240
2254
|
*
|
|
2241
2255
|
* @module
|
|
@@ -2273,16 +2287,34 @@ declare function prepare(agent: Prompty, inputs?: Record<string, unknown>): Prom
|
|
|
2273
2287
|
declare function run(agent: Prompty, messages: Message[], options?: {
|
|
2274
2288
|
raw?: boolean;
|
|
2275
2289
|
}): Promise<unknown>;
|
|
2290
|
+
/** Options for {@link invoke}. */
|
|
2291
|
+
interface InvokeOptions {
|
|
2292
|
+
/** Return raw executor response without processing. */
|
|
2293
|
+
raw?: boolean;
|
|
2294
|
+
}
|
|
2276
2295
|
/**
|
|
2277
|
-
*
|
|
2296
|
+
* One-shot pipeline: load → prepare → execute → process.
|
|
2297
|
+
*
|
|
2298
|
+
* Use `invoke` to call a prompty like a function — give inputs, get output.
|
|
2299
|
+
* No conversation context or turn numbering. Supports file paths or
|
|
2300
|
+
* pre-loaded agents.
|
|
2301
|
+
*
|
|
2302
|
+
* Trace structure (flat):
|
|
2303
|
+
* ```
|
|
2304
|
+
* invoke
|
|
2305
|
+
* load (only when path given)
|
|
2306
|
+
* prepare
|
|
2307
|
+
* Renderer
|
|
2308
|
+
* Parser
|
|
2309
|
+
* Executor
|
|
2310
|
+
* Processor
|
|
2311
|
+
* ```
|
|
2278
2312
|
*
|
|
2279
2313
|
* @overload Untyped — returns `unknown`.
|
|
2280
2314
|
*/
|
|
2281
|
-
declare function invoke(prompt: string | Prompty, inputs?: Record<string, unknown>, options?:
|
|
2282
|
-
raw?: boolean;
|
|
2283
|
-
}): Promise<unknown>;
|
|
2315
|
+
declare function invoke(prompt: string | Prompty, inputs?: Record<string, unknown>, options?: InvokeOptions): Promise<unknown>;
|
|
2284
2316
|
/**
|
|
2285
|
-
*
|
|
2317
|
+
* One-shot pipeline with typed result: load → prepare → execute → process → cast.
|
|
2286
2318
|
*
|
|
2287
2319
|
* When a `validator` is provided the raw result is deserialized from JSON
|
|
2288
2320
|
* and passed through the validator (e.g. a Zod `.parse` function), giving
|
|
@@ -2290,49 +2322,74 @@ declare function invoke(prompt: string | Prompty, inputs?: Record<string, unknow
|
|
|
2290
2322
|
*
|
|
2291
2323
|
* @overload Typed — returns `Promise<T>`.
|
|
2292
2324
|
*/
|
|
2293
|
-
declare function invoke<T>(prompt: string | Prompty, inputs: Record<string, unknown> | undefined, options: {
|
|
2294
|
-
raw?: boolean;
|
|
2325
|
+
declare function invoke<T>(prompt: string | Prompty, inputs: Record<string, unknown> | undefined, options: InvokeOptions & {
|
|
2295
2326
|
validator: (data: unknown) => T;
|
|
2296
2327
|
}): Promise<T>;
|
|
2297
|
-
/**
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
* For each binding on the matched tool, looks up `binding.input` in parentInputs
|
|
2301
|
-
* and sets `args[binding.name]` to that value. Returns a new args object.
|
|
2302
|
-
*/
|
|
2303
|
-
declare function resolveBindings(agent: Prompty, toolName: string, args: Record<string, unknown>, parentInputs?: Record<string, unknown>): Record<string, unknown>;
|
|
2304
|
-
/** Options for {@link invokeAgent}. */
|
|
2305
|
-
interface InvokeAgentOptions {
|
|
2328
|
+
/** Options for {@link turn}. */
|
|
2329
|
+
interface TurnOptions {
|
|
2330
|
+
/** Runtime tool handlers. When provided, triggers the agent loop. */
|
|
2306
2331
|
tools?: Record<string, (...args: unknown[]) => unknown>;
|
|
2332
|
+
/** Turn number for trace labeling (e.g., "turn 3"). */
|
|
2333
|
+
turn?: number;
|
|
2334
|
+
/** Maximum agent-loop iterations before throwing (default: 10). */
|
|
2307
2335
|
maxIterations?: number;
|
|
2336
|
+
/** Return raw executor response without processing. */
|
|
2308
2337
|
raw?: boolean;
|
|
2338
|
+
/** Callback for agent loop events (token, tool_call, done, etc.). */
|
|
2309
2339
|
onEvent?: EventCallback;
|
|
2340
|
+
/** Abort signal for cancellation (§13.2). */
|
|
2310
2341
|
signal?: AbortSignal;
|
|
2342
|
+
/** Max character budget for context window trimming (§13.3). */
|
|
2311
2343
|
contextBudget?: number;
|
|
2344
|
+
/** Input/output/tool guardrails (§13.4). */
|
|
2312
2345
|
guardrails?: Guardrails;
|
|
2346
|
+
/** Steering queue for injecting messages mid-loop (§13.5). */
|
|
2313
2347
|
steering?: Steering;
|
|
2348
|
+
/** Allow parallel tool execution within a single round (§13.6). */
|
|
2314
2349
|
parallelToolCalls?: boolean;
|
|
2315
2350
|
}
|
|
2316
2351
|
/**
|
|
2317
|
-
*
|
|
2352
|
+
* One conversational turn: prepare messages from inputs, then either execute a
|
|
2353
|
+
* single LLM call or enter the agent loop (when tools are provided).
|
|
2318
2354
|
*
|
|
2319
|
-
*
|
|
2320
|
-
*
|
|
2355
|
+
* Trace structure (flat — no redundant wrappers):
|
|
2356
|
+
* ```
|
|
2357
|
+
* turn N
|
|
2358
|
+
* prepare → Renderer → Parser
|
|
2359
|
+
* Executor (each LLM call)
|
|
2360
|
+
* toolCalls → tool1, tool2 (if tools provided)
|
|
2361
|
+
* Executor (follow-up LLM call)
|
|
2362
|
+
* Processor (final result extraction)
|
|
2363
|
+
* ```
|
|
2321
2364
|
*
|
|
2322
2365
|
* @overload Untyped — returns `unknown`.
|
|
2323
2366
|
*/
|
|
2324
|
-
declare function
|
|
2367
|
+
declare function turn(prompt: string | Prompty, inputs: Record<string, unknown>, options?: TurnOptions): Promise<unknown>;
|
|
2325
2368
|
/**
|
|
2326
|
-
*
|
|
2369
|
+
* One conversational turn with typed result.
|
|
2327
2370
|
*
|
|
2328
|
-
* When a `validator` is provided
|
|
2329
|
-
*
|
|
2371
|
+
* When a `validator` is provided the final result is deserialized from JSON
|
|
2372
|
+
* and passed through the validator (e.g. a Zod `.parse` function).
|
|
2330
2373
|
*
|
|
2331
2374
|
* @overload Typed — returns `Promise<T>`.
|
|
2332
2375
|
*/
|
|
2333
|
-
declare function
|
|
2376
|
+
declare function turn<T>(prompt: string | Prompty, inputs: Record<string, unknown>, options: TurnOptions & {
|
|
2334
2377
|
validator: (data: unknown) => T;
|
|
2335
2378
|
}): Promise<T>;
|
|
2379
|
+
/**
|
|
2380
|
+
* Resolve tool bindings: inject values from parentInputs into tool arguments.
|
|
2381
|
+
*
|
|
2382
|
+
* For each binding on the matched tool, looks up `binding.input` in parentInputs
|
|
2383
|
+
* and sets `args[binding.name]` to that value. Returns a new args object.
|
|
2384
|
+
*/
|
|
2385
|
+
declare function resolveBindings(agent: Prompty, toolName: string, args: Record<string, unknown>, parentInputs?: Record<string, unknown>): Record<string, unknown>;
|
|
2386
|
+
/**
|
|
2387
|
+
* @deprecated Use {@link turn} with `tools` option instead.
|
|
2388
|
+
* Kept for backward compatibility — delegates to `turn()`.
|
|
2389
|
+
*/
|
|
2390
|
+
declare const invokeAgent: typeof turn;
|
|
2391
|
+
/** @deprecated Use {@link TurnOptions} instead. */
|
|
2392
|
+
type InvokeAgentOptions = TurnOptions;
|
|
2336
2393
|
|
|
2337
2394
|
/**
|
|
2338
2395
|
* §13.2 Cancellation — cooperative cancellation via AbortSignal.
|
|
@@ -2438,7 +2495,7 @@ declare function tool<T extends (...args: unknown[]) => unknown>(fn: T, options?
|
|
|
2438
2495
|
*
|
|
2439
2496
|
* @param agent - A loaded Prompty agent (has `.tools` property)
|
|
2440
2497
|
* @param tools - Array of `tool()`-wrapped functions
|
|
2441
|
-
* @returns Handler record suitable for `
|
|
2498
|
+
* @returns Handler record suitable for `turn(..., { tools: result })`
|
|
2442
2499
|
* @throws Error if a handler has no `__tool__` property or no matching declaration
|
|
2443
2500
|
*/
|
|
2444
2501
|
declare function bindTools(agent: {
|
|
@@ -2749,4 +2806,4 @@ interface OtelTracerOptions {
|
|
|
2749
2806
|
*/
|
|
2750
2807
|
declare function otelTracer(api: OtelApi, options?: OtelTracerOptions): TracerFactory;
|
|
2751
2808
|
|
|
2752
|
-
export { Prompty as AgentDefinition, type AgentEventType, AnonymousConnection, ApiKeyConnection, ArrayProperty, type AudioPart, Binding, CancelledError, Connection, type ContentPart, CustomTool, type EventCallback, type Executor, type FilePart, FormatConfig, FoundryConnection, FunctionTool, GuardrailError, type GuardrailResult, Guardrails, type GuardrailsOptions, type ImagePart, type InputGuardrail, type InvokeAgentOptions, InvokerError, LoadContext, McpApprovalMode, McpTool, Message, Model, ModelOptions, MustacheRenderer, NunjucksRenderer, OAuthConnection, ObjectProperty, OpenApiTool, type OtelApi, type OtelTracerOptions, type OutputGuardrail, type Parser, ParserConfig, type Processor, Prompty as PromptAgent, Prompty, PromptyChatParser, PromptyStream, PromptyTool, PromptyTracer, Property, RICH_KINDS, ROLES, ReferenceConnection, RemoteConnection, type Renderer, type Role, SaveContext, type SpanEmitter, Steering, type StructuredResult, StructuredResultSymbol, Template, type TextPart, ThreadMarker, Tool, type ToolCall, type ToolFunction, type ToolGuardrail, type ToolOptions, type ToolParameter, Tracer, type TracerBackend, type TracerFactory, bindTools, cast, checkCancellation, clearCache, clearConnections, consoleTracer, createStructuredResult, dictContentToPart, dictToMessage, emitEvent, estimateChars, getConnection, getExecutor, getParser, getProcessor, getRenderer, invoke, invokeAgent, isStructuredResult, load, otelTracer, parse, prepare, process, registerConnection, registerExecutor, registerParser, registerProcessor, registerRenderer, render, resolveBindings, run, sanitizeValue, summarizeDropped, text, textMessage, toSerializable, tool, trace, traceMethod, traceSpan, trimToContextWindow, validateInputs };
|
|
2809
|
+
export { Prompty as AgentDefinition, type AgentEventType, AnonymousConnection, ApiKeyConnection, ArrayProperty, type AudioPart, Binding, CancelledError, Connection, type ContentPart, CustomTool, type EventCallback, type Executor, type FilePart, FormatConfig, FoundryConnection, FunctionTool, GuardrailError, type GuardrailResult, Guardrails, type GuardrailsOptions, type ImagePart, type InputGuardrail, type InvokeAgentOptions, type InvokeOptions, InvokerError, LoadContext, McpApprovalMode, McpTool, Message, Model, ModelOptions, MustacheRenderer, NunjucksRenderer, OAuthConnection, ObjectProperty, OpenApiTool, type OtelApi, type OtelTracerOptions, type OutputGuardrail, type Parser, ParserConfig, type Processor, Prompty as PromptAgent, Prompty, PromptyChatParser, PromptyStream, PromptyTool, PromptyTracer, Property, RICH_KINDS, ROLES, ReferenceConnection, RemoteConnection, type Renderer, type Role, SaveContext, type SpanEmitter, Steering, type StructuredResult, StructuredResultSymbol, Template, type TextPart, ThreadMarker, Tool, type ToolCall, type ToolFunction, type ToolGuardrail, type ToolOptions, type ToolParameter, Tracer, type TracerBackend, type TracerFactory, type TurnOptions, bindTools, cast, checkCancellation, clearCache, clearConnections, consoleTracer, createStructuredResult, dictContentToPart, dictToMessage, emitEvent, estimateChars, getConnection, getExecutor, getParser, getProcessor, getRenderer, invoke, invokeAgent, isStructuredResult, load, otelTracer, parse, prepare, process, registerConnection, registerExecutor, registerParser, registerProcessor, registerRenderer, render, resolveBindings, run, sanitizeValue, summarizeDropped, text, textMessage, toSerializable, tool, trace, traceMethod, traceSpan, trimToContextWindow, turn, validateInputs };
|
package/dist/index.d.ts
CHANGED
|
@@ -2223,19 +2223,33 @@ declare class Steering {
|
|
|
2223
2223
|
}
|
|
2224
2224
|
|
|
2225
2225
|
/**
|
|
2226
|
-
*
|
|
2226
|
+
* Execution pipeline — two top-level APIs plus building blocks.
|
|
2227
2227
|
*
|
|
2228
2228
|
* ```
|
|
2229
|
-
* invoke(prompt, inputs) →
|
|
2229
|
+
* invoke(prompt, inputs) → one-shot: load + prepare + execute + process
|
|
2230
|
+
* ├── load(path) → file → agent (when path given)
|
|
2230
2231
|
* ├── prepare(agent, inputs) → template → wire format
|
|
2231
2232
|
* │ ├── render(agent, inputs) → template + inputs → rendered string
|
|
2232
2233
|
* │ └── parse(agent, rendered) → rendered string → Message[]
|
|
2233
|
-
*
|
|
2234
|
-
*
|
|
2235
|
-
*
|
|
2234
|
+
* ├── Executor.execute(...) → messages → raw LLM response
|
|
2235
|
+
* └── Processor.process(...) → raw response → clean result
|
|
2236
|
+
*
|
|
2237
|
+
* turn(agent, inputs, options?) → conversational round-trip
|
|
2238
|
+
* ├── prepare(agent, inputs) → template → wire format
|
|
2239
|
+
* ├── Executor.execute(...) → LLM call
|
|
2240
|
+
* ├── [toolCalls → Executor]* → agent loop (when tools provided)
|
|
2241
|
+
* └── Processor.process(...) → final result extraction
|
|
2242
|
+
*
|
|
2243
|
+
* run(agent, messages, options?) → standalone: execute + process
|
|
2244
|
+
* ├── Executor.execute(...) → messages → raw LLM response
|
|
2245
|
+
* └── Processor.process(...) → raw response → clean result
|
|
2236
2246
|
* ```
|
|
2237
2247
|
*
|
|
2238
|
-
*
|
|
2248
|
+
* `invoke` = "call this prompty like a function" (one-shot, embeddings, tool JSON).
|
|
2249
|
+
* `turn` = "one round of a conversation" (thread history, turn numbering, tool loops).
|
|
2250
|
+
* `run` = standalone building block for advanced users.
|
|
2251
|
+
*
|
|
2252
|
+
* Each step is independently traced. Users can bring their own
|
|
2239
2253
|
* Renderer, Parser, Executor, Processor via the registry.
|
|
2240
2254
|
*
|
|
2241
2255
|
* @module
|
|
@@ -2273,16 +2287,34 @@ declare function prepare(agent: Prompty, inputs?: Record<string, unknown>): Prom
|
|
|
2273
2287
|
declare function run(agent: Prompty, messages: Message[], options?: {
|
|
2274
2288
|
raw?: boolean;
|
|
2275
2289
|
}): Promise<unknown>;
|
|
2290
|
+
/** Options for {@link invoke}. */
|
|
2291
|
+
interface InvokeOptions {
|
|
2292
|
+
/** Return raw executor response without processing. */
|
|
2293
|
+
raw?: boolean;
|
|
2294
|
+
}
|
|
2276
2295
|
/**
|
|
2277
|
-
*
|
|
2296
|
+
* One-shot pipeline: load → prepare → execute → process.
|
|
2297
|
+
*
|
|
2298
|
+
* Use `invoke` to call a prompty like a function — give inputs, get output.
|
|
2299
|
+
* No conversation context or turn numbering. Supports file paths or
|
|
2300
|
+
* pre-loaded agents.
|
|
2301
|
+
*
|
|
2302
|
+
* Trace structure (flat):
|
|
2303
|
+
* ```
|
|
2304
|
+
* invoke
|
|
2305
|
+
* load (only when path given)
|
|
2306
|
+
* prepare
|
|
2307
|
+
* Renderer
|
|
2308
|
+
* Parser
|
|
2309
|
+
* Executor
|
|
2310
|
+
* Processor
|
|
2311
|
+
* ```
|
|
2278
2312
|
*
|
|
2279
2313
|
* @overload Untyped — returns `unknown`.
|
|
2280
2314
|
*/
|
|
2281
|
-
declare function invoke(prompt: string | Prompty, inputs?: Record<string, unknown>, options?:
|
|
2282
|
-
raw?: boolean;
|
|
2283
|
-
}): Promise<unknown>;
|
|
2315
|
+
declare function invoke(prompt: string | Prompty, inputs?: Record<string, unknown>, options?: InvokeOptions): Promise<unknown>;
|
|
2284
2316
|
/**
|
|
2285
|
-
*
|
|
2317
|
+
* One-shot pipeline with typed result: load → prepare → execute → process → cast.
|
|
2286
2318
|
*
|
|
2287
2319
|
* When a `validator` is provided the raw result is deserialized from JSON
|
|
2288
2320
|
* and passed through the validator (e.g. a Zod `.parse` function), giving
|
|
@@ -2290,49 +2322,74 @@ declare function invoke(prompt: string | Prompty, inputs?: Record<string, unknow
|
|
|
2290
2322
|
*
|
|
2291
2323
|
* @overload Typed — returns `Promise<T>`.
|
|
2292
2324
|
*/
|
|
2293
|
-
declare function invoke<T>(prompt: string | Prompty, inputs: Record<string, unknown> | undefined, options: {
|
|
2294
|
-
raw?: boolean;
|
|
2325
|
+
declare function invoke<T>(prompt: string | Prompty, inputs: Record<string, unknown> | undefined, options: InvokeOptions & {
|
|
2295
2326
|
validator: (data: unknown) => T;
|
|
2296
2327
|
}): Promise<T>;
|
|
2297
|
-
/**
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
* For each binding on the matched tool, looks up `binding.input` in parentInputs
|
|
2301
|
-
* and sets `args[binding.name]` to that value. Returns a new args object.
|
|
2302
|
-
*/
|
|
2303
|
-
declare function resolveBindings(agent: Prompty, toolName: string, args: Record<string, unknown>, parentInputs?: Record<string, unknown>): Record<string, unknown>;
|
|
2304
|
-
/** Options for {@link invokeAgent}. */
|
|
2305
|
-
interface InvokeAgentOptions {
|
|
2328
|
+
/** Options for {@link turn}. */
|
|
2329
|
+
interface TurnOptions {
|
|
2330
|
+
/** Runtime tool handlers. When provided, triggers the agent loop. */
|
|
2306
2331
|
tools?: Record<string, (...args: unknown[]) => unknown>;
|
|
2332
|
+
/** Turn number for trace labeling (e.g., "turn 3"). */
|
|
2333
|
+
turn?: number;
|
|
2334
|
+
/** Maximum agent-loop iterations before throwing (default: 10). */
|
|
2307
2335
|
maxIterations?: number;
|
|
2336
|
+
/** Return raw executor response without processing. */
|
|
2308
2337
|
raw?: boolean;
|
|
2338
|
+
/** Callback for agent loop events (token, tool_call, done, etc.). */
|
|
2309
2339
|
onEvent?: EventCallback;
|
|
2340
|
+
/** Abort signal for cancellation (§13.2). */
|
|
2310
2341
|
signal?: AbortSignal;
|
|
2342
|
+
/** Max character budget for context window trimming (§13.3). */
|
|
2311
2343
|
contextBudget?: number;
|
|
2344
|
+
/** Input/output/tool guardrails (§13.4). */
|
|
2312
2345
|
guardrails?: Guardrails;
|
|
2346
|
+
/** Steering queue for injecting messages mid-loop (§13.5). */
|
|
2313
2347
|
steering?: Steering;
|
|
2348
|
+
/** Allow parallel tool execution within a single round (§13.6). */
|
|
2314
2349
|
parallelToolCalls?: boolean;
|
|
2315
2350
|
}
|
|
2316
2351
|
/**
|
|
2317
|
-
*
|
|
2352
|
+
* One conversational turn: prepare messages from inputs, then either execute a
|
|
2353
|
+
* single LLM call or enter the agent loop (when tools are provided).
|
|
2318
2354
|
*
|
|
2319
|
-
*
|
|
2320
|
-
*
|
|
2355
|
+
* Trace structure (flat — no redundant wrappers):
|
|
2356
|
+
* ```
|
|
2357
|
+
* turn N
|
|
2358
|
+
* prepare → Renderer → Parser
|
|
2359
|
+
* Executor (each LLM call)
|
|
2360
|
+
* toolCalls → tool1, tool2 (if tools provided)
|
|
2361
|
+
* Executor (follow-up LLM call)
|
|
2362
|
+
* Processor (final result extraction)
|
|
2363
|
+
* ```
|
|
2321
2364
|
*
|
|
2322
2365
|
* @overload Untyped — returns `unknown`.
|
|
2323
2366
|
*/
|
|
2324
|
-
declare function
|
|
2367
|
+
declare function turn(prompt: string | Prompty, inputs: Record<string, unknown>, options?: TurnOptions): Promise<unknown>;
|
|
2325
2368
|
/**
|
|
2326
|
-
*
|
|
2369
|
+
* One conversational turn with typed result.
|
|
2327
2370
|
*
|
|
2328
|
-
* When a `validator` is provided
|
|
2329
|
-
*
|
|
2371
|
+
* When a `validator` is provided the final result is deserialized from JSON
|
|
2372
|
+
* and passed through the validator (e.g. a Zod `.parse` function).
|
|
2330
2373
|
*
|
|
2331
2374
|
* @overload Typed — returns `Promise<T>`.
|
|
2332
2375
|
*/
|
|
2333
|
-
declare function
|
|
2376
|
+
declare function turn<T>(prompt: string | Prompty, inputs: Record<string, unknown>, options: TurnOptions & {
|
|
2334
2377
|
validator: (data: unknown) => T;
|
|
2335
2378
|
}): Promise<T>;
|
|
2379
|
+
/**
|
|
2380
|
+
* Resolve tool bindings: inject values from parentInputs into tool arguments.
|
|
2381
|
+
*
|
|
2382
|
+
* For each binding on the matched tool, looks up `binding.input` in parentInputs
|
|
2383
|
+
* and sets `args[binding.name]` to that value. Returns a new args object.
|
|
2384
|
+
*/
|
|
2385
|
+
declare function resolveBindings(agent: Prompty, toolName: string, args: Record<string, unknown>, parentInputs?: Record<string, unknown>): Record<string, unknown>;
|
|
2386
|
+
/**
|
|
2387
|
+
* @deprecated Use {@link turn} with `tools` option instead.
|
|
2388
|
+
* Kept for backward compatibility — delegates to `turn()`.
|
|
2389
|
+
*/
|
|
2390
|
+
declare const invokeAgent: typeof turn;
|
|
2391
|
+
/** @deprecated Use {@link TurnOptions} instead. */
|
|
2392
|
+
type InvokeAgentOptions = TurnOptions;
|
|
2336
2393
|
|
|
2337
2394
|
/**
|
|
2338
2395
|
* §13.2 Cancellation — cooperative cancellation via AbortSignal.
|
|
@@ -2438,7 +2495,7 @@ declare function tool<T extends (...args: unknown[]) => unknown>(fn: T, options?
|
|
|
2438
2495
|
*
|
|
2439
2496
|
* @param agent - A loaded Prompty agent (has `.tools` property)
|
|
2440
2497
|
* @param tools - Array of `tool()`-wrapped functions
|
|
2441
|
-
* @returns Handler record suitable for `
|
|
2498
|
+
* @returns Handler record suitable for `turn(..., { tools: result })`
|
|
2442
2499
|
* @throws Error if a handler has no `__tool__` property or no matching declaration
|
|
2443
2500
|
*/
|
|
2444
2501
|
declare function bindTools(agent: {
|
|
@@ -2749,4 +2806,4 @@ interface OtelTracerOptions {
|
|
|
2749
2806
|
*/
|
|
2750
2807
|
declare function otelTracer(api: OtelApi, options?: OtelTracerOptions): TracerFactory;
|
|
2751
2808
|
|
|
2752
|
-
export { Prompty as AgentDefinition, type AgentEventType, AnonymousConnection, ApiKeyConnection, ArrayProperty, type AudioPart, Binding, CancelledError, Connection, type ContentPart, CustomTool, type EventCallback, type Executor, type FilePart, FormatConfig, FoundryConnection, FunctionTool, GuardrailError, type GuardrailResult, Guardrails, type GuardrailsOptions, type ImagePart, type InputGuardrail, type InvokeAgentOptions, InvokerError, LoadContext, McpApprovalMode, McpTool, Message, Model, ModelOptions, MustacheRenderer, NunjucksRenderer, OAuthConnection, ObjectProperty, OpenApiTool, type OtelApi, type OtelTracerOptions, type OutputGuardrail, type Parser, ParserConfig, type Processor, Prompty as PromptAgent, Prompty, PromptyChatParser, PromptyStream, PromptyTool, PromptyTracer, Property, RICH_KINDS, ROLES, ReferenceConnection, RemoteConnection, type Renderer, type Role, SaveContext, type SpanEmitter, Steering, type StructuredResult, StructuredResultSymbol, Template, type TextPart, ThreadMarker, Tool, type ToolCall, type ToolFunction, type ToolGuardrail, type ToolOptions, type ToolParameter, Tracer, type TracerBackend, type TracerFactory, bindTools, cast, checkCancellation, clearCache, clearConnections, consoleTracer, createStructuredResult, dictContentToPart, dictToMessage, emitEvent, estimateChars, getConnection, getExecutor, getParser, getProcessor, getRenderer, invoke, invokeAgent, isStructuredResult, load, otelTracer, parse, prepare, process, registerConnection, registerExecutor, registerParser, registerProcessor, registerRenderer, render, resolveBindings, run, sanitizeValue, summarizeDropped, text, textMessage, toSerializable, tool, trace, traceMethod, traceSpan, trimToContextWindow, validateInputs };
|
|
2809
|
+
export { Prompty as AgentDefinition, type AgentEventType, AnonymousConnection, ApiKeyConnection, ArrayProperty, type AudioPart, Binding, CancelledError, Connection, type ContentPart, CustomTool, type EventCallback, type Executor, type FilePart, FormatConfig, FoundryConnection, FunctionTool, GuardrailError, type GuardrailResult, Guardrails, type GuardrailsOptions, type ImagePart, type InputGuardrail, type InvokeAgentOptions, type InvokeOptions, InvokerError, LoadContext, McpApprovalMode, McpTool, Message, Model, ModelOptions, MustacheRenderer, NunjucksRenderer, OAuthConnection, ObjectProperty, OpenApiTool, type OtelApi, type OtelTracerOptions, type OutputGuardrail, type Parser, ParserConfig, type Processor, Prompty as PromptAgent, Prompty, PromptyChatParser, PromptyStream, PromptyTool, PromptyTracer, Property, RICH_KINDS, ROLES, ReferenceConnection, RemoteConnection, type Renderer, type Role, SaveContext, type SpanEmitter, Steering, type StructuredResult, StructuredResultSymbol, Template, type TextPart, ThreadMarker, Tool, type ToolCall, type ToolFunction, type ToolGuardrail, type ToolOptions, type ToolParameter, Tracer, type TracerBackend, type TracerFactory, type TurnOptions, bindTools, cast, checkCancellation, clearCache, clearConnections, consoleTracer, createStructuredResult, dictContentToPart, dictToMessage, emitEvent, estimateChars, getConnection, getExecutor, getParser, getProcessor, getRenderer, invoke, invokeAgent, isStructuredResult, load, otelTracer, parse, prepare, process, registerConnection, registerExecutor, registerParser, registerProcessor, registerRenderer, render, resolveBindings, run, sanitizeValue, summarizeDropped, text, textMessage, toSerializable, tool, trace, traceMethod, traceSpan, trimToContextWindow, turn, validateInputs };
|