# --- START OF FILE template_bot.py --- # This is a template file for creating new bot profiles. # To create a new bot profile for a specific Slack channel: # # 1. **Copy this file** and rename it (e.g., `sales_bot.py`, `billing_bot.py`). # 2. **Modify the configuration variables** below (SYSTEM_PROMPT, MODEL, etc.) # to define the new bot's personality, capabilities, and resource limits. # **Change BOT_IDENTIFIER** to a unique name (e.g., "sales", "billing"). # 3. **Define the tools available to this bot**: # * Modify the `ENABLED_TOOL_NAMES` list. Add the *string names* of the tools # (e.g., "get_weather", "lookup_crm_lead", "check_inventory") that this # specific bot should be allowed to use. # * These names **must exactly match** the keys defined in the # `GLOBAL_TOOL_REGISTRY` in `abot.py`. # * If a required tool doesn't exist yet: # a. Create its `.py` file (e.g., `crm_tool.py`). # b. Implement the tool function (e.g., `lookup_crm_lead(**kwargs)`), including # input validation logic within the function. # c. Define its `TOOL_DEFINITION` constant (the schema for the LLM). # d. Add the tool to the `GLOBAL_TOOL_REGISTRY` in `abot.py`, mapping its # name to its definition and function. # 4. **(No `call_tool` function needed here anymore!)** Tool dispatching and argument # validation are now handled centrally by the main application (`claude_functions.py`) # and within the tool implementation files themselves. # 5. **Add the new bot profile to `abot.py`:** # a. Import your new bot profile module at the top of `abot.py`: # `import sales_bot` (use the filename you created). # b. Find the `CHANNEL_BOT_MAPPING` dictionary within `abot.py`. # c. Add a new entry mapping the Slack Channel ID for the target channel # to your imported module. You can find the Channel ID from Slack # (often in the URL or channel details) or from the `channel_cache.json`. # Example: # CHANNEL_BOT_MAPPING = { # "C0D7LT3JA": techsupport_bot, # Existing techsupport # "C08B9A6RPN1": abot_channel_bot, # Existing test bot # "C0DQ40MH8": sales_bot, # Your new sales bot mapping # # Add other mappings here # } # 6. **Restart the Abot application** (`abot.py`). Mentions in the newly configured # channel should now be processed by your new bot profile using only its # enabled tools. import logging # import json # No longer needed here # from typing import Dict, Any # No longer needed here # --- Configuration constants for the [New Bot Name] Bot profile --- # **STEP 2: Modify these values** # Define the primary instructions for the LLM. SYSTEM_PROMPT = """ You are Abot, a helpful AI assistant for First Step Internet. Your purpose in this channel is to assist our wireless and fiber field techs with their jobs. Be [Choose adjectives: friendly, concise, professional, technical, etc.]. Use the available tools (listed below) when needed to [Explain when tools should be used, e.g., look up customer data, check stock levels]. Format your responses clearly. Remember your Slack User ID is <@U08B3QR3C30>. Today's date and the current channel ID are provided below for context. """ # Controls whether this bot profile queries Pinecone RAG for context. ENABLE_RAG_QUERY: bool = True # Default to False, so customers cannot see our chat history. Turn on for internal channels. # Controls whether messages *from* the channel(s) associated with this profile are inserted into Pinecone. ENABLE_RAG_INSERT: bool = True # Default to True, so important messages are saved for future reference. Turn off for private channels. # Choose the Anthropic model to use. MODEL = "claude-3-5-haiku-20241022" # Haiku is often a good balance # Set the maximum number of tokens the LLM can generate. These are units of $$ for Bronson, currently. MAX_TOKENS = 2048 # Configure context lengths: SLACK_HISTORY_LENGTH = 25 # Recent Slack messages from channel log file. SLACK_RAG_HISTORY_LENGTH = 25 # Relevant historical messages retrieved via RAG. shouldn't work if ENABLE_RAG_QUERY is False MAX_HISTORY_LENGTH = 25 # LLM's conversational memory turns. # A unique identifier string used in logging messages from this bot profile. # ** CHANGE THIS to the Slack channel name (e.g., "sales", "billing") ** BOT_IDENTIFIER = "wireless" # --- Enabled Tools --- # **STEP 3: Modify this list** # List the *string names* of tools this bot profile can use. # These names MUST correspond to keys in GLOBAL_TOOL_REGISTRY in abot.py. ENABLED_TOOL_NAMES = [ # Example: # "lookup_crm_lead", # "check_inventory", # Example using existing tools: "get_weather", "generate_mikrotik_CPE_script", # "get_user_info", # this is broken currently # "generate_mikrotik_CPE_script", # Maybe this bot doesn't need this one # Add other enabled tool names here ] # --- END OF FILE template_bot.py ---