ChatMasterMind Application Refactor and Enhancement #8

Merged
juk0de merged 122 commits from restructurings into main 2023-09-12 07:36:07 +02:00
Showing only changes of commit 7d15452242 - Show all commits

View File

@ -0,0 +1,20 @@
"""
Creates different AI instances, based on the given configuration.
"""
import argparse
from .configuration import Config
from .ai import AI, AIError
from .ais.openai import OpenAI
def create_ai(args: argparse.Namespace, config: Config) -> AI:
"""
Creates an AI subclass instance from the given args and configuration.
"""
if args.ai == 'openai':
# FIXME: create actual 'OpenAIConfig' and set values from 'args'
# FIXME: use actual name from config
return OpenAI("openai", config.openai)
else:
raise AIError(f"AI '{args.ai}' is not supported")