This section provides an overview of the framework's directory layout along with a description of each key file and directory. The structure is designed to be modular, making it easy to extend and maintain.
Below is an example directory tree for the framework:
.
├── agent.py
├── llm_provider.py
├── memory.py
├── tool.py
├── semantic_memory.py
├── rag.
├── agent_communication.py
├── evaluation_framework.py
├── multimodal_support.py
├── streaming_responses.py
├── type_safety.py
└── tools/
| ├── calculator.json
| └── calculator/
├── __init__.py
└── evaluate.py
agent.py
Contains the core Agent class that orchestrates query processing by integrating the LLM, memory, and tools. It handles configuration loading, tool execution, and constructing prompts.
llm_provider.py
Defines an abstract base class for LLM providers and implements concrete classes for providers like OpenAI and Anthropic. It includes methods for formatting tool configurations and extracting tool calls from responses.
memory.py
Implements basic conversation memory management. It stores a limited number of recent messages and supports enabling or disabling memory.
tool.py
Provides utilities for creating and managing tool configurations. This file also includes a method for registering basic tools (e.g., a calculator) and setting up an agent configuration file.
semantic_memory.py
Extends the basic memory capabilities with semantic search. It uses open source libraries (SentenceTransformers and FAISS) to compute embeddings and perform similarity-based retrieval of past messages.
rag.py
Implements Retrieval-Augmented Generation (RAG) capabilities. It allows indexing and retrieving external documents to supplement the LLM's responses.
agent_communication.py
Contains functionality for inter-agent communication. It defines methods for sending and receiving messages between multiple agents, facilitating more advanced multi-agent scenarios.
evaluation_framework.py
Provides an evaluation framework to log performance metrics (e.g., response time) and generate reports. This module can be extended with more detailed analytics as needed.
multimodal_support.py
Adds basic multimodal capabilities to process images (and audio). For example, it uses Pillow to process images and return basic metadata.
streaming_responses.py
Implements a mechanism to stream responses in chunks rather than waiting for a full output. This improves interactivity when handling long responses.
type_safety.py
Contains helper functions to validate input and output types, ensuring that functions receive the correct types to improve robustness.
tools/
This directory holds tool configuration files and implementations:
- calculator.json: Defines the configuration for a calculator tool, including its description, parameters, and function path.
- calculator/ Contains the implementation of the calculator tool:
- __init__.py: Marks the directory as a Python package.
- evaluate.py: Implements the logic for evaluating mathematical expressions safely.
This structure ensures that each component of the framework is organized by functionality, making it easier to locate, understand, and extend the codebase.