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_20240620
Required
public readonly ANTHROPIC_CLAUDE_3_5_SONNET_20240620: string;
- Type: string
ANTHROPIC_CLAUDE_3_HAIKU_20240307
Required
public readonly ANTHROPIC_CLAUDE_3_HAIKU_20240307: string;
- Type: string
COHERE_COMMAND_R
Required
public readonly COHERE_COMMAND_R: string;
- Type: string
COHERE_COMMAND_R_PLUS
Required
public readonly COHERE_COMMAND_R_PLUS: string;
- Type: string
META_LLAMA3_1_405B_INSTRUCT
Required
public readonly META_LLAMA3_1_405B_INSTRUCT: string;
- Type: string
META_LLAMA3_1_70B_INSTRUCT
Required
public readonly META_LLAMA3_1_70B_INSTRUCT: string;
- Type: string
META_LLAMA3_1_8B_INSTRUCT
Required
public readonly META_LLAMA3_1_8B_INSTRUCT: string;
- Type: string
MISTRAL_MISTRAL_LARGE_2402
Required
public readonly MISTRAL_MISTRAL_LARGE_2402: string;
- Type: string
MISTRAL_MISTRAL_LARGE_2407
Required
public readonly MISTRAL_MISTRAL_LARGE_2407: string;
- Type: string
MISTRAL_MISTRAL_SMALL_2402
Required
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_INSTRUCT
Required
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_4
Required
public readonly GPT_4: string;
- Type: string
GPT_4_O
Required
public readonly GPT_4_O: string;
- Type: string
GPT_4_O_MINI
Required
public readonly GPT_4_O_MINI: string;
- Type: string
ToolResponse
- Implements: IToolResponse
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. |
toolCallId
Required
- Type: string
The ID of the tool call.
role
Required
- Type: string
The role in the response.
name
Required
- Type: string
The name of the tool.
responseMessage
Required
- Type: string
The response message from the tool.
filteredTool
Required
- Type: object
The filtered tool object.
payloadRequest
Required
- Type: string
The request payload that sent to tool.
localTool
Optional
- Type: IBedrockToolOutput | ILocalTool
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.
json
Required
- 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. |
rawResponse
Required
public readonly rawResponse: any;
- Type: any
Gets the response message.
filteredTool
Required
public readonly filteredTool: object;
- Type: object
The filtered tool object.
name
Required
public readonly name: string;
- Type: string
The name of the tool.
payloadRequest
Required
public readonly payloadRequest: string;
- Type: string
The request payload that sent to tool.
responseMessage
Required
public readonly responseMessage: string;
- Type: string
The response message from the tool.
role
Required
public readonly role: string;
- Type: string
The role in the response.
toolCallId
Required
public readonly toolCallId: string;
- Type: string
The ID of the tool call.
localTool
Optional
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. |
agentKey
Required
- Type: string
The API key for the agent.
agentUrl
Required
- Type: string
The URL for the agent.
llmProvider
Required
- Type: LLMProvider
The LLM provider to use.
localTools
Optional
- Type: ILocalTool[]
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
tools
Required
- Type: ILocalTool[]
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.
llmProvider
Optional
- Type: LLMProvider
(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.
toolId
Required
- Type: string
The ID of the tool to invoke.
payload
Optional
- 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.
toolSelectorResponse
Required
- Type: any
The response from the tool selector.
llmProvider
Optional
- 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. |
validProviders
Required
public readonly validProviders: string[];
- Type: string[]
Provides a list of valid LLM providers.
toolsNamesMapping
Required
public readonly toolsNamesMapping: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Retrieves the tool names mapping for the current LLM provider.
agentKey
Required
public readonly agentKey: string;
- Type: string
agentUrl
Required
public readonly agentUrl: string;
- Type: string
localTools
Required
public readonly localTools: ILocalTool[];
- Type: ILocalTool[]
toolsCache
Required
public readonly toolsCache: any;
- Type: any
Protocols
IBedrockTool
- Implemented By: 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. |
toolSpec
Required
public readonly toolSpec: IBedrockToolSpec;
- Type: IBedrockToolSpec
The tool specification of the Bedrock tool.
execute
Optional
public readonly execute: any;
- Type: any
Function to execute the Bedrock tool.
IBedrockToolOutput
- Implemented By: IBedrockToolOutput
Properties
Name | Type | Description |
---|---|---|
toolSpec |
IBedrockToolSpec |
The tool specification of the Bedrock tool. |
execute |
any |
Function to execute the Bedrock tool. |
toolSpec
Required
public readonly toolSpec: IBedrockToolSpec;
- Type: IBedrockToolSpec
The tool specification of the Bedrock tool.
execute
Optional
public readonly execute: any;
- Type: any
Function to execute the Bedrock tool.
IBedrockToolSpec
- Implemented By: 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. |
description
Required
public readonly description: string;
- Type: string
The description of the Bedrock tool.
inputSchema
Required
public readonly inputSchema: IBedrockToolSpecInputSchema;
Input schema of the Bedrock tool.
name
Required
public readonly name: string;
- Type: string
The name of the Bedrock tool.
IBedrockToolSpecInputSchema
- Implemented By: 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. |
json
Required
public readonly json: {[ key: string ]: IToolParameter};
- Type: {[ key: string ]: IToolParameter}
JSON schema of the tool parameters.
ILLMProviderHandler
- Implemented By: 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.
functionize
Optional
- Type: boolean
Whether to functionize the tools.
invokeTools
public invokeTools(toolSelectorResponse: any): any
Invokes tools based on the tool selector response.
toolSelectorResponse
Required
- Type: any
The response from the tool selector.
singleToolInvoke
public singleToolInvoke(toolId: string, payload: any): string
Invokes a single tool with the provided payload.
toolId
Required
- Type: string
The ID of the tool to invoke.
payload
Required
- Type: any
The payload to send to the tool.
Properties
Name | Type | Description |
---|---|---|
toolsNamesMapping |
{[ key: string ]: string} |
Mapping of tool names. |
toolsNamesMapping
Optional
public readonly toolsNamesMapping: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Mapping of tool names.
ILocalTool
- Implemented By: ILocalTool
Properties
Name | Type | Description |
---|---|---|
function |
ILocalToolFunction |
No description. |
type |
string |
No description. |
function
Required
public readonly function: ILocalToolFunction;
- Type: ILocalToolFunction
type
Required
public readonly type: string;
- Type: string
ILocalToolFunction
- Implemented By: ILocalToolFunction
Properties
Name | Type | Description |
---|---|---|
description |
string |
No description. |
name |
string |
No description. |
parameters |
any |
No description. |
description
Required
public readonly description: string;
- Type: string
name
Required
public readonly name: string;
- Type: string
parameters
Required
public readonly parameters: any;
- Type: any
IMessage
- Implemented By: IMessage
Interface representing a message.
Properties
Name | Type | Description |
---|---|---|
content |
string |
The content of the message. |
role |
string |
The role of the message sender. |
content
Required
public readonly content: string;
- Type: string
The content of the message.
role
Required
public readonly role: string;
- Type: string
The role of the message sender.
IOpenAIToolFunctionOutput
- Implemented By: 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. |
description
Required
public readonly description: string;
- Type: string
The description of the tool.
name
Required
public readonly name: string;
- Type: string
The name of the tool.
execute
Optional
public readonly execute: any;
- Type: any
Function to execute the Bedrock tool.
func
Optional
public readonly func: any;
- Type: any
Function to execute the tool.
parameters
Optional
public readonly parameters: IToolParameter;
- Type: IToolParameter
Parameters of the tool.
IOpenAIToolOutput
- Implemented By: IOpenAIToolOutput
Properties
Name | Type | Description |
---|---|---|
function |
IOpenAIToolFunctionOutput |
No description. |
type |
string |
No description. |
function
Required
public readonly function: IOpenAIToolFunctionOutput;
type
Required
public readonly type: string;
- Type: string
ITool
- Implemented By: 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. |
description
Required
public readonly description: string;
- Type: string
The description of the tool.
name
Required
public readonly name: string;
- Type: string
The name of the tool.
func
Optional
public readonly func: any;
- Type: any
Function to execute the tool.
parameters
Optional
public readonly parameters: {[ key: string ]: IToolParameter};
- Type: {[ key: string ]: IToolParameter}
Parameters of the tool.
IToolParameter
- Implemented By: 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. |
properties
Required
public readonly properties: {[ key: string ]: IToolParameter};
- Type: {[ key: string ]: IToolParameter}
Properties of the parameter.
type
Required
public readonly type: string;
- Type: string
The type of the parameter.
required
Optional
public readonly required: string[];
- Type: string[]
List of required properties.
IToolResponse
- Implemented By: ToolResponse, 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. |
filteredTool
Required
public readonly filteredTool: object;
- Type: object
The filtered tool object.
name
Required
public readonly name: string;
- Type: string
The name of the tool.
payloadRequest
Required
public readonly payloadRequest: string;
- Type: string
The request payload that sent to tool.
responseMessage
Required
public readonly responseMessage: string;
- Type: string
The response message from the tool.
role
Required
public readonly role: string;
- Type: string
The role in the response.
toolCallId
Required
public readonly toolCallId: string;
- Type: string
The ID of the tool call.
IToolResponsePayload
- Implemented By: 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. |
property1
Required
public readonly property1: string;
- Type: string
A string property for the tool response payload.
property2
Required
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.