A research-oriented AI Agent framework focused on practical applications and exploring scalable architecture implementation.
- 🤖 Modular Agent Architecture
- 🛠️ Extensible Tool Integration
- 🔄 Flexible Workflow Management
- 📊 Performance Monitoring
- 🧪 Convenient Experiment Support
- Python 3.10+
- pip or other package managers
pip install -r requirements.txt
A dialogue system based on LangChain and OpenAI, with the following main components:
-
LLM
ChatOpenAI
- OpenAI GPT model interface
- Handles natural language generation
- Supports model parameter configuration
-
Agent
RunnableWithMessageHistory
- Manages conversation flow
- Maintains session state
- Handles multi-turn dialogues
chain
- Builds conversation processing chain
- Connects various components
-
Prompt
ChatPromptTemplate
- Manages overall prompt structure
- Combines multiple prompt components
MessagesPlaceholder
- Handles history message insertion
SystemMessagePromptTemplate
- Defines system role and behavior
HumanMessagePromptTemplate
- Formats user input
-
Tools
ChatMessageHistory
- Stores conversation history
- Supports message tracking
gr.ChatInterface
- Provides Web interaction interface
- Displays conversation content
Usage
python agents/1_simple_conversational_agent.py
Note: Requires OpenAI API key configuration
Features
- Intelligent agent implemented based on ReAct (Reasoning and Acting) paradigm
- Possesses dual capabilities of reasoning and acting
- Integrates search tools for real-time information
- Supports multi-turn dialogue and continuous reasoning
Core Components
-
Large Language Model and Interface
- OpenAI API interface encapsulation
- ChatOpenAI model integrated with LangChain
-
Prompt System
- Uses standard ReAct prompt templates from LangChain Hub
- Supports structured reasoning and action instructions
-
Agent Framework
- ReAct Agent implementation
- AgentExecutor
- Supports thought-action-observation loop
-
Tool Integration
- SerpAPIWrapper search tool
- Extensible tool registration mechanism
- Supports dynamic tool invocation
python agents/2_reason_act.py
Features
- Text Summarization: Uses GPT model for intelligent text summarization
- Chinese Translation: Automatically translates English text to Chinese
- Tool Chain Combination: Implements multi-functionality integration through function calls
- Automated Processing: Agent can automatically decide on appropriate tools for task completion
Core Components
-
LLM
ChatOpenAI
- OpenAI GPT model interface
- Supports function calling capabilities
-
Prompt
PromptTemplate
- Defines prompt templates for agent behavior
- Used for summarization, translation, and agent instructions
-
Agent
create_tool_calling_agent
- Creates function-calling capable agent
- Built based on tools and prompt templates
AgentExecutor
- Responsible for executing agent tasks
- Coordinates tool calling process
-
Tools
StructuredTool
- Wraps functions as structured tools
BaseModel
(Pydantic)- Defines tool input parameter schema
Field
- Adds description information for tool parameters
-
UI
gradio.ChatInterface
- Provides interactive chat interface
- Supports conversation history
python agents/3_function_calling_agent.py
Features
- Multimodal Analysis: Support for joint analysis of images and text
- Org Structure Parsing: Specialized in parsing and understanding organizational charts
- JSON Structured Output: Convert analysis results into standardized JSON format
- Interactive Interface: Support for image upload and multi-turn dialogue
Core Components
-
LLM
- Model Configuration
- GPT-4O-Mini: Text processing model
- O1: Vision-language model
o1_vision
- Supports multimodal input of text and images
- Optional JSON format output
- Base64-based image encoding
- Supports custom prompts
- Model Configuration
-
Prompt
structured_prompt
- Defines structured instruction templates
- Guides model for org structure analysis
- Standardizes JSON output format
-
Agent
process_message
- Handles multimodal input
- Coordinates image and text analysis
- Generates structured responses
-
UI
gr.ChatInterface
- Supports multimodal input interface
- Allows multiple file uploads
- Displays interactive dialogue
Usage
python agents/4_reasoning_with_o1.py
Note: Requires OpenAI API key and O1 model access permissions
We welcome all forms of contributions! Please check the contribution guidelines for more information.
MIT License - See LICENSE file for details