Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.20.0"
".": "0.21.0"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

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

### Features

* **client:** add output_text helper function for responses ([c0d707f](https://github.com/perplexityai/perplexity-node/commit/c0d707fdf492964fd45721f171387b1528040028))

## 0.20.0 (2026-01-23)

Full Changelog: [v0.19.0...v0.20.0](https://github.com/perplexityai/perplexity-node/compare/v0.19.0...v0.20.0)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@perplexity-ai/perplexity_ai",
"version": "0.20.0",
"version": "0.21.0",
"description": "The official TypeScript library for the Perplexity API",
"author": "Perplexity <api@perplexity.ai>",
"types": "dist/index.d.ts",
Expand Down
41 changes: 41 additions & 0 deletions src/lib/add-output-text.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Custom code that persists through Stainless regeneration.
// This adds the output_text convenience property to Response objects,

/**
* Response interface with output_text property added.
* This will match the ResponseCreateResponse type once generated.
*/
interface Response {
object: 'response';
output: Array<{
type: string;
content?: Array<{
type: string;
text?: string;
}>;
}>;
output_text?: string;
}

/**
* Adds the output_text convenience property to a Response object.
* Aggregates all output_text items from the output list.
*
* If no output_text content blocks exist, then an empty string is set.
*
* This mutates the response object in place, matching OpenAI's Node SDK pattern.
*/
export function addOutputText(rsp: Response): void {
const texts: string[] = [];
for (const output of rsp.output) {
if (output.type !== 'message') {
continue;
}
for (const content of output.content || []) {
if (content.type === 'output_text' && content.text) {
texts.push(content.text);
}
}
}
rsp.output_text = texts.join('');
}
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.20.0'; // x-release-please-version
export const VERSION = '0.21.0'; // x-release-please-version