mirror of
https://github.com/kennethreitz/simplemind.git
synced 2026-06-05 14:50:16 +00:00
test
This commit is contained in:
@@ -6,6 +6,10 @@ readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = ["pydantic", "instructor"]
|
||||
|
||||
[dependency-groups]
|
||||
openai = ["openai"]
|
||||
claude = ["anthropic"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import os
|
||||
import logging
|
||||
|
||||
class BaseClientProvider:
|
||||
|
||||
def __init__(self, *, api_key=None, environ_name=None):
|
||||
self._environ_name = environ_name
|
||||
# TODO: reverse order, potentially?
|
||||
def __init__(self, *, api_key=None, api_key_environ_name=None):
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
|
||||
self._api_key_environ_name = api_key_environ_name
|
||||
|
||||
# Load API key from environment if not provided
|
||||
self._api_key = api_key or self._load_from_environ()
|
||||
|
||||
def _load_from_environ(self):
|
||||
if self._environ_name:
|
||||
self.api_key = os.environ.get(self._environ_name)
|
||||
else:
|
||||
self.api_key = None
|
||||
if self._api_key_environ_name:
|
||||
return os.environ.get(self._api_key_environ_name)
|
||||
return None
|
||||
|
||||
def test_connection(self):
|
||||
raise NotImplementedError("This method must be implemented by the AI provider client.")
|
||||
@@ -25,5 +28,5 @@ class BaseClientProvider:
|
||||
def available_models(self):
|
||||
raise NotImplementedError("This method must be implemented by the AI provider client.")
|
||||
|
||||
# TODO: logging provider.
|
||||
#
|
||||
def features(self):
|
||||
raise NotImplementedError("This method must be implemented by the AI provider client.")
|
||||
|
||||
@@ -2,4 +2,7 @@ from .base import BaseClientProvider
|
||||
|
||||
|
||||
class OpenAI(BaseClientProvider):
|
||||
pass
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def test_connection(self):
|
||||
|
||||
Reference in New Issue
Block a user