mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-08-18 20:54:05 +08:00
13 lines
491 B
Python
13 lines
491 B
Python
from openai import OpenAI
|
|
|
|
from app.gpt.base import GPT
|
|
from app.gpt.provider.OpenAI_compatible_provider import OpenAICompatibleProvider
|
|
from app.gpt.universal_gpt import UniversalGPT
|
|
from app.models.model_config import ModelConfig
|
|
|
|
|
|
class GPTFactory:
|
|
@staticmethod
|
|
def from_config(config: ModelConfig) -> GPT:
|
|
client = OpenAICompatibleProvider(api_key=config.api_key, base_url=config.base_url).get_client()
|
|
return UniversalGPT(client=client, model=config.model_name) |