refactor: moved registries into a separate module and code cleanup
fix: refactored dial provider to follow the same pattern
This commit is contained in:
@@ -11,8 +11,8 @@ from typing import Any, Optional
|
||||
|
||||
from mcp.types import TextContent
|
||||
|
||||
from providers.custom_registry import CustomEndpointModelRegistry
|
||||
from providers.openrouter_registry import OpenRouterModelRegistry
|
||||
from providers.registries.custom import CustomEndpointModelRegistry
|
||||
from providers.registries.openrouter import OpenRouterModelRegistry
|
||||
from tools.models import ToolModelCategory, ToolOutput
|
||||
from tools.shared.base_models import ToolRequest
|
||||
from tools.shared.base_tool import BaseTool
|
||||
|
||||
@@ -89,7 +89,7 @@ class BaseTool(ABC):
|
||||
"""Get cached OpenRouter registry instance, creating if needed."""
|
||||
# Use BaseTool class directly to ensure cache is shared across all subclasses
|
||||
if BaseTool._openrouter_registry_cache is None:
|
||||
from providers.openrouter_registry import OpenRouterModelRegistry
|
||||
from providers.registries.openrouter import OpenRouterModelRegistry
|
||||
|
||||
BaseTool._openrouter_registry_cache = OpenRouterModelRegistry()
|
||||
logger.debug("Created cached OpenRouter registry instance")
|
||||
@@ -99,7 +99,7 @@ class BaseTool(ABC):
|
||||
def _get_custom_registry(cls):
|
||||
"""Get cached custom-endpoint registry instance."""
|
||||
if BaseTool._custom_registry_cache is None:
|
||||
from providers.custom_registry import CustomEndpointModelRegistry
|
||||
from providers.registries.custom import CustomEndpointModelRegistry
|
||||
|
||||
BaseTool._custom_registry_cache = CustomEndpointModelRegistry()
|
||||
logger.debug("Created cached Custom registry instance")
|
||||
|
||||
Reference in New Issue
Block a user