Tutorial

setupConfiguration

setupAssistant Configuration

Schema

let config = {
    provider: 'azureai',// or 'openai'
    model: gpt model, //For azure it is the model created on Azure Portal
    credentials: {
      key: <key for openai or azureai> //from openai or azureai
      endPoint: <url of AzureAI resource> // From azureai portal
    },
    assistantid: NEW|REUSE| valid assistantid 
    assistantName: <name of the assistant>,
    threadid: NEW|REUSE|valid threadid, 
    code: true, 
    retrieval: true,
    userData: <some object set by developer>
}

provider

This is either 'openai' or 'azureai" depending on who your provider is.

model and credentials

  • openai: A model that supports assistant api Openai keys

  • azureai: This is the deployment you create with Azure AI studio. Visit Azure AI portal

Assistant

Each instance of assistant has a unique id, However the names of the assistant are not unique.

To avoid adding the overhead of persisting these id's the library has some local rules.

  1. If assistandid is specified, it then used to retrieve the session. (suspect this would be a production scenario)
  2. If assistandid is 'REUSE' then search for an assistant with the assistname.
    • If not found drop down to option 3 below and create a new assistant
  3. If assistantid is 'NEW' then create a new assistant with the sessionName
    • If the assistant with the name exists, it will be deleted
    • This might result in mulitple assistants with the same name

During development recommend setting assistantid to NEW

Thread

To avoid adding the overhead of persisting these id's the library has some local rules.

  1. If threadid is specified, it then used. (suspect this would be a production scenario)
  2. If threadid is 'REUSE', then the threadid saved with in the assistant's metadata will be used.
  3. If threadid is 'NEW' then a new thread is created
    • If a there was a threadid saved with the assistant it will be deleted.
    • This new threadid will be saved in the current assistant's metadata.

userData

You can set this to some object. This is passed along to the handlers for the custom tools. Some potential uses are to pass your application specific information to the custom tools.