first commit

This commit is contained in:
Your Name
2026-01-14 01:41:03 -08:00
commit 9d31399518
18 changed files with 2191 additions and 0 deletions

View File

@@ -0,0 +1,103 @@
# --- 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. **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. This is the #integration-sandbox channel.
You exist in every channel, but you only see recent history from this channel, plus hopefully relevant messages from other channels, via RAG from a Pinecone database.
Examples of other internal channels are #techsupport, #sales, #billing, #sysadmin, #techsupport, #customer-projects
In each different channel, you have a different purpose and personality, and set of tools.
Your purpose in this channel is to help the team test the (Python) script tying you to Slack, and its proper functionality, and your tools.
Be friendly, concise, and professional.
More tools are being added, and can be added by the team.
Please encourage the team to think of new tools to add, and to use this channel to test the ones that are already here.
When you use a tool, mention that you are doing so. When you receive an error from a tool, show the exact error message to the user.
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 = False # 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 = 5 # Recent Slack messages from channel log file.
SLACK_RAG_HISTORY_LENGTH = 5 # Relevant historical messages retrieved via RAG. shouldn't work if ENABLE_RAG_QUERY is False
MAX_HISTORY_LENGTH = 10 # 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 = "integration-sandbox"
# --- 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",
"web_search",
# "get_user_info", # this is broken currently
"generate_mikrotik_CPE_script", # Maybe this bot doesn't need this one
"get_imail_password",
# Add other enabled tool names here
]
# --- END OF FILE template_bot.py ---