mbudisic commited on
Commit
6c6c541
·
1 Parent(s): afb75fe

doc: Add DEVELOPER.md for improved onboarding and documentation

Browse files

- Introduced a new DEVELOPER.md file to guide developers through the codebase of the RAG application.
- Documented the `get_chat_api` function, highlighting its improved robustness in selecting chat models based on input strings.
- Enhanced clarity on core components and their functionalities to facilitate easier navigation and understanding of the codebase.

Files changed (1) hide show
  1. DEVELOPER.md +18 -0
DEVELOPER.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ✨ DEVELOPER.md ✨
2
+
3
+ This document is your trusty co-pilot for navigating the codebase of our amazing RAG application! 🚀
4
+
5
+ ## ⚙️ Core Components
6
+
7
+ ### `pstuts_rag/pstuts_rag/utils.py`
8
+
9
+ This module is a collection of utility functions that make our lives easier.
10
+
11
+ #### `get_chat_api(input: str) -> Type[ChatHuggingFace | ChatOpenAI | ChatOllama]`
12
+
13
+ Dynamically selects the appropriate chat model class (e.g., `ChatOpenAI`, `ChatHuggingFace`, `ChatOllama`) based on the `input` string.
14
+
15
+ * **Previous Behavior**: Directly used the input string as a key for `ChatAPISelector`. This was prone to errors if the input string didn't exactly match a `ModelAPI` enum member's name.
16
+ * **Current Behavior (Improved! 🥳)**: The `input` string is now robustly parsed into a `ModelAPI` enum member before being used as a key. This ensures that we correctly identify the desired API provider even if the input string's case or format varies slightly, as long as it's a valid `ModelAPI` value. For example, `"openai"` or `"OLLAMA"` will now correctly map to `ModelAPI.OPENAI` and `ModelAPI.OLLAMA` respectively.
17
+
18
+ This change makes the chat API selection more resilient and less error-prone! 🤓