Bring Your Own LLM
Guide to using xpander SDK with your own LLM deployment
While xpander.ai offers a serverless solution where you can use AI agents without managing LLM infrastructure, you might want to use your own LLM deployment for:
- Running models locally for lower latency
- Using specific model versions or custom fine-tuned models
- Implementing local function calling
- Maintaining full control over your LLM stack
- Handling sensitive data locally
This guide shows how to integrate your LLM with xpander’s tools and local functions.
Choose Your LLM Provider
To integrate your LLM with xpander’s tools and local functions, you’ll need to select one LLM provider and model combination. The integration is done by configuring your agent object with the chosen provider and model.
Provider and Model Selection
You can specify your chosen LLM provider and model using either enums from the SDK or string values:
Get Tools to the LLM
Run Tools for the LLM
Available Providers and Models
Here are all the supported LLM providers and their corresponding models. Choose the combination that best fits your needs:
Framework | Model Name | Model Identifier (String) |
---|---|---|
Amazon Bedrock | Anthropocene Claude 3 Haiku | anthropic.claude-3-haiku-20240307-v1:0 |
Anthropocene Claude 3.5 Sonnet | anthropic.claude-3-5-sonnet-20240620-v1:0 | |
Cohere Command R | cohere.command-r-v1:0 | |
Cohere Command R Plus | cohere.command-r-plus-v1:0 | |
Meta Llama 3 1.8B Instruct | meta.llama3-1-8b-instruct-v1:0 | |
Meta Llama 3 1.70B Instruct | meta.llama3-1-70b-instruct-v1:0 | |
Meta Llama 3 1.405B Instruct | meta.llama3-1-405b-instruct-v1:0 | |
Mistral Large 2402 | mistral.mistral-large-2402-v1:0 | |
Mistral Large 2407 | mistral.mistral-large-2407-v1:0 | |
Mistral Small 2402 | mistral.mistral-small-2402-v1:0 | |
Nvidia NIM | Meta Llama 3.1 70B Instruct | meta/llama-3.1-70b-instruct |
Ollama | Qwen2.5-Coder | qwen2.5-coder |
OpenAI | OpenAI GPT-4 | gpt-4 |
OpenAI GPT-4o | gpt-4o | |
OpenAI GPT-4o Mini | gpt-4o-mini |
Tool Response
The tool_response
object represents the output from a tool invoked by an AI Agent. It contains key attributes that provide information about the tool invocation’s execution and results. This data is used to build the AI Agent’s memory and guide further interactions.
Tool Response Object Structure
Attribute | Type | Description |
---|---|---|
function_name | str | The name of the invoked function or tool. |
status_code | int | The HTTP status code returned by the tool or system. |
result | dict | The actual response or output from the tool. |
payload | dict | The data payload generated by the AI for the tool invocation. |
tool_call_id | str | A unique identifier for the specific tool invocation. |
Full example
Best Practices
- Error Handling: Implement robust error handling for both LLM and tool calls
- Memory Management: Properly manage conversation context
- Security: Validate all inputs and file operations
- Monitoring: Log LLM and tool performance metrics
- Testing: Test with different prompts and tool combinations
Need help? Visit our Discord community or documentation.