@perplexity-ai/perplexity_ai 0.42.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.43.0](https://github.com/perplexityai/perplexity-node/compare/v0.42.0...v0.43.0) (2026-11-18)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** add context resource ([aa66ec6](https://github.com/perplexityai/perplexity-node/commit/aa66ec6cc8b473d3b73b4ff1889c632c00b10e4d))
9
+
3
10
  ## [0.42.0](https://github.com/perplexityai/perplexity-node/compare/v0.41.0...v0.42.0) (2026-11-17)
4
11
 
5
12
 
@@ -558,6 +558,104 @@ export type ContentPartOutput = {
558
558
  };
559
559
  export type ContentPartTypeInput = "output_text";
560
560
  export type ContentPartTypeOutput = "output_text";
561
+ export type ContextCostInput = {
562
+ currency: ContextCurrencyInput;
563
+ total_cost: number;
564
+ };
565
+ export type ContextCostOutput = {
566
+ currency: ContextCurrencyOutput;
567
+ total_cost: number;
568
+ };
569
+ export type ContextCurrencyInput = "USD";
570
+ export type ContextCurrencyOutput = "USD";
571
+ export type ContextDocumentInput = {
572
+ highlights?: string;
573
+ html?: string;
574
+ links?: string[];
575
+ markdown?: string;
576
+ metadata?: ContextMetadataInput;
577
+ status: ContextStatusInput;
578
+ url: string;
579
+ };
580
+ export type ContextDocumentOutput = {
581
+ highlights?: string;
582
+ html?: string;
583
+ links?: string[];
584
+ markdown?: string;
585
+ metadata?: ContextMetadataOutput;
586
+ status: ContextStatusOutput;
587
+ url: string;
588
+ };
589
+ export type ContextHighlightsInput = {
590
+ max_tokens_per_url?: number;
591
+ query: string;
592
+ };
593
+ export type ContextHighlightsOutput = {
594
+ max_tokens_per_url?: number;
595
+ query: string;
596
+ };
597
+ export type ContextMetadataInput = {
598
+ author?: string;
599
+ content_type?: string;
600
+ description?: string;
601
+ fetched_at?: string;
602
+ language?: string;
603
+ last_modified?: string;
604
+ origin?: "cached" | "live";
605
+ published_date?: string;
606
+ source_url: string;
607
+ title?: string;
608
+ } & Record<string, (string | string[]) | string | string | string | string | string | string | ("cached" | "live") | string | string | string>;
609
+ export type ContextMetadataOutput = {
610
+ author?: string;
611
+ content_type?: string;
612
+ description?: string;
613
+ fetched_at?: string;
614
+ language?: string;
615
+ last_modified?: string;
616
+ origin?: "cached" | "live";
617
+ published_date?: string;
618
+ source_url: string;
619
+ title?: string;
620
+ } & Record<string, (string | string[]) | string | string | string | string | string | string | ("cached" | "live") | string | string | string>;
621
+ export type ContextRequestInput = {
622
+ cache_only?: boolean;
623
+ formats?: ("markdown" | "html" | "links" | "highlights")[];
624
+ highlights?: ContextHighlightsInput;
625
+ if_modified_since?: string;
626
+ max_age_seconds?: number;
627
+ timeout_ms?: number;
628
+ urls: string[];
629
+ };
630
+ export type ContextRequestOutput = {
631
+ cache_only?: boolean;
632
+ formats?: ("markdown" | "html" | "links" | "highlights")[];
633
+ highlights?: ContextHighlightsOutput;
634
+ if_modified_since?: string;
635
+ max_age_seconds?: number;
636
+ timeout_ms?: number;
637
+ urls: string[];
638
+ };
639
+ export type ContextResponseInput = {
640
+ request_id: string;
641
+ results: ContextDocumentInput[];
642
+ usage: ContextUsageInput;
643
+ };
644
+ export type ContextResponseOutput = {
645
+ request_id: string;
646
+ results: ContextDocumentOutput[];
647
+ usage: ContextUsageOutput;
648
+ };
649
+ export type ContextStatusInput = {
650
+ message?: string;
651
+ status_code?: number;
652
+ type: "ok" | "not_modified" | "invalid_url" | "blocked" | "bot_challenge" | "crawl_failed" | "crawl_timeout" | "no_text" | "no_content" | "internal_error";
653
+ };
654
+ export type ContextStatusOutput = {
655
+ message?: string;
656
+ status_code?: number;
657
+ type: "ok" | "not_modified" | "invalid_url" | "blocked" | "bot_challenge" | "crawl_failed" | "crawl_timeout" | "no_text" | "no_content" | "internal_error";
658
+ };
561
659
  export type ContextualizedEmbeddingObjectInput = {
562
660
  data?: EmbeddingObjectInput[];
563
661
  index?: number;
@@ -592,6 +690,14 @@ export type ContextualizedEmbeddingsResponseOutput = {
592
690
  object?: string;
593
691
  usage?: EmbeddingsUsageOutput;
594
692
  };
693
+ export type ContextUsageInput = {
694
+ cost: ContextCostInput;
695
+ fetched_urls: number;
696
+ };
697
+ export type ContextUsageOutput = {
698
+ cost: ContextCostOutput;
699
+ fetched_urls: number;
700
+ };
595
701
  export type CostInput = {
596
702
  citation_tokens_cost?: number | null;
597
703
  input_tokens_cost: number;
@@ -2242,6 +2348,7 @@ export type ResponsesObjectTypeInput = "response";
2242
2348
  export type ResponsesObjectTypeOutput = "response";
2243
2349
  export type ResponsesRequestInput = {
2244
2350
  background?: boolean | null;
2351
+ code_mode?: boolean;
2245
2352
  effort?: string;
2246
2353
  input: InputInput;
2247
2354
  instructions?: string;
@@ -2269,6 +2376,7 @@ export type ResponsesRequestInput = {
2269
2376
  };
2270
2377
  export type ResponsesRequestOutput = {
2271
2378
  background?: boolean | null;
2379
+ code_mode?: boolean;
2272
2380
  effort?: string;
2273
2381
  input: InputOutput;
2274
2382
  instructions?: string;
@@ -2983,6 +3091,11 @@ export declare class ChatResource {
2983
3091
  readonly completions: ChatCompletionsResource;
2984
3092
  constructor(client: SdkTransport);
2985
3093
  }
3094
+ export declare class ContextResource {
3095
+ private readonly _client;
3096
+ constructor(client: SdkTransport);
3097
+ create(body: ContextRequestInput, options?: RequestOptions): APIPromise<ContextResponseOutput>;
3098
+ }
2986
3099
  export declare class ContextualizedEmbeddingsResource {
2987
3100
  private readonly _client;
2988
3101
  constructor(client: SdkTransport);
@@ -3126,6 +3239,7 @@ export declare class PerplexitySdk {
3126
3239
  readonly batches: BatchesResource;
3127
3240
  readonly browser: BrowserResource;
3128
3241
  readonly chat: ChatResource;
3242
+ readonly context: ContextResource;
3129
3243
  readonly contextualizedEmbeddings: ContextualizedEmbeddingsResource;
3130
3244
  readonly decisions: DecisionsResource;
3131
3245
  readonly embeddings: EmbeddingsResource;
@@ -3145,6 +3259,8 @@ export declare class Browser extends BrowserResource {
3145
3259
  }
3146
3260
  export declare class Chat extends ChatResource {
3147
3261
  }
3262
+ export declare class Context extends ContextResource {
3263
+ }
3148
3264
  export declare class ContextualizedEmbeddings extends ContextualizedEmbeddingsResource {
3149
3265
  }
3150
3266
  export declare class Decisions extends DecisionsResource {
@@ -3173,6 +3289,11 @@ export type ChatMessageInput = ChatMessageInputInput;
3173
3289
  export type ChatMessageOutput = ChatMessageOutputOutput;
3174
3290
  export type Choice = ChoiceOutput;
3175
3291
  export type ContentPart = ContentPartOutput;
3292
+ export type ContextCreateParams = ContextRequestInput;
3293
+ export type ContextCreateResponse = Awaited<ReturnType<ContextResource["create"]>>;
3294
+ export type ContextDocument = ContextDocumentOutput;
3295
+ export type ContextMetadata = ContextMetadataOutput;
3296
+ export type ContextStatus = ContextStatusOutput;
3176
3297
  export type ContextualizedEmbeddingCreateParams = ContextualizedEmbeddingsRequestInput;
3177
3298
  export type ContextualizedEmbeddingCreateResponse = ContextualizedEmbeddingsResponseOutput;
3178
3299
  export type ContextualizedEmbeddingObject = ContextualizedEmbeddingObjectOutput;
@@ -3293,6 +3414,13 @@ export declare namespace Chat {
3293
3414
  };
3294
3415
  }
3295
3416
  }
3417
+ export declare namespace Context {
3418
+ type ContextCreateParams = ContextRequestInput;
3419
+ type ContextCreateResponse = Awaited<ReturnType<ContextResource["create"]>>;
3420
+ type ContextDocument = ContextDocumentOutput;
3421
+ type ContextMetadata = ContextMetadataOutput;
3422
+ type ContextStatus = ContextStatusOutput;
3423
+ }
3296
3424
  export declare namespace ContextualizedEmbeddings {
3297
3425
  type ContextualizedEmbeddingCreateParams = ContextualizedEmbeddingsRequestInput;
3298
3426
  type ContextualizedEmbeddingCreateResponse = ContextualizedEmbeddingsResponseOutput;