TeLLMgramBot 3.13.3__tar.gz → 3.13.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/PKG-INFO +8 -9
  2. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/README.md +7 -8
  3. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/TeLLMgramBot.py +1 -1
  4. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/conversation.py +2 -2
  5. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/initialize.py +10 -38
  6. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/message_handlers.py +21 -7
  7. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot.egg-info/PKG-INFO +8 -9
  8. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/setup.py +1 -1
  9. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/LICENSE +0 -0
  10. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/__init__.py +0 -0
  11. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/archive.py +0 -0
  12. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/database.py +0 -0
  13. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/models.py +0 -0
  14. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/providers/__init__.py +0 -0
  15. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/providers/anthropic_provider.py +0 -0
  16. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/providers/base.py +0 -0
  17. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/providers/factory.py +0 -0
  18. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/providers/openai_provider.py +0 -0
  19. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/tools.py +0 -0
  20. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/utils.py +0 -0
  21. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot/web_utils.py +0 -0
  22. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot.egg-info/SOURCES.txt +0 -0
  23. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot.egg-info/dependency_links.txt +0 -0
  24. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot.egg-info/requires.txt +0 -0
  25. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/TeLLMgramBot.egg-info/top_level.txt +0 -0
  26. {tellmgrambot-3.13.3 → tellmgrambot-3.13.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TeLLMgramBot
3
- Version: 3.13.3
3
+ Version: 3.13.4
4
4
  Summary: LLM-powered Telegram bot (OpenAI + Anthropic)
5
5
  Home-page: https://github.com/Digital-Heresy/TeLLMgramBot
6
6
  Author: Digital Heresy
@@ -75,12 +75,11 @@ Simply set `chat_model` (and optionally `url_model`) in your `config.yaml` to an
75
75
  ## Directories
76
76
  TeLLMgramBot creates the following directories:
77
77
 
78
- - **`configs`** - Bot configuration and model parameters
79
- - `config.yaml` - Bot settings: owner, model names, token limits, search limits, nickname/initials, database name
78
+ - **`configs`** - Bot configuration and model parameters (path configurable via `TELLMGRAMBOT_CONFIGS_PATH`)
79
+ - `config.yaml` - Default bot configuration file (filename used throughout this README); can be changed by passing `config_file` to `TelegramBot.set()`
80
80
  - `models.yaml` - Token limits for each LLM model (pre-populated on first run)
81
- - **`prompts`** - Bot personas and URL analysis templates
82
- - `test_personality.prmpt` - Sample bot personality (multi-provider, can be renamed)
83
- - `url_analysis.prmpt` - URL summarization prompt template
81
+ - **`prompts`** - Bot personas (path configurable via `TELLMGRAMBOT_PROMPTS_PATH`)
82
+ - `test_personality.prmpt` - Default bot persona file (filename used throughout this README); can be changed by passing `prompt_file` to `TelegramBot.set()`
84
83
  - A system appendix is automatically appended to every persona at runtime, teaching the LLM about cross-chat memory and search behavior. User messages include speaker annotations with chat context and timestamps so the LLM always knows who is speaking, in which chat, and when.
85
84
  - **`logs`** - Bot instance logs (one per startup, named after the bot's Telegram username or `instance_name` config, e.g. `my_bot_2026-03-29_10-30-45.log`)
86
85
  - Logs include anonymized Telegram IDs for privacy. Console shows INFO-level TeLLMgramBot messages only, prefixed with an `[identity label]` (the bot's Telegram username by default, or `instance_name` when configured).
@@ -102,13 +101,13 @@ Override default directory locations by setting these environment variables (use
102
101
  If unset, all paths default to subdirectories of the execution directory (the directory containing your entry-point script).
103
102
 
104
103
  ## API Keys
105
- TeLLMgramBot supports four API keys. OpenAI, Anthropic, and VirusTotal keys load from environment variables or `.key` files. The Telegram key loads from `telegram_api_key` in `config.yaml` or its env var (no `.key` file):
104
+ TeLLMgramBot supports four API keys. OpenAI, Anthropic, and VirusTotal keys load from environment variables or `.key` files. The Telegram key loads from its env var or the bot config field `telegram_api_key` (no `.key` file):
106
105
 
107
106
  | Key | Env Var | File/Config | When required |
108
107
  |-----|---------|-------------|---------------|
109
108
  | [OpenAI](https://platform.openai.com/api-keys) | `TELLMGRAMBOT_OPENAI_API_KEY` | `openai.key` | For `gpt-*` models |
110
109
  | [Anthropic](https://console.anthropic.com/settings/keys) | `TELLMGRAMBOT_ANTHROPIC_API_KEY` | `anthropic.key` | For `claude-*` models |
111
- | [Telegram](https://t.me/BotFather) | `TELLMGRAMBOT_TELEGRAM_API_KEY` | `telegram_api_key` in config.yaml | Always required |
110
+ | [Telegram](https://t.me/BotFather) | `TELLMGRAMBOT_TELEGRAM_API_KEY` | bot config `telegram_api_key` in `config.yaml` | Always required |
112
111
  | [VirusTotal](https://www.virustotal.com/gui/my-apikey) | `TELLMGRAMBOT_VIRUSTOTAL_API_KEY` | `virustotal.key` | For URL analysis |
113
112
 
114
113
  Missing provider keys (OpenAI or Anthropic) disable chat and URL analysis but allow the bot to start. Missing VirusTotal disables URL analysis. Telegram key is required - the bot will not start without it.
@@ -151,7 +150,7 @@ When the bot is triggered in a group and about to respond (not deferring to anot
151
150
  - `bot_owner`: Telegram username(s) with admin access (required, no `@`). Accepts a single string or a YAML list of usernames.
152
151
  - `chat_model`: LLM model for conversation (e.g. `gpt-4o-mini` or `claude-sonnet-4-6`)
153
152
  - `url_model`: LLM model for URL analysis (e.g. `gpt-4o` or `claude-haiku-4-5`)
154
- - `telegram_api_key`: Telegram bot API key (required). Lookup order: TELLMGRAMBOT_TELEGRAM_API_KEY env var -> config field.
153
+ - `telegram_api_key`: Telegram bot API key (required). Lookup order: (1) `TELLMGRAMBOT_TELEGRAM_API_KEY` env var, (2) `telegram_api_key` in `config.yaml`. Exits on placeholder, missing, or malformed key.
155
154
  - `bot_nickname` / `bot_initials`: Names the bot responds to in groups
156
155
  - `instance_name`: Optional label for console prefix, log filename, and database name (e.g. `MyBot` produces `[MyBot] INFO: ...` on console, `MyBot_{timestamp}.log` logs, and `MyBot.db` database); omit to use bot's Telegram username for logging and `conversations.db` for database. Use distinct names when running multiple bot instances in the same directory.
157
156
  - `token_limit`: Max tokens (optional; defaults to model's maximum)
@@ -43,12 +43,11 @@ Simply set `chat_model` (and optionally `url_model`) in your `config.yaml` to an
43
43
  ## Directories
44
44
  TeLLMgramBot creates the following directories:
45
45
 
46
- - **`configs`** - Bot configuration and model parameters
47
- - `config.yaml` - Bot settings: owner, model names, token limits, search limits, nickname/initials, database name
46
+ - **`configs`** - Bot configuration and model parameters (path configurable via `TELLMGRAMBOT_CONFIGS_PATH`)
47
+ - `config.yaml` - Default bot configuration file (filename used throughout this README); can be changed by passing `config_file` to `TelegramBot.set()`
48
48
  - `models.yaml` - Token limits for each LLM model (pre-populated on first run)
49
- - **`prompts`** - Bot personas and URL analysis templates
50
- - `test_personality.prmpt` - Sample bot personality (multi-provider, can be renamed)
51
- - `url_analysis.prmpt` - URL summarization prompt template
49
+ - **`prompts`** - Bot personas (path configurable via `TELLMGRAMBOT_PROMPTS_PATH`)
50
+ - `test_personality.prmpt` - Default bot persona file (filename used throughout this README); can be changed by passing `prompt_file` to `TelegramBot.set()`
52
51
  - A system appendix is automatically appended to every persona at runtime, teaching the LLM about cross-chat memory and search behavior. User messages include speaker annotations with chat context and timestamps so the LLM always knows who is speaking, in which chat, and when.
53
52
  - **`logs`** - Bot instance logs (one per startup, named after the bot's Telegram username or `instance_name` config, e.g. `my_bot_2026-03-29_10-30-45.log`)
54
53
  - Logs include anonymized Telegram IDs for privacy. Console shows INFO-level TeLLMgramBot messages only, prefixed with an `[identity label]` (the bot's Telegram username by default, or `instance_name` when configured).
@@ -70,13 +69,13 @@ Override default directory locations by setting these environment variables (use
70
69
  If unset, all paths default to subdirectories of the execution directory (the directory containing your entry-point script).
71
70
 
72
71
  ## API Keys
73
- TeLLMgramBot supports four API keys. OpenAI, Anthropic, and VirusTotal keys load from environment variables or `.key` files. The Telegram key loads from `telegram_api_key` in `config.yaml` or its env var (no `.key` file):
72
+ TeLLMgramBot supports four API keys. OpenAI, Anthropic, and VirusTotal keys load from environment variables or `.key` files. The Telegram key loads from its env var or the bot config field `telegram_api_key` (no `.key` file):
74
73
 
75
74
  | Key | Env Var | File/Config | When required |
76
75
  |-----|---------|-------------|---------------|
77
76
  | [OpenAI](https://platform.openai.com/api-keys) | `TELLMGRAMBOT_OPENAI_API_KEY` | `openai.key` | For `gpt-*` models |
78
77
  | [Anthropic](https://console.anthropic.com/settings/keys) | `TELLMGRAMBOT_ANTHROPIC_API_KEY` | `anthropic.key` | For `claude-*` models |
79
- | [Telegram](https://t.me/BotFather) | `TELLMGRAMBOT_TELEGRAM_API_KEY` | `telegram_api_key` in config.yaml | Always required |
78
+ | [Telegram](https://t.me/BotFather) | `TELLMGRAMBOT_TELEGRAM_API_KEY` | bot config `telegram_api_key` in `config.yaml` | Always required |
80
79
  | [VirusTotal](https://www.virustotal.com/gui/my-apikey) | `TELLMGRAMBOT_VIRUSTOTAL_API_KEY` | `virustotal.key` | For URL analysis |
81
80
 
82
81
  Missing provider keys (OpenAI or Anthropic) disable chat and URL analysis but allow the bot to start. Missing VirusTotal disables URL analysis. Telegram key is required - the bot will not start without it.
@@ -119,7 +118,7 @@ When the bot is triggered in a group and about to respond (not deferring to anot
119
118
  - `bot_owner`: Telegram username(s) with admin access (required, no `@`). Accepts a single string or a YAML list of usernames.
120
119
  - `chat_model`: LLM model for conversation (e.g. `gpt-4o-mini` or `claude-sonnet-4-6`)
121
120
  - `url_model`: LLM model for URL analysis (e.g. `gpt-4o` or `claude-haiku-4-5`)
122
- - `telegram_api_key`: Telegram bot API key (required). Lookup order: TELLMGRAMBOT_TELEGRAM_API_KEY env var -> config field.
121
+ - `telegram_api_key`: Telegram bot API key (required). Lookup order: (1) `TELLMGRAMBOT_TELEGRAM_API_KEY` env var, (2) `telegram_api_key` in `config.yaml`. Exits on placeholder, missing, or malformed key.
123
122
  - `bot_nickname` / `bot_initials`: Names the bot responds to in groups
124
123
  - `instance_name`: Optional label for console prefix, log filename, and database name (e.g. `MyBot` produces `[MyBot] INFO: ...` on console, `MyBot_{timestamp}.log` logs, and `MyBot.db` database); omit to use bot's Telegram username for logging and `conversations.db` for database. Use distinct names when running multiple bot instances in the same directory.
125
124
  - `token_limit`: Max tokens (optional; defaults to model's maximum)
@@ -506,7 +506,7 @@ class TelegramBot:
506
506
  reply = _MSG_PROCESS_ERROR
507
507
  if url_match and self.key_status.url_analysis_enabled:
508
508
  await msg.reply_text("Sure, give me a moment to look at that URL...")
509
- reply = await handle_url_ask(text, self.llm['url_model'])
509
+ reply = await handle_url_ask(text, self.llm['url_model'], conv.system_content)
510
510
  elif self._online and self.key_status.chat_enabled:
511
511
  # This is the transition point between quick Telegram replies and the LLM.
512
512
  tools = self._build_tool_list(chat_type, username)
@@ -111,9 +111,9 @@ class Conversation:
111
111
  init and on every incoming message so long sessions always carry an accurate
112
112
  UTC timestamp in format 'YYYY-MM-DD HH:MM UTC'.
113
113
  """
114
- dt_line = f'\nCurrent date and time: {format_now(None)}'
114
+ dt_line = f'\n- Current date and time: {format_now(None)}'
115
115
  new_content, n = re.subn(
116
- r'\nCurrent date and time:.*',
116
+ r'\n-?\s*Current date and time:.*',
117
117
  dt_line,
118
118
  self.system_content,
119
119
  )
@@ -126,12 +126,13 @@ INIT_BOT_CONFIG_COMMENTS = {
126
126
  # Append the framework-owned system appendix to the persona prompt.
127
127
  # Teaches an LLM how cross-chat memory works without requiring persona authors to include it.
128
128
  _SYSTEM_APPENDIX = (
129
- "You have access to past messages across chats and a search tool - use them to inform your responses, but never quote or volunteer content from other chats unprompted, especially in group settings.\n"
130
- "Always invoke the search tool before concluding a message does not exist.\n"
131
- "Messages marked private are never shared between chats.\n"
132
- "Never reveal or repeat Telegram user IDs, chat IDs, or any other internal numeric identifiers in your responses.\n"
133
- "When your context includes a '[Replying to Name, ...]' prefix indicating you were triggered via a reply, acknowledge the original author by name in your response.\n"
134
- "Current date and time: (not yet known)\n"
129
+ "## System\n"
130
+ "- You have access to past messages across chats and a search tool - use them to inform your responses, but never quote or volunteer content from other chats unprompted, especially in group settings.\n"
131
+ "- Always invoke the search tool before concluding a message does not exist.\n"
132
+ "- Messages marked private are never shared between chats.\n"
133
+ "- Never reveal or repeat Telegram user IDs, chat IDs, or any other internal numeric identifiers in your responses.\n"
134
+ "- When your context includes a '[Replying to Name, ...]' prefix indicating you were triggered via a reply, acknowledge the original author by name in your response.\n"
135
+ "- Current date and time: (not yet known)\n"
135
136
  )
136
137
 
137
138
 
@@ -270,9 +271,8 @@ def _model_provider(model: str) -> str | None:
270
271
  def _load_telegram_key(config: dict):
271
272
  """
272
273
  Load and validate the Telegram API key into TELLMGRAMBOT_TELEGRAM_API_KEY.
273
-
274
- Lookup order: TELLMGRAMBOT_TELEGRAM_API_KEY env var -> bot config `telegram_api_key`.
275
- No .key file support. Exits on placeholder, missing, or malformed key.
274
+ Lookup order: (1) TELLMGRAMBOT_TELEGRAM_API_KEY env var, (2) bot config
275
+ telegram_api_key. Exits on placeholder, missing, or malformed key.
276
276
 
277
277
  Args:
278
278
  config: Parsed bot configuration dict from init_bot_config().
@@ -488,33 +488,6 @@ def init_bot_prompt(file: str = 'test_personality.prmpt') -> str:
488
488
  sys.exit(f"{type(e).__name__} on {env_var} file '{file}': {e}\nExiting...")
489
489
 
490
490
 
491
- def init_url_prompt(file: str = 'url_analysis.prmpt') -> str:
492
- """
493
- Ensure prompt file is created that defines how the bot will analyze URLs via square brackets [].
494
- Must specify the environment variable 'TELLMGRAMBOT_PROMPTS_PATH'.
495
- """
496
- env_var = "TELLMGRAMBOT_PROMPTS_PATH"
497
- try:
498
- return read_text(
499
- generate_file_path(os.environ[env_var], file, "URL analysis prompt",
500
- "The user has provided a URL to perform some level of analysis. You will infer "
501
- "the nature of the analysis from the user's query.\n\n"
502
- "The contents of the URL mentioned have already been harvested and cleansed. "
503
- "Note the URL contents will likely have sections of text that are less relevant "
504
- "to the user's question (headers, footers, menus, ads, etc.). You will need to "
505
- "ignore those sections of text and focus on the main content of the page.\n\n"
506
- "The contents of the URL are shown below:\n"
507
- "BEGIN URL CONTENTS\n"
508
- "{url_content}\n"
509
- "END URL CONTENTS\n"
510
- )
511
- )
512
- except KeyError:
513
- sys.exit(f"{env_var} must be defined to create file '{file}'! Exiting...")
514
- except Exception as e:
515
- sys.exit(f"{type(e).__name__} on {env_var} file '{file}': {e}\nExiting...")
516
-
517
-
518
491
  def init_structure(
519
492
  config_file: str = 'config.yaml',
520
493
  prompt_file: str = 'test_personality.prmpt',
@@ -526,7 +499,7 @@ def init_structure(
526
499
  - Database naming and schema initialization from config (conversations.db or custom instance_name).
527
500
  - Provider-conditional API keys (OpenAI/Anthropic determined by bot config model prefixes).
528
501
  - Configuration files (bot config, models.yaml) with inline parameter descriptions.
529
- - System prompt files (test_personality.prmpt, url_analysis.prmpt).
502
+ - System prompt file (test_personality.prmpt).
530
503
 
531
504
  Provider key requirements are inferred from bot config model prefixes (claude-* -> Anthropic,
532
505
  gpt-* -> OpenAI, etc.) to streamline setup for single-provider deployments.
@@ -599,7 +572,6 @@ def init_structure(
599
572
  prompt = INIT_BOT_CONFIG.get('persona_prompt', '')
600
573
  logger.warning(f"File '{prompt_file}' is empty, using default persona prompt.")
601
574
  prompt = prompt.rstrip() + "\n\n" + _SYSTEM_APPENDIX
602
- init_url_prompt()
603
575
 
604
576
  # Load API keys before running archival so the provider can authenticate.
605
577
  key_status = init_keys(config)
@@ -3,7 +3,6 @@ import re
3
3
  from typing import Optional
4
4
  import validators
5
5
 
6
- from .initialize import init_url_prompt
7
6
  from .utils import log_error
8
7
  from .models import TokenLimits
9
8
  from .web_utils import (
@@ -15,6 +14,20 @@ from .web_utils import (
15
14
  )
16
15
  from .providers.factory import get_provider
17
16
 
17
+ _URL_ANALYSIS_TEMPLATE = (
18
+ "## URL Analysis\n"
19
+ "The user has provided a URL to perform some level of analysis. You will infer "
20
+ "the nature of the analysis from the user's query.\n\n"
21
+ "The contents of the URL mentioned have already been harvested and cleansed. "
22
+ "Note the URL contents will likely have sections of text that are less relevant "
23
+ "to the user's question (headers, footers, menus, ads, etc.). You will need to "
24
+ "ignore those sections of text and focus on the main content of the page.\n\n"
25
+ "The contents of the URL are shown below:\n"
26
+ "BEGIN URL CONTENTS\n"
27
+ "{url_content}\n"
28
+ "END URL CONTENTS\n"
29
+ )
30
+
18
31
 
19
32
  def handle_greetings(text: str) -> Optional[str]:
20
33
  """
@@ -44,18 +57,19 @@ def handle_common_queries(text: str) -> Optional[str]:
44
57
  return None
45
58
 
46
59
 
47
- async def handle_url_ask(text: str, model: str = 'gpt-4o') -> Optional[str]:
60
+ async def handle_url_ask(text: str, model: str = 'gpt-4o', prompt: str = '') -> Optional[str]:
48
61
  """
49
62
  Process URL content in an LLM to provide a summary.
50
63
 
51
64
  Extracts URLs wrapped in square brackets [], validates them, checks for
52
65
  safety via VirusTotal, fetches content, and summarizes via an LLM specified
53
- by model name. Errors are logged via the logging system categorized by model
54
- and error type.
66
+ by model name. The bot's persona prompt is prepended to the URL analysis
67
+ system message so responses match the bot's personality.
55
68
 
56
69
  Args:
57
70
  text: The message text potentially containing a URL in [square brackets].
58
71
  model: The LLM model to use for URL summarization (default: 'gpt-4o').
72
+ prompt: Bot persona prompt prepended to the URL analysis system message.
59
73
 
60
74
  Returns:
61
75
  A summary string if a URL was found and processed successfully, an error
@@ -104,9 +118,9 @@ async def handle_url_ask(text: str, model: str = 'gpt-4o') -> Optional[str]:
104
118
  # Show the last 50 characters of the pruned URL content
105
119
  pruned_tail = messages[0]["content"][-50:]
106
120
 
107
- # Load system prompt template to insert URL content
108
- template = init_url_prompt('url_analysis.prmpt')
109
- messages[0]["content"] = template.format(url_content=messages[0]["content"])
121
+ # Build system message: bot persona (if any) + URL analysis template with content
122
+ url_system = _URL_ANALYSIS_TEMPLATE.replace('{url_content}', messages[0]["content"])
123
+ messages[0]["content"] = f"{prompt}\n\n{url_system}" if prompt else url_system
110
124
 
111
125
  # Call the LLM for the response that summarizes URL content
112
126
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TeLLMgramBot
3
- Version: 3.13.3
3
+ Version: 3.13.4
4
4
  Summary: LLM-powered Telegram bot (OpenAI + Anthropic)
5
5
  Home-page: https://github.com/Digital-Heresy/TeLLMgramBot
6
6
  Author: Digital Heresy
@@ -75,12 +75,11 @@ Simply set `chat_model` (and optionally `url_model`) in your `config.yaml` to an
75
75
  ## Directories
76
76
  TeLLMgramBot creates the following directories:
77
77
 
78
- - **`configs`** - Bot configuration and model parameters
79
- - `config.yaml` - Bot settings: owner, model names, token limits, search limits, nickname/initials, database name
78
+ - **`configs`** - Bot configuration and model parameters (path configurable via `TELLMGRAMBOT_CONFIGS_PATH`)
79
+ - `config.yaml` - Default bot configuration file (filename used throughout this README); can be changed by passing `config_file` to `TelegramBot.set()`
80
80
  - `models.yaml` - Token limits for each LLM model (pre-populated on first run)
81
- - **`prompts`** - Bot personas and URL analysis templates
82
- - `test_personality.prmpt` - Sample bot personality (multi-provider, can be renamed)
83
- - `url_analysis.prmpt` - URL summarization prompt template
81
+ - **`prompts`** - Bot personas (path configurable via `TELLMGRAMBOT_PROMPTS_PATH`)
82
+ - `test_personality.prmpt` - Default bot persona file (filename used throughout this README); can be changed by passing `prompt_file` to `TelegramBot.set()`
84
83
  - A system appendix is automatically appended to every persona at runtime, teaching the LLM about cross-chat memory and search behavior. User messages include speaker annotations with chat context and timestamps so the LLM always knows who is speaking, in which chat, and when.
85
84
  - **`logs`** - Bot instance logs (one per startup, named after the bot's Telegram username or `instance_name` config, e.g. `my_bot_2026-03-29_10-30-45.log`)
86
85
  - Logs include anonymized Telegram IDs for privacy. Console shows INFO-level TeLLMgramBot messages only, prefixed with an `[identity label]` (the bot's Telegram username by default, or `instance_name` when configured).
@@ -102,13 +101,13 @@ Override default directory locations by setting these environment variables (use
102
101
  If unset, all paths default to subdirectories of the execution directory (the directory containing your entry-point script).
103
102
 
104
103
  ## API Keys
105
- TeLLMgramBot supports four API keys. OpenAI, Anthropic, and VirusTotal keys load from environment variables or `.key` files. The Telegram key loads from `telegram_api_key` in `config.yaml` or its env var (no `.key` file):
104
+ TeLLMgramBot supports four API keys. OpenAI, Anthropic, and VirusTotal keys load from environment variables or `.key` files. The Telegram key loads from its env var or the bot config field `telegram_api_key` (no `.key` file):
106
105
 
107
106
  | Key | Env Var | File/Config | When required |
108
107
  |-----|---------|-------------|---------------|
109
108
  | [OpenAI](https://platform.openai.com/api-keys) | `TELLMGRAMBOT_OPENAI_API_KEY` | `openai.key` | For `gpt-*` models |
110
109
  | [Anthropic](https://console.anthropic.com/settings/keys) | `TELLMGRAMBOT_ANTHROPIC_API_KEY` | `anthropic.key` | For `claude-*` models |
111
- | [Telegram](https://t.me/BotFather) | `TELLMGRAMBOT_TELEGRAM_API_KEY` | `telegram_api_key` in config.yaml | Always required |
110
+ | [Telegram](https://t.me/BotFather) | `TELLMGRAMBOT_TELEGRAM_API_KEY` | bot config `telegram_api_key` in `config.yaml` | Always required |
112
111
  | [VirusTotal](https://www.virustotal.com/gui/my-apikey) | `TELLMGRAMBOT_VIRUSTOTAL_API_KEY` | `virustotal.key` | For URL analysis |
113
112
 
114
113
  Missing provider keys (OpenAI or Anthropic) disable chat and URL analysis but allow the bot to start. Missing VirusTotal disables URL analysis. Telegram key is required - the bot will not start without it.
@@ -151,7 +150,7 @@ When the bot is triggered in a group and about to respond (not deferring to anot
151
150
  - `bot_owner`: Telegram username(s) with admin access (required, no `@`). Accepts a single string or a YAML list of usernames.
152
151
  - `chat_model`: LLM model for conversation (e.g. `gpt-4o-mini` or `claude-sonnet-4-6`)
153
152
  - `url_model`: LLM model for URL analysis (e.g. `gpt-4o` or `claude-haiku-4-5`)
154
- - `telegram_api_key`: Telegram bot API key (required). Lookup order: TELLMGRAMBOT_TELEGRAM_API_KEY env var -> config field.
153
+ - `telegram_api_key`: Telegram bot API key (required). Lookup order: (1) `TELLMGRAMBOT_TELEGRAM_API_KEY` env var, (2) `telegram_api_key` in `config.yaml`. Exits on placeholder, missing, or malformed key.
155
154
  - `bot_nickname` / `bot_initials`: Names the bot responds to in groups
156
155
  - `instance_name`: Optional label for console prefix, log filename, and database name (e.g. `MyBot` produces `[MyBot] INFO: ...` on console, `MyBot_{timestamp}.log` logs, and `MyBot.db` database); omit to use bot's Telegram username for logging and `conversations.db` for database. Use distinct names when running multiple bot instances in the same directory.
157
156
  - `token_limit`: Max tokens (optional; defaults to model's maximum)
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name='TeLLMgramBot',
8
- version='3.13.3',
8
+ version='3.13.4',
9
9
  packages=find_packages(),
10
10
  license='MIT',
11
11
  author='Digital Heresy',
File without changes
File without changes