-
Notifications
You must be signed in to change notification settings - Fork 4
Developer Documentation
Krishnakanth Alagiri edited this page May 13, 2024
·
8 revisions
Meeseeks is designed with a multi-agent architecture to efficiently handle complex user queries. It leverages multiple Large Language Models (LLMs) to break down tasks and utilizes semantic caching to minimize LLM calls.
-
core/task_master.py
:-
generate_action_plan(user_query: str, model_name: str = None) -> List[dict]
:- Takes a user query as input and generates an action plan, a list of dictionaries representing individual tasks.
- Leverages LangChain for prompt engineering, LLM interaction, and output parsing.
- Utilizes
core.classes.TaskQueue
to structure the action plan.
-
run_action_plan(task_queue: TaskQueue) -> TaskQueue
:- Executes the generated action plan.
- Calls appropriate tools based on the
action_consumer
specified in each action step. - Updates the
task_queue
with the results from each tool.
-
-
core/classes.py
:-
ActionStep
(BaseModel):- Represents a single step in the action plan.
- Fields:
action_consumer
,action_type
,action_argument
,result
. - Validates the fields to ensure correctness.
-
TaskQueue
(BaseModel):- Represents the overall action plan.
- Fields:
human_message
,action_steps
. - Validates the
action_steps
to ensure they are compatible with available tools.
-
AbstractTool
(ABC):- Abstract base class for all tools.
- Defines common methods for tools, like
set_state
,get_state
, andrun
. - Provides basic functionality like caching and Langfuse integration.
-
-
core/common.py
:- Provides utility functions like
get_logger
,num_tokens_from_string
,get_unique_timestamp
,get_system_prompt
, andha_render_system_prompt
.
- Provides utility functions like
-
tools/integration/homeassistant.py
:-
HomeAssistant
(AbstractTool):- Tool to interact with Home Assistant.
- Inherits from
AbstractTool
and implementsset_state
andget_state
. - Manages a cache of Home Assistant entities and services.
- Uses LangChain to translate natural language commands into Home Assistant API calls.
-
-
tools/core/talk_to_user.py
:-
TalkToUser
(AbstractTool):- Simple tool to communicate directly with the user.
- Primarily used for conveying messages or asking for input.
-
-
meeseeks-chat/chat_master.py
:- Implements the Streamlit-based chat interface.
- Handles user input, generates and runs the action plan, and displays the results.
- Utilizes
streamlit
components for interactive chat features.
- User Input: The user interacts with the chat interface, providing a query in natural language.
-
Action Plan Generation: The
core.task_master.generate_action_plan
function processes the user's query and creates anTaskQueue
with a series ofActionStep
instances. -
Action Plan Execution: The
core.task_master.run_action_plan
function iterates through theActionStep
instances in theTaskQueue
, utilizing the appropriateAbstractTool
to fulfill each step. - Response Generation: The results from each tool are collected and compiled into a comprehensive response for the user.
- User Interaction: The response is presented to the user via the chat interface, completing the interaction cycle.
This documentation provides a high-level overview of the Meeseeks project architecture. For detailed information on specific functions and classes, please refer to the inline comments within the code.
Contributions to enhance this documentation or any other aspect of the project are highly encouraged.