From 660396643188333345e7f21f4eafcdd80783a191 Mon Sep 17 00:00:00 2001 From: bucolucas Date: Mon, 19 Aug 2024 13:50:38 -0500 Subject: [PATCH 1/3] Update default model to gpt-4o --- chatgpt_telegram_inference_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatgpt_telegram_inference_bot.py b/chatgpt_telegram_inference_bot.py index 88f9c94..b916c23 100644 --- a/chatgpt_telegram_inference_bot.py +++ b/chatgpt_telegram_inference_bot.py @@ -9,7 +9,7 @@ class ChatGPTTelegramInferenceBot(BaseTelegramInferenceBot): def __init__(self): super().__init__() self.client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) - self.model = "gpt-4o-mini" + self.model = "gpt-4o" self.max_tokens = 16384 def get_chat_response(self, messages): From d40be179eace9c8020eef372d1d48a47e15a9b70 Mon Sep 17 00:00:00 2001 From: bucolucas Date: Mon, 19 Aug 2024 13:51:36 -0500 Subject: [PATCH 2/3] Update default max tokens for gpt-4o --- chatgpt_telegram_inference_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatgpt_telegram_inference_bot.py b/chatgpt_telegram_inference_bot.py index b916c23..777bf6c 100644 --- a/chatgpt_telegram_inference_bot.py +++ b/chatgpt_telegram_inference_bot.py @@ -10,7 +10,7 @@ class ChatGPTTelegramInferenceBot(BaseTelegramInferenceBot): super().__init__() self.client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY")) self.model = "gpt-4o" - self.max_tokens = 16384 + self.max_tokens = 4096 def get_chat_response(self, messages): response = self.client.chat.completions.create( From 5b4f7157bd596d8302c1b1d16706bf1d319ae4dd Mon Sep 17 00:00:00 2001 From: bucolucas Date: Mon, 19 Aug 2024 14:11:45 -0500 Subject: [PATCH 3/3] Add refactor analysis plan --- scratch/refactor_analysis_plan.md | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 scratch/refactor_analysis_plan.md diff --git a/scratch/refactor_analysis_plan.md b/scratch/refactor_analysis_plan.md new file mode 100644 index 0000000..748b432 --- /dev/null +++ b/scratch/refactor_analysis_plan.md @@ -0,0 +1,47 @@ +# Refactor Analysis Plan + +## 1. Examine Base Class Structure +- Analyze `BaseTelegramInferenceBot` in `base_telegram_inference_bot.py` +- Identify abstract methods and common functionality +- Note the tool loading mechanism and conversation history management + +## 2. Compare Derived Classes +- Compare `ChatGPTTelegramInferenceBot` in `chatgpt_telegram_inference_bot.py` +- Compare `AnthropicTelegramInferenceBot` in `anthropic_telegram_inference_bot.py` +- Identify similarities and differences in implementation + +## 3. Analyze Tool Integration +- Examine how tools are loaded and called in each bot +- Compare tool calling mechanisms between ChatGPT and Anthropic implementations + +## 4. Review Message Handling +- Analyze the `handle_message` method in both derived classes +- Compare the flow of conversation and tool usage + +## 5. Investigate Model-Specific Features +- Identify any model-specific features or optimizations +- Note differences in API calls and response handling + +## 6. Examine Error Handling and Logging +- Review error handling mechanisms in each class +- Analyze logging practices across the codebase + +## 7. Assess Code Reusability and DRY Principles +- Identify any repeated code that could be further abstracted +- Suggest potential improvements for code reuse + +## 8. Review Configuration and Environment Variables +- Examine how configuration and API keys are managed +- Suggest any improvements for security or flexibility + +## 9. Analyze Performance Considerations +- Identify any performance-critical sections +- Suggest potential optimizations if applicable + +## 10. Summarize Findings +- Create a summary of the refactoring changes +- Highlight successful abstractions and areas for potential improvement + +## 11. Suggest Future Improvements +- Based on the analysis, propose any further refactoring or feature additions +- Consider extensibility for potential new AI model integrations