Skip to navigation

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.

1

Check the installed version of the SDK

Note the version. You need it after the upgrade.

pip show twelvelabs
2

Upgrade the SDK

Install the latest version of the SDK:

pip install --upgrade twelvelabs
3

Update your code

Select the tab for your previous version of the SDK.

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.

Before:

Python
usage = response.usage
print(usage.input_tokens, usage.output_tokens)

After:

Python
billing = response.billing
print(billing.amount, billing.currency)

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 type field of ResponseOutputItem is a string. The SDK still exports ResponseOutputItemType with the values message, function_call, and function_call_output.
  • The type field of ResponseAnnotation is a string. The SDK still exports ResponseAnnotationType with the values video_citation, image_citation, and collection_citation. The platform also returns the url_citation value.
  • An output item with the jockey:web_search type contains the details of the search in the action field. The response stream includes the jockey:web_search.in_progress, jockey:web_search.searching, and jockey:web_search.completed events. The response contains these items and events only when the request sets the include parameter 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:

pip install --upgrade twelvelabs

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:

pip install --upgrade twelvelabs

For details, see the List knowledge store items page in the API Reference section, or the SDK reference for Python and Node.js.