Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed typo "Boolean indicating if the close button should be present present."

...

Starting an agent within your Web application involved involves calling the profound.ai.startAgent() API and passing a configuration object parameter. For example:

Code Block
languagejs
profound.ai.startAgent({
  agent: "HR.agent.json",
  heading: "HR Assistant",
  greeting: "How can I help?"embed: true
});

After an agent is started, you can use various methods of profound.ai.agent to control it. For example:

...

Specifies the server-side definition file for the AI Agent. The file should end in “.agent.json”.

embed

When set to true, instead of starting the agent interface immediately, a chat icon is rendered in the bottom right corner of the application.

heading

Overrides the heading text for the chat interface.

greeting

Overrides the greeting message to show at the top of the chat interface.

server

Optional URL of the Profound AI server. This property should be specified if the application is running on a separate serverserver is that is separate from Profound AI.

jwt

Provides a JSON Web Token to facilitate authentication into Profound AI. The token can be supplied either as a static value to be used at the start of an agent conversation or as a function. When provided as a function, the token will be re-evaluated with every agent interaction.

theme

The Sets the theme of the chat interface (e.g., "light" or "dark").

brandColor

The Overrides the brand color used in the chat interface. If a brand color is not specified, the default CSS rules are used.

...

Boolean indicating if the close button should be present present.

closeTitle

The tool tip text for the close button.

...

The tool tip text for the send button.

...

embedIconTitle

Placeholder The tool tip text for the prompt boxembed icon.

...

promptPlaceHolder

Heading Placeholder text for the chat interface.

greeting

Greeting message to show at the top of the chat interfaceprompt box.

pollInterval

Time interval for polling in milliseconds.

...

Variable instruction data that is specified as an object of key/value pairs or a function that returns an object of key/value pairs. The values can either be simple values, such as strings or numbers, or more complex values, such as a list of records. See the Application Variables section under Agent Guidance for details on how utilize variable data. Examples:

Code Block
languagejs
// Static value(s) initialized once when the agent is started
data: {
  "customerName": "ABC Company"
}

// Dynamic value(s) provided withinwith an arrow function and evaluated with every interaction
data: () => ({
  "customerName": getCustomerName()
})

...

Checks if the loader is currently displayed, which indicates that the server is currently processing the user’s request.

removeEmbedIcon()

Removes the embedded chat icon in the corner of the screen. You can use this method when navigating away from a screen in a single page application. The method is accessible both from the profound.ai.agent and the profound.ai client-side objects. The following 2 method calls are equivalent:

Code Block
languagejs
// This method call is preferred and will work even when an agent is not started
profound.ai.removeEmbedIcon();

// This method call will only work if an agent is already started
profound.ai.agent.removeEmbedIcon();

destroy()

Destroys the chat user interface and cleans up resources.