Skip to content

Commit f6e7aef

Browse files
chore: generate
1 parent e269788 commit f6e7aef

2 files changed

Lines changed: 129 additions & 45 deletions

File tree

packages/sdk/openapi.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,6 +2420,9 @@
24202420
"type": "boolean"
24212421
}
24222422
},
2423+
"format": {
2424+
"$ref": "#/components/schemas/OutputFormat"
2425+
},
24232426
"system": {
24242427
"type": "string"
24252428
},
@@ -2796,6 +2799,9 @@
27962799
"type": "boolean"
27972800
}
27982801
},
2802+
"format": {
2803+
"$ref": "#/components/schemas/OutputFormat"
2804+
},
27992805
"system": {
28002806
"type": "string"
28012807
},
@@ -6073,6 +6079,52 @@
60736079
},
60746080
"required": ["type", "properties"]
60756081
},
6082+
"OutputFormatText": {
6083+
"type": "object",
6084+
"properties": {
6085+
"type": {
6086+
"type": "string",
6087+
"const": "text"
6088+
}
6089+
},
6090+
"required": ["type"]
6091+
},
6092+
"JSONSchema": {
6093+
"type": "object",
6094+
"propertyNames": {
6095+
"type": "string"
6096+
},
6097+
"additionalProperties": {}
6098+
},
6099+
"OutputFormatJsonSchema": {
6100+
"type": "object",
6101+
"properties": {
6102+
"type": {
6103+
"type": "string",
6104+
"const": "json_schema"
6105+
},
6106+
"schema": {
6107+
"$ref": "#/components/schemas/JSONSchema"
6108+
},
6109+
"retryCount": {
6110+
"default": 2,
6111+
"type": "integer",
6112+
"minimum": 0,
6113+
"maximum": 9007199254740991
6114+
}
6115+
},
6116+
"required": ["type", "schema"]
6117+
},
6118+
"OutputFormat": {
6119+
"anyOf": [
6120+
{
6121+
"$ref": "#/components/schemas/OutputFormatText"
6122+
},
6123+
{
6124+
"$ref": "#/components/schemas/OutputFormatJsonSchema"
6125+
}
6126+
]
6127+
},
60766128
"FileDiff": {
60776129
"type": "object",
60786130
"properties": {
@@ -6120,6 +6172,9 @@
61206172
},
61216173
"required": ["created"]
61226174
},
6175+
"format": {
6176+
"$ref": "#/components/schemas/OutputFormat"
6177+
},
61236178
"summary": {
61246179
"type": "object",
61256180
"properties": {
@@ -6245,6 +6300,28 @@
62456300
},
62466301
"required": ["name", "data"]
62476302
},
6303+
"StructuredOutputError": {
6304+
"type": "object",
6305+
"properties": {
6306+
"name": {
6307+
"type": "string",
6308+
"const": "StructuredOutputError"
6309+
},
6310+
"data": {
6311+
"type": "object",
6312+
"properties": {
6313+
"message": {
6314+
"type": "string"
6315+
},
6316+
"retries": {
6317+
"type": "number"
6318+
}
6319+
},
6320+
"required": ["message", "retries"]
6321+
}
6322+
},
6323+
"required": ["name", "data"]
6324+
},
62486325
"ContextOverflowError": {
62496326
"type": "object",
62506327
"properties": {
@@ -6352,6 +6429,9 @@
63526429
{
63536430
"$ref": "#/components/schemas/MessageAbortedError"
63546431
},
6432+
{
6433+
"$ref": "#/components/schemas/StructuredOutputError"
6434+
},
63556435
{
63566436
"$ref": "#/components/schemas/ContextOverflowError"
63576437
},
@@ -6423,6 +6503,7 @@
64236503
},
64246504
"required": ["input", "output", "reasoning", "cache"]
64256505
},
6506+
"structured": {},
64266507
"variant": {
64276508
"type": "string"
64286509
},
@@ -8128,6 +8209,9 @@
81288209
{
81298210
"$ref": "#/components/schemas/MessageAbortedError"
81308211
},
8212+
{
8213+
"$ref": "#/components/schemas/StructuredOutputError"
8214+
},
81318215
{
81328216
"$ref": "#/components/schemas/ContextOverflowError"
81338217
},

packages/web/src/content/docs/sdk.mdx

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -127,24 +127,24 @@ You can request structured JSON output from the model by specifying an `outputFo
127127
const result = await client.session.prompt({
128128
path: { id: sessionId },
129129
body: {
130-
parts: [{ type: 'text', text: 'Research Anthropic and provide company info' }],
130+
parts: [{ type: "text", text: "Research Anthropic and provide company info" }],
131131
outputFormat: {
132-
type: 'json_schema',
132+
type: "json_schema",
133133
schema: {
134-
type: 'object',
134+
type: "object",
135135
properties: {
136-
company: { type: 'string', description: 'Company name' },
137-
founded: { type: 'number', description: 'Year founded' },
136+
company: { type: "string", description: "Company name" },
137+
founded: { type: "number", description: "Year founded" },
138138
products: {
139-
type: 'array',
140-
items: { type: 'string' },
141-
description: 'Main products'
142-
}
139+
type: "array",
140+
items: { type: "string" },
141+
description: "Main products",
142+
},
143143
},
144-
required: ['company', 'founded']
145-
}
146-
}
147-
}
144+
required: ["company", "founded"],
145+
},
146+
},
147+
},
148148
})
149149

150150
// Access the structured output
@@ -154,29 +154,29 @@ console.log(result.data.info.structured_output)
154154

155155
### Output Format Types
156156

157-
| Type | Description |
158-
|------|-------------|
159-
| `text` | Default. Standard text response (no structured output) |
160-
| `json_schema` | Returns validated JSON matching the provided schema |
157+
| Type | Description |
158+
| ------------- | ------------------------------------------------------ |
159+
| `text` | Default. Standard text response (no structured output) |
160+
| `json_schema` | Returns validated JSON matching the provided schema |
161161

162162
### JSON Schema Format
163163

164164
When using `type: 'json_schema'`, provide:
165165

166-
| Field | Type | Description |
167-
|-------|------|-------------|
168-
| `type` | `'json_schema'` | Required. Specifies JSON schema mode |
169-
| `schema` | `object` | Required. JSON Schema object defining the output structure |
170-
| `retryCount` | `number` | Optional. Number of validation retries (default: 2) |
166+
| Field | Type | Description |
167+
| ------------ | --------------- | ---------------------------------------------------------- |
168+
| `type` | `'json_schema'` | Required. Specifies JSON schema mode |
169+
| `schema` | `object` | Required. JSON Schema object defining the output structure |
170+
| `retryCount` | `number` | Optional. Number of validation retries (default: 2) |
171171

172172
### Error Handling
173173

174174
If the model fails to produce valid structured output after all retries, the response will include a `StructuredOutputError`:
175175

176176
```typescript
177-
if (result.data.info.error?.name === 'StructuredOutputError') {
178-
console.error('Failed to produce structured output:', result.data.info.error.message)
179-
console.error('Attempts:', result.data.info.error.retries)
177+
if (result.data.info.error?.name === "StructuredOutputError") {
178+
console.error("Failed to produce structured output:", result.data.info.error.message)
179+
console.error("Attempts:", result.data.info.error.retries)
180180
}
181181
```
182182

@@ -298,27 +298,27 @@ const { providers, default: defaults } = await client.config.providers()
298298

299299
### Sessions
300300

301-
| Method | Description | Notes |
302-
| ---------------------------------------------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
303-
| `session.list()` | List sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
304-
| `session.get({ path })` | Get session | Returns <a href={typesUrl}><code>Session</code></a> |
305-
| `session.children({ path })` | List child sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
306-
| `session.create({ body })` | Create session | Returns <a href={typesUrl}><code>Session</code></a> |
307-
| `session.delete({ path })` | Delete session | Returns `boolean` |
308-
| `session.update({ path, body })` | Update session properties | Returns <a href={typesUrl}><code>Session</code></a> |
309-
| `session.init({ path, body })` | Analyze app and create `AGENTS.md` | Returns `boolean` |
310-
| `session.abort({ path })` | Abort a running session | Returns `boolean` |
311-
| `session.share({ path })` | Share session | Returns <a href={typesUrl}><code>Session</code></a> |
312-
| `session.unshare({ path })` | Unshare session | Returns <a href={typesUrl}><code>Session</code></a> |
313-
| `session.summarize({ path, body })` | Summarize session | Returns `boolean` |
314-
| `session.messages({ path })` | List messages in a session | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}[]` |
315-
| `session.message({ path })` | Get message details | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
301+
| Method | Description | Notes |
302+
| ---------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
303+
| `session.list()` | List sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
304+
| `session.get({ path })` | Get session | Returns <a href={typesUrl}><code>Session</code></a> |
305+
| `session.children({ path })` | List child sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
306+
| `session.create({ body })` | Create session | Returns <a href={typesUrl}><code>Session</code></a> |
307+
| `session.delete({ path })` | Delete session | Returns `boolean` |
308+
| `session.update({ path, body })` | Update session properties | Returns <a href={typesUrl}><code>Session</code></a> |
309+
| `session.init({ path, body })` | Analyze app and create `AGENTS.md` | Returns `boolean` |
310+
| `session.abort({ path })` | Abort a running session | Returns `boolean` |
311+
| `session.share({ path })` | Share session | Returns <a href={typesUrl}><code>Session</code></a> |
312+
| `session.unshare({ path })` | Unshare session | Returns <a href={typesUrl}><code>Session</code></a> |
313+
| `session.summarize({ path, body })` | Summarize session | Returns `boolean` |
314+
| `session.messages({ path })` | List messages in a session | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}[]` |
315+
| `session.message({ path })` | Get message details | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
316316
| `session.prompt({ path, body })` | Send prompt message | `body.noReply: true` returns UserMessage (context only). Default returns <a href={typesUrl}><code>AssistantMessage</code></a> with AI response. Supports `body.outputFormat` for [structured output](#structured-output) |
317-
| `session.command({ path, body })` | Send command to session | Returns `{ info: `<a href={typesUrl}><code>AssistantMessage</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
318-
| `session.shell({ path, body })` | Run a shell command | Returns <a href={typesUrl}><code>AssistantMessage</code></a> |
319-
| `session.revert({ path, body })` | Revert a message | Returns <a href={typesUrl}><code>Session</code></a> |
320-
| `session.unrevert({ path })` | Restore reverted messages | Returns <a href={typesUrl}><code>Session</code></a> |
321-
| `postSessionByIdPermissionsByPermissionId({ path, body })` | Respond to a permission request | Returns `boolean` |
317+
| `session.command({ path, body })` | Send command to session | Returns `{ info: `<a href={typesUrl}><code>AssistantMessage</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
318+
| `session.shell({ path, body })` | Run a shell command | Returns <a href={typesUrl}><code>AssistantMessage</code></a> |
319+
| `session.revert({ path, body })` | Revert a message | Returns <a href={typesUrl}><code>Session</code></a> |
320+
| `session.unrevert({ path })` | Restore reverted messages | Returns <a href={typesUrl}><code>Session</code></a> |
321+
| `postSessionByIdPermissionsByPermissionId({ path, body })` | Respond to a permission request | Returns `boolean` |
322322

323323
---
324324

0 commit comments

Comments
 (0)