The Outpost API Node.js SDK with TypeScript support.
# with npm
npm install outpostkit
# with yarn
yarn add outpostkit
# with pnpm
pnpm add outpostkit
To start using the Comet API, create a Comet object with your API key and the ID of the comet service.
import { Comet } from 'outpostkit'
const comet= new Comet('api-key','cometId');
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:
const response = comet.prompt({input:"what is useCallback?",stream:false,sessionId:'prevSession'});
const sessions = comet.listSessions({});
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.
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
const conversation = comet.getConversation({conversationId:'convoId'});
const message = comet.getMessage({messageId:'mId'});
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. |
Outpost Kit is a project by Outpost.
Released under the MIT License.