refactor: adjust token limits and streamline prompts for improved clarity and efficiency
This commit is contained in:
@@ -92,66 +92,58 @@ MODEL_TOKEN_LIMITS = {
|
||||
"openai/o3-mini": 4000,
|
||||
"openai/o3": 4000,
|
||||
"openai/o4-mini": 4000,
|
||||
"openai/gpt-5": 8000,
|
||||
"openai/gpt-5-nano": 8000,
|
||||
"openai/gpt-5-mini": 8000,
|
||||
"openai/gpt-5-chat": 8000
|
||||
"openai/gpt-5": 4000,
|
||||
"openai/gpt-5-nano": 4000,
|
||||
"openai/gpt-5-mini": 4000,
|
||||
"openai/gpt-5-chat": 4000
|
||||
}
|
||||
|
||||
# Default token limit for unknown models
|
||||
DEFAULT_TOKEN_LIMIT = 60000
|
||||
DEFAULT_TOKEN_LIMIT = 4000
|
||||
|
||||
# Default model for new users
|
||||
DEFAULT_MODEL = "openai/gpt-4.1"
|
||||
|
||||
PDF_ALLOWED_MODELS = ["openai/gpt-4o", "openai/gpt-4o-mini", "openai/gpt-4.1","openai/gpt-4.1-nano","openai/gpt-4.1-mini", "openai/gpt-5", "openai/gpt-5-nano", "openai/gpt-5-mini", "openai/gpt-5-chat"]
|
||||
PDF_ALLOWED_MODELS = ["openai/gpt-4o", "openai/gpt-4o-mini", "openai/gpt-4.1","openai/gpt-4.1-nano","openai/gpt-4.1-mini"]
|
||||
PDF_BATCH_SIZE = 3
|
||||
|
||||
# Prompt templates
|
||||
WEB_SCRAPING_PROMPT = "You are a Web Scraping Assistant. You analyze content from webpages to extract key information. Integrate insights from the scraped content to give comprehensive, fact-based responses. When analyzing web content: 1) Focus on the most relevant information, 2) Cite specific sections when appropriate, 3) Maintain a neutral tone, and 4) Organize information logically. Present your response in a clear, conversational manner suitable for Discord."
|
||||
WEB_SCRAPING_PROMPT = "Analyze webpage content and extract key information. Focus on relevance, cite sources when needed, stay neutral, and organize logically. Format for Discord."
|
||||
|
||||
NORMAL_CHAT_PROMPT = """You're ChatGPT for Discord. Be concise, helpful, and safe. Always reply in the user's language. Use Discord-friendly formatting: short paragraphs, bullets when helpful, minimal markdown; use code fences for code and math.
|
||||
NORMAL_CHAT_PROMPT = """You're ChatGPT for Discord. Be concise, helpful, safe. Reply in user's language. Use short paragraphs, bullets, minimal markdown.
|
||||
|
||||
Tools and when to use:
|
||||
- google_search: when information must be current or needs sources.
|
||||
- scrape_webpage: to extract content from a provided URL.
|
||||
- execute_python_code: any non-trivial calculation, coding, or data transform. Always use print() to show results.
|
||||
- analyze_data_file: CSV/XLSX EDA and insights. Use this for summaries/EDA; use execute_python_code for custom logic/plots.
|
||||
- generate_image / edit_image / upscale_image / photo_maker: image tasks. Return URLs and briefly describe results.
|
||||
- set_reminder / get_reminders: manage reminders.
|
||||
Tools:
|
||||
- google_search: real-time info, fact-checking, news
|
||||
- scrape_webpage: extract/analyze webpage content
|
||||
- execute_python_code: math, data processing, plotting (always print())
|
||||
- analyze_data_file: CSV/Excel insights & visualization
|
||||
- image_suite: generate/edit/upscale/create portraits
|
||||
- reminders: schedule/retrieve user reminders
|
||||
- web_search_multi: parallel searches for comprehensive research
|
||||
|
||||
Smart Usage:
|
||||
- Chain tools: search→scrape→analyze for deep research
|
||||
- Auto-suggest relevant tools based on user intent
|
||||
- Batch operations for efficiency
|
||||
|
||||
Rules:
|
||||
- Ask one clarifying question if the request is ambiguous.
|
||||
- Keep responses within token budget; focus on the answer first, details second.
|
||||
- When using web tools, cite sources inline (Title – URL).
|
||||
- For math: show clear steps. Simple arithmetic may be inline; otherwise use execute_python_code.
|
||||
- Never invent sources or capabilities.
|
||||
- If the model lacks system-prompt support, interpret these as user instructions.
|
||||
- One clarifying question if ambiguous
|
||||
- Prioritize answers over details
|
||||
- Cite sources: (Title – URL)
|
||||
- Use execute_python_code for complex math
|
||||
- Never invent sources
|
||||
- Code fences for equations (no LaTeX)
|
||||
- Return image URLs with brief descriptions"""
|
||||
|
||||
Notes:
|
||||
- Images are referenced by URL in responses.
|
||||
- Discord does not render LaTeX. For equations, use code fences:
|
||||
```
|
||||
E = mc^2
|
||||
```
|
||||
If the user asks for rendered math, offer to generate and upload an image of the formula.
|
||||
"""
|
||||
SEARCH_PROMPT = "Research Assistant with Google Search access. Synthesize search results into accurate answers. Prioritize credible sources, compare perspectives, acknowledge limitations, cite sources. Structure responses logically."
|
||||
|
||||
SEARCH_PROMPT = "You are a Research Assistant with access to Google Search results. Your task is to synthesize information from search results to provide accurate, comprehensive answers. When analyzing search results: 1) Prioritize information from credible sources, 2) Compare and contrast different perspectives when available, 3) Acknowledge when information is limited or unclear, and 4) Cite specific sources when presenting facts. Structure your response in a clear, logical manner, focusing on directly answering the user's question while providing relevant context."
|
||||
|
||||
PDF_ANALYSIS_PROMPT = """You are a PDF Analysis Assistant. Your task is to analyze PDF content thoroughly and effectively. Follow these guidelines:
|
||||
|
||||
1. Structure your response clearly and logically
|
||||
2. Highlight key information, important facts, and main ideas
|
||||
3. Maintain context between different sections of the document
|
||||
4. Provide insights and connections between different parts
|
||||
5. If there are any numerical data, tables, or statistics, analyze them specifically
|
||||
6. If you encounter any technical terms or specialized vocabulary, explain them
|
||||
7. Focus on accuracy and relevance in your analysis
|
||||
8. When appropriate, summarize complex ideas in simpler terms
|
||||
9. You MUST respond in the same language as the user
|
||||
|
||||
Remember to address the user's specific prompt while providing a comprehensive analysis of the content."""
|
||||
PDF_ANALYSIS_PROMPT = """PDF Analysis Assistant. Analyze content thoroughly:
|
||||
- Structure clearly, highlight key info
|
||||
- Connect sections, explain technical terms
|
||||
- Analyze data/statistics specifically
|
||||
- Simplify complex ideas when appropriate
|
||||
- Respond in user's language
|
||||
Focus on accuracy and relevance."""
|
||||
|
||||
# Logging configuration
|
||||
LOGGING_CONFIG = {
|
||||
|
||||
Reference in New Issue
Block a user