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/resources/responses.ts b/src/resources/responses.ts index 3799927..734dd4a 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; 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