MCPcopy
hub / github.com/llmware-ai/llmware / _ModelRegistry

Class _ModelRegistry

llmware/models.py:64–373  ·  view source on GitHub ↗

ModelRegistry class is wrapper class around the global_model_repo_catalog_list for easy dynamic updating, and holds most of the key Model, ModelClass and Function/Tool mappings and configurations.

Source from the content-addressed store, hash-verified

62
63
64class _ModelRegistry:
65
66 """ ModelRegistry class is wrapper class around the global_model_repo_catalog_list for easy dynamic updating,
67 and holds most of the key Model, ModelClass and Function/Tool mappings and configurations. """
68
69 # notes:
70 # --held out as internal global cls to keep options to adapt implementation over time
71 # --generally does not to be directly accessed -> make changes through ModelCatalog
72
73 # pulls default model list from model_configs.py
74 registered_models = global_model_repo_catalog_list
75
76 # global list of supported model classes with module lookup - and placeholder for other attributes over time
77 model_classes = {"ONNXGenerativeModel": {"module": "llmware.models", "open_source": True},
78 "OVGenerativeModel": {"module": "llmware.models", "open_source": True},
79 "GGUFGenerativeModel": {"module": "llmware.models", "open_source":True},
80 "GGUFVisionGenerativeModel": {"module": "llmware.models", "open_source":True},
81 "OVVisionGenerativeModel": {"module": "llmware.models", "open_source": True},
82 "ONNXQNNGenerativeModel": {"module": "llmware.models", "open_source":True},
83 "ONNXEmbeddingModel": {"module": "llmware.models", "open_source": True},
84 "ONNXVisionGenerativeModel": {"module": "llmware.models", "open_source":True},
85 "OVEmbeddingModel": {"module": "llmware.models", "open_source": True},
86 "WindowsLocalFoundryModel": {"module": "llmware.models", "open_source":True},
87 "WhisperCPPModel": {"module": "llmware.models", "open_source": True},
88 "HFGenerativeModel": {"module": "llmware.models", "open_source":True},
89 "HFReRankerModel": {"module": "llmware.models", "open_source": True},
90 "LLMWareModel": {"module": "llmware.models", "open_source": True},
91 "LLMWareSemanticModel": {"module": "llmware.models", "open_source": True},
92 "HFEmbeddingModel": {"module": "llmware.models", "open_source": True},
93 "OpenChatModel": {"module": "llmware.models", "open_source": True},
94 "OllamaModel":{"module": "llmware.models", "open_source": True},
95 "OpenAIGenModel":{"module": "llmware.models", "open_source": False},
96 "ClaudeModel":{"module": "llmware.models", "open_source": False},
97 "GoogleGeminiModel":{"module": "llmware.models", "open_source": False},
98 "OpenAIEmbeddingModel":{"module": "llmware.models", "open_source": False},
99 }
100
101 model_catalog_state_attributes = ["selected_model", "loaded_model_name", "loaded_model_class", "temperature",
102 "api_endpoint", "get_logits", "max_output", "sample",
103 "force_reload", "account_name", "library_name", "api_key"]
104
105 # model card validation for registering new model - required attributes
106 min_required_fields = ["model_name", "model_family", "model_category"]
107
108 # most fine-tuned models require a specific prompt wrapping that was used in the fine-tuning process
109 # we are treating these "prompt_wrappers" as core attributes of the model
110 prompt_wrappers = ["alpaca", "human_bot", "chatgpt", "<INST>", "open_chat", "hf_chat", "chat_ml", "phi_3",
111 "llama_3_chat","tiny_llama_chat","stablelm_zephyr_chat", "google_gemma_chat",
112 "vicuna_chat", "phi_4", "deepseek_chat", "phi-4-mini",
113 "granite_chat", "lfm2_chat", "olmo_chat", "oss_chat", "phi_3_vision"]
114
115 registered_wrappers = global_model_finetuning_prompt_wrappers_lookup
116
117 # new attribute - track bos/eos for common tokenizers
118 tokenizer_bos_eos_config = global_tokenizer_bos_eos_lookup
119
120 # list of specialized function calling tools
121

Callers 15

__init__Method · 0.90
exec_function_callMethod · 0.90
fx_over_api_endpointMethod · 0.90
__init__Method · 0.85
load_model_registryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected