Node.js Library
Last updated
Last updated
The function .getDocument
takes in two parameters: knowledgeName
and documentID
. It retrieves a specific document from a specified knowledge base. The function returns an AxiosPromise
with the document object.
Example return json:
The function .uploadDocument
takes in three parameters: knowledgeName
, documentID
, and document
. It uploads a new document to a specified knowledge base. The function returns an AxiosPromise
with the newly uploaded document object and the knowledge object that the document was uploaded to.
The Document object has the following interface:
Example return json:
The function .deleteDocument
takes in two parameters: knowledgeName
and documentID
. It deletes a specific document from a specified knowledge base. The function returns an AxiosPromise
with the deleted document object.
.runCallable(callableID: string, data: CallableParams): AxiosPromise<{run: RunType}>
This function runs a callable identified by callableID
with the given data
. The data
parameter must be an object of type CallableParams
which includes the version
, config
, inputs
, blocking
, and block_filter
properties. The version
property specifies the version of the callable to run. The config
property is an object of configuration parameters for the callable. The inputs
property is an array of input values for the callable. The blocking
property is a boolean that specifies whether the function should wait for the callable to complete before returning. The block_filter
property is an array of block status filters for the callable. The function returns a promise that resolves to an object of type AxiosPromise<{run: RunType}>
which includes the status of the run.
.runCallableWithStream(callableID: string, data: CallableParams): AxiosPromise
This function runs a callable identified by callableID
with the given data
and streams the output. The data
parameter must be an object of type CallableParams
which includes the version
, config
, inputs
, blocking
, and block_filter
properties. The version
property specifies the version of the callable to run. The config
property is an object of configuration parameters for the callable. The inputs
property is an array of input values for the callable. The blocking
property is a boolean that specifies whether the function should wait for the callable to complete before returning. The block_filter
property is an array of block status filters for the callable. The function returns a promise that resolves to an object of type AxiosPromise
which includes the streamed output of the callable.
.runChatCompletion(version: string, messages: Message[], input: string, projectID:string, knowledgeName: string, copilotID: string)
Name | Description |
---|---|
version
(string
) "latest"
| version number
messages
(Message[]
) array of messages previously sent to the chat callable
input
(string
) chat message that wants to be answered
projectID
(string
) projectID of user who created the knowledge that is being referenced
knowledgeName
(string
) name of knowledge being referenced
copilotID
(string
) ID of chat copilot