@perplexity-ai/perplexity_ai 0.38.8 → 0.39.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/generated/api.d.ts +358 -3
  3. package/dist/generated/api.d.ts.map +1 -1
  4. package/dist/generated/api.js +144 -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 +476 -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, 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,8 +1559,10 @@ 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[];
1407
1567
  store?: boolean;
1408
1568
  stream?: boolean;
@@ -1423,8 +1583,10 @@ export type ResponsesRequestOutput = {
1423
1583
  preset?: string;
1424
1584
  previous_response_id?: string;
1425
1585
  profile?: ProfileReferenceOutput;
1586
+ prompt_cache_key?: string;
1426
1587
  reasoning?: ReasoningConfigOutput;
1427
1588
  response_format?: ResponseFormatOutput;
1589
+ service_tier?: "auto" | "default" | "flex" | "priority" | "fast";
1428
1590
  skills?: SkillOutput[];
1429
1591
  store?: boolean;
1430
1592
  stream?: boolean;
@@ -1442,6 +1604,8 @@ export type ResponsesResponseInput = {
1442
1604
  object: ResponsesObjectTypeInput;
1443
1605
  output: OutputItemInput[];
1444
1606
  previous_response_id?: string | null;
1607
+ prompt_cache_key?: string | null;
1608
+ service_tier?: string;
1445
1609
  status: StatusInput;
1446
1610
  store?: boolean;
1447
1611
  usage?: ResponsesUsageInput;
@@ -1455,6 +1619,8 @@ export type ResponsesResponseOutput = {
1455
1619
  object: ResponsesObjectTypeOutput;
1456
1620
  output: OutputItemOutput[];
1457
1621
  previous_response_id?: string | null;
1622
+ prompt_cache_key?: string | null;
1623
+ service_tier?: string;
1458
1624
  status: StatusOutput;
1459
1625
  store?: boolean;
1460
1626
  usage?: ResponsesUsageOutput;
@@ -1701,6 +1867,30 @@ export type ShareFileOutputItemOutput = {
1701
1867
  };
1702
1868
  export type SkillInput = BuiltinSkillInput | InlineSkillInput | CustomSkillInput;
1703
1869
  export type SkillOutput = BuiltinSkillOutput | InlineSkillOutput | CustomSkillOutput;
1870
+ export type SkillBundleInput = {
1871
+ file: Blob;
1872
+ };
1873
+ export type SkillBundleOutput = {
1874
+ file: string;
1875
+ };
1876
+ export type SkillDownloadInput = {
1877
+ download_url: string;
1878
+ name?: string;
1879
+ revision?: string;
1880
+ };
1881
+ export type SkillDownloadOutput = {
1882
+ download_url: string;
1883
+ name?: string;
1884
+ revision?: string;
1885
+ };
1886
+ export type SkillListInput = {
1887
+ next_page_token?: string;
1888
+ skills: SkillSummaryInput[];
1889
+ };
1890
+ export type SkillListOutput = {
1891
+ next_page_token?: string;
1892
+ skills: SkillSummaryOutput[];
1893
+ };
1704
1894
  export type SkillLoadedOutputItemInput = {
1705
1895
  name: string;
1706
1896
  type: "skill_loaded";
@@ -1709,6 +1899,38 @@ export type SkillLoadedOutputItemOutput = {
1709
1899
  name: string;
1710
1900
  type: "skill_loaded";
1711
1901
  };
1902
+ export type SkillRevisionInput = {
1903
+ created_at?: string;
1904
+ name?: string;
1905
+ revision: string;
1906
+ };
1907
+ export type SkillRevisionOutput = {
1908
+ created_at?: string;
1909
+ name?: string;
1910
+ revision: string;
1911
+ };
1912
+ export type SkillRevisionListInput = {
1913
+ next_page_token?: string;
1914
+ revisions: SkillRevisionInput[];
1915
+ };
1916
+ export type SkillRevisionListOutput = {
1917
+ next_page_token?: string;
1918
+ revisions: SkillRevisionOutput[];
1919
+ };
1920
+ export type SkillSummaryInput = {
1921
+ created_at?: string;
1922
+ name?: string;
1923
+ revision?: string;
1924
+ skill_id: string;
1925
+ updated_at?: string;
1926
+ };
1927
+ export type SkillSummaryOutput = {
1928
+ created_at?: string;
1929
+ name?: string;
1930
+ revision?: string;
1931
+ skill_id: string;
1932
+ updated_at?: string;
1933
+ };
1712
1934
  export type StatusInput = "completed" | "failed" | "in_progress" | "queued" | "cancelled" | "requires_action";
1713
1935
  export type StatusOutput = "completed" | "failed" | "in_progress" | "queued" | "cancelled" | "requires_action";
1714
1936
  export type TextDeltaEventInput = {
@@ -1756,10 +1978,14 @@ export type ToolCallOutput = {
1756
1978
  type?: "function" | null;
1757
1979
  };
1758
1980
  export type ToolCallDetailsInput = {
1981
+ cost_usd?: number;
1759
1982
  invocation?: number;
1983
+ token_usage?: ToolCallTokenUsageInput[];
1760
1984
  };
1761
1985
  export type ToolCallDetailsOutput = {
1986
+ cost_usd?: number;
1762
1987
  invocation?: number;
1988
+ token_usage?: ToolCallTokenUsageOutput[];
1763
1989
  };
1764
1990
  export type ToolCallFunctionInput = {
1765
1991
  arguments?: string | null;
@@ -1769,6 +1995,20 @@ export type ToolCallFunctionOutput = {
1769
1995
  arguments?: string | null;
1770
1996
  name?: string | null;
1771
1997
  };
1998
+ export type ToolCallTokenUsageInput = {
1999
+ input_tokens: number;
2000
+ input_tokens_details: InputTokensDetailsInput;
2001
+ model?: string;
2002
+ output_tokens: number;
2003
+ output_tokens_details: OutputTokensDetailsInput;
2004
+ };
2005
+ export type ToolCallTokenUsageOutput = {
2006
+ input_tokens: number;
2007
+ input_tokens_details: InputTokensDetailsOutput;
2008
+ model?: string;
2009
+ output_tokens: number;
2010
+ output_tokens_details: OutputTokensDetailsOutput;
2011
+ };
1772
2012
  export type ToolChoiceInput = ("none" | "auto" | "required") | ({} & Record<string, unknown>);
1773
2013
  export type ToolChoiceOutput = ("none" | "auto" | "required") | ({} & Record<string, unknown>);
1774
2014
  export type ToolSearchOutputItemInput = {
@@ -1949,7 +2189,7 @@ export class AsyncChatCompletionsResource {
1949
2189
  "x-usage-tier"?: string;
1950
2190
  "x-user-id"?: string;
1951
2191
  }, options?: RequestOptions): APIPromise<AsyncApiChatCompletionsResponseOutput> {
1952
- return this._client.get<AsyncApiChatCompletionsResponseOutput>(`/async/chat/completions/${encodeURIComponent(String(apiRequest))}`, {
2192
+ return this._client.get<AsyncApiChatCompletionsResponseOutput>(`/async/chat/completions/${pathSegment(apiRequest)}`, {
1953
2193
  ...options,
1954
2194
  query: {
1955
2195
  local_mode: params?.local_mode,
@@ -1990,7 +2230,7 @@ export class BrowserSessionsResource {
1990
2230
  });
1991
2231
  }
1992
2232
  delete(sessionID: string, options?: RequestOptions): APIPromise<void> {
1993
- return this._client.delete<void>(`/v1/browser/sessions/${encodeURIComponent(String(sessionID))}`, {
2233
+ return this._client.delete<void>(`/v1/browser/sessions/${pathSegment(sessionID)}`, {
1994
2234
  ...options,
1995
2235
  headers: {
1996
2236
  "Accept": "*/*",
@@ -2015,7 +2255,7 @@ export class ChatCompletionsResource {
2015
2255
  return this._client.post<CompletionResponseOutput | Stream<CompletionResponseOutput>>("/chat/completions", {
2016
2256
  ...options,
2017
2257
  body: body,
2018
- stream: body?.stream ?? false
2258
+ stream: body?.stream === true
2019
2259
  });
2020
2260
  }
2021
2261
  }
@@ -2027,7 +2267,7 @@ export class ResponsesFilesResource {
2027
2267
  content(fileID: string, params: {
2028
2268
  response_id: string;
2029
2269
  }, options?: RequestOptions): APIPromise<Response> {
2030
- return this._client.get<Response>(`/v1/responses/${encodeURIComponent(String(params.response_id))}/files/${encodeURIComponent(String(fileID))}/content`, {
2270
+ return this._client.get<Response>(`/v1/responses/${pathSegment(params.response_id)}/files/${pathSegment(fileID)}/content`, {
2031
2271
  ...options,
2032
2272
  headers: {
2033
2273
  "Accept": "application/octet-stream",
@@ -2037,11 +2277,30 @@ export class ResponsesFilesResource {
2037
2277
  });
2038
2278
  }
2039
2279
  list(responseID: string, options?: RequestOptions): APIPromise<ResponseFileListOutput> {
2040
- return this._client.get<ResponseFileListOutput>(`/v1/responses/${encodeURIComponent(String(responseID))}/files`, {
2280
+ return this._client.get<ResponseFileListOutput>(`/v1/responses/${pathSegment(responseID)}/files`, {
2041
2281
  ...options
2042
2282
  });
2043
2283
  }
2044
2284
  }
2285
+ export class SkillsRevisionsResource {
2286
+ private readonly _client: SdkTransport;
2287
+ constructor(client: SdkTransport) {
2288
+ this._client = client;
2289
+ }
2290
+ list(skillID: string, params?: {
2291
+ limit?: number;
2292
+ page_token?: string;
2293
+ }, options?: RequestOptions): APIPromise<SkillRevisionListOutput> {
2294
+ return this._client.get<SkillRevisionListOutput>(`/v1/skills/${pathSegment(skillID)}/revisions`, {
2295
+ ...options,
2296
+ query: {
2297
+ limit: params?.limit,
2298
+ page_token: params?.page_token,
2299
+ ...options?.query
2300
+ }
2301
+ });
2302
+ }
2303
+ }
2045
2304
  export class AsyncResource {
2046
2305
  readonly chat: AsyncChatResource;
2047
2306
  constructor(client: SdkTransport) {
@@ -2072,6 +2331,18 @@ export class ContextualizedEmbeddingsResource {
2072
2331
  });
2073
2332
  }
2074
2333
  }
2334
+ export class DecisionsResource {
2335
+ private readonly _client: SdkTransport;
2336
+ constructor(client: SdkTransport) {
2337
+ this._client = client;
2338
+ }
2339
+ create(body: DecisionsRequestInput, options?: RequestOptions): APIPromise<DecisionsResponseOutput> {
2340
+ return this._client.post<DecisionsResponseOutput>("/v1/decisions", {
2341
+ ...options,
2342
+ body: body
2343
+ });
2344
+ }
2345
+ }
2075
2346
  export class EmbeddingsResource {
2076
2347
  private readonly _client: SdkTransport;
2077
2348
  constructor(client: SdkTransport) {
@@ -2084,6 +2355,17 @@ export class EmbeddingsResource {
2084
2355
  });
2085
2356
  }
2086
2357
  }
2358
+ export class ModelsResource {
2359
+ private readonly _client: SdkTransport;
2360
+ constructor(client: SdkTransport) {
2361
+ this._client = client;
2362
+ }
2363
+ list(options?: RequestOptions): APIPromise<ModelListOutput> {
2364
+ return this._client.get<ModelListOutput>("/v1/models", {
2365
+ ...options
2366
+ });
2367
+ }
2368
+ }
2087
2369
  export class ResponsesResource {
2088
2370
  private readonly _client: SdkTransport;
2089
2371
  readonly files: ResponsesFilesResource;
@@ -2098,7 +2380,7 @@ export class ResponsesResource {
2098
2380
  return this._client.post<{
2099
2381
  response_id: string;
2100
2382
  status: "cancelling";
2101
- }>(`/v1/responses/${encodeURIComponent(String(responseID))}/cancel`, {
2383
+ }>(`/v1/responses/${pathSegment(responseID)}/cancel`, {
2102
2384
  ...options
2103
2385
  });
2104
2386
  }
@@ -2117,9 +2399,9 @@ export class ResponsesResource {
2117
2399
  const promise = this._client.post<ResponsesResponseOutput | Stream<ResponseStreamEventOutput>>("/v1/responses", {
2118
2400
  ...options,
2119
2401
  body: body,
2120
- stream: body?.stream ?? false
2402
+ stream: body?.stream === true
2121
2403
  });
2122
- if (!body?.stream) {
2404
+ if (body?.stream !== true) {
2123
2405
  return promise._thenUnwrap(response => {
2124
2406
  if ("object" in response && response.object === "response") {
2125
2407
  addOutputText(response as ResponsesResponseOutput & {
@@ -2131,22 +2413,67 @@ export class ResponsesResource {
2131
2413
  }
2132
2414
  return promise;
2133
2415
  }
2134
- retrieve(responseID: string, options?: RequestOptions): APIPromise<ResponsesResponseOutput & {
2416
+ retrieve(responseID: string, params?: Omit<{
2417
+ starting_after?: number;
2418
+ stream?: boolean;
2419
+ }, "stream"> & {
2420
+ stream?: false;
2421
+ }, options?: RequestOptions): APIPromise<ResponsesResponseOutput & {
2135
2422
  output_text: string;
2136
- }> {
2137
- const promise = this._client.get<ResponsesResponseOutput>(`/v1/responses/${encodeURIComponent(String(responseID))}`, {
2138
- ...options
2423
+ }>;
2424
+ retrieve(responseID: string, params: Omit<Required<{
2425
+ starting_after?: number;
2426
+ stream?: boolean;
2427
+ }>, "stream"> & {
2428
+ stream: true;
2429
+ }, options?: RequestOptions): APIPromise<Stream<ResponseStreamEventOutput>>;
2430
+ retrieve(responseID: string, params: Omit<Required<{
2431
+ starting_after?: number;
2432
+ stream?: boolean;
2433
+ }>, "stream"> & {
2434
+ stream: boolean;
2435
+ }, options?: RequestOptions): APIPromise<(ResponsesResponseOutput & {
2436
+ output_text: string;
2437
+ }) | Stream<ResponseStreamEventOutput>>;
2438
+ retrieve(responseID: string, params?: Omit<RequestOptions, "__binaryResponse" | "body" | "defaultBaseURL" | "method" | "path"> & {
2439
+ starting_after?: never;
2440
+ }, options?: RequestOptions): APIPromise<ResponsesResponseOutput & {
2441
+ output_text: string;
2442
+ }>;
2443
+ retrieve(responseID: string, params?: {
2444
+ starting_after?: number;
2445
+ stream?: boolean;
2446
+ }, options?: RequestOptions): APIPromise<(ResponsesResponseOutput & {
2447
+ output_text: string;
2448
+ }) | Stream<ResponseStreamEventOutput>>;
2449
+ retrieve(responseID: string, params?: {
2450
+ starting_after?: number;
2451
+ stream?: boolean;
2452
+ } & RequestOptions, options?: RequestOptions): APIPromise<ResponsesResponseOutput | Stream<ResponseStreamEventOutput>> {
2453
+ const streamFlag = ownBoolean(params, "stream");
2454
+ const cursor = ownCursor(params, "starting_after");
2455
+ const promise = this._client.get<ResponsesResponseOutput | Stream<ResponseStreamEventOutput>>(`/v1/responses/${pathSegment(responseID)}`, {
2456
+ ...legacyRequestOptions(params, cursor, streamFlag),
2457
+ ...options,
2458
+ query: {
2459
+ ...legacyQuery(params, ["starting_after", "stream"], cursor),
2460
+ ...options?.query,
2461
+ starting_after: cursor,
2462
+ stream: streamFlag
2463
+ },
2464
+ stream: streamFlag === true
2139
2465
  });
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
- }>;
2466
+ if (streamFlag !== true) {
2467
+ return promise._thenUnwrap(response => {
2468
+ if ("object" in response && response.object === "response") {
2469
+ addOutputText(response as ResponsesResponseOutput & {
2470
+ output_text: string;
2471
+ });
2472
+ }
2473
+ return response;
2474
+ });
2475
+ }
2476
+ return promise;
2150
2477
  }
2151
2478
  }
2152
2479
  export class SearchResource {
@@ -2161,22 +2488,104 @@ export class SearchResource {
2161
2488
  });
2162
2489
  }
2163
2490
  }
2491
+ export class SkillsResource {
2492
+ private readonly _client: SdkTransport;
2493
+ readonly revisions: SkillsRevisionsResource;
2494
+ constructor(client: SdkTransport) {
2495
+ this._client = client;
2496
+ this.revisions = new SkillsRevisionsResource(client);
2497
+ }
2498
+ create(body: SkillBundleInput, options?: RequestOptions): APIPromise<ManagedSkillOutput> {
2499
+ return this._client.post<ManagedSkillOutput>("/v1/skills", {
2500
+ ...options,
2501
+ body: multipartBody(body, ["file"])
2502
+ });
2503
+ }
2504
+ delete(skillID: string, params: {
2505
+ expected_revision: string;
2506
+ }, options?: RequestOptions): APIPromise<void> {
2507
+ return this._client.delete<void>(`/v1/skills/${pathSegment(skillID)}`, {
2508
+ ...options,
2509
+ query: {
2510
+ expected_revision: params.expected_revision,
2511
+ ...options?.query
2512
+ },
2513
+ headers: {
2514
+ "Accept": "*/*",
2515
+ ...normalizeHeaders(options?.headers)
2516
+ }
2517
+ });
2518
+ }
2519
+ download(skillID: string, params?: {
2520
+ revision?: string;
2521
+ }, options?: RequestOptions): APIPromise<SkillDownloadOutput> {
2522
+ return this._client.get<SkillDownloadOutput>(`/v1/skills/${pathSegment(skillID)}/download`, {
2523
+ ...options,
2524
+ query: {
2525
+ revision: params?.revision,
2526
+ ...options?.query
2527
+ }
2528
+ });
2529
+ }
2530
+ list(params?: {
2531
+ limit?: number;
2532
+ page_token?: string;
2533
+ }, options?: RequestOptions): APIPromise<SkillListOutput> {
2534
+ return this._client.get<SkillListOutput>("/v1/skills", {
2535
+ ...options,
2536
+ query: {
2537
+ limit: params?.limit,
2538
+ page_token: params?.page_token,
2539
+ ...options?.query
2540
+ }
2541
+ });
2542
+ }
2543
+ retrieve(skillID: string, params?: {
2544
+ revision?: string;
2545
+ }, options?: RequestOptions): APIPromise<ManagedSkillOutput> {
2546
+ return this._client.get<ManagedSkillOutput>(`/v1/skills/${pathSegment(skillID)}`, {
2547
+ ...options,
2548
+ query: {
2549
+ revision: params?.revision,
2550
+ ...options?.query
2551
+ }
2552
+ });
2553
+ }
2554
+ update(skillID: string, body: SkillBundleInput, params: {
2555
+ expected_revision: string;
2556
+ }, options?: RequestOptions): APIPromise<ManagedSkillOutput> {
2557
+ return this._client.put<ManagedSkillOutput>(`/v1/skills/${pathSegment(skillID)}`, {
2558
+ ...options,
2559
+ body: multipartBody(body, ["file"]),
2560
+ query: {
2561
+ expected_revision: params.expected_revision,
2562
+ ...options?.query
2563
+ }
2564
+ });
2565
+ }
2566
+ }
2164
2567
  export class PerplexitySdk {
2165
2568
  readonly async: AsyncResource;
2166
2569
  readonly browser: BrowserResource;
2167
2570
  readonly chat: ChatResource;
2168
2571
  readonly contextualizedEmbeddings: ContextualizedEmbeddingsResource;
2572
+ readonly decisions: DecisionsResource;
2169
2573
  readonly embeddings: EmbeddingsResource;
2574
+ readonly models: ModelsResource;
2170
2575
  readonly responses: ResponsesResource;
2171
2576
  readonly search: SearchResource;
2577
+ readonly skills: SkillsResource;
2172
2578
  constructor(client: SdkTransport) {
2173
2579
  this.async = new AsyncResource(client);
2174
2580
  this.browser = new BrowserResource(client);
2175
2581
  this.chat = new ChatResource(client);
2176
2582
  this.contextualizedEmbeddings = new ContextualizedEmbeddingsResource(client);
2583
+ this.decisions = new DecisionsResource(client);
2177
2584
  this.embeddings = new EmbeddingsResource(client);
2585
+ this.models = new ModelsResource(client);
2178
2586
  this.responses = new ResponsesResource(client);
2179
2587
  this.search = new SearchResource(client);
2588
+ this.skills = new SkillsResource(client);
2180
2589
  }
2181
2590
  }
2182
2591
  export class Async extends AsyncResource {
@@ -2187,12 +2596,18 @@ export class Chat extends ChatResource {
2187
2596
  }
2188
2597
  export class ContextualizedEmbeddings extends ContextualizedEmbeddingsResource {
2189
2598
  }
2599
+ export class Decisions extends DecisionsResource {
2600
+ }
2190
2601
  export class Embeddings extends EmbeddingsResource {
2191
2602
  }
2603
+ export class Models extends ModelsResource {
2604
+ }
2192
2605
  export class Responses extends ResponsesResource {
2193
2606
  }
2194
2607
  export class Search extends SearchResource {
2195
2608
  }
2609
+ export class Skills extends SkillsResource {
2610
+ }
2196
2611
  export type Annotation = AnnotationOutput;
2197
2612
  export type APIPublicSearchResult = ApiPublicSearchResultOutput;
2198
2613
  export type BrowserSessionResponse = BrowserSessionResponseOutput;
@@ -2203,6 +2618,10 @@ export type ContentPart = ContentPartOutput;
2203
2618
  export type ContextualizedEmbeddingCreateParams = ContextualizedEmbeddingsRequestInput;
2204
2619
  export type ContextualizedEmbeddingCreateResponse = ContextualizedEmbeddingsResponseOutput;
2205
2620
  export type ContextualizedEmbeddingObject = ContextualizedEmbeddingObjectOutput;
2621
+ export type DecisionAnswer = DecisionAnswerOutput;
2622
+ export type DecisionCreateParams = DecisionsRequestInput;
2623
+ export type DecisionCreateResponse = Awaited<ReturnType<DecisionsResource["create"]>>;
2624
+ export type DecisionQuestion = DecisionQuestionInput;
2206
2625
  export type EmbeddingCreateParams = EmbeddingsRequestInput;
2207
2626
  export type EmbeddingCreateResponse = EmbeddingsResponseOutput;
2208
2627
  export type EmbeddingObject = EmbeddingObjectOutput;
@@ -2215,6 +2634,9 @@ export type ImageSearchResultsOutputItem = ImageSearchResultsOutputItemOutput;
2215
2634
  export type ImageSearchTool = ImageSearchToolInput;
2216
2635
  export type InputItem = InputItemInput;
2217
2636
  export type JsonSchemaFormat = JSONSchemaFormatInput;
2637
+ export type ManagedSkill = ManagedSkillOutput;
2638
+ export type Model = ModelOutput;
2639
+ export type ModelListResponse = Awaited<ReturnType<ModelsResource["list"]>>;
2218
2640
  export type OutputItem = OutputItemOutput;
2219
2641
  export type ResponseCancelResponse = Awaited<ReturnType<ResponsesResource["cancel"]>>;
2220
2642
  export type ResponseCreateParams = ResponsesRequestInput;
@@ -2233,6 +2655,11 @@ export type ResponsesUsage = ResponsesUsageOutput;
2233
2655
  export type SearchCreateParams = ApiSearchRequestInput;
2234
2656
  export type SearchCreateResponse = ApiSearchResponseOutput;
2235
2657
  export type SearchResult = SearchResultOutput;
2658
+ export type SkillDownloadResponse = SkillDownloadOutput;
2659
+ export type SkillListResponse = SkillListOutput;
2660
+ export type SkillRevision = SkillRevisionOutput;
2661
+ export type SkillRevisionListResponse = SkillRevisionListOutput;
2662
+ export type SkillUploadParams = SkillBundleInput;
2236
2663
  export type StreamChunk = CompletionResponseOutput;
2237
2664
  export type UsageInfo = UsageInfoOutput;
2238
2665
  export type UserLocation = UserLocationInput;
@@ -2290,10 +2717,20 @@ export namespace ContextualizedEmbeddings {
2290
2717
  export type ContextualizedEmbeddingCreateParams = ContextualizedEmbeddingsRequestInput;
2291
2718
  export type ContextualizedEmbeddingCreateResponse = ContextualizedEmbeddingsResponseOutput;
2292
2719
  }
2720
+ export namespace Decisions {
2721
+ export type DecisionAnswer = DecisionAnswerOutput;
2722
+ export type DecisionCreateParams = DecisionsRequestInput;
2723
+ export type DecisionCreateResponse = Awaited<ReturnType<DecisionsResource["create"]>>;
2724
+ export type DecisionQuestion = DecisionQuestionInput;
2725
+ }
2293
2726
  export namespace Embeddings {
2294
2727
  export type EmbeddingCreateParams = EmbeddingsRequestInput;
2295
2728
  export type EmbeddingCreateResponse = EmbeddingsResponseOutput;
2296
2729
  }
2730
+ export namespace Models {
2731
+ export type Model = ModelOutput;
2732
+ export type ModelListResponse = Awaited<ReturnType<ModelsResource["list"]>>;
2733
+ }
2297
2734
  export namespace Responses {
2298
2735
  export class Files extends ResponsesFilesResource {
2299
2736
  }
@@ -2335,3 +2772,17 @@ export namespace Search {
2335
2772
  export type SearchCreateParams = ApiSearchRequestInput;
2336
2773
  export type SearchCreateResponse = ApiSearchResponseOutput;
2337
2774
  }
2775
+ export namespace Skills {
2776
+ export class Revisions extends SkillsRevisionsResource {
2777
+ }
2778
+ export type ManagedSkill = ManagedSkillOutput;
2779
+ export type SkillDownloadResponse = SkillDownloadOutput;
2780
+ export type SkillListResponse = SkillListOutput;
2781
+ export type SkillRevision = SkillRevisionOutput;
2782
+ export type SkillRevisionListResponse = SkillRevisionListOutput;
2783
+ export type SkillUploadParams = SkillBundleInput;
2784
+ export namespace Revisions {
2785
+ export type SkillRevision = SkillRevisionOutput;
2786
+ export type SkillRevisionListResponse = SkillRevisionListOutput;
2787
+ }
2788
+ }