Skip to content

Commit

Permalink
- fixed bug that caused by multiple inheritance in azure-based runners
Browse files Browse the repository at this point in the history
  • Loading branch information
t-schn committed Oct 21, 2024
1 parent 96dfd85 commit 73bf1b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sammo"
version = "0.2.6"
version = "0.2.7"
description = "A flexible, easy-to-use library for running and optimizing prompts for Large Language Models (LLMs)."
authors = ["Tobias Schnabel"]
license = "MIT"
Expand Down
1 change: 1 addition & 0 deletions sammo/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ class AzureMixIn:
"""

def _post_init(self):
super()._post_init()
if not "endpoint" in self._api_config:
raise ValueError("Azure API needs an endpoint.")
if not "deployment_id" in self._api_config:
Expand Down
10 changes: 9 additions & 1 deletion sammo/runners_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest

from sammo.runners import BaseRunner, OpenAIChat, OpenAIEmbedding, RetriableError, JsonSchema
from sammo.runners import BaseRunner, OpenAIChat, OpenAIEmbedding, RetriableError, JsonSchema, AzureEmbedding
from sammo.base import Costs
from sammo.store import InMemoryDict

Expand Down Expand Up @@ -166,6 +166,14 @@ def test_schema_simple_dict():
assert JsonSchema.guess_schema(data).schema == expected


def test_instantiate_azure():
test = AzureEmbedding(
model_id="dummy",
api_config={"api_key": "test", "endpoint": "test", "deployment_id": "sth", "api_version": "2023-05-15"},
)
assert hasattr(test, "_embeddings_cache")


def test_schema_nested_dict():
data = {"person": {"name": "Alice", "age": 25}}
expected = {
Expand Down

0 comments on commit 73bf1b6

Please sign in to comment.