Skip to content

Sgudkov/salon-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Salon Bot Project Description

The Salon Bot is a Python-based application designed to provide an interactive and intelligent conversational experience for customers of a beauty salon. It leverages advanced AI techniques, including Large Language Models (LLMs) and LangGraph, to understand user requests and facilitate salon-related tasks.

Features:

  • Appointment Booking: Users can book appointments by specifying services, preferred dates, and times.
  • Service Inquiries: The bot can provide information about salon services, including details and potential pricing.
  • Master Information: Users can inquire about specific masters or general master availability.
  • Natural Language Understanding: Utilizes LLMs to understand user queries in natural language, even with complex or multi-part requests.
  • Contextual Conversation: Maintains conversation history through ConversationMemory to provide relevant and uninterrupted interactions.
  • Tool Integration: Interacts with external tools to fetch real-time data from a vector store (e.g., Qdrant) for services and master information.
  • Observability: Integrates with Langfuse for monitoring, tracing, and analyzing the bot's performance and interactions.

Architecture:

The project follows a layered architecture, with clearly defined responsibilities for each component:

  1. Main Entry Point (main.py): Initializes the application, sets up all necessary components (LLM, database managers, tools, agent), and starts the user interaction loop.
  2. Agent (salon_agent.py): The SalonAgent orchestrates the conversation flow. It manages the agent's state, integrates with the state graph, and handles memory and dependency management.
  3. State Graph (salon_graph.py): Implements the conversational logic using LangGraph's stateful execution. It defines nodes for intent detection and request processing, guiding the conversation through different states.
  4. Nodes (process_request.py, intent_nodes.py):
    • intent_nodes.py: Contains logic for detecting user intents using an LLM and parsing the results.
    • process_request.py: Handles the core business logic based on the detected intent, extracting entities, calling tools, and formulating responses.
  5. Data Management:
    • DependencyManager: Manages dependencies, including database and vector store connections.
    • DatabaseManager, QdrantManager, SbertEmbeddingProvider: Handle data persistence and vector storage.
    • ConversationMemory: Manages dialogue history and short-term memory.
  6. Configuration (config/): Contains configurations for LLMs (ollama_config), Langfuse (langfuse_config), and application settings (settings).
  7. Tools (tools/): Defines specific tools the agent can use, such as GetServiceInfoTool and GetMasterInfoTool.

Environment Variables (.env):

The following environment variables are used to configure the application:

  • Langfuse:
    • LANGFUSE_SECRET_KEY: Secret key for Langfuse authentication.
    • LANGFUSE_PUBLIC_KEY: Public key for Langfuse authentication.
    • LANGFUSE_HOST: Host URL for the Langfuse instance.
  • LLM Configuration:
    • BOT_OLLAMA_HOST: Host URL for the Ollama service.
    • OLLAMA_CHAT_MODEL: The name of the Ollama chat model to use (e.g., "qwen2.5:7b").
  • Database Configuration:
    • DATABASE_URL: The primary connection URL for the PostgreSQL database.
    • DATABASE_MEMORY_URL: A specific connection URL or an in-memory database URL.
    • DB_SCHEMA_NAME: The schema name to use within the database (e.g., "dialog").
  • Vector Store Configuration:
    • QDRANT_URL: Host URL for the Qdrant vector store.
  • Other Configurations:
    • HG_FACE_TOKEN: Hugging Face API token, potentially for accessing models or datasets.
    • MCP_SERVER_COMMAND: Command to run the MCP server.
    • MCP_SERVER_ARGS: Arguments for the MCP server (commented out, likely for production use).

Tech Stack:

  • Python: The primary programming language.
  • LangGraph: For building and managing stateful, multi-agent applications.
  • LLMs: Utilizes models through Ollama for natural language understanding and generation.
  • Qdrant: A vector database used for efficient similarity search on embeddings.
  • Langfuse: For observability, tracing, and analytics.
  • Pydantic: For data validation and defining state models.

How it Works:

  1. The user inputs a message.
  2. The SalonAgent receives the message.
  3. The detect_intent_node uses an LLM to determine the user's intention and extract relevant entities.
  4. The process_request node takes the intent and message, retrieves necessary information using tools, and decides the next action (e.g., asking for clarification, providing information, or confirming a booking).
  5. The conversation state is updated, and the response is sent back to the user.
  6. The ConversationMemory and database managers ensure that the conversation context is maintained and persisted.

About

The Salon Bot is an AI-powered conversational agent built with Python, LangGraph, and LLMs. It's designed to streamline customer interactions for beauty salons by handling appointment booking, service inquiries, and master information requests.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages