Skip to content

Commit fca12d3

Browse files
committed
Added older provider interface back for tests to pass.
Added back few older files. Replaced test_client with newer test code. Will need to port the older provider files to the new format. Till then keeping the older provider interface related tests.
1 parent d9ede71 commit fca12d3

18 files changed

+154
-123
lines changed

aisuite/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ def chat(self):
5151
class Chat:
5252
def __init__(self, client: "Client"):
5353
self.client = client
54+
self._completions = Completions(self.client)
5455

5556
@property
5657
def completions(self):
5758
"""Return the completions interface."""
58-
return Completions(self.client)
59+
return self._completions
5960

6061

6162
class Completions:

aisuite/framework/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
from .provider_interface import ProviderInterface
12
from .chat_completion_response import ChatCompletionResponse
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""The shared interface for model providers."""
2+
3+
4+
class ProviderInterface:
5+
"""Defines the expected behavior for provider-specific interfaces."""
6+
7+
def chat_completion_create(self, messages=None, model=None, temperature=0) -> None:
8+
"""Create a chat completion using the specified messages, model, and temperature.
9+
10+
This method must be implemented by subclasses to perform completions.
11+
12+
Args:
13+
----
14+
messages (list): The chat history.
15+
model (str): The identifier of the model to be used in the completion.
16+
temperature (float): The temperature to use in the completion.
17+
18+
Raises:
19+
------
20+
NotImplementedError: If this method has not been implemented by a subclass.
21+
22+
"""
23+
raise NotImplementedError(
24+
"Provider Interface has not implemented chat_completion_create()"
25+
)

aisuite/old_providers/__init__.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

aisuite/providers/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
# Empty __init__.py
1+
"""Provides the individual provider interfaces for each FM provider."""
2+
3+
from .anthropic_interface import AnthropicInterface
4+
from .aws_bedrock_interface import AWSBedrockInterface
5+
from .fireworks_interface import FireworksInterface
6+
from .groq_interface import GroqInterface
7+
from .mistral_interface import MistralInterface
8+
from .octo_interface import OctoInterface
9+
from .ollama_interface import OllamaInterface
10+
from .openai_interface import OpenAIInterface
11+
from .replicate_interface import ReplicateInterface
12+
from .together_interface import TogetherInterface
13+
from .google_interface import GoogleInterface
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)