Compare commits
2 Commits
f3dfbc627e
...
05ae13c147
| Author | SHA1 | Date | |
|---|---|---|---|
| 05ae13c147 | |||
| 86663e072e |
@ -1,7 +1,7 @@
|
||||
from dataclasses import dataclass
|
||||
from abc import abstractmethod
|
||||
from typing import Protocol, Optional, Union
|
||||
from .configuration import Config
|
||||
from .configuration import AIConfig
|
||||
from .message import Message
|
||||
from .chat import Chat
|
||||
|
||||
@ -34,7 +34,7 @@ class AI(Protocol):
|
||||
"""
|
||||
|
||||
name: str
|
||||
config: Config
|
||||
config: AIConfig
|
||||
|
||||
@abstractmethod
|
||||
def request(self,
|
||||
|
||||
@ -7,7 +7,15 @@ OpenAIConfigInst = TypeVar('OpenAIConfigInst', bound='OpenAIConfig')
|
||||
|
||||
|
||||
@dataclass
|
||||
class OpenAIConfig():
|
||||
class AIConfig:
|
||||
"""
|
||||
The base class of all AI configurations.
|
||||
"""
|
||||
name: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class OpenAIConfig(AIConfig):
|
||||
"""
|
||||
The OpenAI section of the configuration file.
|
||||
"""
|
||||
@ -25,6 +33,7 @@ class OpenAIConfig():
|
||||
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']),
|
||||
@ -36,7 +45,7 @@ class OpenAIConfig():
|
||||
|
||||
|
||||
@dataclass
|
||||
class Config():
|
||||
class Config:
|
||||
"""
|
||||
The configuration file structure.
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user