@revenium/perplexity 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +113 -97
- package/LICENSE +21 -21
- package/README.md +292 -290
- package/SECURITY.md +34 -34
- package/dist/cjs/core/client/manager.js +6 -3
- package/dist/cjs/core/client/manager.js.map +1 -1
- package/dist/cjs/core/config/validator.js +18 -16
- package/dist/cjs/core/config/validator.js.map +1 -1
- package/dist/cjs/core/middleware/interfaces.js +4 -4
- package/dist/cjs/core/middleware/interfaces.js.map +1 -1
- package/dist/cjs/core/middleware/streaming-wrapper.js +4 -4
- package/dist/cjs/core/middleware/streaming-wrapper.js.map +1 -1
- package/dist/cjs/core/tracking/api-client.js +3 -3
- package/dist/cjs/core/tracking/api-client.js.map +1 -1
- package/dist/cjs/index.js +1 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/core/client/manager.js +6 -3
- package/dist/esm/core/client/manager.js.map +1 -1
- package/dist/esm/core/config/validator.js +18 -16
- package/dist/esm/core/config/validator.js.map +1 -1
- package/dist/esm/core/middleware/interfaces.js +1 -1
- package/dist/esm/core/middleware/interfaces.js.map +1 -1
- package/dist/esm/core/middleware/streaming-wrapper.js +2 -2
- package/dist/esm/core/middleware/streaming-wrapper.js.map +1 -1
- package/dist/esm/core/tracking/api-client.js +1 -1
- package/dist/esm/core/tracking/api-client.js.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/types/core/client/manager.d.ts.map +1 -1
- package/dist/types/core/config/validator.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.d.ts.map +1 -1
- package/examples/README.md +226 -226
- package/examples/advanced.ts +123 -123
- package/examples/basic.ts +45 -45
- package/examples/getting_started.ts +41 -41
- package/examples/metadata.ts +68 -68
- package/examples/stream.ts +53 -53
- package/package.json +72 -71
- package/dist/cjs/constants/models.js +0 -38
- package/dist/cjs/constants/models.js.map +0 -1
- package/dist/esm/constants/models.js +0 -35
- package/dist/esm/constants/models.js.map +0 -1
- package/dist/types/constants/models.d.ts +0 -39
- package/dist/types/constants/models.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,71 +1,72 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@revenium/perplexity",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "NodeJS middleware for Perplexity AI API with Revenium metering",
|
|
5
|
-
"homepage": "https://github.com/revenium/revenium-middleware-perplexity-node#readme",
|
|
6
|
-
"bugs": {
|
|
7
|
-
"url": "https://github.com/revenium/revenium-middleware-perplexity-node/issues"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/revenium/revenium-middleware-perplexity-node.git"
|
|
12
|
-
},
|
|
13
|
-
"main": "dist/cjs/index.js",
|
|
14
|
-
"module": "dist/esm/index.js",
|
|
15
|
-
"types": "dist/types/index.d.ts",
|
|
16
|
-
"exports": {
|
|
17
|
-
".": {
|
|
18
|
-
"import": "./dist/esm/index.js",
|
|
19
|
-
"require": "./dist/cjs/index.js",
|
|
20
|
-
"types": "./dist/types/index.d.ts"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"dist/",
|
|
25
|
-
"examples/",
|
|
26
|
-
"README.md",
|
|
27
|
-
"CHANGELOG.md",
|
|
28
|
-
"LICENSE",
|
|
29
|
-
"SECURITY.md"
|
|
30
|
-
],
|
|
31
|
-
"scripts": {
|
|
32
|
-
"clean": "rm -rf dist",
|
|
33
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
34
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
35
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
36
|
-
"build": "npm run
|
|
37
|
-
"prepublishOnly": "npm run build",
|
|
38
|
-
"example:getting-started": "npx tsx examples/getting_started.ts",
|
|
39
|
-
"example:basic": "npx tsx examples/basic.ts",
|
|
40
|
-
"example:metadata": "npx tsx examples/metadata.ts",
|
|
41
|
-
"example:advanced": "npx tsx examples/advanced.ts",
|
|
42
|
-
"example:stream": "npx tsx examples/stream.ts",
|
|
43
|
-
"test": "npm run example:getting-started && npm run example:stream"
|
|
44
|
-
},
|
|
45
|
-
"keywords": [
|
|
46
|
-
"revenium",
|
|
47
|
-
"middleware",
|
|
48
|
-
"perplexity",
|
|
49
|
-
"ai",
|
|
50
|
-
"chat",
|
|
51
|
-
"completion",
|
|
52
|
-
"metering",
|
|
53
|
-
"monitoring",
|
|
54
|
-
"typescript"
|
|
55
|
-
],
|
|
56
|
-
"author": "Revenium",
|
|
57
|
-
"license": "MIT",
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@revenium/perplexity",
|
|
3
|
+
"version": "2.0.6",
|
|
4
|
+
"description": "NodeJS middleware for Perplexity AI API with Revenium metering",
|
|
5
|
+
"homepage": "https://github.com/revenium/revenium-middleware-perplexity-node#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/revenium/revenium-middleware-perplexity-node/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/revenium/revenium-middleware-perplexity-node.git"
|
|
12
|
+
},
|
|
13
|
+
"main": "dist/cjs/index.js",
|
|
14
|
+
"module": "dist/esm/index.js",
|
|
15
|
+
"types": "dist/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/esm/index.js",
|
|
19
|
+
"require": "./dist/cjs/index.js",
|
|
20
|
+
"types": "./dist/types/index.d.ts"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist/",
|
|
25
|
+
"examples/",
|
|
26
|
+
"README.md",
|
|
27
|
+
"CHANGELOG.md",
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"SECURITY.md"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"clean": "rm -rf dist",
|
|
33
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
34
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
35
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
36
|
+
"build": "npm run build:esm && npm run build:cjs && npm run build:types",
|
|
37
|
+
"prepublishOnly": "npm run build",
|
|
38
|
+
"example:getting-started": "npx tsx examples/getting_started.ts",
|
|
39
|
+
"example:basic": "npx tsx examples/basic.ts",
|
|
40
|
+
"example:metadata": "npx tsx examples/metadata.ts",
|
|
41
|
+
"example:advanced": "npx tsx examples/advanced.ts",
|
|
42
|
+
"example:stream": "npx tsx examples/stream.ts",
|
|
43
|
+
"test": "npm run example:getting-started && npm run example:stream"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"revenium",
|
|
47
|
+
"middleware",
|
|
48
|
+
"perplexity",
|
|
49
|
+
"ai",
|
|
50
|
+
"chat",
|
|
51
|
+
"completion",
|
|
52
|
+
"metering",
|
|
53
|
+
"monitoring",
|
|
54
|
+
"typescript"
|
|
55
|
+
],
|
|
56
|
+
"author": "Revenium",
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"type": "commonjs",
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=20.0.0"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"dotenv": "^17.2.2",
|
|
64
|
+
"openai": "^5.23.1",
|
|
65
|
+
"tsx": "^4.19.2",
|
|
66
|
+
"typescript": "^5.9.2",
|
|
67
|
+
"uuid": "^13.0.0"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@types/node": "^24.7.1"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Perplexity Model Constants
|
|
4
|
-
*
|
|
5
|
-
* Official model names for Perplexity AI.
|
|
6
|
-
* Use these constants instead of hardcoding model strings.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import { PERPLEXITY_MODELS } from "@revenium/perplexity";
|
|
11
|
-
*
|
|
12
|
-
* const response = await client.chat().completions().create({
|
|
13
|
-
* model: PERPLEXITY_MODELS.SONAR_PRO,
|
|
14
|
-
* messages: [{ role: "user", content: "Hello!" }]
|
|
15
|
-
* });
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.PERPLEXITY_MODELS = void 0;
|
|
20
|
-
/**
|
|
21
|
-
* Available Perplexity AI models
|
|
22
|
-
* @see https://docs.perplexity.ai/docs/model-cards
|
|
23
|
-
*/
|
|
24
|
-
exports.PERPLEXITY_MODELS = {
|
|
25
|
-
/**
|
|
26
|
-
* Sonar Pro - Most capable model for complex queries
|
|
27
|
-
*/
|
|
28
|
-
SONAR_PRO: "sonar-pro",
|
|
29
|
-
/**
|
|
30
|
-
* Sonar - Standard model for most use cases
|
|
31
|
-
*/
|
|
32
|
-
SONAR: "sonar",
|
|
33
|
-
/**
|
|
34
|
-
* Sonar Reasoning - Specialized for reasoning tasks
|
|
35
|
-
*/
|
|
36
|
-
SONAR_REASONING: "sonar-reasoning",
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=models.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/constants/models.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH;;;GAGG;AACU,QAAA,iBAAiB,GAAG;IAC/B;;OAEG;IACH,SAAS,EAAE,WAAoB;IAE/B;;OAEG;IACH,KAAK,EAAE,OAAgB;IAEvB;;OAEG;IACH,eAAe,EAAE,iBAA0B;CACnC,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Perplexity Model Constants
|
|
3
|
-
*
|
|
4
|
-
* Official model names for Perplexity AI.
|
|
5
|
-
* Use these constants instead of hardcoding model strings.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { PERPLEXITY_MODELS } from "@revenium/perplexity";
|
|
10
|
-
*
|
|
11
|
-
* const response = await client.chat().completions().create({
|
|
12
|
-
* model: PERPLEXITY_MODELS.SONAR_PRO,
|
|
13
|
-
* messages: [{ role: "user", content: "Hello!" }]
|
|
14
|
-
* });
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Available Perplexity AI models
|
|
19
|
-
* @see https://docs.perplexity.ai/docs/model-cards
|
|
20
|
-
*/
|
|
21
|
-
export const PERPLEXITY_MODELS = {
|
|
22
|
-
/**
|
|
23
|
-
* Sonar Pro - Most capable model for complex queries
|
|
24
|
-
*/
|
|
25
|
-
SONAR_PRO: "sonar-pro",
|
|
26
|
-
/**
|
|
27
|
-
* Sonar - Standard model for most use cases
|
|
28
|
-
*/
|
|
29
|
-
SONAR: "sonar",
|
|
30
|
-
/**
|
|
31
|
-
* Sonar Reasoning - Specialized for reasoning tasks
|
|
32
|
-
*/
|
|
33
|
-
SONAR_REASONING: "sonar-reasoning",
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=models.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/constants/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;;OAEG;IACH,SAAS,EAAE,WAAoB;IAE/B;;OAEG;IACH,KAAK,EAAE,OAAgB;IAEvB;;OAEG;IACH,eAAe,EAAE,iBAA0B;CACnC,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Perplexity Model Constants
|
|
3
|
-
*
|
|
4
|
-
* Official model names for Perplexity AI.
|
|
5
|
-
* Use these constants instead of hardcoding model strings.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { PERPLEXITY_MODELS } from "@revenium/perplexity";
|
|
10
|
-
*
|
|
11
|
-
* const response = await client.chat().completions().create({
|
|
12
|
-
* model: PERPLEXITY_MODELS.SONAR_PRO,
|
|
13
|
-
* messages: [{ role: "user", content: "Hello!" }]
|
|
14
|
-
* });
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Available Perplexity AI models
|
|
19
|
-
* @see https://docs.perplexity.ai/docs/model-cards
|
|
20
|
-
*/
|
|
21
|
-
export declare const PERPLEXITY_MODELS: {
|
|
22
|
-
/**
|
|
23
|
-
* Sonar Pro - Most capable model for complex queries
|
|
24
|
-
*/
|
|
25
|
-
readonly SONAR_PRO: "sonar-pro";
|
|
26
|
-
/**
|
|
27
|
-
* Sonar - Standard model for most use cases
|
|
28
|
-
*/
|
|
29
|
-
readonly SONAR: "sonar";
|
|
30
|
-
/**
|
|
31
|
-
* Sonar Reasoning - Specialized for reasoning tasks
|
|
32
|
-
*/
|
|
33
|
-
readonly SONAR_REASONING: "sonar-reasoning";
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Type representing valid Perplexity model names
|
|
37
|
-
*/
|
|
38
|
-
export type PerplexityModel = (typeof PERPLEXITY_MODELS)[keyof typeof PERPLEXITY_MODELS];
|
|
39
|
-
//# sourceMappingURL=models.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/constants/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;IAC5B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEK,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,eAAe,GACzB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
|