1 Commits

Author SHA1 Message Date
juk0de f3dfbc627e added new module 'ai.py' 2023-09-01 09:01:14 +02:00
2 changed files with 4 additions and 13 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from abc import abstractmethod
from typing import Protocol, Optional, Union
from .configuration import AIConfig
from .configuration import Config
from .message import Message
from .chat import Chat
@@ -34,7 +34,7 @@ class AI(Protocol):
"""
name: str
config: AIConfig
config: Config
@abstractmethod
def request(self,
+2 -11
View File
@@ -7,15 +7,7 @@ OpenAIConfigInst = TypeVar('OpenAIConfigInst', bound='OpenAIConfig')
@dataclass
class AIConfig:
"""
The base class of all AI configurations.
"""
name: str
@dataclass
class OpenAIConfig(AIConfig):
class OpenAIConfig():
"""
The OpenAI section of the configuration file.
"""
@@ -33,7 +25,6 @@ class OpenAIConfig(AIConfig):
Create OpenAIConfig from a dict.
"""
return cls(
name='OpenAI',
api_key=str(source['api_key']),
model=str(source['model']),
max_tokens=int(source['max_tokens']),
@@ -45,7 +36,7 @@ class OpenAIConfig(AIConfig):
@dataclass
class Config:
class Config():
"""
The configuration file structure.
"""