Global

Methods

# async createFile(filename, content, mimeType, purpose, appControl) → {promise}

make a file object from a string

Parameters:
Name Type Description
filename string

name of the file

content string

content of the file

mimeType string

mime type of the file

purpose string

assistants|Fine-turning|null

appControl object

appControl object

  • file object
promise

# async runAssistant(appControl, prompt, instructions, attachment) → {promise}

  • Run the latest prompt from the user
Parameters:
Name Type Description
appControl appControl

gpt session control object

prompt string

user's prompt

instructions string

Additional instructions for the run

attachment Array

array of files to attach to file_search for this prompt

  • response from GPT(can be text, string, html etc...)
promise
Examples
- This function will run the assistant with the prompt and return the response from the assistant.
let prompt = 'fetch 20 records from cars from public';
 let promptInstructions = 'some instructions';
 let response = await runAssistant(appControl, prompt, promptInstructions);
 console.log(response);

# async setupAssistant(config) → {promise}

Setup the assistant

Parameters:
Name Type Description
config config

configuration object

  • return appControl object}
promise

Type Definitions

object

# appControl

appControl object

Properties:
Name Type Description
provider string

provider name

model string

model name

domainTools toolspecs

tools prepended to the builtins

instructions- string

Instructions string|null. If null default instructions is used

code object

if true, enable code interpreter tool

retrieval boolean

if true enable retrieval tool(now called file_search tool in openai)

assistantName string

assistant name

assistantid string

assistant id|null

threadid string

thread id|'0'|null

vectorStoreId string

vector store id|null

assistant object

current assistant object|null

thread object

thread object|null

appEnv object

Viya session control object

client object

client object for openai|azureai

run object

active run object|null

api assistantApi

maps openai api to azureai api(most of them) with extensions

userData object

user data object

getViyaSession function

get a viya session

uploadFile function

uploadFile function(in openai writes to vector store)

object

# appEnv

appEnv object

Properties:
Name Type Description
host string

url to viya server

logonPayload logonPayload

logonPayload - passed in to setupAssistant

source string

cas|compute|none

sessionID string

session id if source is cas or compute

session object

session object(for restaf users) if source is cas or compute

servers object

servers object(for restaf users) if source is cas or compute

serverName object

compute context or cas server name

store object

restaf store object(for restaf users)

restaflib object

restaflib object(for restaf users)

restafedit object

restafedit object(for restaf users)

object

# assistantApi

api object

Properties:
Name Type Description
listAssistants function

list assistants

getAssistant function

get assistant

createAssistant function

create assistant

deleteAssistant function

delete assistant

updateAssistant function

update assistant

listMessages function

list messages

createMessage function

create message

createThread function

create thread

getThread function

get thread

deleteThread function

delete thread

createRun function

create run

getRun function

get run

cancelRun function

cancel run

listRuns function

list runs

submitToolOutputsToRun function

submit tool outputs to run

uploadFile function

upload file

createAssistantFile function

create assistant file

deleteFile function

delete file

createVectorStores function

create vector stores

getVectorStore function

get vector store

createVectorStoresFiles function

create vector stores files

deleteVectorStore function

delete vector store

listVectorStores function

list vector stores

object

# config

assistantjs setup configuration

Properties:
Name Type Description
provider string

provider name

model string

GPT model name

credentials credentials

credentials object

temperature string

temperature for GPT model

devMode string

true|false(default false)

assistantid string

assistant id(used if non-null)

assistantName string

assistant name(used if assistantid is null)

threadid string

thread id|null (used if non-null and devMode is false)

vectorStoreId string

vector store id|null

domainTools toolspecs

domain tools

viyaConfig object

viya config

logLevel string

log level - place holder for future use

pollStatus object

if true, will print status of polling

pollInterval object

interval for polling(default 5000ms)

code boolean

if true enable code-interpreter

retrieval boolean

if true enable retrieval(now called file_search)

userData object

user data object

object

# credentials

credentials object

Properties:
Name Type Description
key string

key for openai|azureai

endPoint string

endpoint for azureai

object

# logonPayload

logonPayload object for SAS Viya

Properties:
Name Type Description
authType string

code|token

host URL

host url

token string

token (if authType is token)

tokenType string

bearer(if authType is token)

object

# toolspecs

tool specification

Properties:
Name Type Description
tools array

array of tool definitions

functionList object

object of tool functions{a: functionA, b: functionb, ...}

instructions string

instructions string

object

# viyaConfig

viyaConfig object

Properties:
Name Type Description
logonPayload logonPayload

logon payload |null if not using Viya

additional object

options for restaf