Skip to content

Frequently Asked Questions (FAQ)

Welcome to the Swarmauri SDK FAQ page. Here you'll find answers to common questions, troubleshooting tips, usage clarifications, and performance optimization advice.

Common Questions

What is Swarmauri SDK?

Swarmauri SDK is a comprehensive toolkit for building AI-powered applications. It provides a modular architecture, unified API, and support for various AI models and tools.

How do I install Swarmauri SDK?

You can install Swarmauri SDK using pip:

pip install swarmauri

Installation Options

For specific versions or development builds: ```bash # Install specific version pip install swarmauri==1.2.3

# Install from GitHub (latest development version)
pip install git+https://github.com/swarmauri/swarmauri-sdk.git
```

For detailed installation instructions, refer to our Installation Guide.

What are the system requirements for Swarmauri SDK?

  • Python 3.10, 3.11, or 3.12
  • Package installer (pip or uv)
  • Internet connection for downloading packages

How do I get started with Swarmauri SDK?

Start by following the Usage Guide for basic examples.

Troubleshooting Tips

Import Errors

If you encounter ModuleNotFoundError:

# Ensure Swarmauri SDK is installed
pip list | grep swarmauri

!!! warning "Common Import Error Causes" - Package not installed correctly - Virtual environment not activated - Package installed in a different Python environment - Package name misspelled in the import statement

Version Conflicts

If you face dependency conflicts:

# Create a fresh virtual environment
python -m venv fresh-env
source fresh-env/bin/activate

# or fresh-env\Scripts\activate on Windows
pip install swarmauri

Dependency Isolation

Consider using tools like Poetry or pipenv for better dependency management. These tools create lockfiles that ensure consistent environments across different machines.

```bash
# Using Poetry
poetry add swarmauri

# Using pipenv
pipenv install swarmauri
```

Installation Fails

If installation fails with build errors:

# Install build tools
# On Windows:
pip install --upgrade setuptools wheel

# On macOS/Linux:
pip install --upgrade setuptools wheel
sudo apt install build-essential  # For Ubuntu/Debian
Installation Troubleshooting

If you encounter persistent installation issues:

1. Make sure your pip is up to date: `pip install --upgrade pip`
2. Check if you have sufficient privileges (try using `sudo` on Linux/Mac or run as administrator on Windows)
3. If you're behind a corporate firewall, you may need to configure pip to use an HTTPS proxy
4. For C extension errors, ensure you have the appropriate compilers installed

Usage Clarifications

How do I use tools in Swarmauri SDK?

Swarmauri SDK allows you to integrate various tools to enhance the capabilities of your AI models.

from swarmauri.tools.JSONRequestsTool import JSONRequestsTool
from swarmauri.tools.CalculatorTool import CalculatorTool
from swarmauri.tool_llms.OpenAIToolModel import OpenAIToolModel
from swarmauri.toolkit.Toolkit import Toolkit
from swarmauri.conversations.Conversation import Conversation
from swarmauri.messages.HumanMessage import HumanMessage
from swarmauri.messages.SystemMessage import SystemMessage
import os
# Create a conversation with a system message
conversation = Conversation()
conversation.add_message(SystemMessage(content="You are a helpful assistant with access to tools."))

# Create a toolkit with a calculator
toolkit = Toolkit()
toolkit.add_tool(CalculatorTool())

# Initialize an LLM with tool capabilities
llm = OpenAIToolModel(model="gpt-4-turbo")

# Create a tool agent
agent = ToolAgent(conversation=conversation, llm=llm, toolkit=toolkit)

# Example usage
response = agent.exec("What is 25 * 16?")
print(response)

# Continue the conversation with another tool-based query
response = agent.exec("What is the square root of 144?")
print(response)

Available Tools

Swarmauri SDK offers a variety of built-in tools including:

- `CalculatorTool`: For mathematical operations
- `RequestsTool`: For HTTP requests
- `CodeExtractorTool`: For code extraction
- `CodeInterpreterTool`: For python code execution

You can also create custom tools by extending the `ToolBase` class.

How do I create an AI assistant?

Create a simple AI assistant that can handle conversations:

from swarmauri import SimpleConversationAgent, Conversation, SystemMessage, OpenAIModel

# Create a conversation with a system message
conversation = Conversation()
conversation.add_message(SystemMessage(content="You are a helpful assistant."))

# Initialize an LLM
llm = OpenAIModel(model="gpt-3.5-turbo")

# Create a simple conversation agent
agent = SimpleConversationAgent(conversation=conversation, llm=llm)

# Example usage
response = agent.exec("What is machine learning?")
print(response)

# Continue the conversation
response = agent.exec("Can you explain it in simpler terms?")
print(response)

How do I handle large datasets?

  • Chunking: Break down large datasets into smaller chunks for processing.
  • Parallel Processing: Utilize parallel processing to handle large datasets efficiently.
  • Vector Stores: Use vector stores for efficient storage and retrieval of embeddings.
from swarmauri.agents.RagAgent import RagAgent
from swarmauri.llms.OpenAIModel import OpenAIModel
from swarmauri.documents.Document import Document
from swarmauri.conversations.Conversation import Conversation
from swarmauri.vector_stores.TfidfVectorStore import TfidfVectorStore
import os

# Create documents
documents = [
    Document(content="Paris is the capital of France."),
    Document(content="Berlin is the capital of Germany."),
    Document(content="Rome is the capital of Italy.")
]

# Initialize TfidfVectorStore
vector_store = TfidfVectorStore()

# Add documents to the vector store
vector_store.add_documents(documents)

# Create a conversation
conversation = Conversation()

# Create a RAG agent
agent = RagAgent(
    llm=OpenAIModel(model="gpt-3.5-turbo", api_key=os.getenv("OPENAI_API_KEY")),
    vector_store=vector_store,
    conversation=conversation
)

# Ask a question
answer = agent.exec("What is the capital of France?")
print(answer)

Performance Optimization

How can I optimize the performance of my Swarmauri application?

  • Use Efficient Models: Choose models that balance performance and accuracy for your use case.
  • Batch Processing: Process data in batches to reduce overhead.
  • Caching: Implement caching for repeated computations.
  • Asynchronous Operations: Use asynchronous operations to improve responsiveness.

Getting Help

If you need further assistance:

  1. Check our API Documentation
  2. Visit our GitHub Issues
  3. Join our Discord Community

Community Support

Our community is active and ready to help with any questions you might have. Don't hesitate to reach out if you're facing challenges with Swarmauri SDK.