3.1.5 • Published 10 months ago

cortex-ts v3.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

cortex-ts

Installation

npm install cortex-ts

Usage

First initalize the CortexAPI class with your API key and user ID. You can find your API key and user ID in the Cortex dashboard.

import { CortexAPI } from 'cortex-ts';
const {CORTEX_API_KEY, USER_ID} = process.env;

const cortex = new CortexAPI(CORTEX_API_KEY,USER_ID);

Then you can use the API methods to interact with the Cortex API.

try {
    const res = await cortex.getDocument('tigers','testing.txt')
    const document = res.data.document
    console.log(document.text);
} catch (error) {
    if (error.response) {
        console.log(error.response.status);
        console.log(error.response.data);
    } else {
        console.log(error.message);
    }
}
const testing = {
  "source_url": "https://www.test.com/",
  "text": "test"
  }

try {
  let output = await cortex.uploadDocument('tigers','test1',testing);
  console.log(output.data.document);
} catch (error:any) {
  if (error.response) {
    console.log(error.response.status);
    console.log(error.response.data);
  } else {
    console.log(error.message);
  }
}
try {
  let output = await cortex.deleteDocument('tigers','test1');
  console.log(output.data.document);
} catch (error:any) {
  if (error.response) {
    console.log(error.response.status);
    console.log(error.response.data);
  } else {
    console.log(error.message);
  }
}
3.1.3

10 months ago

3.1.2

11 months ago

3.1.1

11 months ago

3.1.0

11 months ago

3.1.5

10 months ago

3.1.4

10 months ago

3.0.1

11 months ago

3.0.0

11 months ago

2.2.1

11 months ago

2.2.0

11 months ago

2.1.0

11 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago