@revenium/perplexity 1.0.0 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenium/perplexity",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "NodeJS middleware for perplexity's AI API",
5
5
  "homepage": "https://github.com/revenium/revenium-middleware-perplexity-node#readme",
6
6
  "bugs": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "license": "ISC",
14
14
  "author": "",
15
- "type": "commonjs",
15
+ "type": "module",
16
16
  "main": "dist/index.js",
17
17
  "scripts": {
18
18
  "build": "tsc",
@@ -41,6 +41,7 @@
41
41
  "typescript"
42
42
  ],
43
43
  "dependencies": {
44
+ "@revenium/perplexity": "^1.0.0",
44
45
  "axios": "^1.11.0",
45
46
  "dotenv": "^17.2.1",
46
47
  "openai": "^5.15.0",
@@ -0,0 +1,22 @@
1
+ import { createPerplexityClient } from "@revenium/perplexity";
2
+
3
+ async function basicExample() {
4
+ const client = createPerplexityClient();
5
+
6
+ const response = await client.createChatCompletion({
7
+ model: "sonar-pro",
8
+ messages: [
9
+ {
10
+ role: "user",
11
+ content: "What is the meaning of life, the universe and everything?",
12
+ },
13
+ ],
14
+ });
15
+
16
+ console.log("āœ… Response received:");
17
+ console.log(response.choices[0].message.content);
18
+ console.log("\nšŸ“Š Token usage automatically tracked by middleware");
19
+ console.log("šŸŽ‰ Basic client example successful!");
20
+ }
21
+
22
+ basicExample();