@perplexity-ai/perplexity_ai 0.38.8 → 0.39.1

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/generated/api.d.ts +367 -3
  3. package/dist/generated/api.d.ts.map +1 -1
  4. package/dist/generated/api.js +145 -18
  5. package/dist/generated/api.js.map +1 -1
  6. package/dist/generated/runtime.d.ts +7 -0
  7. package/dist/generated/runtime.d.ts.map +1 -1
  8. package/dist/generated/runtime.js +113 -0
  9. package/dist/generated/runtime.js.map +1 -1
  10. package/dist/resources/client.d.ts +21 -0
  11. package/dist/resources/client.d.ts.map +1 -1
  12. package/dist/resources/client.js +8 -2
  13. package/dist/resources/client.js.map +1 -1
  14. package/dist/resources/decisions.d.ts +7 -0
  15. package/dist/resources/decisions.d.ts.map +1 -0
  16. package/dist/resources/decisions.js +3 -0
  17. package/dist/resources/decisions.js.map +1 -0
  18. package/dist/resources/index.d.ts +3 -0
  19. package/dist/resources/index.d.ts.map +1 -1
  20. package/dist/resources/index.js +3 -0
  21. package/dist/resources/index.js.map +1 -1
  22. package/dist/resources/models.d.ts +5 -0
  23. package/dist/resources/models.d.ts.map +1 -0
  24. package/dist/resources/models.js +3 -0
  25. package/dist/resources/models.js.map +1 -0
  26. package/dist/resources/shared.d.ts +12 -0
  27. package/dist/resources/shared.d.ts.map +1 -1
  28. package/dist/resources/skills/index.d.ts +3 -0
  29. package/dist/resources/skills/index.d.ts.map +1 -0
  30. package/dist/resources/skills/index.js +3 -0
  31. package/dist/resources/skills/index.js.map +1 -0
  32. package/dist/resources/skills/revisions.d.ts +5 -0
  33. package/dist/resources/skills/revisions.d.ts.map +1 -0
  34. package/dist/resources/skills/revisions.js +3 -0
  35. package/dist/resources/skills/revisions.js.map +1 -0
  36. package/dist/resources/skills/skills.d.ts +9 -0
  37. package/dist/resources/skills/skills.d.ts.map +1 -0
  38. package/dist/resources/skills/skills.js +3 -0
  39. package/dist/resources/skills/skills.js.map +1 -0
  40. package/dist/resources/skills.d.ts +2 -0
  41. package/dist/resources/skills.d.ts.map +1 -0
  42. package/dist/resources/skills.js +2 -0
  43. package/dist/resources/skills.js.map +1 -0
  44. package/dist/version.d.ts +1 -1
  45. package/dist/version.js +1 -1
  46. package/package.json +1 -1
  47. package/src/generated/api.ts +487 -25
  48. package/src/generated/runtime.ts +129 -0
  49. package/src/resources/client.ts +26 -2
  50. package/src/resources/decisions.ts +6 -0
  51. package/src/resources/index.ts +3 -0
  52. package/src/resources/models.ts +4 -0
  53. package/src/resources/shared.ts +12 -0
  54. package/src/resources/skills/index.ts +2 -0
  55. package/src/resources/skills/revisions.ts +4 -0
  56. package/src/resources/skills/skills.ts +8 -0
  57. package/src/resources/skills.ts +1 -0
  58. package/src/version.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { addOutputText, normalizeHeaders } from "./runtime.js";
1
+ import { addOutputText, legacyQuery, legacyRequestOptions, ownBoolean, ownCursor, ownParameter, normalizeHeaders, multipartBody, pathSegment } from "./runtime.js";
2
2
  import type { APIPromise, RequestOptions, SdkTransport, Stream } from "./runtime.js";
3
3
  export type { APIPromise, HeaderValue, HeadersLike, RequestOptions, SdkTransport, Stream } from "./runtime.js";
4
4
  export type AdvisorResultOutputItemInput = {
@@ -539,6 +539,110 @@ export type DateFiltersOutput = {
539
539
  search_before_date_filter?: DateOutput;
540
540
  search_recency_filter?: SearchRecencyFilterOutput;
541
541
  };
542
+ export type DecisionAnswerInput = DecisionNoulAnswerInput | DecisionScoreAnswerInput | DecisionChoiceAnswerInput;
543
+ export type DecisionAnswerOutput = DecisionNoulAnswerOutput | DecisionScoreAnswerOutput | DecisionChoiceAnswerOutput;
544
+ export type DecisionChoiceAnswerInput = {
545
+ choice: string;
546
+ confidence: number;
547
+ probabilities: {} & Record<string, number>;
548
+ type: "choice";
549
+ };
550
+ export type DecisionChoiceAnswerOutput = {
551
+ choice: string;
552
+ confidence: number;
553
+ probabilities: {} & Record<string, number>;
554
+ type: "choice";
555
+ };
556
+ export type DecisionChoiceQuestionInput = {
557
+ criteria: {} & Record<string, string | ({} & Record<string, unknown>) | unknown[] | null>;
558
+ instructions?: string | ({} & Record<string, unknown>) | unknown[] | null;
559
+ type: "choice";
560
+ };
561
+ export type DecisionChoiceQuestionOutput = {
562
+ criteria: {} & Record<string, string | ({} & Record<string, unknown>) | unknown[] | null>;
563
+ instructions?: string | ({} & Record<string, unknown>) | unknown[] | null;
564
+ type: "choice";
565
+ };
566
+ export type DecisionNoulAnswerInput = {
567
+ noul: number;
568
+ type: "noul";
569
+ };
570
+ export type DecisionNoulAnswerOutput = {
571
+ noul: number;
572
+ type: "noul";
573
+ };
574
+ export type DecisionNoulCriteriaInput = {
575
+ false?: string | ({} & Record<string, unknown>) | unknown[] | null;
576
+ true?: string | ({} & Record<string, unknown>) | unknown[] | null;
577
+ } | null;
578
+ export type DecisionNoulCriteriaOutput = {
579
+ false?: string | ({} & Record<string, unknown>) | unknown[] | null;
580
+ true?: string | ({} & Record<string, unknown>) | unknown[] | null;
581
+ } | null;
582
+ export type DecisionNoulQuestionInput = {
583
+ criteria?: DecisionNoulCriteriaInput;
584
+ instructions?: string | ({} & Record<string, unknown>) | unknown[] | null;
585
+ type: "noul";
586
+ };
587
+ export type DecisionNoulQuestionOutput = {
588
+ criteria?: DecisionNoulCriteriaOutput;
589
+ instructions?: string | ({} & Record<string, unknown>) | unknown[] | null;
590
+ type: "noul";
591
+ };
592
+ export type DecisionQuestionInput = DecisionNoulQuestionInput | DecisionChoiceQuestionInput | DecisionScoreQuestionInput;
593
+ export type DecisionQuestionOutput = DecisionNoulQuestionOutput | DecisionChoiceQuestionOutput | DecisionScoreQuestionOutput;
594
+ export type DecisionScoreAnswerInput = {
595
+ confidence: number;
596
+ legend: {} & Record<string, string | ({} & Record<string, unknown>) | unknown[]>;
597
+ probabilities: {} & Record<string, number>;
598
+ score: number;
599
+ type: "score";
600
+ };
601
+ export type DecisionScoreAnswerOutput = {
602
+ confidence: number;
603
+ legend: {} & Record<string, string | ({} & Record<string, unknown>) | unknown[]>;
604
+ probabilities: {} & Record<string, number>;
605
+ score: number;
606
+ type: "score";
607
+ };
608
+ export type DecisionScoreQuestionInput = {
609
+ criteria: (string | ({} & Record<string, unknown>) | unknown[])[];
610
+ instructions?: string | ({} & Record<string, unknown>) | unknown[] | null;
611
+ type: "score";
612
+ };
613
+ export type DecisionScoreQuestionOutput = {
614
+ criteria: (string | ({} & Record<string, unknown>) | unknown[])[];
615
+ instructions?: string | ({} & Record<string, unknown>) | unknown[] | null;
616
+ type: "score";
617
+ };
618
+ export type DecisionsRequestInput = {
619
+ model: string;
620
+ questions: {} & Record<string, DecisionQuestionInput>;
621
+ state: string | ({} & Record<string, unknown>) | unknown[];
622
+ };
623
+ export type DecisionsRequestOutput = {
624
+ model: string;
625
+ questions: {} & Record<string, DecisionQuestionOutput>;
626
+ state: string | ({} & Record<string, unknown>) | unknown[];
627
+ };
628
+ export type DecisionsResponseInput = {
629
+ answers: {} & Record<string, DecisionAnswerInput>;
630
+ model: string;
631
+ usage: DecisionUsageInput;
632
+ };
633
+ export type DecisionsResponseOutput = {
634
+ answers: {} & Record<string, DecisionAnswerOutput>;
635
+ model: string;
636
+ usage: DecisionUsageOutput;
637
+ };
638
+ export type DecisionUsageInput = {
639
+ input_tokens: number;
640
+ output_tokens: number;
641
+ };
642
+ export type DecisionUsageOutput = {
643
+ input_tokens: number;
644
+ output_tokens: number;
645
+ };
542
646
  export type EmbeddingObjectInput = {
543
647
  embedding?: string;
544
648
  index?: number;
@@ -876,12 +980,22 @@ export type InputItemOutput = InputMessageOutput | FunctionCallOutputInputOutput
876
980
  export type InputMessageInput = {
877
981
  content: InputContentInput;
878
982
  role: "user" | "assistant" | "system" | "developer";
879
- type: "message";
983
+ type?: "message";
880
984
  };
881
985
  export type InputMessageOutput = {
882
986
  content: InputContentOutput;
883
987
  role: "user" | "assistant" | "system" | "developer";
884
- type: "message";
988
+ type?: "message";
989
+ };
990
+ export type InputTokensDetailsInput = {
991
+ cache_creation_input_tokens?: number;
992
+ cache_read_input_tokens?: number;
993
+ cached_tokens: number;
994
+ };
995
+ export type InputTokensDetailsOutput = {
996
+ cache_creation_input_tokens?: number;
997
+ cache_read_input_tokens?: number;
998
+ cached_tokens: number;
885
999
  };
886
1000
  export type JSONSchemaInput = {
887
1001
  description?: string | null;
@@ -915,6 +1029,24 @@ export type ListAsyncApiChatCompletionsResponseOutput = {
915
1029
  next_token?: string | null;
916
1030
  requests: AsyncApiChatCompletionsResponseSummaryOutput[];
917
1031
  };
1032
+ export type ManagedSkillInput = {
1033
+ created_at?: string;
1034
+ description?: string;
1035
+ latest_revision?: string;
1036
+ name?: string;
1037
+ revision?: string;
1038
+ skill_id: string;
1039
+ updated_at?: string;
1040
+ };
1041
+ export type ManagedSkillOutput = {
1042
+ created_at?: string;
1043
+ description?: string;
1044
+ latest_revision?: string;
1045
+ name?: string;
1046
+ revision?: string;
1047
+ skill_id: string;
1048
+ updated_at?: string;
1049
+ };
918
1050
  export type McpApprovalRequestInputInput = {
919
1051
  arguments: string;
920
1052
  connector_id?: string;
@@ -1089,6 +1221,26 @@ export type MessageOutputItemOutput = {
1089
1221
  status: StatusOutput;
1090
1222
  type: "message";
1091
1223
  };
1224
+ export type ModelInput = {
1225
+ created: number;
1226
+ id: string;
1227
+ object: "model";
1228
+ owned_by: string;
1229
+ };
1230
+ export type ModelOutput = {
1231
+ created: number;
1232
+ id: string;
1233
+ object: "model";
1234
+ owned_by: string;
1235
+ };
1236
+ export type ModelListInput = {
1237
+ data: ModelInput[];
1238
+ object: "list";
1239
+ };
1240
+ export type ModelListOutput = {
1241
+ data: ModelOutput[];
1242
+ object: "list";
1243
+ };
1092
1244
  export type NamespaceToolInput = {
1093
1245
  description: string;
1094
1246
  name: string;
@@ -1139,6 +1291,12 @@ export type OutputItemDoneEventOutput = {
1139
1291
  sequence_number: number;
1140
1292
  type: "response.output_item.done";
1141
1293
  };
1294
+ export type OutputTokensDetailsInput = {
1295
+ reasoning_tokens: number;
1296
+ };
1297
+ export type OutputTokensDetailsOutput = {
1298
+ reasoning_tokens: number;
1299
+ };
1142
1300
  export type ParameterSpecInput = {
1143
1301
  additional_properties?: boolean | null;
1144
1302
  properties: {} & Record<string, unknown>;
@@ -1401,9 +1559,12 @@ export type ResponsesRequestInput = {
1401
1559
  preset?: string;
1402
1560
  previous_response_id?: string;
1403
1561
  profile?: ProfileReferenceInput;
1562
+ prompt_cache_key?: string;
1404
1563
  reasoning?: ReasoningConfigInput;
1405
1564
  response_format?: ResponseFormatInput;
1565
+ service_tier?: "auto" | "default" | "flex" | "priority" | "fast";
1406
1566
  skills?: SkillInput[];
1567
+ step_budget_reminder?: boolean;
1407
1568
  store?: boolean;
1408
1569
  stream?: boolean;
1409
1570
  temperature?: number;
@@ -1423,9 +1584,12 @@ export type ResponsesRequestOutput = {
1423
1584
  preset?: string;
1424
1585
  previous_response_id?: string;
1425
1586
  profile?: ProfileReferenceOutput;
1587
+ prompt_cache_key?: string;
1426
1588
  reasoning?: ReasoningConfigOutput;
1427
1589
  response_format?: ResponseFormatOutput;
1590
+ service_tier?: "auto" | "default" | "flex" | "priority" | "fast";
1428
1591
  skills?: SkillOutput[];
1592
+ step_budget_reminder?: boolean;
1429
1593
  store?: boolean;
1430
1594
  stream?: boolean;
1431
1595
  temperature?: number;
@@ -1441,7 +1605,10 @@ export type ResponsesResponseInput = {
1441
1605
  model: string;
1442
1606
  object: ResponsesObjectTypeInput;
1443
1607
  output: OutputItemInput[];
1608
+ preset?: string;
1444
1609
  previous_response_id?: string | null;
1610
+ prompt_cache_key?: string | null;
1611
+ service_tier?: string;
1445
1612
  status: StatusInput;
1446
1613
  store?: boolean;
1447
1614
  usage?: ResponsesUsageInput;
@@ -1454,7 +1621,10 @@ export type ResponsesResponseOutput = {
1454
1621
  model: string;
1455
1622
  object: ResponsesObjectTypeOutput;
1456
1623
  output: OutputItemOutput[];
1624
+ preset?: string;
1457
1625
  previous_response_id?: string | null;
1626
+ prompt_cache_key?: string | null;
1627
+ service_tier?: string;
1458
1628
  status: StatusOutput;
1459
1629
  store?: boolean;
1460
1630
  usage?: ResponsesUsageOutput;
@@ -1701,6 +1871,30 @@ export type ShareFileOutputItemOutput = {
1701
1871
  };
1702
1872
  export type SkillInput = BuiltinSkillInput | InlineSkillInput | CustomSkillInput;
1703
1873
  export type SkillOutput = BuiltinSkillOutput | InlineSkillOutput | CustomSkillOutput;
1874
+ export type SkillBundleInput = {
1875
+ file: Blob;
1876
+ };
1877
+ export type SkillBundleOutput = {
1878
+ file: string;
1879
+ };
1880
+ export type SkillDownloadInput = {
1881
+ download_url: string;
1882
+ name?: string;
1883
+ revision?: string;
1884
+ };
1885
+ export type SkillDownloadOutput = {
1886
+ download_url: string;
1887
+ name?: string;
1888
+ revision?: string;
1889
+ };
1890
+ export type SkillListInput = {
1891
+ next_page_token?: string;
1892
+ skills: SkillSummaryInput[];
1893
+ };
1894
+ export type SkillListOutput = {
1895
+ next_page_token?: string;
1896
+ skills: SkillSummaryOutput[];
1897
+ };
1704
1898
  export type SkillLoadedOutputItemInput = {
1705
1899
  name: string;
1706
1900
  type: "skill_loaded";
@@ -1709,6 +1903,38 @@ export type SkillLoadedOutputItemOutput = {
1709
1903
  name: string;
1710
1904
  type: "skill_loaded";
1711
1905
  };
1906
+ export type SkillRevisionInput = {
1907
+ created_at?: string;
1908
+ name?: string;
1909
+ revision: string;
1910
+ };
1911
+ export type SkillRevisionOutput = {
1912
+ created_at?: string;
1913
+ name?: string;
1914
+ revision: string;
1915
+ };
1916
+ export type SkillRevisionListInput = {
1917
+ next_page_token?: string;
1918
+ revisions: SkillRevisionInput[];
1919
+ };
1920
+ export type SkillRevisionListOutput = {
1921
+ next_page_token?: string;
1922
+ revisions: SkillRevisionOutput[];
1923
+ };
1924
+ export type SkillSummaryInput = {
1925
+ created_at?: string;
1926
+ name?: string;
1927
+ revision?: string;
1928
+ skill_id: string;
1929
+ updated_at?: string;
1930
+ };
1931
+ export type SkillSummaryOutput = {
1932
+ created_at?: string;
1933
+ name?: string;
1934
+ revision?: string;
1935
+ skill_id: string;
1936
+ updated_at?: string;
1937
+ };
1712
1938
  export type StatusInput = "completed" | "failed" | "in_progress" | "queued" | "cancelled" | "requires_action";
1713
1939
  export type StatusOutput = "completed" | "failed" | "in_progress" | "queued" | "cancelled" | "requires_action";
1714
1940
  export type TextDeltaEventInput = {
@@ -1756,10 +1982,14 @@ export type ToolCallOutput = {
1756
1982
  type?: "function" | null;
1757
1983
  };
1758
1984
  export type ToolCallDetailsInput = {
1985
+ cost_usd?: number;
1759
1986
  invocation?: number;
1987
+ token_usage?: ToolCallTokenUsageInput[];
1760
1988
  };
1761
1989
  export type ToolCallDetailsOutput = {
1990
+ cost_usd?: number;
1762
1991
  invocation?: number;
1992
+ token_usage?: ToolCallTokenUsageOutput[];
1763
1993
  };
1764
1994
  export type ToolCallFunctionInput = {
1765
1995
  arguments?: string | null;
@@ -1769,6 +1999,20 @@ export type ToolCallFunctionOutput = {
1769
1999
  arguments?: string | null;
1770
2000
  name?: string | null;
1771
2001
  };
2002
+ export type ToolCallTokenUsageInput = {
2003
+ input_tokens: number;
2004
+ input_tokens_details: InputTokensDetailsInput;
2005
+ model?: string;
2006
+ output_tokens: number;
2007
+ output_tokens_details: OutputTokensDetailsInput;
2008
+ };
2009
+ export type ToolCallTokenUsageOutput = {
2010
+ input_tokens: number;
2011
+ input_tokens_details: InputTokensDetailsOutput;
2012
+ model?: string;
2013
+ output_tokens: number;
2014
+ output_tokens_details: OutputTokensDetailsOutput;
2015
+ };
1772
2016
  export type ToolChoiceInput = ("none" | "auto" | "required") | ({} & Record<string, unknown>);
1773
2017
  export type ToolChoiceOutput = ("none" | "auto" | "required") | ({} & Record<string, unknown>);
1774
2018
  export type ToolSearchOutputItemInput = {
@@ -1949,7 +2193,7 @@ export class AsyncChatCompletionsResource {
1949
2193
  "x-usage-tier"?: string;
1950
2194
  "x-user-id"?: string;
1951
2195
  }, options?: RequestOptions): APIPromise<AsyncApiChatCompletionsResponseOutput> {
1952
- return this._client.get<AsyncApiChatCompletionsResponseOutput>(`/async/chat/completions/${encodeURIComponent(String(apiRequest))}`, {
2196
+ return this._client.get<AsyncApiChatCompletionsResponseOutput>(`/async/chat/completions/${pathSegment(apiRequest)}`, {
1953
2197
  ...options,
1954
2198
  query: {
1955
2199
  local_mode: params?.local_mode,
@@ -1990,7 +2234,7 @@ export class BrowserSessionsResource {
1990
2234
  });
1991
2235
  }
1992
2236
  delete(sessionID: string, options?: RequestOptions): APIPromise<void> {
1993
- return this._client.delete<void>(`/v1/browser/sessions/${encodeURIComponent(String(sessionID))}`, {
2237
+ return this._client.delete<void>(`/v1/browser/sessions/${pathSegment(sessionID)}`, {
1994
2238
  ...options,
1995
2239
  headers: {
1996
2240
  "Accept": "*/*",
@@ -2015,7 +2259,7 @@ export class ChatCompletionsResource {
2015
2259
  return this._client.post<CompletionResponseOutput | Stream<CompletionResponseOutput>>("/chat/completions", {
2016
2260
  ...options,
2017
2261
  body: body,
2018
- stream: body?.stream ?? false
2262
+ stream: body?.stream === true
2019
2263
  });
2020
2264
  }
2021
2265
  }
@@ -2027,7 +2271,7 @@ export class ResponsesFilesResource {
2027
2271
  content(fileID: string, params: {
2028
2272
  response_id: string;
2029
2273
  }, options?: RequestOptions): APIPromise<Response> {
2030
- return this._client.get<Response>(`/v1/responses/${encodeURIComponent(String(params.response_id))}/files/${encodeURIComponent(String(fileID))}/content`, {
2274
+ return this._client.get<Response>(`/v1/responses/${pathSegment(params.response_id)}/files/${pathSegment(fileID)}/content`, {
2031
2275
  ...options,
2032
2276
  headers: {
2033
2277
  "Accept": "application/octet-stream",
@@ -2037,11 +2281,30 @@ export class ResponsesFilesResource {
2037
2281
  });
2038
2282
  }
2039
2283
  list(responseID: string, options?: RequestOptions): APIPromise<ResponseFileListOutput> {
2040
- return this._client.get<ResponseFileListOutput>(`/v1/responses/${encodeURIComponent(String(responseID))}/files`, {
2284
+ return this._client.get<ResponseFileListOutput>(`/v1/responses/${pathSegment(responseID)}/files`, {
2041
2285
  ...options
2042
2286
  });
2043
2287
  }
2044
2288
  }
2289
+ export class SkillsRevisionsResource {
2290
+ private readonly _client: SdkTransport;
2291
+ constructor(client: SdkTransport) {
2292
+ this._client = client;
2293
+ }
2294
+ list(skillID: string, params?: {
2295
+ limit?: number;
2296
+ page_token?: string;
2297
+ }, options?: RequestOptions): APIPromise<SkillRevisionListOutput> {
2298
+ return this._client.get<SkillRevisionListOutput>(`/v1/skills/${pathSegment(skillID)}/revisions`, {
2299
+ ...options,
2300
+ query: {
2301
+ limit: params?.limit,
2302
+ page_token: params?.page_token,
2303
+ ...options?.query
2304
+ }
2305
+ });
2306
+ }
2307
+ }
2045
2308
  export class AsyncResource {
2046
2309
  readonly chat: AsyncChatResource;
2047
2310
  constructor(client: SdkTransport) {
@@ -2072,6 +2335,18 @@ export class ContextualizedEmbeddingsResource {
2072
2335
  });
2073
2336
  }
2074
2337
  }
2338
+ export class DecisionsResource {
2339
+ private readonly _client: SdkTransport;
2340
+ constructor(client: SdkTransport) {
2341
+ this._client = client;
2342
+ }
2343
+ create(body: DecisionsRequestInput, options?: RequestOptions): APIPromise<DecisionsResponseOutput> {
2344
+ return this._client.post<DecisionsResponseOutput>("/v1/decisions", {
2345
+ ...options,
2346
+ body: body
2347
+ });
2348
+ }
2349
+ }
2075
2350
  export class EmbeddingsResource {
2076
2351
  private readonly _client: SdkTransport;
2077
2352
  constructor(client: SdkTransport) {
@@ -2084,6 +2359,17 @@ export class EmbeddingsResource {
2084
2359
  });
2085
2360
  }
2086
2361
  }
2362
+ export class ModelsResource {
2363
+ private readonly _client: SdkTransport;
2364
+ constructor(client: SdkTransport) {
2365
+ this._client = client;
2366
+ }
2367
+ list(options?: RequestOptions): APIPromise<ModelListOutput> {
2368
+ return this._client.get<ModelListOutput>("/v1/models", {
2369
+ ...options
2370
+ });
2371
+ }
2372
+ }
2087
2373
  export class ResponsesResource {
2088
2374
  private readonly _client: SdkTransport;
2089
2375
  readonly files: ResponsesFilesResource;
@@ -2098,7 +2384,7 @@ export class ResponsesResource {
2098
2384
  return this._client.post<{
2099
2385
  response_id: string;
2100
2386
  status: "cancelling";
2101
- }>(`/v1/responses/${encodeURIComponent(String(responseID))}/cancel`, {
2387
+ }>(`/v1/responses/${pathSegment(responseID)}/cancel`, {
2102
2388
  ...options
2103
2389
  });
2104
2390
  }
@@ -2117,9 +2403,9 @@ export class ResponsesResource {
2117
2403
  const promise = this._client.post<ResponsesResponseOutput | Stream<ResponseStreamEventOutput>>("/v1/responses", {
2118
2404
  ...options,
2119
2405
  body: body,
2120
- stream: body?.stream ?? false
2406
+ stream: body?.stream === true
2121
2407
  });
2122
- if (!body?.stream) {
2408
+ if (body?.stream !== true) {
2123
2409
  return promise._thenUnwrap(response => {
2124
2410
  if ("object" in response && response.object === "response") {
2125
2411
  addOutputText(response as ResponsesResponseOutput & {
@@ -2131,22 +2417,74 @@ export class ResponsesResource {
2131
2417
  }
2132
2418
  return promise;
2133
2419
  }
2134
- retrieve(responseID: string, options?: RequestOptions): APIPromise<ResponsesResponseOutput & {
2420
+ retrieve(responseID: string, params?: Omit<{
2421
+ format?: "default" | "short";
2422
+ starting_after?: number;
2423
+ stream?: boolean;
2424
+ }, "stream"> & {
2425
+ stream?: false;
2426
+ }, options?: RequestOptions): APIPromise<ResponsesResponseOutput & {
2135
2427
  output_text: string;
2136
- }> {
2137
- const promise = this._client.get<ResponsesResponseOutput>(`/v1/responses/${encodeURIComponent(String(responseID))}`, {
2138
- ...options
2428
+ }>;
2429
+ retrieve(responseID: string, params: Omit<Required<{
2430
+ format?: "default" | "short";
2431
+ starting_after?: number;
2432
+ stream?: boolean;
2433
+ }>, "stream"> & {
2434
+ stream: true;
2435
+ }, options?: RequestOptions): APIPromise<Stream<ResponseStreamEventOutput>>;
2436
+ retrieve(responseID: string, params: Omit<Required<{
2437
+ format?: "default" | "short";
2438
+ starting_after?: number;
2439
+ stream?: boolean;
2440
+ }>, "stream"> & {
2441
+ stream: boolean;
2442
+ }, options?: RequestOptions): APIPromise<(ResponsesResponseOutput & {
2443
+ output_text: string;
2444
+ }) | Stream<ResponseStreamEventOutput>>;
2445
+ retrieve(responseID: string, params?: Omit<RequestOptions, "__binaryResponse" | "body" | "defaultBaseURL" | "method" | "path"> & {
2446
+ format?: never;
2447
+ starting_after?: never;
2448
+ }, options?: RequestOptions): APIPromise<ResponsesResponseOutput & {
2449
+ output_text: string;
2450
+ }>;
2451
+ retrieve(responseID: string, params?: {
2452
+ format?: "default" | "short";
2453
+ starting_after?: number;
2454
+ stream?: boolean;
2455
+ }, options?: RequestOptions): APIPromise<(ResponsesResponseOutput & {
2456
+ output_text: string;
2457
+ }) | Stream<ResponseStreamEventOutput>>;
2458
+ retrieve(responseID: string, params?: {
2459
+ format?: "default" | "short";
2460
+ starting_after?: number;
2461
+ stream?: boolean;
2462
+ } & RequestOptions, options?: RequestOptions): APIPromise<ResponsesResponseOutput | Stream<ResponseStreamEventOutput>> {
2463
+ const streamFlag = ownBoolean(params, "stream");
2464
+ const cursor = ownCursor(params, "starting_after");
2465
+ const promise = this._client.get<ResponsesResponseOutput | Stream<ResponseStreamEventOutput>>(`/v1/responses/${pathSegment(responseID)}`, {
2466
+ ...legacyRequestOptions(params, cursor, streamFlag),
2467
+ ...options,
2468
+ query: {
2469
+ ...legacyQuery(params, ["format", "starting_after", "stream"], cursor),
2470
+ ...options?.query,
2471
+ starting_after: cursor,
2472
+ stream: streamFlag,
2473
+ format: ownParameter(params, "format")
2474
+ },
2475
+ stream: streamFlag === true
2139
2476
  });
2140
- return promise._thenUnwrap(response => {
2141
- if ("object" in response && response.object === "response") {
2142
- addOutputText(response as ResponsesResponseOutput & {
2143
- output_text: string;
2144
- });
2145
- }
2146
- return response;
2147
- }) as APIPromise<ResponsesResponseOutput & {
2148
- output_text: string;
2149
- }>;
2477
+ if (streamFlag !== true) {
2478
+ return promise._thenUnwrap(response => {
2479
+ if ("object" in response && response.object === "response") {
2480
+ addOutputText(response as ResponsesResponseOutput & {
2481
+ output_text: string;
2482
+ });
2483
+ }
2484
+ return response;
2485
+ });
2486
+ }
2487
+ return promise;
2150
2488
  }
2151
2489
  }
2152
2490
  export class SearchResource {
@@ -2161,22 +2499,104 @@ export class SearchResource {
2161
2499
  });
2162
2500
  }
2163
2501
  }
2502
+ export class SkillsResource {
2503
+ private readonly _client: SdkTransport;
2504
+ readonly revisions: SkillsRevisionsResource;
2505
+ constructor(client: SdkTransport) {
2506
+ this._client = client;
2507
+ this.revisions = new SkillsRevisionsResource(client);
2508
+ }
2509
+ create(body: SkillBundleInput, options?: RequestOptions): APIPromise<ManagedSkillOutput> {
2510
+ return this._client.post<ManagedSkillOutput>("/v1/skills", {
2511
+ ...options,
2512
+ body: multipartBody(body, ["file"])
2513
+ });
2514
+ }
2515
+ delete(skillID: string, params: {
2516
+ expected_revision: string;
2517
+ }, options?: RequestOptions): APIPromise<void> {
2518
+ return this._client.delete<void>(`/v1/skills/${pathSegment(skillID)}`, {
2519
+ ...options,
2520
+ query: {
2521
+ expected_revision: params.expected_revision,
2522
+ ...options?.query
2523
+ },
2524
+ headers: {
2525
+ "Accept": "*/*",
2526
+ ...normalizeHeaders(options?.headers)
2527
+ }
2528
+ });
2529
+ }
2530
+ download(skillID: string, params?: {
2531
+ revision?: string;
2532
+ }, options?: RequestOptions): APIPromise<SkillDownloadOutput> {
2533
+ return this._client.get<SkillDownloadOutput>(`/v1/skills/${pathSegment(skillID)}/download`, {
2534
+ ...options,
2535
+ query: {
2536
+ revision: params?.revision,
2537
+ ...options?.query
2538
+ }
2539
+ });
2540
+ }
2541
+ list(params?: {
2542
+ limit?: number;
2543
+ page_token?: string;
2544
+ }, options?: RequestOptions): APIPromise<SkillListOutput> {
2545
+ return this._client.get<SkillListOutput>("/v1/skills", {
2546
+ ...options,
2547
+ query: {
2548
+ limit: params?.limit,
2549
+ page_token: params?.page_token,
2550
+ ...options?.query
2551
+ }
2552
+ });
2553
+ }
2554
+ retrieve(skillID: string, params?: {
2555
+ revision?: string;
2556
+ }, options?: RequestOptions): APIPromise<ManagedSkillOutput> {
2557
+ return this._client.get<ManagedSkillOutput>(`/v1/skills/${pathSegment(skillID)}`, {
2558
+ ...options,
2559
+ query: {
2560
+ revision: params?.revision,
2561
+ ...options?.query
2562
+ }
2563
+ });
2564
+ }
2565
+ update(skillID: string, body: SkillBundleInput, params: {
2566
+ expected_revision: string;
2567
+ }, options?: RequestOptions): APIPromise<ManagedSkillOutput> {
2568
+ return this._client.put<ManagedSkillOutput>(`/v1/skills/${pathSegment(skillID)}`, {
2569
+ ...options,
2570
+ body: multipartBody(body, ["file"]),
2571
+ query: {
2572
+ expected_revision: params.expected_revision,
2573
+ ...options?.query
2574
+ }
2575
+ });
2576
+ }
2577
+ }
2164
2578
  export class PerplexitySdk {
2165
2579
  readonly async: AsyncResource;
2166
2580
  readonly browser: BrowserResource;
2167
2581
  readonly chat: ChatResource;
2168
2582
  readonly contextualizedEmbeddings: ContextualizedEmbeddingsResource;
2583
+ readonly decisions: DecisionsResource;
2169
2584
  readonly embeddings: EmbeddingsResource;
2585
+ readonly models: ModelsResource;
2170
2586
  readonly responses: ResponsesResource;
2171
2587
  readonly search: SearchResource;
2588
+ readonly skills: SkillsResource;
2172
2589
  constructor(client: SdkTransport) {
2173
2590
  this.async = new AsyncResource(client);
2174
2591
  this.browser = new BrowserResource(client);
2175
2592
  this.chat = new ChatResource(client);
2176
2593
  this.contextualizedEmbeddings = new ContextualizedEmbeddingsResource(client);
2594
+ this.decisions = new DecisionsResource(client);
2177
2595
  this.embeddings = new EmbeddingsResource(client);
2596
+ this.models = new ModelsResource(client);
2178
2597
  this.responses = new ResponsesResource(client);
2179
2598
  this.search = new SearchResource(client);
2599
+ this.skills = new SkillsResource(client);
2180
2600
  }
2181
2601
  }
2182
2602
  export class Async extends AsyncResource {
@@ -2187,12 +2607,18 @@ export class Chat extends ChatResource {
2187
2607
  }
2188
2608
  export class ContextualizedEmbeddings extends ContextualizedEmbeddingsResource {
2189
2609
  }
2610
+ export class Decisions extends DecisionsResource {
2611
+ }
2190
2612
  export class Embeddings extends EmbeddingsResource {
2191
2613
  }
2614
+ export class Models extends ModelsResource {
2615
+ }
2192
2616
  export class Responses extends ResponsesResource {
2193
2617
  }
2194
2618
  export class Search extends SearchResource {
2195
2619
  }
2620
+ export class Skills extends SkillsResource {
2621
+ }
2196
2622
  export type Annotation = AnnotationOutput;
2197
2623
  export type APIPublicSearchResult = ApiPublicSearchResultOutput;
2198
2624
  export type BrowserSessionResponse = BrowserSessionResponseOutput;
@@ -2203,6 +2629,10 @@ export type ContentPart = ContentPartOutput;
2203
2629
  export type ContextualizedEmbeddingCreateParams = ContextualizedEmbeddingsRequestInput;
2204
2630
  export type ContextualizedEmbeddingCreateResponse = ContextualizedEmbeddingsResponseOutput;
2205
2631
  export type ContextualizedEmbeddingObject = ContextualizedEmbeddingObjectOutput;
2632
+ export type DecisionAnswer = DecisionAnswerOutput;
2633
+ export type DecisionCreateParams = DecisionsRequestInput;
2634
+ export type DecisionCreateResponse = Awaited<ReturnType<DecisionsResource["create"]>>;
2635
+ export type DecisionQuestion = DecisionQuestionInput;
2206
2636
  export type EmbeddingCreateParams = EmbeddingsRequestInput;
2207
2637
  export type EmbeddingCreateResponse = EmbeddingsResponseOutput;
2208
2638
  export type EmbeddingObject = EmbeddingObjectOutput;
@@ -2215,6 +2645,9 @@ export type ImageSearchResultsOutputItem = ImageSearchResultsOutputItemOutput;
2215
2645
  export type ImageSearchTool = ImageSearchToolInput;
2216
2646
  export type InputItem = InputItemInput;
2217
2647
  export type JsonSchemaFormat = JSONSchemaFormatInput;
2648
+ export type ManagedSkill = ManagedSkillOutput;
2649
+ export type Model = ModelOutput;
2650
+ export type ModelListResponse = Awaited<ReturnType<ModelsResource["list"]>>;
2218
2651
  export type OutputItem = OutputItemOutput;
2219
2652
  export type ResponseCancelResponse = Awaited<ReturnType<ResponsesResource["cancel"]>>;
2220
2653
  export type ResponseCreateParams = ResponsesRequestInput;
@@ -2233,6 +2666,11 @@ export type ResponsesUsage = ResponsesUsageOutput;
2233
2666
  export type SearchCreateParams = ApiSearchRequestInput;
2234
2667
  export type SearchCreateResponse = ApiSearchResponseOutput;
2235
2668
  export type SearchResult = SearchResultOutput;
2669
+ export type SkillDownloadResponse = SkillDownloadOutput;
2670
+ export type SkillListResponse = SkillListOutput;
2671
+ export type SkillRevision = SkillRevisionOutput;
2672
+ export type SkillRevisionListResponse = SkillRevisionListOutput;
2673
+ export type SkillUploadParams = SkillBundleInput;
2236
2674
  export type StreamChunk = CompletionResponseOutput;
2237
2675
  export type UsageInfo = UsageInfoOutput;
2238
2676
  export type UserLocation = UserLocationInput;
@@ -2290,10 +2728,20 @@ export namespace ContextualizedEmbeddings {
2290
2728
  export type ContextualizedEmbeddingCreateParams = ContextualizedEmbeddingsRequestInput;
2291
2729
  export type ContextualizedEmbeddingCreateResponse = ContextualizedEmbeddingsResponseOutput;
2292
2730
  }
2731
+ export namespace Decisions {
2732
+ export type DecisionAnswer = DecisionAnswerOutput;
2733
+ export type DecisionCreateParams = DecisionsRequestInput;
2734
+ export type DecisionCreateResponse = Awaited<ReturnType<DecisionsResource["create"]>>;
2735
+ export type DecisionQuestion = DecisionQuestionInput;
2736
+ }
2293
2737
  export namespace Embeddings {
2294
2738
  export type EmbeddingCreateParams = EmbeddingsRequestInput;
2295
2739
  export type EmbeddingCreateResponse = EmbeddingsResponseOutput;
2296
2740
  }
2741
+ export namespace Models {
2742
+ export type Model = ModelOutput;
2743
+ export type ModelListResponse = Awaited<ReturnType<ModelsResource["list"]>>;
2744
+ }
2297
2745
  export namespace Responses {
2298
2746
  export class Files extends ResponsesFilesResource {
2299
2747
  }
@@ -2335,3 +2783,17 @@ export namespace Search {
2335
2783
  export type SearchCreateParams = ApiSearchRequestInput;
2336
2784
  export type SearchCreateResponse = ApiSearchResponseOutput;
2337
2785
  }
2786
+ export namespace Skills {
2787
+ export class Revisions extends SkillsRevisionsResource {
2788
+ }
2789
+ export type ManagedSkill = ManagedSkillOutput;
2790
+ export type SkillDownloadResponse = SkillDownloadOutput;
2791
+ export type SkillListResponse = SkillListOutput;
2792
+ export type SkillRevision = SkillRevisionOutput;
2793
+ export type SkillRevisionListResponse = SkillRevisionListOutput;
2794
+ export type SkillUploadParams = SkillBundleInput;
2795
+ export namespace Revisions {
2796
+ export type SkillRevision = SkillRevisionOutput;
2797
+ export type SkillRevisionListResponse = SkillRevisionListOutput;
2798
+ }
2799
+ }