2023-09-29 00:09:01 +00:00
|
|
|
from application.llm.openai import OpenAILLM, AzureOpenAILLM
|
|
|
|
from application.llm.sagemaker import SagemakerAPILLM
|
|
|
|
from application.llm.huggingface import HuggingFaceLLM
|
2023-09-30 19:38:48 +00:00
|
|
|
from application.llm.llama_cpp import LlamaCpp
|
2023-10-28 18:51:12 +00:00
|
|
|
from application.llm.anthropic import AnthropicLLM
|
2024-01-08 23:35:37 +00:00
|
|
|
from application.llm.docsgpt_provider import DocsGPTAPILLM
|
2024-02-13 14:08:55 +00:00
|
|
|
from application.llm.premai import PremAILLM
|
2023-09-29 00:09:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LLMCreator:
|
|
|
|
llms = {
|
|
|
|
'openai': OpenAILLM,
|
|
|
|
'azure_openai': AzureOpenAILLM,
|
|
|
|
'sagemaker': SagemakerAPILLM,
|
2023-09-30 19:38:48 +00:00
|
|
|
'huggingface': HuggingFaceLLM,
|
2023-10-28 18:51:12 +00:00
|
|
|
'llama.cpp': LlamaCpp,
|
2024-01-08 23:35:37 +00:00
|
|
|
'anthropic': AnthropicLLM,
|
2024-02-13 14:08:55 +00:00
|
|
|
'docsgpt': DocsGPTAPILLM,
|
|
|
|
'premai': PremAILLM,
|
2023-09-29 00:09:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def create_llm(cls, type, *args, **kwargs):
|
|
|
|
llm_class = cls.llms.get(type.lower())
|
|
|
|
if not llm_class:
|
|
|
|
raise ValueError(f"No LLM class found for type {type}")
|
|
|
|
return llm_class(*args, **kwargs)
|