@perplexity-ai/perplexity_ai 0.22.0 → 0.25.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 (63) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/client.d.mts +12 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +12 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +14 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +14 -2
  9. package/client.mjs.map +1 -1
  10. package/core/streaming.js.map +1 -1
  11. package/core/streaming.mjs.map +1 -1
  12. package/internal/parse.d.mts.map +1 -1
  13. package/internal/parse.d.ts.map +1 -1
  14. package/internal/parse.js +5 -0
  15. package/internal/parse.js.map +1 -1
  16. package/internal/parse.mjs +5 -0
  17. package/internal/parse.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/contextualized-embeddings.d.mts +64 -0
  20. package/resources/contextualized-embeddings.d.mts.map +1 -0
  21. package/resources/contextualized-embeddings.d.ts +64 -0
  22. package/resources/contextualized-embeddings.d.ts.map +1 -0
  23. package/resources/contextualized-embeddings.js +17 -0
  24. package/resources/contextualized-embeddings.js.map +1 -0
  25. package/resources/contextualized-embeddings.mjs +13 -0
  26. package/resources/contextualized-embeddings.mjs.map +1 -0
  27. package/resources/embeddings.d.mts +60 -0
  28. package/resources/embeddings.d.mts.map +1 -0
  29. package/resources/embeddings.d.ts +60 -0
  30. package/resources/embeddings.d.ts.map +1 -0
  31. package/resources/embeddings.js +16 -0
  32. package/resources/embeddings.js.map +1 -0
  33. package/resources/embeddings.mjs +12 -0
  34. package/resources/embeddings.mjs.map +1 -0
  35. package/resources/index.d.mts +3 -1
  36. package/resources/index.d.mts.map +1 -1
  37. package/resources/index.d.ts +3 -1
  38. package/resources/index.d.ts.map +1 -1
  39. package/resources/index.js +5 -1
  40. package/resources/index.js.map +1 -1
  41. package/resources/index.mjs +2 -0
  42. package/resources/index.mjs.map +1 -1
  43. package/resources/responses.d.mts +111 -43
  44. package/resources/responses.d.mts.map +1 -1
  45. package/resources/responses.d.ts +111 -43
  46. package/resources/responses.d.ts.map +1 -1
  47. package/resources/shared.d.mts +72 -0
  48. package/resources/shared.d.mts.map +1 -1
  49. package/resources/shared.d.ts +72 -0
  50. package/resources/shared.d.ts.map +1 -1
  51. package/src/client.ts +41 -3
  52. package/src/core/streaming.ts +2 -2
  53. package/src/internal/parse.ts +6 -0
  54. package/src/resources/contextualized-embeddings.ts +83 -0
  55. package/src/resources/embeddings.ts +76 -0
  56. package/src/resources/index.ts +9 -0
  57. package/src/resources/responses.ts +144 -54
  58. package/src/resources/shared.ts +84 -0
  59. package/src/version.ts +1 -1
  60. package/version.d.mts +1 -1
  61. package/version.d.ts +1 -1
  62. package/version.js +1 -1
  63. package/version.mjs +1 -1
@@ -24,6 +24,11 @@ export async function defaultParseResponse(client, props) {
24
24
  const mediaType = contentType?.split(';')[0]?.trim();
25
25
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
26
26
  if (isJSON) {
27
+ const contentLength = response.headers.get('content-length');
28
+ if (contentLength === '0') {
29
+ // if there is no content we can't do anything
30
+ return undefined;
31
+ }
27
32
  const json = await response.json();
28
33
  return json;
29
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parse.mjs","sourceRoot":"","sources":["../src/internal/parse.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,MAAM,EAAE;OAEV,EAAE,oBAAoB,EAAE,SAAS,EAAE;AAW1C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAI,MAAkB,EAAE,KAAuB;IACvF,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACzB,SAAS,CAAC,MAAM,CAAC,CAAC,K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
3
+ "version": "0.25.0",
4
4
  "description": "The official TypeScript library for the Perplexity API",
5
5
  "author": "Perplexity <api@perplexity.ai>",
6
6
  "types": "./index.d.ts",
@@ -0,0 +1,64 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import * as Shared from "./shared.mjs";
3
+ import { APIPromise } from "../core/api-promise.mjs";
4
+ import { RequestOptions } from "../internal/request-options.mjs";
5
+ export declare class ContextualizedEmbeddings extends APIResource {
6
+ /**
7
+ * Generate contextualized embeddings for document chunks. Chunks from the same
8
+ * document share context awareness, improving retrieval quality for document-based
9
+ * applications.
10
+ */
11
+ create(body: ContextualizedEmbeddingCreateParams, options?: RequestOptions): APIPromise<ContextualizedEmbeddingCreateResponse>;
12
+ }
13
+ /**
14
+ * Response body for contextualized embeddings request
15
+ */
16
+ export interface ContextualizedEmbeddingCreateResponse {
17
+ /**
18
+ * List of contextualized embedding objects
19
+ */
20
+ data?: Array<Shared.ContextualizedEmbeddingObject>;
21
+ /**
22
+ * The model used to generate embeddings
23
+ */
24
+ model?: string;
25
+ /**
26
+ * The object type
27
+ */
28
+ object?: string;
29
+ /**
30
+ * Token usage for the embeddings request
31
+ */
32
+ usage?: Shared.EmbeddingsUsage;
33
+ }
34
+ export interface ContextualizedEmbeddingCreateParams {
35
+ /**
36
+ * Nested array structure where each inner array contains chunks from a single
37
+ * document. Chunks within the same document are encoded with document-level
38
+ * context awareness. Maximum 512 documents. Total chunks across all documents must
39
+ * not exceed 16,000. Total tokens per document must not exceed 32K. All chunks in
40
+ * a single request must not exceed 120,000 tokens combined. Empty strings are not
41
+ * allowed.
42
+ */
43
+ input: Array<Array<string>>;
44
+ /**
45
+ * The contextualized embedding model to use
46
+ */
47
+ model: 'pplx-embed-context-v1-0.6b' | 'pplx-embed-context-v1-4b';
48
+ /**
49
+ * Number of dimensions for output embeddings (Matryoshka). Range: 128-1024 for
50
+ * pplx-embed-context-v1-0.6b, 128-2560 for pplx-embed-context-v1-4b. Defaults to
51
+ * full dimensions (1024 or 2560).
52
+ */
53
+ dimensions?: number;
54
+ /**
55
+ * Output encoding format for embeddings. base64_int8 returns base64-encoded signed
56
+ * int8 values. base64_binary returns base64-encoded packed binary (1 bit per
57
+ * dimension).
58
+ */
59
+ encoding_format?: 'base64_int8' | 'base64_binary';
60
+ }
61
+ export declare namespace ContextualizedEmbeddings {
62
+ export { type ContextualizedEmbeddingCreateResponse as ContextualizedEmbeddingCreateResponse, type ContextualizedEmbeddingCreateParams as ContextualizedEmbeddingCreateParams, };
63
+ }
64
+ //# sourceMappingURL=contextualized-embeddings.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextualized-embeddings.d.mts","sourceRoot":"","sources":["../src/resources/contextualized-embeddings.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,wBAAyB,SAAQ,WAAW;IACvD;;;;OAIG;IACH,MAAM,CACJ,IAAI,EAAE,mCAAmC,EACzC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,qCAAqC,CAAC;CAGrD;AAED;;GAEG;AACH,MAAM,WAAW,qCAAqC;IACpD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,6BAA6B,CAAC,CAAC;IAEnD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC;CAChC;AAED,MAAM,WAAW,mCAAmC;IAClD;;;;;;;OAOG;IACH,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5B;;OAEG;IACH,KAAK,EAAE,4BAA4B,GAAG,0BAA0B,CAAC;IAEjE;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,aAAa,GAAG,eAAe,CAAC;CACnD;AAED,MAAM,CAAC,OAAO,WAAW,wBAAwB,CAAC;IAChD,OAAO,EACL,KAAK,qCAAqC,IAAI,qCAAqC,EACnF,KAAK,mCAAmC,IAAI,mCAAmC,GAChF,CAAC;CACH"}
@@ -0,0 +1,64 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as Shared from "./shared.js";
3
+ import { APIPromise } from "../core/api-promise.js";
4
+ import { RequestOptions } from "../internal/request-options.js";
5
+ export declare class ContextualizedEmbeddings extends APIResource {
6
+ /**
7
+ * Generate contextualized embeddings for document chunks. Chunks from the same
8
+ * document share context awareness, improving retrieval quality for document-based
9
+ * applications.
10
+ */
11
+ create(body: ContextualizedEmbeddingCreateParams, options?: RequestOptions): APIPromise<ContextualizedEmbeddingCreateResponse>;
12
+ }
13
+ /**
14
+ * Response body for contextualized embeddings request
15
+ */
16
+ export interface ContextualizedEmbeddingCreateResponse {
17
+ /**
18
+ * List of contextualized embedding objects
19
+ */
20
+ data?: Array<Shared.ContextualizedEmbeddingObject>;
21
+ /**
22
+ * The model used to generate embeddings
23
+ */
24
+ model?: string;
25
+ /**
26
+ * The object type
27
+ */
28
+ object?: string;
29
+ /**
30
+ * Token usage for the embeddings request
31
+ */
32
+ usage?: Shared.EmbeddingsUsage;
33
+ }
34
+ export interface ContextualizedEmbeddingCreateParams {
35
+ /**
36
+ * Nested array structure where each inner array contains chunks from a single
37
+ * document. Chunks within the same document are encoded with document-level
38
+ * context awareness. Maximum 512 documents. Total chunks across all documents must
39
+ * not exceed 16,000. Total tokens per document must not exceed 32K. All chunks in
40
+ * a single request must not exceed 120,000 tokens combined. Empty strings are not
41
+ * allowed.
42
+ */
43
+ input: Array<Array<string>>;
44
+ /**
45
+ * The contextualized embedding model to use
46
+ */
47
+ model: 'pplx-embed-context-v1-0.6b' | 'pplx-embed-context-v1-4b';
48
+ /**
49
+ * Number of dimensions for output embeddings (Matryoshka). Range: 128-1024 for
50
+ * pplx-embed-context-v1-0.6b, 128-2560 for pplx-embed-context-v1-4b. Defaults to
51
+ * full dimensions (1024 or 2560).
52
+ */
53
+ dimensions?: number;
54
+ /**
55
+ * Output encoding format for embeddings. base64_int8 returns base64-encoded signed
56
+ * int8 values. base64_binary returns base64-encoded packed binary (1 bit per
57
+ * dimension).
58
+ */
59
+ encoding_format?: 'base64_int8' | 'base64_binary';
60
+ }
61
+ export declare namespace ContextualizedEmbeddings {
62
+ export { type ContextualizedEmbeddingCreateResponse as ContextualizedEmbeddingCreateResponse, type ContextualizedEmbeddingCreateParams as ContextualizedEmbeddingCreateParams, };
63
+ }
64
+ //# sourceMappingURL=contextualized-embeddings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextualized-embeddings.d.ts","sourceRoot":"","sources":["../src/resources/contextualized-embeddings.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,wBAAyB,SAAQ,WAAW;IACvD;;;;OAIG;IACH,MAAM,CACJ,IAAI,EAAE,mCAAmC,EACzC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,qCAAqC,CAAC;CAGrD;AAED;;GAEG;AACH,MAAM,WAAW,qCAAqC;IACpD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,6BAA6B,CAAC,CAAC;IAEnD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC;CAChC;AAED,MAAM,WAAW,mCAAmC;IAClD;;;;;;;OAOG;IACH,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5B;;OAEG;IACH,KAAK,EAAE,4BAA4B,GAAG,0BAA0B,CAAC;IAEjE;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,aAAa,GAAG,eAAe,CAAC;CACnD;AAED,MAAM,CAAC,OAAO,WAAW,wBAAwB,CAAC;IAChD,OAAO,EACL,KAAK,qCAAqC,IAAI,qCAAqC,EACnF,KAAK,mCAAmC,IAAI,mCAAmC,GAChF,CAAC;CACH"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ContextualizedEmbeddings = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ class ContextualizedEmbeddings extends resource_1.APIResource {
7
+ /**
8
+ * Generate contextualized embeddings for document chunks. Chunks from the same
9
+ * document share context awareness, improving retrieval quality for document-based
10
+ * applications.
11
+ */
12
+ create(body, options) {
13
+ return this._client.post('/v1/contextualizedembeddings', { body, ...options });
14
+ }
15
+ }
16
+ exports.ContextualizedEmbeddings = ContextualizedEmbeddings;
17
+ //# sourceMappingURL=contextualized-embeddings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextualized-embeddings.js","sourceRoot":"","sources":["../src/resources/contextualized-embeddings.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAK/C,MAAa,wBAAyB,SAAQ,sBAAW;IACvD;;;;OAIG;IACH,MAAM,CACJ,IAAyC,EACzC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;CACF;AAZD,4DAYC"}
@@ -0,0 +1,13 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ export class ContextualizedEmbeddings extends APIResource {
4
+ /**
5
+ * Generate contextualized embeddings for document chunks. Chunks from the same
6
+ * document share context awareness, improving retrieval quality for document-based
7
+ * applications.
8
+ */
9
+ create(body, options) {
10
+ return this._client.post('/v1/contextualizedembeddings', { body, ...options });
11
+ }
12
+ }
13
+ //# sourceMappingURL=contextualized-embeddings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextualized-embeddings.mjs","sourceRoot":"","sources":["../src/resources/contextualized-embeddings.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAKtB,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IACvD;;;;OAIG;IACH,MAAM,CACJ,IAAyC,EACzC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;CACF"}
@@ -0,0 +1,60 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import * as Shared from "./shared.mjs";
3
+ import { APIPromise } from "../core/api-promise.mjs";
4
+ import { RequestOptions } from "../internal/request-options.mjs";
5
+ export declare class Embeddings extends APIResource {
6
+ /**
7
+ * Generate embeddings for a list of texts. Use these embeddings for semantic
8
+ * search, clustering, and other machine learning applications.
9
+ */
10
+ create(body: EmbeddingCreateParams, options?: RequestOptions): APIPromise<EmbeddingCreateResponse>;
11
+ }
12
+ /**
13
+ * Response body for embeddings request
14
+ */
15
+ export interface EmbeddingCreateResponse {
16
+ /**
17
+ * List of embedding objects
18
+ */
19
+ data?: Array<Shared.EmbeddingObject>;
20
+ /**
21
+ * The model used to generate embeddings
22
+ */
23
+ model?: string;
24
+ /**
25
+ * The object type
26
+ */
27
+ object?: string;
28
+ /**
29
+ * Token usage for the embeddings request
30
+ */
31
+ usage?: Shared.EmbeddingsUsage;
32
+ }
33
+ export interface EmbeddingCreateParams {
34
+ /**
35
+ * Input text to embed, encoded as a string or array of strings. Maximum 512 texts
36
+ * per request. Each input must not exceed 32K tokens. All inputs in a single
37
+ * request must not exceed 120,000 tokens combined. Empty strings are not allowed.
38
+ */
39
+ input: string | Array<string>;
40
+ /**
41
+ * The embedding model to use
42
+ */
43
+ model: 'pplx-embed-v1-0.6b' | 'pplx-embed-v1-4b';
44
+ /**
45
+ * Number of dimensions for output embeddings (Matryoshka). Range: 128-1024 for
46
+ * pplx-embed-v1-0.6b, 128-2560 for pplx-embed-v1-4b. Defaults to full dimensions
47
+ * (1024 or 2560).
48
+ */
49
+ dimensions?: number;
50
+ /**
51
+ * Output encoding format for embeddings. base64_int8 returns base64-encoded signed
52
+ * int8 values. base64_binary returns base64-encoded packed binary (1 bit per
53
+ * dimension).
54
+ */
55
+ encoding_format?: 'base64_int8' | 'base64_binary';
56
+ }
57
+ export declare namespace Embeddings {
58
+ export { type EmbeddingCreateResponse as EmbeddingCreateResponse, type EmbeddingCreateParams as EmbeddingCreateParams, };
59
+ }
60
+ //# sourceMappingURL=embeddings.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddings.d.mts","sourceRoot":"","sources":["../src/resources/embeddings.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,UAAW,SAAQ,WAAW;IACzC;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;CAGnG;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAErC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B;;OAEG;IACH,KAAK,EAAE,oBAAoB,GAAG,kBAAkB,CAAC;IAEjD;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,aAAa,GAAG,eAAe,CAAC;CACnD;AAED,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC;IAClC,OAAO,EACL,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;CACH"}
@@ -0,0 +1,60 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as Shared from "./shared.js";
3
+ import { APIPromise } from "../core/api-promise.js";
4
+ import { RequestOptions } from "../internal/request-options.js";
5
+ export declare class Embeddings extends APIResource {
6
+ /**
7
+ * Generate embeddings for a list of texts. Use these embeddings for semantic
8
+ * search, clustering, and other machine learning applications.
9
+ */
10
+ create(body: EmbeddingCreateParams, options?: RequestOptions): APIPromise<EmbeddingCreateResponse>;
11
+ }
12
+ /**
13
+ * Response body for embeddings request
14
+ */
15
+ export interface EmbeddingCreateResponse {
16
+ /**
17
+ * List of embedding objects
18
+ */
19
+ data?: Array<Shared.EmbeddingObject>;
20
+ /**
21
+ * The model used to generate embeddings
22
+ */
23
+ model?: string;
24
+ /**
25
+ * The object type
26
+ */
27
+ object?: string;
28
+ /**
29
+ * Token usage for the embeddings request
30
+ */
31
+ usage?: Shared.EmbeddingsUsage;
32
+ }
33
+ export interface EmbeddingCreateParams {
34
+ /**
35
+ * Input text to embed, encoded as a string or array of strings. Maximum 512 texts
36
+ * per request. Each input must not exceed 32K tokens. All inputs in a single
37
+ * request must not exceed 120,000 tokens combined. Empty strings are not allowed.
38
+ */
39
+ input: string | Array<string>;
40
+ /**
41
+ * The embedding model to use
42
+ */
43
+ model: 'pplx-embed-v1-0.6b' | 'pplx-embed-v1-4b';
44
+ /**
45
+ * Number of dimensions for output embeddings (Matryoshka). Range: 128-1024 for
46
+ * pplx-embed-v1-0.6b, 128-2560 for pplx-embed-v1-4b. Defaults to full dimensions
47
+ * (1024 or 2560).
48
+ */
49
+ dimensions?: number;
50
+ /**
51
+ * Output encoding format for embeddings. base64_int8 returns base64-encoded signed
52
+ * int8 values. base64_binary returns base64-encoded packed binary (1 bit per
53
+ * dimension).
54
+ */
55
+ encoding_format?: 'base64_int8' | 'base64_binary';
56
+ }
57
+ export declare namespace Embeddings {
58
+ export { type EmbeddingCreateResponse as EmbeddingCreateResponse, type EmbeddingCreateParams as EmbeddingCreateParams, };
59
+ }
60
+ //# sourceMappingURL=embeddings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddings.d.ts","sourceRoot":"","sources":["../src/resources/embeddings.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,UAAW,SAAQ,WAAW;IACzC;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;CAGnG;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAErC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B;;OAEG;IACH,KAAK,EAAE,oBAAoB,GAAG,kBAAkB,CAAC;IAEjD;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,aAAa,GAAG,eAAe,CAAC;CACnD;AAED,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC;IAClC,OAAO,EACL,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;CACH"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Embeddings = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ class Embeddings extends resource_1.APIResource {
7
+ /**
8
+ * Generate embeddings for a list of texts. Use these embeddings for semantic
9
+ * search, clustering, and other machine learning applications.
10
+ */
11
+ create(body, options) {
12
+ return this._client.post('/v1/embeddings', { body, ...options });
13
+ }
14
+ }
15
+ exports.Embeddings = Embeddings;
16
+ //# sourceMappingURL=embeddings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddings.js","sourceRoot":"","sources":["../src/resources/embeddings.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAK/C,MAAa,UAAW,SAAQ,sBAAW;IACzC;;;OAGG;IACH,MAAM,CAAC,IAA2B,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;CACF;AARD,gCAQC"}
@@ -0,0 +1,12 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ export class Embeddings extends APIResource {
4
+ /**
5
+ * Generate embeddings for a list of texts. Use these embeddings for semantic
6
+ * search, clustering, and other machine learning applications.
7
+ */
8
+ create(body, options) {
9
+ return this._client.post('/v1/embeddings', { body, ...options });
10
+ }
11
+ }
12
+ //# sourceMappingURL=embeddings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddings.mjs","sourceRoot":"","sources":["../src/resources/embeddings.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAKtB,MAAM,OAAO,UAAW,SAAQ,WAAW;IACzC;;;OAGG;IACH,MAAM,CAAC,IAA2B,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;CACF"}
@@ -1,6 +1,8 @@
1
1
  export * from "./shared.mjs";
2
2
  export { Async } from "./async/async.mjs";
3
3
  export { Chat, type StreamChunk } from "./chat/chat.mjs";
4
- export { Responses, type Annotation, type ContentPart, type ErrorInfo, type OutputItem, type ResponseStreamChunk, type ResponsesCreateParams, type ResponsesUsage, type ResponseCreateResponse, type ResponseCreateParams, type ResponseCreateParamsNonStreaming, type ResponseCreateParamsStreaming, } from "./responses.mjs";
4
+ export { ContextualizedEmbeddings, type ContextualizedEmbeddingCreateResponse, type ContextualizedEmbeddingCreateParams, } from "./contextualized-embeddings.mjs";
5
+ export { Embeddings, type EmbeddingCreateResponse, type EmbeddingCreateParams } from "./embeddings.mjs";
6
+ export { Responses, type Annotation, type ContentPart, type ErrorInfo, type FunctionCallOutputItem, type FunctionTool, type InputItem, type OutputItem, type ResponseStreamChunk, type ResponsesCreateParams, type ResponsesUsage, type ResponseCreateResponse, type ResponseCreateParams, type ResponseCreateParamsNonStreaming, type ResponseCreateParamsStreaming, } from "./responses.mjs";
5
7
  export { Search, type SearchCreateResponse, type SearchCreateParams } from "./search.mjs";
6
8
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EAAE,KAAK,EAAE;OACT,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE;OAC1B,EACL,SAAS,EACT,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,GACnC;OACM,EAAE,MAAM,EAAE,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAAE"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EAAE,KAAK,EAAE;OACT,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE;OAC1B,EACL,wBAAwB,EACxB,KAAK,qCAAqC,EAC1C,KAAK,mCAAmC,GACzC;OACM,EAAE,UAAU,EAAE,KAAK,uBAAuB,EAAE,KAAK,qBAAqB,EAAE;OACxE,EACL,SAAS,EACT,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,GACnC;OACM,EAAE,MAAM,EAAE,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAAE"}
@@ -1,6 +1,8 @@
1
1
  export * from "./shared.js";
2
2
  export { Async } from "./async/async.js";
3
3
  export { Chat, type StreamChunk } from "./chat/chat.js";
4
- export { Responses, type Annotation, type ContentPart, type ErrorInfo, type OutputItem, type ResponseStreamChunk, type ResponsesCreateParams, type ResponsesUsage, type ResponseCreateResponse, type ResponseCreateParams, type ResponseCreateParamsNonStreaming, type ResponseCreateParamsStreaming, } from "./responses.js";
4
+ export { ContextualizedEmbeddings, type ContextualizedEmbeddingCreateResponse, type ContextualizedEmbeddingCreateParams, } from "./contextualized-embeddings.js";
5
+ export { Embeddings, type EmbeddingCreateResponse, type EmbeddingCreateParams } from "./embeddings.js";
6
+ export { Responses, type Annotation, type ContentPart, type ErrorInfo, type FunctionCallOutputItem, type FunctionTool, type InputItem, type OutputItem, type ResponseStreamChunk, type ResponsesCreateParams, type ResponsesUsage, type ResponseCreateResponse, type ResponseCreateParams, type ResponseCreateParamsNonStreaming, type ResponseCreateParamsStreaming, } from "./responses.js";
5
7
  export { Search, type SearchCreateResponse, type SearchCreateParams } from "./search.js";
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EAAE,KAAK,EAAE;OACT,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE;OAC1B,EACL,SAAS,EACT,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,GACnC;OACM,EAAE,MAAM,EAAE,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAAE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";OAGO,EAAE,KAAK,EAAE;OACT,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE;OAC1B,EACL,wBAAwB,EACxB,KAAK,qCAAqC,EAC1C,KAAK,mCAAmC,GACzC;OACM,EAAE,UAAU,EAAE,KAAK,uBAAuB,EAAE,KAAK,qBAAqB,EAAE;OACxE,EACL,SAAS,EACT,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,GACnC;OACM,EAAE,MAAM,EAAE,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAAE"}
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Search = exports.Responses = exports.Chat = exports.Async = void 0;
4
+ exports.Search = exports.Responses = exports.Embeddings = exports.ContextualizedEmbeddings = exports.Chat = exports.Async = void 0;
5
5
  const tslib_1 = require("../internal/tslib.js");
6
6
  tslib_1.__exportStar(require("./shared.js"), exports);
7
7
  var async_1 = require("./async/async.js");
8
8
  Object.defineProperty(exports, "Async", { enumerable: true, get: function () { return async_1.Async; } });
9
9
  var chat_1 = require("./chat/chat.js");
10
10
  Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return chat_1.Chat; } });
11
+ var contextualized_embeddings_1 = require("./contextualized-embeddings.js");
12
+ Object.defineProperty(exports, "ContextualizedEmbeddings", { enumerable: true, get: function () { return contextualized_embeddings_1.ContextualizedEmbeddings; } });
13
+ var embeddings_1 = require("./embeddings.js");
14
+ Object.defineProperty(exports, "Embeddings", { enumerable: true, get: function () { return embeddings_1.Embeddings; } });
11
15
  var responses_1 = require("./responses.js");
12
16
  Object.defineProperty(exports, "Responses", { enumerable: true, get: function () { return responses_1.Responses; } });
13
17
  var search_1 = require("./search.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,sDAAyB;AACzB,0CAAsC;AAA7B,8FAAA,KAAK,OAAA;AACd,uCAAqD;AAA5C,4FAAA,IAAI,OAAA;AACb,4CAaqB;AAZnB,sGAAA,SAAS,OAAA;AAaX,sCAAsF;AAA7E,gGAAA,MAAM,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,sDAAyB;AACzB,0CAAsC;AAA7B,8FAAA,KAAK,OAAA;AACd,uCAAqD;AAA5C,4FAAA,IAAI,OAAA;AACb,4EAIqC;AAHnC,qIAAA,wBAAwB,OAAA;AAI1B,8CAAoG;AAA3F,wGAAA,UAAU,OAAA;AACnB,4CAgBqB;AAfnB,sGAAA,SAAS,OAAA;AAgBX,sCAAsF;AAA7E,gGAAA,MAAM,OAAA"}
@@ -2,6 +2,8 @@
2
2
  export * from "./shared.mjs";
3
3
  export { Async } from "./async/async.mjs";
4
4
  export { Chat } from "./chat/chat.mjs";
5
+ export { ContextualizedEmbeddings, } from "./contextualized-embeddings.mjs";
6
+ export { Embeddings } from "./embeddings.mjs";
5
7
  export { Responses, } from "./responses.mjs";
6
8
  export { Search } from "./search.mjs";
7
9
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,EAAE,KAAK,EAAE;OACT,EAAE,IAAI,EAAoB;OAC1B,EACL,SAAS,GAYV;OACM,EAAE,MAAM,EAAsD"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,EAAE,KAAK,EAAE;OACT,EAAE,IAAI,EAAoB;OAC1B,EACL,wBAAwB,GAGzB;OACM,EAAE,UAAU,EAA4D;OACxE,EACL,SAAS,GAeV;OACM,EAAE,MAAM,EAAsD"}