chore: generate
parent
e269788a8f
commit
f6e7aefa72
|
|
@ -2420,6 +2420,9 @@
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"format": {
|
||||||
|
"$ref": "#/components/schemas/OutputFormat"
|
||||||
|
},
|
||||||
"system": {
|
"system": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
@ -2796,6 +2799,9 @@
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"format": {
|
||||||
|
"$ref": "#/components/schemas/OutputFormat"
|
||||||
|
},
|
||||||
"system": {
|
"system": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
@ -6073,6 +6079,52 @@
|
||||||
},
|
},
|
||||||
"required": ["type", "properties"]
|
"required": ["type", "properties"]
|
||||||
},
|
},
|
||||||
|
"OutputFormatText": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"const": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["type"]
|
||||||
|
},
|
||||||
|
"JSONSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"propertyNames": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"additionalProperties": {}
|
||||||
|
},
|
||||||
|
"OutputFormatJsonSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"const": "json_schema"
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/JSONSchema"
|
||||||
|
},
|
||||||
|
"retryCount": {
|
||||||
|
"default": 2,
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 9007199254740991
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["type", "schema"]
|
||||||
|
},
|
||||||
|
"OutputFormat": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/OutputFormatText"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/OutputFormatJsonSchema"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"FileDiff": {
|
"FileDiff": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
@ -6120,6 +6172,9 @@
|
||||||
},
|
},
|
||||||
"required": ["created"]
|
"required": ["created"]
|
||||||
},
|
},
|
||||||
|
"format": {
|
||||||
|
"$ref": "#/components/schemas/OutputFormat"
|
||||||
|
},
|
||||||
"summary": {
|
"summary": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
@ -6245,6 +6300,28 @@
|
||||||
},
|
},
|
||||||
"required": ["name", "data"]
|
"required": ["name", "data"]
|
||||||
},
|
},
|
||||||
|
"StructuredOutputError": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"const": "StructuredOutputError"
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"message": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"retries": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["message", "retries"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["name", "data"]
|
||||||
|
},
|
||||||
"ContextOverflowError": {
|
"ContextOverflowError": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
@ -6352,6 +6429,9 @@
|
||||||
{
|
{
|
||||||
"$ref": "#/components/schemas/MessageAbortedError"
|
"$ref": "#/components/schemas/MessageAbortedError"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/StructuredOutputError"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"$ref": "#/components/schemas/ContextOverflowError"
|
"$ref": "#/components/schemas/ContextOverflowError"
|
||||||
},
|
},
|
||||||
|
|
@ -6423,6 +6503,7 @@
|
||||||
},
|
},
|
||||||
"required": ["input", "output", "reasoning", "cache"]
|
"required": ["input", "output", "reasoning", "cache"]
|
||||||
},
|
},
|
||||||
|
"structured": {},
|
||||||
"variant": {
|
"variant": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
@ -8128,6 +8209,9 @@
|
||||||
{
|
{
|
||||||
"$ref": "#/components/schemas/MessageAbortedError"
|
"$ref": "#/components/schemas/MessageAbortedError"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/StructuredOutputError"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"$ref": "#/components/schemas/ContextOverflowError"
|
"$ref": "#/components/schemas/ContextOverflowError"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -127,24 +127,24 @@ You can request structured JSON output from the model by specifying an `outputFo
|
||||||
const result = await client.session.prompt({
|
const result = await client.session.prompt({
|
||||||
path: { id: sessionId },
|
path: { id: sessionId },
|
||||||
body: {
|
body: {
|
||||||
parts: [{ type: 'text', text: 'Research Anthropic and provide company info' }],
|
parts: [{ type: "text", text: "Research Anthropic and provide company info" }],
|
||||||
outputFormat: {
|
outputFormat: {
|
||||||
type: 'json_schema',
|
type: "json_schema",
|
||||||
schema: {
|
schema: {
|
||||||
type: 'object',
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
company: { type: 'string', description: 'Company name' },
|
company: { type: "string", description: "Company name" },
|
||||||
founded: { type: 'number', description: 'Year founded' },
|
founded: { type: "number", description: "Year founded" },
|
||||||
products: {
|
products: {
|
||||||
type: 'array',
|
type: "array",
|
||||||
items: { type: 'string' },
|
items: { type: "string" },
|
||||||
description: 'Main products'
|
description: "Main products",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
required: ['company', 'founded']
|
required: ["company", "founded"],
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// Access the structured output
|
// Access the structured output
|
||||||
|
|
@ -154,29 +154,29 @@ console.log(result.data.info.structured_output)
|
||||||
|
|
||||||
### Output Format Types
|
### Output Format Types
|
||||||
|
|
||||||
| Type | Description |
|
| Type | Description |
|
||||||
|------|-------------|
|
| ------------- | ------------------------------------------------------ |
|
||||||
| `text` | Default. Standard text response (no structured output) |
|
| `text` | Default. Standard text response (no structured output) |
|
||||||
| `json_schema` | Returns validated JSON matching the provided schema |
|
| `json_schema` | Returns validated JSON matching the provided schema |
|
||||||
|
|
||||||
### JSON Schema Format
|
### JSON Schema Format
|
||||||
|
|
||||||
When using `type: 'json_schema'`, provide:
|
When using `type: 'json_schema'`, provide:
|
||||||
|
|
||||||
| Field | Type | Description |
|
| Field | Type | Description |
|
||||||
|-------|------|-------------|
|
| ------------ | --------------- | ---------------------------------------------------------- |
|
||||||
| `type` | `'json_schema'` | Required. Specifies JSON schema mode |
|
| `type` | `'json_schema'` | Required. Specifies JSON schema mode |
|
||||||
| `schema` | `object` | Required. JSON Schema object defining the output structure |
|
| `schema` | `object` | Required. JSON Schema object defining the output structure |
|
||||||
| `retryCount` | `number` | Optional. Number of validation retries (default: 2) |
|
| `retryCount` | `number` | Optional. Number of validation retries (default: 2) |
|
||||||
|
|
||||||
### Error Handling
|
### Error Handling
|
||||||
|
|
||||||
If the model fails to produce valid structured output after all retries, the response will include a `StructuredOutputError`:
|
If the model fails to produce valid structured output after all retries, the response will include a `StructuredOutputError`:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
if (result.data.info.error?.name === 'StructuredOutputError') {
|
if (result.data.info.error?.name === "StructuredOutputError") {
|
||||||
console.error('Failed to produce structured output:', result.data.info.error.message)
|
console.error("Failed to produce structured output:", result.data.info.error.message)
|
||||||
console.error('Attempts:', result.data.info.error.retries)
|
console.error("Attempts:", result.data.info.error.retries)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -298,27 +298,27 @@ const { providers, default: defaults } = await client.config.providers()
|
||||||
|
|
||||||
### Sessions
|
### Sessions
|
||||||
|
|
||||||
| Method | Description | Notes |
|
| Method | Description | Notes |
|
||||||
| ---------------------------------------------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ---------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| `session.list()` | List sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
|
| `session.list()` | List sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
|
||||||
| `session.get({ path })` | Get session | Returns <a href={typesUrl}><code>Session</code></a> |
|
| `session.get({ path })` | Get session | Returns <a href={typesUrl}><code>Session</code></a> |
|
||||||
| `session.children({ path })` | List child sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
|
| `session.children({ path })` | List child sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
|
||||||
| `session.create({ body })` | Create session | Returns <a href={typesUrl}><code>Session</code></a> |
|
| `session.create({ body })` | Create session | Returns <a href={typesUrl}><code>Session</code></a> |
|
||||||
| `session.delete({ path })` | Delete session | Returns `boolean` |
|
| `session.delete({ path })` | Delete session | Returns `boolean` |
|
||||||
| `session.update({ path, body })` | Update session properties | Returns <a href={typesUrl}><code>Session</code></a> |
|
| `session.update({ path, body })` | Update session properties | Returns <a href={typesUrl}><code>Session</code></a> |
|
||||||
| `session.init({ path, body })` | Analyze app and create `AGENTS.md` | Returns `boolean` |
|
| `session.init({ path, body })` | Analyze app and create `AGENTS.md` | Returns `boolean` |
|
||||||
| `session.abort({ path })` | Abort a running session | Returns `boolean` |
|
| `session.abort({ path })` | Abort a running session | Returns `boolean` |
|
||||||
| `session.share({ path })` | Share session | Returns <a href={typesUrl}><code>Session</code></a> |
|
| `session.share({ path })` | Share session | Returns <a href={typesUrl}><code>Session</code></a> |
|
||||||
| `session.unshare({ path })` | Unshare session | Returns <a href={typesUrl}><code>Session</code></a> |
|
| `session.unshare({ path })` | Unshare session | Returns <a href={typesUrl}><code>Session</code></a> |
|
||||||
| `session.summarize({ path, body })` | Summarize session | Returns `boolean` |
|
| `session.summarize({ path, body })` | Summarize session | Returns `boolean` |
|
||||||
| `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>`}[]` |
|
| `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>`}[]` |
|
||||||
| `session.message({ path })` | Get message details | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
|
| `session.message({ path })` | Get message details | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
|
||||||
| `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) |
|
| `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) |
|
||||||
| `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>`}` |
|
| `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>`}` |
|
||||||
| `session.shell({ path, body })` | Run a shell command | Returns <a href={typesUrl}><code>AssistantMessage</code></a> |
|
| `session.shell({ path, body })` | Run a shell command | Returns <a href={typesUrl}><code>AssistantMessage</code></a> |
|
||||||
| `session.revert({ path, body })` | Revert a message | Returns <a href={typesUrl}><code>Session</code></a> |
|
| `session.revert({ path, body })` | Revert a message | Returns <a href={typesUrl}><code>Session</code></a> |
|
||||||
| `session.unrevert({ path })` | Restore reverted messages | Returns <a href={typesUrl}><code>Session</code></a> |
|
| `session.unrevert({ path })` | Restore reverted messages | Returns <a href={typesUrl}><code>Session</code></a> |
|
||||||
| `postSessionByIdPermissionsByPermissionId({ path, body })` | Respond to a permission request | Returns `boolean` |
|
| `postSessionByIdPermissionsByPermissionId({ path, body })` | Respond to a permission request | Returns `boolean` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue