mirror of
https://github.com/kennethreitz/simplemind.git
synced 2026-06-05 22:50:18 +00:00
Add OpenAI streaming support and enhance provider properties
This commit is contained in:
@@ -3,7 +3,10 @@ Release History
|
||||
|
||||
## 0.2.2 (2024-11-02)
|
||||
|
||||
- Add openai streaming support (set `stream=True` to `generate_text`).
|
||||
- `conv.prepend_system_message` now uses system role by default.
|
||||
- Add `provider.supports_streaming` property.
|
||||
- Add `provider.supports_structured_response` property.
|
||||
- General improvements.
|
||||
|
||||
## 0.2.1 (2024-11-01)
|
||||
|
||||
@@ -17,6 +17,7 @@ class BaseProvider(ABC):
|
||||
NAME: str
|
||||
DEFAULT_MODEL: str
|
||||
supports_streaming: bool = False
|
||||
supports_structured_responses: bool = True
|
||||
|
||||
@cached_property
|
||||
@abstractmethod
|
||||
|
||||
@@ -24,6 +24,7 @@ class OpenAI(BaseProvider):
|
||||
DEFAULT_MODEL = DEFAULT_MODEL
|
||||
DEFAULT_KWARGS = DEFAULT_KWARGS
|
||||
supports_streaming = True
|
||||
|
||||
|
||||
def __init__(self, api_key: str | None = None):
|
||||
self.api_key = api_key or settings.get_api_key(PROVIDER_NAME)
|
||||
|
||||
@@ -25,6 +25,7 @@ class XAI(BaseProvider):
|
||||
NAME = PROVIDER_NAME
|
||||
DEFAULT_MODEL = DEFAULT_MODEL
|
||||
DEFAULT_KWARGS = DEFAULT_KWARGS
|
||||
supports_structured_responses = False
|
||||
|
||||
def __init__(self, api_key: str | None = None):
|
||||
self.api_key = api_key or settings.get_api_key(PROVIDER_NAME)
|
||||
|
||||
Reference in New Issue
Block a user