@jaypie/llm 1.3.12 → 1.3.13

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.
@@ -106,6 +106,7 @@ type FireworksContentPart = {
106
106
  export declare class FireworksAdapter extends BaseProviderAdapter {
107
107
  readonly name: "fireworks";
108
108
  readonly defaultModel: string;
109
+ readonly supportsStructuredOutputRetry = true;
109
110
  private runtimeNoStructuredOutputModels;
110
111
  rememberModelRejectsStructuredOutput(model: string): void;
111
112
  clearRuntimeNoStructuredOutputModels(): void;
@@ -20,6 +20,12 @@ export interface ProviderAdapter {
20
20
  * Default model for this provider
21
21
  */
22
22
  readonly defaultModel: string;
23
+ /**
24
+ * Whether OperateLoop may take a corrective turn when a `format` request
25
+ * completes with prose instead of structured output (tool-emulation
26
+ * providers opt in).
27
+ */
28
+ readonly supportsStructuredOutputRetry?: boolean;
23
29
  /**
24
30
  * Build a provider-specific request from the standardized format
25
31
  *
@@ -169,6 +175,13 @@ export declare abstract class BaseProviderAdapter implements ProviderAdapter {
169
175
  abstract responseToHistoryItems(response: unknown): LlmHistory;
170
176
  abstract classifyError(error: unknown): ClassifiedError;
171
177
  abstract isComplete(response: unknown): boolean;
178
+ /**
179
+ * Whether OperateLoop may take a corrective turn when a `format` request
180
+ * completes with prose instead of structured output. Providers whose
181
+ * structured output rides a tool emulation (where compliance is a model
182
+ * decision) opt in; native grammar-constrained providers do not need it.
183
+ */
184
+ readonly supportsStructuredOutputRetry: boolean;
172
185
  /**
173
186
  * Default implementation checks if error is retryable via classifyError
174
187
  */
@@ -77,6 +77,13 @@ export interface OperateRequest {
77
77
  stream?: boolean;
78
78
  /** Sampling temperature (0-2 for most providers) */
79
79
  temperature?: number;
80
+ /**
81
+ * Set by OperateLoop on a corrective turn after a format request came back
82
+ * as prose. Adapters that support the retry (see
83
+ * `ProviderAdapter.supportsStructuredOutputRetry`) should offer only the
84
+ * structured-output mechanism on this turn.
85
+ */
86
+ structuredOutputRetry?: boolean;
80
87
  /** User identifier for tracking */
81
88
  user?: string;
82
89
  }
@@ -135,6 +142,8 @@ import type { ResponseBuilder } from "./response/ResponseBuilder.js";
135
142
  export interface OperateLoopState {
136
143
  /** Count of consecutive tool errors (resets on success) */
137
144
  consecutiveToolErrors: number;
145
+ /** Set when the loop has taken a corrective structured-output turn */
146
+ structuredOutputRetry?: boolean;
138
147
  /** Current conversation input/messages */
139
148
  currentInput: LlmHistory;
140
149
  /** Current turn number (0-indexed, incremented at start of each turn) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/llm",
3
- "version": "1.3.12",
3
+ "version": "1.3.13",
4
4
  "description": "Large language model utilities",
5
5
  "repository": {
6
6
  "type": "git",