Responses API types change in the 1.3.8 SDKs
Version 1.3.8 of the Python and Node.js SDKs changes the types for the Responses API. Upgrading can require changes to your code, depending on the version that you have installed. The API is unchanged. Follow these steps to upgrade.
Update your code
Select the tab for your previous version of the SDK.
1.3.6 or earlier
1.3.7
SDK type changes (breaking change)
The usage field is removed. This change affects you if your code reads the usage field or uses the ResponseUsage type. To find the cost of a response, read the billing field. It contains the amount and the currency. It does not contain token counts.
Python
Node.js
Before:
After:
The keepalive stream event type is removed. This change affects you if your code uses the ResponseStreamKeepAliveEvent type. Remove the code that handles it.
The status field of an output item is an optional string. This change affects you if your code reads the status field and assumes that it has a value.
Other SDK type changes
- The
typefield ofResponseOutputItemis a string. The SDK still exportsResponseOutputItemTypewith the valuesmessage,function_call, andfunction_call_output. - The
typefield ofResponseAnnotationis a string. The SDK still exportsResponseAnnotationTypewith the valuesvideo_citation,image_citation, andcollection_citation. The platform also returns theurl_citationvalue. - An output item with the
jockey:web_searchtype contains the details of the search in theactionfield. The response stream includes thejockey:web_search.in_progress,jockey:web_search.searching, andjockey:web_search.completedevents. The response contains these items and events only when the request sets theincludeparameter to["intermediate_outputs"].
More information
For details, see the Create a response page in the API Reference section, or the SDK reference for Python and Node.js.
Filter knowledge stores by asset
When you list knowledge stores, you can now filter them by asset. Use the asset_id parameter to pass the identifier of the asset. A knowledge store matches when it contains an item that uses the asset.
To use this feature, upgrade to the latest version of the Python or Node.js SDK:
For details, see the List knowledge stores page in the API Reference section, or the SDK reference for Python and Node.js.
Filter knowledge store items by asset
When you list the items in a knowledge store, you can now filter them by asset. Use the asset_id parameter to pass the identifiers of the assets. You can pass 1 to 50 identifiers. An item matches when it uses one of these assets.
To use this feature, upgrade to the latest version of the Python or Node.js SDK:
For details, see the List knowledge store items page in the API Reference section, or the SDK reference for Python and Node.js.