Console Login

API Reference

Classes

AmazonBedrockSupportedModels

Initializers

import { AmazonBedrockSupportedModels } from 'xpander-sdk'

new AmazonBedrockSupportedModels()

Constants

Name Type Description
ANTHROPIC_CLAUDE_3_5_SONNET_20240620 string No description.
ANTHROPIC_CLAUDE_3_HAIKU_20240307 string No description.
COHERE_COMMAND_R string No description.
COHERE_COMMAND_R_PLUS string No description.
META_LLAMA3_1_405B_INSTRUCT string No description.
META_LLAMA3_1_70B_INSTRUCT string No description.
META_LLAMA3_1_8B_INSTRUCT string No description.
MISTRAL_MISTRAL_LARGE_2402 string No description.
MISTRAL_MISTRAL_LARGE_2407 string No description.
MISTRAL_MISTRAL_SMALL_2402 string No description.

ANTHROPIC_CLAUDE_3_5_SONNET_20240620Required
public readonly ANTHROPIC_CLAUDE_3_5_SONNET_20240620: string;
  • Type: string

ANTHROPIC_CLAUDE_3_HAIKU_20240307Required
public readonly ANTHROPIC_CLAUDE_3_HAIKU_20240307: string;
  • Type: string

COHERE_COMMAND_RRequired
public readonly COHERE_COMMAND_R: string;
  • Type: string

COHERE_COMMAND_R_PLUSRequired
public readonly COHERE_COMMAND_R_PLUS: string;
  • Type: string

META_LLAMA3_1_405B_INSTRUCTRequired
public readonly META_LLAMA3_1_405B_INSTRUCT: string;
  • Type: string

META_LLAMA3_1_70B_INSTRUCTRequired
public readonly META_LLAMA3_1_70B_INSTRUCT: string;
  • Type: string

META_LLAMA3_1_8B_INSTRUCTRequired
public readonly META_LLAMA3_1_8B_INSTRUCT: string;
  • Type: string

MISTRAL_MISTRAL_LARGE_2402Required
public readonly MISTRAL_MISTRAL_LARGE_2402: string;
  • Type: string

MISTRAL_MISTRAL_LARGE_2407Required
public readonly MISTRAL_MISTRAL_LARGE_2407: string;
  • Type: string

MISTRAL_MISTRAL_SMALL_2402Required
public readonly MISTRAL_MISTRAL_SMALL_2402: string;
  • Type: string

NvidiaNIMSupportedModels

Initializers

import { NvidiaNIMSupportedModels } from 'xpander-sdk'

new NvidiaNIMSupportedModels()

Constants

Name Type Description
LLAMA_3_1_70B_INSTRUCT string No description.

LLAMA_3_1_70B_INSTRUCTRequired
public readonly LLAMA_3_1_70B_INSTRUCT: string;
  • Type: string

OpenAISupportedModels

Initializers

import { OpenAISupportedModels } from 'xpander-sdk'

new OpenAISupportedModels()

Constants

Name Type Description
GPT_4 string No description.
GPT_4_O string No description.
GPT_4_O_MINI string No description.

GPT_4Required
public readonly GPT_4: string;
  • Type: string

GPT_4_ORequired
public readonly GPT_4_O: string;
  • Type: string

GPT_4_O_MINIRequired
public readonly GPT_4_O_MINI: string;
  • Type: string

ToolResponse

Initializers

import { ToolResponse } from 'xpander-sdk'

new ToolResponse(toolCallId: string, role: string, name: string, responseMessage: string, filteredTool: object, payloadRequest: string, localTool?: IBedrockToolOutput | ILocalTool)
Name Type Description
toolCallId string - The ID of the tool call.
role string - The role in the response.
name string - The name of the tool.
responseMessage string - The response message from the tool.
filteredTool object - The filtered tool object.
payloadRequest string - The request payload that sent to tool.
localTool IBedrockToolOutput \ ILocalTool No description.

toolCallIdRequired
  • Type: string

The ID of the tool call.


roleRequired
  • Type: string

The role in the response.


nameRequired
  • Type: string

The name of the tool.


responseMessageRequired
  • Type: string

The response message from the tool.


filteredToolRequired
  • Type: object

The filtered tool object.


payloadRequestRequired
  • Type: string

The request payload that sent to tool.


localToolOptional

Methods

Name Description
toJSON Converts the ToolResponse instance to a JSON object.

toJSON
public toJSON(): object

Converts the ToolResponse instance to a JSON object.

Static Functions

Name Description
fromJSON Creates a ToolResponse instance from a JSON object.

fromJSON
import { ToolResponse } from 'xpander-sdk'

ToolResponse.fromJSON(json: any)

Creates a ToolResponse instance from a JSON object.

jsonRequired
  • Type: any

The JSON object to create the instance from.


Properties

Name Type Description
rawResponse any Gets the response message.
filteredTool object The filtered tool object.
name string The name of the tool.
payloadRequest string The request payload that sent to tool.
responseMessage string The response message from the tool.
role string The role in the response.
toolCallId string The ID of the tool call.
localTool any No description.

rawResponseRequired
public readonly rawResponse: any;
  • Type: any

Gets the response message.


filteredToolRequired
public readonly filteredTool: object;
  • Type: object

The filtered tool object.


nameRequired
public readonly name: string;
  • Type: string

The name of the tool.


payloadRequestRequired
public readonly payloadRequest: string;
  • Type: string

The request payload that sent to tool.


responseMessageRequired
public readonly responseMessage: string;
  • Type: string

The response message from the tool.


roleRequired
public readonly role: string;
  • Type: string

The role in the response.


toolCallIdRequired
public readonly toolCallId: string;
  • Type: string

The ID of the tool call.


localToolOptional
public readonly localTool: any;
  • Type: any

XpanderClient

Class representing the Xpander client.

Initializers

import { XpanderClient } from 'xpander-sdk'

new XpanderClient(agentKey: string, agentUrl: string, llmProvider: LLMProvider, localTools?: ILocalTool[])
Name Type Description
agentKey string - The API key for the agent.
agentUrl string - The URL for the agent.
llmProvider LLMProvider - The LLM provider to use.
localTools ILocalTool[] No description.

agentKeyRequired
  • Type: string

The API key for the agent.


agentUrlRequired
  • Type: string

The URL for the agent.


llmProviderRequired

The LLM provider to use.


localToolsOptional

Methods

Name Description
addLocalTools No description.
loadXpanderTools Loads the tools available from the Xpander agent.
tools Retrieves the tools for the current or specified LLM provider.
xpanderSingleToolInvoke Invokes a single tool with the given tool ID and payload.
xpanderToolCall Invokes the tools based on the tool selector response.

addLocalTools
public addLocalTools(tools: ILocalTool[]): void
toolsRequired

loadXpanderTools
public loadXpanderTools(): any[]

Loads the tools available from the Xpander agent.

tools
public tools(llmProvider?: LLMProvider): any[] | IOpenAIToolOutput[] | IBedrockToolOutput[]

Retrieves the tools for the current or specified LLM provider.

llmProviderOptional

(Optional) The LLM provider to use.


xpanderSingleToolInvoke
public xpanderSingleToolInvoke(toolId: string, payload?: any): string

Invokes a single tool with the given tool ID and payload.

toolIdRequired
  • Type: string

The ID of the tool to invoke.


payloadOptional
  • Type: any

The payload to pass to the tool.


xpanderToolCall
public xpanderToolCall(toolSelectorResponse: any, llmProvider?: string): ToolResponse[]

Invokes the tools based on the tool selector response.

toolSelectorResponseRequired
  • Type: any

The response from the tool selector.


llmProviderOptional
  • Type: string

(Optional) The LLM provider to use.


Properties

Name Type Description
validProviders string[] Provides a list of valid LLM providers.
toolsNamesMapping {[ key: string ]: string} Retrieves the tool names mapping for the current LLM provider.
agentKey string No description.
agentUrl string No description.
localTools ILocalTool[] No description.
toolsCache any No description.

validProvidersRequired
public readonly validProviders: string[];
  • Type: string[]

Provides a list of valid LLM providers.


toolsNamesMappingRequired
public readonly toolsNamesMapping: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Retrieves the tool names mapping for the current LLM provider.


agentKeyRequired
public readonly agentKey: string;
  • Type: string

agentUrlRequired
public readonly agentUrl: string;
  • Type: string

localToolsRequired
public readonly localTools: ILocalTool[];

toolsCacheRequired
public readonly toolsCache: any;
  • Type: any

Protocols

IBedrockTool

Interface representing a Bedrock tool.

Properties

Name Type Description
toolSpec IBedrockToolSpec The tool specification of the Bedrock tool.
execute any Function to execute the Bedrock tool.

toolSpecRequired
public readonly toolSpec: IBedrockToolSpec;

The tool specification of the Bedrock tool.


executeOptional
public readonly execute: any;
  • Type: any

Function to execute the Bedrock tool.


IBedrockToolOutput

Properties

Name Type Description
toolSpec IBedrockToolSpec The tool specification of the Bedrock tool.
execute any Function to execute the Bedrock tool.

toolSpecRequired
public readonly toolSpec: IBedrockToolSpec;

The tool specification of the Bedrock tool.


executeOptional
public readonly execute: any;
  • Type: any

Function to execute the Bedrock tool.


IBedrockToolSpec

Interface representing a Bedrock tool specification.

Properties

Name Type Description
description string The description of the Bedrock tool.
inputSchema IBedrockToolSpecInputSchema Input schema of the Bedrock tool.
name string The name of the Bedrock tool.

descriptionRequired
public readonly description: string;
  • Type: string

The description of the Bedrock tool.


inputSchemaRequired
public readonly inputSchema: IBedrockToolSpecInputSchema;

Input schema of the Bedrock tool.


nameRequired
public readonly name: string;
  • Type: string

The name of the Bedrock tool.


IBedrockToolSpecInputSchema

Interface representing the input schema for a Bedrock tool specification.

Properties

Name Type Description
json {[ key: string ]: IToolParameter} JSON schema of the tool parameters.

jsonRequired
public readonly json: {[ key: string ]: IToolParameter};

JSON schema of the tool parameters.


ILLMProviderHandler

Interface representing a LLM (Large Language Model) provider handler.

Methods

Name Description
getTools Retrieves tools.
invokeTools Invokes tools based on the tool selector response.
singleToolInvoke Invokes a single tool with the provided payload.

getTools
public getTools(functionize?: boolean): any[]

Retrieves tools.

functionizeOptional
  • Type: boolean

Whether to functionize the tools.


invokeTools
public invokeTools(toolSelectorResponse: any): any

Invokes tools based on the tool selector response.

toolSelectorResponseRequired
  • Type: any

The response from the tool selector.


singleToolInvoke
public singleToolInvoke(toolId: string, payload: any): string

Invokes a single tool with the provided payload.

toolIdRequired
  • Type: string

The ID of the tool to invoke.


payloadRequired
  • Type: any

The payload to send to the tool.


Properties

Name Type Description
toolsNamesMapping {[ key: string ]: string} Mapping of tool names.

toolsNamesMappingOptional
public readonly toolsNamesMapping: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Mapping of tool names.


ILocalTool

Properties

Name Type Description
function ILocalToolFunction No description.
type string No description.

functionRequired
public readonly function: ILocalToolFunction;

typeRequired
public readonly type: string;
  • Type: string

ILocalToolFunction

Properties

Name Type Description
description string No description.
name string No description.
parameters any No description.

descriptionRequired
public readonly description: string;
  • Type: string

nameRequired
public readonly name: string;
  • Type: string

parametersRequired
public readonly parameters: any;
  • Type: any

IMessage

Interface representing a message.

Properties

Name Type Description
content string The content of the message.
role string The role of the message sender.

contentRequired
public readonly content: string;
  • Type: string

The content of the message.


roleRequired
public readonly role: string;
  • Type: string

The role of the message sender.


IOpenAIToolFunctionOutput

Properties

Name Type Description
description string The description of the tool.
name string The name of the tool.
execute any Function to execute the Bedrock tool.
func any Function to execute the tool.
parameters IToolParameter Parameters of the tool.

descriptionRequired
public readonly description: string;
  • Type: string

The description of the tool.


nameRequired
public readonly name: string;
  • Type: string

The name of the tool.


executeOptional
public readonly execute: any;
  • Type: any

Function to execute the Bedrock tool.


funcOptional
public readonly func: any;
  • Type: any

Function to execute the tool.


parametersOptional
public readonly parameters: IToolParameter;

Parameters of the tool.


IOpenAIToolOutput

Properties

Name Type Description
function IOpenAIToolFunctionOutput No description.
type string No description.

functionRequired
public readonly function: IOpenAIToolFunctionOutput;

typeRequired
public readonly type: string;
  • Type: string

ITool

Interface representing a tool.

Properties

Name Type Description
description string The description of the tool.
name string The name of the tool.
func any Function to execute the tool.
parameters {[ key: string ]: IToolParameter} Parameters of the tool.

descriptionRequired
public readonly description: string;
  • Type: string

The description of the tool.


nameRequired
public readonly name: string;
  • Type: string

The name of the tool.


funcOptional
public readonly func: any;
  • Type: any

Function to execute the tool.


parametersOptional
public readonly parameters: {[ key: string ]: IToolParameter};

Parameters of the tool.


IToolParameter

Interface representing a tool parameter.

Properties

Name Type Description
properties {[ key: string ]: IToolParameter} Properties of the parameter.
type string The type of the parameter.
required string[] List of required properties.

propertiesRequired
public readonly properties: {[ key: string ]: IToolParameter};

Properties of the parameter.


typeRequired
public readonly type: string;
  • Type: string

The type of the parameter.


requiredOptional
public readonly required: string[];
  • Type: string[]

List of required properties.


IToolResponse

Properties

Name Type Description
filteredTool object The filtered tool object.
name string The name of the tool.
payloadRequest string The request payload that sent to tool.
responseMessage string The response message from the tool.
role string The role in the response.
toolCallId string The ID of the tool call.

filteredToolRequired
public readonly filteredTool: object;
  • Type: object

The filtered tool object.


nameRequired
public readonly name: string;
  • Type: string

The name of the tool.


payloadRequestRequired
public readonly payloadRequest: string;
  • Type: string

The request payload that sent to tool.


responseMessageRequired
public readonly responseMessage: string;
  • Type: string

The response message from the tool.


roleRequired
public readonly role: string;
  • Type: string

The role in the response.


toolCallIdRequired
public readonly toolCallId: string;
  • Type: string

The ID of the tool call.


IToolResponsePayload

Properties

Name Type Description
property1 string A string property for the tool response payload.
property2 number A numeric property for the tool response payload.

property1Required
public readonly property1: string;
  • Type: string

A string property for the tool response payload.


property2Required
public readonly property2: number;
  • Type: number

A numeric property for the tool response payload.


Enums

LLMProvider

Enum representing different Large Language Model (LLM) providers.

Members

Name Description
LANG_CHAIN Represents the 'langchain' provider.
OPEN_AI Represents the 'openai' provider.
NVIDIA_NIM Represents the 'nvidiaNim' provider.
AMAZON_BEDROCK Represents the 'amazonBedrock' provider.

LANG_CHAIN

Represents the 'langchain' provider.


OPEN_AI

Represents the 'openai' provider.


NVIDIA_NIM

Represents the 'nvidiaNim' provider.


AMAZON_BEDROCK

Represents the 'amazonBedrock' provider.