Skip to content

Commit 2abef57

Browse files
committed
fix(responses): correct reasoning output type
1 parent 0b33959 commit 2abef57

File tree

2 files changed

+45
-87
lines changed

2 files changed

+45
-87
lines changed

api.md

+1
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ Types:
583583
- <code><a href="./src/resources/responses/responses.ts">ResponseOutputMessage</a></code>
584584
- <code><a href="./src/resources/responses/responses.ts">ResponseOutputRefusal</a></code>
585585
- <code><a href="./src/resources/responses/responses.ts">ResponseOutputText</a></code>
586+
- <code><a href="./src/resources/responses/responses.ts">ResponseReasoningItem</a></code>
586587
- <code><a href="./src/resources/responses/responses.ts">ResponseRefusalDeltaEvent</a></code>
587588
- <code><a href="./src/resources/responses/responses.ts">ResponseRefusalDoneEvent</a></code>
588589
- <code><a href="./src/resources/responses/responses.ts">ResponseStatus</a></code>

src/resources/responses/responses.ts

+44-87
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export type ParsedResponseOutputItem<ParsedT> =
3636
| ResponseFileSearchToolCall
3737
| ResponseFunctionWebSearch
3838
| ResponseComputerToolCall
39-
| ResponseOutputItem.Reasoning;
39+
| ResponseReasoningItem;
4040

4141
export interface ParsedResponse<ParsedT> extends Response {
4242
output: Array<ParsedResponseOutputItem<ParsedT>>;
@@ -1562,7 +1562,7 @@ export type ResponseInputItem =
15621562
| ResponseFunctionWebSearch
15631563
| ResponseFunctionToolCall
15641564
| ResponseInputItem.FunctionCallOutput
1565-
| ResponseInputItem.Reasoning
1565+
| ResponseReasoningItem
15661566
| ResponseInputItem.ItemReference;
15671567

15681568
export namespace ResponseInputItem {
@@ -1707,47 +1707,6 @@ export namespace ResponseInputItem {
17071707
status?: 'in_progress' | 'completed' | 'incomplete';
17081708
}
17091709

1710-
/**
1711-
* A description of the chain of thought used by a reasoning model while generating
1712-
* a response.
1713-
*/
1714-
export interface Reasoning {
1715-
/**
1716-
* The unique identifier of the reasoning content.
1717-
*/
1718-
id: string;
1719-
1720-
/**
1721-
* Reasoning text contents.
1722-
*/
1723-
content: Array<Reasoning.Content>;
1724-
1725-
/**
1726-
* The type of the object. Always `reasoning`.
1727-
*/
1728-
type: 'reasoning';
1729-
1730-
/**
1731-
* The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1732-
* Populated when items are returned via API.
1733-
*/
1734-
status?: 'in_progress' | 'completed' | 'incomplete';
1735-
}
1736-
1737-
export namespace Reasoning {
1738-
export interface Content {
1739-
/**
1740-
* A short summary of the reasoning used by the model when generating the response.
1741-
*/
1742-
text: string;
1743-
1744-
/**
1745-
* The type of the object. Always `text`.
1746-
*/
1747-
type: 'reasoning_summary';
1748-
}
1749-
}
1750-
17511710
/**
17521711
* An internal identifier for an item to reference.
17531712
*/
@@ -1814,50 +1773,7 @@ export type ResponseOutputItem =
18141773
| ResponseFunctionToolCall
18151774
| ResponseFunctionWebSearch
18161775
| ResponseComputerToolCall
1817-
| ResponseOutputItem.Reasoning;
1818-
1819-
export namespace ResponseOutputItem {
1820-
/**
1821-
* A description of the chain of thought used by a reasoning model while generating
1822-
* a response.
1823-
*/
1824-
export interface Reasoning {
1825-
/**
1826-
* The unique identifier of the reasoning content.
1827-
*/
1828-
id: string;
1829-
1830-
/**
1831-
* Reasoning text contents.
1832-
*/
1833-
content: Array<Reasoning.Content>;
1834-
1835-
/**
1836-
* The type of the object. Always `reasoning`.
1837-
*/
1838-
type: 'reasoning';
1839-
1840-
/**
1841-
* The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1842-
* Populated when items are returned via API.
1843-
*/
1844-
status?: 'in_progress' | 'completed' | 'incomplete';
1845-
}
1846-
1847-
export namespace Reasoning {
1848-
export interface Content {
1849-
/**
1850-
* A short summary of the reasoning used by the model when generating the response.
1851-
*/
1852-
text: string;
1853-
1854-
/**
1855-
* The type of the object. Always `text`.
1856-
*/
1857-
type: 'reasoning_summary';
1858-
}
1859-
}
1860-
}
1776+
| ResponseReasoningItem;
18611777

18621778
/**
18631779
* Emitted when a new output item is added.
@@ -2039,6 +1955,47 @@ export namespace ResponseOutputText {
20391955
}
20401956
}
20411957

1958+
/**
1959+
* A description of the chain of thought used by a reasoning model while generating
1960+
* a response.
1961+
*/
1962+
export interface ResponseReasoningItem {
1963+
/**
1964+
* The unique identifier of the reasoning content.
1965+
*/
1966+
id: string;
1967+
1968+
/**
1969+
* Reasoning text contents.
1970+
*/
1971+
summary: Array<ResponseReasoningItem.Summary>;
1972+
1973+
/**
1974+
* The type of the object. Always `reasoning`.
1975+
*/
1976+
type: 'reasoning';
1977+
1978+
/**
1979+
* The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1980+
* Populated when items are returned via API.
1981+
*/
1982+
status?: 'in_progress' | 'completed' | 'incomplete';
1983+
}
1984+
1985+
export namespace ResponseReasoningItem {
1986+
export interface Summary {
1987+
/**
1988+
* A short summary of the reasoning used by the model when generating the response.
1989+
*/
1990+
text: string;
1991+
1992+
/**
1993+
* The type of the object. Always `summary_text`.
1994+
*/
1995+
type: 'summary_text';
1996+
}
1997+
}
1998+
20421999
/**
20432000
* Emitted when there is a partial refusal text.
20442001
*/

0 commit comments

Comments
 (0)