From 2b8b60afe9e4cbb28dc6fbe66201c29d53bb60bc Mon Sep 17 00:00:00 2001 From: Kesku Date: Fri, 23 Jan 2026 19:43:50 -0800 Subject: [PATCH 1/3] feat(client): integrate output_text automatically in responses.create() --- src/resources/responses.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/resources/responses.ts b/src/resources/responses.ts index 3799927..08c86df 100644 --- a/src/resources/responses.ts +++ b/src/resources/responses.ts @@ -6,6 +6,7 @@ import * as Shared from './shared'; import { APIPromise } from '../core/api-promise'; import { Stream } from '../core/streaming'; import { RequestOptions } from '../internal/request-options'; +import { addOutputText } from '../lib/add-output-text'; export class Responses extends APIResource { /** @@ -28,9 +29,19 @@ export class Responses extends APIResource { body: ResponseCreateParams, options?: RequestOptions, ): APIPromise | APIPromise> { - return this._client.post('/v1/responses', { body, ...options, stream: body.stream ?? false }) as - | APIPromise - | APIPromise>; + const promise = this._client.post('/v1/responses', { body, ...options, stream: body.stream ?? false }); + + // For non-streaming responses, automatically add output_text property + if (!body.stream) { + return (promise as APIPromise)._thenUnwrap((rsp) => { + if ('object' in rsp && rsp.object === 'response') { + addOutputText(rsp as ResponseCreateResponse); + } + return rsp; + }) as APIPromise; + } + + return promise as APIPromise>; } } @@ -996,6 +1007,12 @@ export interface ResponseCreateResponse { error?: ErrorInfo; usage?: ResponsesUsage; + + /** + * Convenience property that aggregates all `output_text` items from the `output` list. + * If no `output_text` content blocks exist, then an empty string is returned. + */ + output_text?: string; } export type ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCreateParamsStreaming; From 9808062dc0acd80dd4b30280ac36ebc81402f5b7 Mon Sep 17 00:00:00 2001 From: Kesku Date: Fri, 23 Jan 2026 19:46:05 -0800 Subject: [PATCH 2/3] fix: remove trailing whitespace in responses.ts --- src/resources/responses.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/resources/responses.ts b/src/resources/responses.ts index 08c86df..734dd4a 100644 --- a/src/resources/responses.ts +++ b/src/resources/responses.ts @@ -30,7 +30,7 @@ export class Responses extends APIResource { options?: RequestOptions, ): APIPromise | APIPromise> { const promise = this._client.post('/v1/responses', { body, ...options, stream: body.stream ?? false }); - + // For non-streaming responses, automatically add output_text property if (!body.stream) { return (promise as APIPromise)._thenUnwrap((rsp) => { @@ -40,7 +40,7 @@ export class Responses extends APIResource { return rsp; }) as APIPromise; } - + return promise as APIPromise>; } } From eb79100eaa83d5c1e2be0ecaaa6a6ff22910cac6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 24 Jan 2026 03:46:27 +0000 Subject: [PATCH 3/3] release: 0.22.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d353515..788b0fa 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.21.0" + ".": "0.22.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 4797a2e..4bb4a9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.22.0 (2026-01-24) + +Full Changelog: [v0.21.0...v0.22.0](https://github.com/perplexityai/perplexity-node/compare/v0.21.0...v0.22.0) + +### Features + +* **client:** integrate output_text automatically in responses.create() ([2b8b60a](https://github.com/perplexityai/perplexity-node/commit/2b8b60afe9e4cbb28dc6fbe66201c29d53bb60bc)) + + +### Bug Fixes + +* remove trailing whitespace in responses.ts ([9808062](https://github.com/perplexityai/perplexity-node/commit/9808062dc0acd80dd4b30280ac36ebc81402f5b7)) + ## 0.21.0 (2026-01-24) Full Changelog: [v0.20.0...v0.21.0](https://github.com/perplexityai/perplexity-node/compare/v0.20.0...v0.21.0) diff --git a/package.json b/package.json index 5fd11bc..492ac00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@perplexity-ai/perplexity_ai", - "version": "0.21.0", + "version": "0.22.0", "description": "The official TypeScript library for the Perplexity API", "author": "Perplexity ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index bc95435..db66d33 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.21.0'; // x-release-please-version +export const VERSION = '0.22.0'; // x-release-please-version