codeforpdx / codeforpdx/tenantfirstaid

Split LangChainChatManager into Inheritance Hierarchy

Open
#261 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backend enhancement
Dominant language
Python
Stars
13
Forks
21
Avg merge
6d 7h
Merged PRs (30d)
3

Description

Description

Refactor the LangChainChatManager class into a base class and model-specific child classes to handle differences between Gemini model versions that leak through the LangChain API.

Context
Proposed Structure
class GeminiChatManager:
    """Base class for Gemini-based chat management"""
    # Common functionality across all Gemini models
    
class Gemini2_5ChatManager(GeminiChatManager):
    """Child class for Gemini 2.5-specific features"""
    # Handles Gemini 2.5-specific quirks and features
    
class Gemini3PlusChatManager(GeminiChatManager):
    """Child class for Gemini 3+ specific features"""
    # Handles Gemini 3+ specific quirks and features
Rationale
  • Different Gemini model versions have different capabilities and behaviors
  • LangChain API doesn't fully abstract these differences
  • Model-specific handling is currently mixed in a single class
  • Inheritance hierarchy would make model-specific code paths explicit
Benefits
  • Clear separation of model-specific logic
  • Easier to add support for new Gemini versions
  • Better testability of model-specific features
  • Reduced conditional logic in core class
Impact

Moderate refactoring of backend/tenantfirstaid/langchain_chat_manager.py and related tests

Priority

🟡 MEDIUM

Parent Issue

#254

References

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with backend/tenantfirstaid/langchain_chat_manager.py and inspect the related tests to map the current Gemini model-specific behavior and conditional logic. Separate shared behavior from Gemini 2.5 and Gemini 3+ handling according to the proposed hierarchy, then run the related tests to verify the refactor preserves behavior and makes model-specific paths testable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.