> This page is for version v1.3 (default).
> For other versions, use one of these documentation indexes:
> - v1.3 (default): https://docs.twelvelabs.io/v1.3/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.twelvelabs.io/llms.txt.

## 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.

#### Check the installed version of the SDK

Note the version. You need it after the upgrade.

**`Python SDK`**

```sh Python SDK
pip show twelvelabs
```

**`Node.js SDK`**

```sh Node.js SDK
npm ls twelvelabs-js
```

#### Upgrade the SDK

Install the latest version of the SDK:

**`Python SDK`**

```sh Python SDK
pip install --upgrade twelvelabs
```

**`Node.js SDK`**

```sh Node.js SDK
npm install twelvelabs-js@latest
```

#### Update your code

Select the tab for your previous version of the SDK.

#### 1.3.6 or earlier

#### 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

**Before**:

**`Python`**

```python Python maxLines=12
usage = response.usage
print(usage.input_tokens, usage.output_tokens)
```

**After**:

**`Python`**

```python Python maxLines=12
billing = response.billing
print(billing.amount, billing.currency)
```

#### Node.js

**Before**:

**`Node.js`**

```javascript Node.js maxLines=12
const usage = response.usage;
console.log(usage?.inputTokens, usage?.outputTokens);
```

**After**:

**`Node.js`**

```javascript Node.js maxLines=12
const billing = response.billing;
console.log(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"]`.

#### 1.3.7

#### SDK type changes (breaking change)

**`ResponseOutputItem` is one type, not a union.** This change affects you if your code uses a variant of `ResponseOutputItem`. Use `ResponseOutputItem` instead, and read the `type` field to tell output items apart.

#### Python

The SDK no longer includes these types:

* `ResponseOutputItem_Message`
* `ResponseOutputItem_FunctionCall`
* `ResponseOutputItem_FunctionCallOutput`
* `ResponseOutputItem_JockeyWebSearch`

**Before**:

**`Python`**

```python Python maxLines=12
from twelvelabs import ResponseOutputItem_Message

for item in response.output:
    if isinstance(item, ResponseOutputItem_Message):
        print(item.content)
```

**After**:

**`Python`**

```python Python maxLines=12
for item in response.output:
    if item.type == "message":
        print(item.content)
```

#### Node.js

The SDK no longer includes these types:

* `ResponseOutputItem.Message`
* `ResponseOutputItem.FunctionCall`
* `ResponseOutputItem.FunctionCallOutput`
* `ResponseOutputItem.JockeyWebSearch`

**Before**:

**`Node.js`**

```typescript Node.js maxLines=12
import { TwelvelabsApi } from "twelvelabs-js";

function printMessage(item: TwelvelabsApi.ResponseOutputItem.Message) {
  console.log(item.content);
}
```

**After**:

**`Node.js`**

```typescript Node.js maxLines=12
import { TwelvelabsApi } from "twelvelabs-js";

function printMessage(item: TwelvelabsApi.ResponseOutputItem) {
  if (item.type === "message") {
    console.log(item.content);
  }
}
```

**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.

### More information

For details, see the [Create a response](/v1.3/api-reference/responses/create) page in the API Reference section, or the SDK reference for [Python](/v1.3/sdk-reference/python/responses) and [Node.js](/v1.3/sdk-reference/node-js/responses).

## 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:

**`Python SDK`**

```sh Python SDK
pip install --upgrade twelvelabs
```

**`Node.js SDK`**

```sh Node.js SDK
npm install twelvelabs-js@latest
```

For details, see the [List knowledge stores](/v1.3/api-reference/knowledge-stores/list) page in the API Reference section, or the SDK reference for [Python](/v1.3/sdk-reference/python/knowledge-stores#list-knowledge-stores) and [Node.js](/v1.3/sdk-reference/node-js/knowledge-stores#list-knowledge-stores).

## 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:

**`Python SDK`**

```sh Python SDK
pip install --upgrade twelvelabs
```

**`Node.js SDK`**

```sh Node.js SDK
npm install twelvelabs-js@latest
```

For details, see the [List knowledge store items](/v1.3/api-reference/knowledge-store-items/list) page in the API Reference section, or the SDK reference for [Python](/v1.3/sdk-reference/python/knowledge-store-items#list-knowledge-store-items) and [Node.js](/v1.3/sdk-reference/node-js/knowledge-store-items#list-knowledge-store-items).