| from typing import Type
|
|
|
| from ..config import get_settings
|
| from .base import BaseAttributionService
|
| from .service_anthropic import AnthropicService
|
| from .service_openai import OpenAIService
|
|
|
| settings = get_settings()
|
|
|
|
|
| class AIServiceFactory:
|
| _services = {"openai": OpenAIService, "anthropic": AnthropicService}
|
|
|
| @classmethod
|
| def get_service(cls, ai_vendor: str = None) -> BaseAttributionService:
|
| ai_vendor = ai_vendor or settings.DEFAULT_VENDOR
|
| service_class = cls._services.get(ai_vendor.lower())
|
| if not service_class:
|
| raise ValueError(f"Unsupported ai_vendor: {ai_vendor}")
|
| return service_class()
|
|
|