✅ **Assistant Registry**:
- A centralized **registry** (`AssistantRegistry`) to manage and retrieve AI assistants dynamically.
- Easily list, register, and fetch assistants by name.
✅ **Modular Assistant Design**:
- Each assistant is implemented in a separate file, making it modular and extensible.
- Only **LLM dependencies** are required, keeping it lightweight.
✅ **Prebuilt `react_assistant`**:
- Uses **LangGraph's ReAct** framework to analyze and modify code intelligently.
- Comes with predefined tools from **CodePromptForge** to interact with the file system.
📦 **How to Install the Assistant Module**
By default, the assistant module is **not installed**. To enable it, use:
bash
pip install codepromptforge[assistant]
🛠 **Example Usage**
python
from codepromptforge.assistant import AssistantRegistry
List available assistants
print(AssistantRegistry.list_assistants())
Expected output: ['react_assistant']
from langchain_ollama import ChatOllama
Initialize an LLM
llm = ChatOllama(
model="qwen2.5:14b",
temperature=0,
num_ctx=80000,
num_gpu=1,
)
Retrieve and use the assistant
agent = AssistantRegistry.get_assistant('react_assistant', llm)
def print_stream(stream):
for s in stream:
message = s["messages"][-1]
if isinstance(message, tuple):
print(message)
else:
message.pretty_print()
Provide a query for the assistant
inputs = {
"messages": [("user", "This is my package named CodePromptForge. Your job is to describe what needs to be modified to improve the current code")]
}
print_stream(agent.stream(inputs, stream_mode="values"))
🚀 **Why Use the Assistant Module?**
- 🧠 **Intelligent Code Analysis**: Automatically reviews and improves code.
- 🔍 **Deep File System Integration**: Uses `CodePromptForge` tools to read/write files.
- ⚡ **Customizable & Extendable**: Register custom assistants with **AssistantRegistry**.
---
🛠 **Other Improvements**
- **Refactored Code Structure**: Improved modularity for better extensibility.
- **Enhanced CLI Error Handling**: More descriptive error messages.
- **Bug Fixes & Stability Improvements**: Ensuring seamless tool execution.
---
🚀 **Upgrade Now!** 🚀
bash
pip install --upgrade codepromptforge
or, to enable assistants:
bash
pip install --upgrade codepromptforge[assistant]
Enjoy the new **AI-powered** CodePromptForge experience! 🎉