@usecortex_ai/node 0.2.0 → 0.2.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/README.md +1 -44
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,15 +5,6 @@ The official TypeScript SDK for the Cortex AI platform. Build powerful, context-
|
|
|
5
5
|
* **Homepage:** [usecortex.ai](https://www.usecortex.ai/ "null")
|
|
6
6
|
* **Documentation:** [docs.usecortex.ai](https://docs.usecortex.ai/ "null")
|
|
7
7
|
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
npm install @usecortex/ai
|
|
12
|
-
# or
|
|
13
|
-
yarn add @usecortex/ai
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
|
|
17
8
|
## Getting Started
|
|
18
9
|
|
|
19
10
|
To use the SDK, you'll need an API key from your Cortex AI dashboard.
|
|
@@ -32,40 +23,6 @@ const client = new CortexAI({
|
|
|
32
23
|
|
|
33
24
|
```
|
|
34
25
|
|
|
35
|
-
### Example: Searching a Collection
|
|
36
|
-
|
|
37
|
-
Here’s a quick example of how to perform a search on an existing collection.
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
import { CortexAI } from "@usecortex/ai";
|
|
41
|
-
|
|
42
|
-
const client = new CortexAI({ apiKey: "YOUR_API_KEY" });
|
|
43
|
-
|
|
44
|
-
async function main() {
|
|
45
|
-
try {
|
|
46
|
-
const searchResults = await client.search.search({
|
|
47
|
-
collectionName: "my-knowledge-base",
|
|
48
|
-
data: {
|
|
49
|
-
query: "What is the main topic of the document?",
|
|
50
|
-
topK: 3,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
console.log("Search Results:");
|
|
55
|
-
for (const chunk of searchResults.chunks) {
|
|
56
|
-
console.log(`- Score: ${chunk.score.toFixed(2)}`);
|
|
57
|
-
console.log(` Text: ${chunk.text.substring(0, 100)}...`);
|
|
58
|
-
console.log("----------");
|
|
59
|
-
}
|
|
60
|
-
} catch (error) {
|
|
61
|
-
console.error("An error occurred during search:", error);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
main();
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
|
|
69
26
|
## Support
|
|
70
27
|
|
|
71
|
-
If you have any questions or need help, please reach out to our support team at [
|
|
28
|
+
If you have any questions or need help, please reach out to our support team at [founders@usecortex.ai](mailto:founders@usecortex.ai "null").
|
package/package.json
CHANGED