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