21 lines
601 B
Python
21 lines
601 B
Python
"""
|
|
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")
|