File size: 1,379 Bytes
0aca678
0dbfea5
0aca678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0dbfea5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0aca678
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from LLMS.groqllm import GroqLLM
from LLMS.oaillm import OAILLM


class LLMHandler:
    def __init__(self, user_controls_input):
        self.user_control = user_controls_input
        self.api_type = user_controls_input.get('api_type')

    def handle_request(self):
        # Dispatch to the appropriate method based on api_type
        handler_method_name = f"{self.api_type}_handler"
        if hasattr(self, handler_method_name):
            handler_method = getattr(self, handler_method_name)
            handler_method()
        else:
            raise ValueError(f"Unsupported API type: {self.api_type}")

    def groq_handler(self):
        obj_llm_config = GroqLLM(user_controls_input=self.user_control)
        llm_config = obj_llm_config.groq_llm_config()
        return llm_config
    
    def common_handler(self):
        obj_llm_config = OAILLM(user_controls_input=self.user_control)
        obj_llm_config.oai_llm_config()

    def google_handler(self):
        self.common_handler()

    def mistral_handler(self):
        self.common_handler()

    def anthropic_handler(self):
        self.common_handler()

    def bedrock_handler(self):
        self.common_handler()

    def ollama_handler(self):
        self.common_handler()
    def together_handler(self):
        self.common_handler()
    
    def openai_handler(self):
        self.common_handler()