mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 00:23:17 +00:00
19 lines
642 B
Python
19 lines
642 B
Python
from application.llm.handlers.base import LLMHandler
|
|
from application.llm.handlers.google import GoogleLLMHandler
|
|
from application.llm.handlers.openai import OpenAILLMHandler
|
|
|
|
|
|
class LLMHandlerCreator:
|
|
handlers = {
|
|
"openai": OpenAILLMHandler,
|
|
"google": GoogleLLMHandler,
|
|
"default": OpenAILLMHandler,
|
|
}
|
|
|
|
@classmethod
|
|
def create_handler(cls, llm_type: str, *args, **kwargs) -> LLMHandler:
|
|
handler_class = cls.handlers.get(llm_type.lower())
|
|
if not handler_class:
|
|
raise ValueError(f"No LLM handler class found for type {llm_type}")
|
|
return handler_class(*args, **kwargs)
|