https://github.com/outposthq/outpostkit
The Outpost API Node.js SDK with TypeScript support.
https://github.com/outposthq/outpostkit
Last synced: about 1 year ago
JSON representation
The Outpost API Node.js SDK with TypeScript support.
- Host: GitHub
- URL: https://github.com/outposthq/outpostkit
- Owner: outpostHQ
- License: mit
- Created: 2023-08-03T15:31:40.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-28T09:00:06.000Z (over 2 years ago)
- Last Synced: 2025-05-05T04:17:51.709Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://outpost.run
- Size: 273 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Outpost Kit
The Outpost API Node.js SDK with TypeScript support.
[](https://www.npmjs.com/package/outpostkit)
[](https://discord.gg/sHnHPnAPZj)
## Installation
```sh
# with npm
npm install outpostkit
# with yarn
yarn add outpostkit
# with pnpm
pnpm add outpostkit
```
## Usage
To start using the Comet API, create a Comet object with your API key and the ID of the comet service.
```ts
import { Comet } from 'outpostkit'
const comet= new Comet('api-key','cometId');
```
### Now you can start prompting the comet service
```ts
const response = comet.prompt({input:"what is useCallback?",stream:false}); //returns sessionId along with the response
```
This will create a new `Session` which can then be used in subsequent prompts to maintain messaging history, which can be particularly useful when using chat models.
To continue the prompting in the same session:
```ts
const response = comet.prompt({input:"what is useCallback?",stream:false,sessionId:'prevSession'});
```
### Prompt Sessions
#### List Prompt Sessions
```ts
const sessions = comet.listSessions({});
```
#### Get details of a particular Session
```ts
const session = comet.getSession({sessionId:'someSessionId'});
```
A `Session` consists of one or more `Conversations` which in turn are usally just a single prompt and its response (for example: pair of one human and one agent `Message`).
The `Conversation` model is created to better handle human feedback.
A conversation can also contain messages from functions, system too.
### Conversations
#### List Conversations of a Session
```ts
const conversations = comet.listConversations({sessionId:'sessionId',stats:false,messages:true}); //defaults: stats:false messages:false
```
This lists all the conversations of a session along with its messages but omits the conversation stats
#### Get messages and details of a particular Conversation
```ts
const conversation = comet.getConversation({conversationId:'convoId'});
```
### Messages
#### Get Message
```ts
const message = comet.getMessage({messageId:'mId'});
```
### Available Routes
| Route | Route Description |
| ----------------------- | --------------------------------------- |
| `GET /api/v1/project` | Endpoint to receive Project lists. |
| `GET /api/v1/comet` | Endpoint to receive Comet lists. |
| `GET /api/v1/conflux` | Endpoint to receive Conflux lists. |
## License
Outpost Kit is a project by [Outpost](https://outpost.run).
Released under the MIT License.