diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 64f3cdd..76d5538 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.8.0" + ".": "0.9.0" } diff --git a/.stats.yml b/.stats.yml index eb05b46..b8499aa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 5 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai%2Fperplexity-aba0c21c569842e93e17b69cae9cee58d389fce9c2482f4d251fd8727db05679.yml -openapi_spec_hash: 3d01b1c1425f7d43a8acf8b99bb9b321 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai%2Fperplexity-51a3b755ae8040a6baeff490b3226a94c02a71aca6c4754dd365d7d0de8e399d.yml +openapi_spec_hash: 03d28237de381a5b914ef738b3587bb5 config_hash: 0be7520657a7a0fb6b5a839e716fe30c diff --git a/CHANGELOG.md b/CHANGELOG.md index 1db148d..a2eb245 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.9.0 (2025-10-08) + +Full Changelog: [v0.8.0...v0.9.0](https://github.com/perplexityai/perplexity-node/compare/v0.8.0...v0.9.0) + +### Features + +* **api:** manual updates ([d17785c](https://github.com/perplexityai/perplexity-node/commit/d17785c3ec2ec4bf22d0719da119f13db8c8c0fd)) + + +### Chores + +* **internal:** use npm pack for build uploads ([b2d7e82](https://github.com/perplexityai/perplexity-node/commit/b2d7e82ea8ac19c91e8b675230ffc81c73915f21)) +* **jsdoc:** fix [@link](https://github.com/link) annotations to refer only to parts of the packageā€˜s public interface ([657927d](https://github.com/perplexityai/perplexity-node/commit/657927d9f2a0b50f8fd93ec68ee7f2b1c35e7845)) + ## 0.8.0 (2025-10-02) Full Changelog: [v0.7.1...v0.8.0](https://github.com/perplexityai/perplexity-node/compare/v0.7.1...v0.8.0) diff --git a/package.json b/package.json index 6bc9cf3..41aa538 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@perplexity-ai/perplexity_ai", - "version": "0.8.0", + "version": "0.9.0", "description": "The official TypeScript library for the Perplexity API", "author": "Perplexity <>", "types": "dist/index.d.ts", diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index 0ec7b7b..6f2be6f 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -12,9 +12,11 @@ if [[ "$SIGNED_URL" == "null" ]]; then exit 1 fi -UPLOAD_RESPONSE=$(tar "${BASE_PATH:+-C$BASE_PATH}" -cz "${ARTIFACT_PATH:-dist}" | curl -v -X PUT \ +TARBALL=$(cd dist && npm pack --silent) + +UPLOAD_RESPONSE=$(curl -v -X PUT \ -H "Content-Type: application/gzip" \ - --data-binary @- "$SIGNED_URL" 2>&1) + --data-binary "@dist/$TARBALL" "$SIGNED_URL" 2>&1) if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" diff --git a/src/internal/to-file.ts b/src/internal/to-file.ts index 245e849..30eada3 100644 --- a/src/internal/to-file.ts +++ b/src/internal/to-file.ts @@ -73,7 +73,7 @@ export type ToFileInput = /** * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats - * @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s + * @param value the raw content of the file. Can be an {@link Uploadable}, BlobLikePart, or AsyncIterable of BlobLikeParts * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible * @param {Object=} options additional properties * @param {string=} options.type the MIME type of the content diff --git a/src/resources/async/chat/completions.ts b/src/resources/async/chat/completions.ts index 5e3dfda..7e8b4cd 100644 --- a/src/resources/async/chat/completions.ts +++ b/src/resources/async/chat/completions.ts @@ -10,24 +10,21 @@ import { path } from '../../../internal/utils/path'; export class Completions extends APIResource { /** - * FastAPI wrapper around async chat completions - * - * This endpoint creates an asynchronous chat completion job and returns a job ID - * that can be used to poll for results. + * Submit an asynchronous chat completion request. */ create(body: CompletionCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/async/chat/completions', { body, ...options }); } /** - * list all async chat completion requests for a given user. + * Retrieve a list of all asynchronous chat completion requests for a given user. */ list(options?: RequestOptions): APIPromise { return this._client.get('/async/chat/completions', options); } /** - * get the response for a given async chat completion request. + * Retrieve the response for a given asynchronous chat completion request. */ get( apiRequest: string, @@ -37,6 +34,7 @@ export class Completions extends APIResource { const { 'x-client-env': xClientEnv, 'x-client-name': xClientName, + 'x-created-at-epoch-seconds': xCreatedAtEpochSeconds, 'x-request-time': xRequestTime, 'x-usage-tier': xUsageTier, 'x-user-id': xUserID, @@ -49,6 +47,9 @@ export class Completions extends APIResource { { ...(xClientEnv != null ? { 'x-client-env': xClientEnv } : undefined), ...(xClientName != null ? { 'x-client-name': xClientName } : undefined), + ...(xCreatedAtEpochSeconds != null ? + { 'x-created-at-epoch-seconds': xCreatedAtEpochSeconds } + : undefined), ...(xRequestTime != null ? { 'x-request-time': xRequestTime } : undefined), ...(xUsageTier != null ? { 'x-usage-tier': xUsageTier } : undefined), ...(xUserID != null ? { 'x-user-id': xUserID } : undefined), @@ -176,6 +177,8 @@ export namespace CompletionCreateParams { image_format_filter?: Array | null; + language_preference?: string | null; + last_updated_after_filter?: string | null; last_updated_before_filter?: string | null; @@ -234,8 +237,12 @@ export namespace CompletionCreateParams { stream?: boolean | null; + stream_mode?: 'full' | 'concise'; + temperature?: number | null; + thread_id?: string | null; + tool_choice?: 'none' | 'auto' | 'required' | null; tools?: Array | null; @@ -250,6 +257,8 @@ export namespace CompletionCreateParams { updated_before_timestamp?: number | null; + use_threads?: boolean | null; + web_search_options?: Request.WebSearchOptions; } @@ -335,7 +344,7 @@ export namespace CompletionCreateParams { search_context_size?: 'low' | 'medium' | 'high'; - search_type?: 'fast' | 'pro' | 'auto'; + search_type?: 'fast' | 'pro' | 'auto' | null; user_location?: WebSearchOptions.UserLocation | null; } @@ -372,6 +381,11 @@ export interface CompletionGetParams { */ 'x-client-name'?: string; + /** + * Header param: + */ + 'x-created-at-epoch-seconds'?: string; + /** * Header param: */ diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 753ea43..952dc2e 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -23,8 +23,6 @@ export interface StreamChunk { model: string; - usage: Shared.UsageInfo; - citations?: Array | null; object?: string; @@ -34,6 +32,8 @@ export interface StreamChunk { status?: 'PENDING' | 'COMPLETED' | null; type?: 'message' | 'info' | 'end_of_stream' | null; + + usage?: Shared.UsageInfo | null; } Chat.Completions = Completions; diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 99285d9..3b71f44 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -10,7 +10,7 @@ import { RequestOptions } from '../../internal/request-options'; export class Completions extends APIResource { /** - * FastAPI wrapper around chat completions + * Generate a chat completion response for the given conversation. */ create(body: CompletionCreateParamsNonStreaming, options?: RequestOptions): APIPromise; create( @@ -70,6 +70,8 @@ export interface CompletionCreateParamsBase { image_format_filter?: Array | null; + language_preference?: string | null; + last_updated_after_filter?: string | null; last_updated_before_filter?: string | null; @@ -128,8 +130,12 @@ export interface CompletionCreateParamsBase { stream?: boolean | null; + stream_mode?: 'full' | 'concise'; + temperature?: number | null; + thread_id?: string | null; + tool_choice?: 'none' | 'auto' | 'required' | null; tools?: Array | null; @@ -144,6 +150,8 @@ export interface CompletionCreateParamsBase { updated_before_timestamp?: number | null; + use_threads?: boolean | null; + web_search_options?: CompletionCreateParams.WebSearchOptions; } @@ -229,7 +237,7 @@ export namespace CompletionCreateParams { search_context_size?: 'low' | 'medium' | 'high'; - search_type?: 'fast' | 'pro' | 'auto'; + search_type?: 'fast' | 'pro' | 'auto' | null; user_location?: WebSearchOptions.UserLocation | null; } diff --git a/src/resources/search.ts b/src/resources/search.ts index ba0c53c..6ebea94 100644 --- a/src/resources/search.ts +++ b/src/resources/search.ts @@ -6,7 +6,7 @@ import { RequestOptions } from '../internal/request-options'; export class Search extends APIResource { /** - * Search + * Search the web and retrieve relevant web page contents. */ create(body: SearchCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/search', { body, ...options }); @@ -17,6 +17,8 @@ export interface SearchCreateResponse { id: string; results: Array; + + server_time?: string | null; } export namespace SearchCreateResponse { @@ -36,7 +38,7 @@ export namespace SearchCreateResponse { export interface SearchCreateParams { query: string | Array; - country?: string | null; + display_server_time?: boolean; max_results?: number; diff --git a/src/resources/shared.ts b/src/resources/shared.ts index cc94618..7ffd25c 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -12,6 +12,8 @@ export interface APIPublicSearchResult { last_updated?: string | null; snippet?: string; + + source?: 'web' | 'attachment'; } export interface ChatMessageInput { diff --git a/src/version.ts b/src/version.ts index 23f967c..5c16194 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.8.0'; // x-release-please-version +export const VERSION = '0.9.0'; // x-release-please-version diff --git a/tests/api-resources/async/chat/completions.test.ts b/tests/api-resources/async/chat/completions.test.ts index 2122819..2a67f62 100644 --- a/tests/api-resources/async/chat/completions.test.ts +++ b/tests/api-resources/async/chat/completions.test.ts @@ -46,6 +46,7 @@ describe('resource completions', () => { date: 'date', last_updated: 'last_updated', snippet: 'snippet', + source: 'web', }, ], }, @@ -59,6 +60,7 @@ describe('resource completions', () => { date: 'date', last_updated: 'last_updated', snippet: 'snippet', + source: 'web', }, ], }, @@ -87,6 +89,7 @@ describe('resource completions', () => { has_image_url: true, image_domain_filter: ['string'], image_format_filter: ['string'], + language_preference: 'language_preference', last_updated_after_filter: 'last_updated_after_filter', last_updated_before_filter: 'last_updated_before_filter', latitude: 0, @@ -114,7 +117,9 @@ describe('resource completions', () => { search_tenant: 'search_tenant', stop: 'string', stream: true, + stream_mode: 'full', temperature: 0, + thread_id: 'thread_id', tool_choice: 'none', tools: [ { @@ -137,6 +142,7 @@ describe('resource completions', () => { top_p: 0, updated_after_timestamp: 0, updated_before_timestamp: 0, + use_threads: true, web_search_options: { image_results_enhanced_relevance: true, search_context_size: 'low', @@ -182,6 +188,7 @@ describe('resource completions', () => { local_mode: true, 'x-client-env': 'x-client-env', 'x-client-name': 'x-client-name', + 'x-created-at-epoch-seconds': 'x-created-at-epoch-seconds', 'x-request-time': 'x-request-time', 'x-usage-tier': 'x-usage-tier', 'x-user-id': 'x-user-id', diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index 0aaeac1..350ef7b 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -46,6 +46,7 @@ describe('resource completions', () => { date: 'date', last_updated: 'last_updated', snippet: 'snippet', + source: 'web', }, ], }, @@ -59,6 +60,7 @@ describe('resource completions', () => { date: 'date', last_updated: 'last_updated', snippet: 'snippet', + source: 'web', }, ], }, @@ -87,6 +89,7 @@ describe('resource completions', () => { has_image_url: true, image_domain_filter: ['string'], image_format_filter: ['string'], + language_preference: 'language_preference', last_updated_after_filter: 'last_updated_after_filter', last_updated_before_filter: 'last_updated_before_filter', latitude: 0, @@ -114,7 +117,9 @@ describe('resource completions', () => { search_tenant: 'search_tenant', stop: 'string', stream: false, + stream_mode: 'full', temperature: 0, + thread_id: 'thread_id', tool_choice: 'none', tools: [ { @@ -137,6 +142,7 @@ describe('resource completions', () => { top_p: 0, updated_after_timestamp: 0, updated_before_timestamp: 0, + use_threads: true, web_search_options: { image_results_enhanced_relevance: true, search_context_size: 'low', diff --git a/tests/api-resources/search.test.ts b/tests/api-resources/search.test.ts index 212ceaa..a3a2a2f 100644 --- a/tests/api-resources/search.test.ts +++ b/tests/api-resources/search.test.ts @@ -24,7 +24,7 @@ describe('resource search', () => { test.skip('create: required and optional params', async () => { const response = await client.search.create({ query: 'string', - country: 'country', + display_server_time: true, max_results: 0, max_tokens: 0, max_tokens_per_page: 0,