xpander SDK API Documentation
Comprehensive guide on how to use the xpander SDK to build and deploy intelligent AI Agents
AmazonBedrockSupportedModels
The AmazonBedrockSupportedModels class offers constants for models supported by Amazon Bedrock, simplifying model selection in your applications.
Usage
Constant | Description |
---|---|
ANTHROPIC_CLAUDE_3_5_SONNET_20240620 | Optimized for general use. |
ANTHROPIC_CLAUDE_3_HAIKU_20240307 | Excels in summarization tasks. |
COHERE_COMMAND_R | Ideal for command-based instructions and NLP. |
These constants help in selecting models that support function calling, reducing the need to memorize model names and IDs.
NvidiaNIMSupportedModels
The NvidiaNIMSupportedModels class provides constants for NVIDIA’s NIM platform models, aiding in model selection.
Usage
Constant | Description |
---|---|
LLAMA_3_1_70B_INSTRUCT | Suitable for large-scale instructional tasks requiring deep context understanding. |
OpenAISupportedModels
The OpenAISupportedModels class provides constants for OpenAI models compatible with the xpander SDK.
Usage
Constant | Description |
---|---|
GPT_4 | Latest version of OpenAI’s GPT model. |
GPT_4_O | Cost-effective optimized version. |
ToolResponse
The ToolResponse class encapsulates the response from a tool invoked by an AI Agent, including details like tool call ID, role, and response message.
Initialization
Methods
- toJSON(): Serializes the ToolResponse instance to a JSON object.
- fromJSON(json: any): Instantiates a ToolResponse from a JSON object.
XpanderClient
The XpanderClient is the core class for interacting with xpanderAI tools, offering methods for managing sessions and invoking tools.
Initialization
Methods
Method | Description |
---|---|
addLocalTools(tools: ILocalTool[]) | Adds tools for specific needs. |
getGraphSessionParam(param: string) | Retrieves a parameter for the current session. |
startSession(prompt?: string) | Initiates a new session with an optional prompt. |
xpanderToolCall(toolSelectorResponse: any, llmProvider?: string) | Invokes tools based on the selector response. |
LLMProvider Enum
The LLMProvider enum allows selection of the desired LLM provider for interactions.
Values
Value | Description |
---|---|
LANG_CHAIN | LangChain’s LLM models. |
OPEN_AI | OpenAI models like GPT-4. |
NVIDIA_NIM | NVIDIA’s LLM models. |
AMAZON_BEDROCK | Amazon Bedrock’s LLM models. |
Example Workflow
To create an AI agent workflow interacting with multiple systems, follow these steps:
- Initialize the Xpander Client:
- Add Local Tools:
- Start a Session:
- Invoke a Tool:
Protocols & Interfaces
To extend the xpander SDK or create custom implementations, interfaces are provided:
ITool
The ITool interface represents a generic tool used by AI agents, including properties like:
Property | Description |
---|---|
name | The tool’s name. |
description | A description of the tool’s capabilities. |
func | Function for executing the tool. |
parameters | Parameters required for execution. |
Example Implementation
ILocalTool
The ILocalTool interface allows the creation of tools for local use, maintaining security boundaries.