Skip to content

Commit

Permalink
packages updated (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
davorrunje committed Aug 22, 2024
1 parent ebc72fe commit e948a38
Show file tree
Hide file tree
Showing 27 changed files with 160 additions and 160 deletions.
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ classifiers = [
dynamic = ["version"]

dependencies = [
"pyautogen[anthropic,together]==0.2.34",
"pyautogen[anthropic,together]==0.2.35",
"faststream[nats]>=0.5.10,<0.6",
"typing-extensions>=4.8.0,<5",
"pydantic>=2.3,<3",
Expand All @@ -67,10 +67,10 @@ server = [

# dev dependencies
devdocs = [
"mkdocs-material==9.5.29",
"mkdocs-material==9.5.32",
"mkdocs-static-i18n==1.2.3",
"mdx-include==1.4.2",
"mkdocstrings[python]==0.25.1",
"mkdocstrings[python]==0.25.2",
"mkdocs-literate-nav==0.6.1",
"mkdocs-git-revision-date-localized-plugin==1.2.6",
"mike==2.1.2", # versioning
Expand All @@ -89,7 +89,7 @@ lint = [
"types-Pygments",
"types-docutils",
"mypy==1.11.1",
"ruff==0.5.2",
"ruff==0.6.1",
"pyupgrade-directories==0.3.0",
"bandit==1.7.9",
"semgrep==1.85.0",
Expand All @@ -98,7 +98,7 @@ lint = [

test-core = [
"coverage[toml]==7.6.1",
"pytest==8.2.2",
"pytest==8.3.2",
"pytest-asyncio==0.23.8",
"dirty-equals==0.7.1.post0",
"pytest-rerunfailures==14.0",
Expand Down
36 changes: 18 additions & 18 deletions tests/app/test_model_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(self, id: str, choices: List[Choice]):
self.choices = choices


@pytest.mark.asyncio()
@pytest.mark.asyncio
@pytest.mark.parametrize(
"api_key,expected", # noqa: PT006
[("whatever", "wha*ever"), ("some_other_key", "som*******_key")],
Expand All @@ -66,9 +66,9 @@ async def test_mask(api_key: str, expected: str) -> None:
assert await mask(api_key) == expected


@pytest.mark.db()
@pytest.mark.db
class TestModelRoutes:
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_get_all_models(
self, user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand Down Expand Up @@ -105,7 +105,7 @@ async def test_get_all_models(
for key in expected[i]:
assert actual[i][key] == expected[i][key]

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_setup_user(self) -> None:
random_id = random.randint(1, 1_000_000)
user_uuid = await DefaultDB.frontend()._create_user(
Expand Down Expand Up @@ -159,7 +159,7 @@ async def test_setup_user(self) -> None:
actual = response.json()
assert actual == expected_setup_again

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_add_model(self, user_uuid: str) -> None:
model_uuid = str(uuid.uuid4())
azure_oai_api_key = AzureOAIAPIKey(api_key="whatever", name="who cares?")
Expand All @@ -176,7 +176,7 @@ async def test_add_model(self, user_uuid: str) -> None:
actual = response.json()
assert actual == expected

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_add_model_deployment(self, user_uuid: str) -> None:
team_uuid = str(uuid.uuid4())
deployment_uuid = str(uuid.uuid4())
Expand Down Expand Up @@ -250,7 +250,7 @@ async def test_add_model_deployment(self, user_uuid: str) -> None:
actual = response.json()
assert actual == expected

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_add_model_deployment_with_long_name(self, user_uuid: str) -> None:
team_uuid = str(uuid.uuid4())
deployment_uuid = str(uuid.uuid4())
Expand Down Expand Up @@ -283,7 +283,7 @@ async def test_add_model_deployment_with_long_name(self, user_uuid: str) -> None

assert response.status_code != 200

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_background_task_not_called_on_error(self, user_uuid: str) -> None:
team_uuid = str(uuid.uuid4())
deployment_uuid = str(uuid.uuid4())
Expand Down Expand Up @@ -328,7 +328,7 @@ async def test_background_task_not_called_on_error(self, user_uuid: str) -> None
mock_task.assert_not_called()
assert response.status_code != 200

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_update_model(
self, user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand Down Expand Up @@ -357,7 +357,7 @@ async def test_update_model(
actual = response.json()
assert actual == expected

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_update_model_deployment(self, user_uuid: str) -> None:
team_uuid = str(uuid.uuid4())
deployment_uuid = str(uuid.uuid4())
Expand Down Expand Up @@ -459,7 +459,7 @@ async def test_update_model_deployment(self, user_uuid: str) -> None:
actual = response.json()
assert actual == expected

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_delete_model(
self, user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand All @@ -485,8 +485,8 @@ async def test_delete_model(
actual = response.json()
assert actual == expected

@pytest.mark.llm()
@pytest.mark.asyncio()
@pytest.mark.llm
@pytest.mark.asyncio
async def test_chat_with_no_function_calling(
self, user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand Down Expand Up @@ -530,8 +530,8 @@ async def test_chat_with_no_function_calling(
# Assert the mock was called with the correct arguments
mock_create.assert_called_once()

@pytest.mark.llm()
@pytest.mark.asyncio()
@pytest.mark.llm
@pytest.mark.asyncio
async def test_chat_error(
self, user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand Down Expand Up @@ -571,8 +571,8 @@ async def test_chat_error(
# Assert the mock was called with the correct arguments
mock_create.assert_called_once()

@pytest.mark.llm()
@pytest.mark.asyncio()
@pytest.mark.llm
@pytest.mark.asyncio
async def test_chat_with_function_calling(
self, user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand Down Expand Up @@ -626,7 +626,7 @@ async def test_chat_with_function_calling(
# Assert the mock was called with the correct arguments
mock_create.assert_called_once()

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_ping(self) -> None:
deployment_uuid = str(uuid.uuid4())
response = client.get(f"/deployment/{deployment_uuid}/ping")
Expand Down
22 changes: 11 additions & 11 deletions tests/app/test_openai_extensively.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


class TestValidateOpenAIKey:
@pytest.fixture()
@pytest.fixture
def model_dict(self) -> Dict[str, Any]:
model = OpenAIAPIKey(
api_key="sk-sUeBP9asw6GiYHXqtg70T3BlbkFJJuLwJFco90bOpU0Ntest", # pragma: allowlist secret
Expand Down Expand Up @@ -50,8 +50,8 @@ def test_validate_incorrect_api_key(self, model_dict: Dict[str, Any]) -> None:
}
assert msg_dict == expected

@pytest.mark.db()
@pytest.mark.asyncio()
@pytest.mark.db
@pytest.mark.asyncio
async def test_validate_secret_model(
self,
model_dict: Dict[str, Any],
Expand Down Expand Up @@ -80,7 +80,7 @@ async def test_validate_secret_model(

# we will do this for OpenAI only, the rest should be the same
class TestValidateOpenAI:
@pytest.fixture()
@pytest.fixture
def model_dict(self) -> Dict[str, Any]:
key_uuid = uuid.uuid4()
OpenAIAPIKeyRef = OpenAIAPIKey.get_reference_model() # noqa: N806
Expand Down Expand Up @@ -181,8 +181,8 @@ def test_get_schemas() -> None:


class TestToolbox:
@pytest.mark.db()
@pytest.mark.asyncio()
@pytest.mark.db
@pytest.mark.asyncio
async def test_add_toolbox(self, user_uuid: str, fastapi_openapi_url: str) -> None:
openapi_auth = OpenAPIAuth(
name="openapi_auth_secret",
Expand Down Expand Up @@ -225,7 +225,7 @@ async def test_add_toolbox(self, user_uuid: str, fastapi_openapi_url: str) -> No
actual = response.json()
assert actual == expected

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_validate_toolbox(self, fastapi_openapi_url: str) -> None:
openapi_auth = OpenAPIAuth(
name="openapi_auth_secret",
Expand All @@ -244,7 +244,7 @@ async def test_validate_toolbox(self, fastapi_openapi_url: str) -> None:

await validate_toolbox(toolbox)

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_validate_toolbox_route(self, fastapi_openapi_url: str) -> None:
openapi_auth = OpenAPIAuth(
name="openapi_auth_secret",
Expand All @@ -269,7 +269,7 @@ async def test_validate_toolbox_route(self, fastapi_openapi_url: str) -> None:
)
assert response.status_code == 200

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_validate_toolbox_with_404_url(self) -> None:
invalid_url = "http://i.dont.exist.airt.ai/openapi.json"

Expand All @@ -294,7 +294,7 @@ async def test_validate_toolbox_with_404_url(self) -> None:
assert e.value.status_code == 422
assert e.value.detail == "OpenAPI URL is invalid"

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_validate_toolbox_with_invalid_openapi_spec(self) -> None:
invalid_url = "http://echo.jsontest.com/key/value/one/two"

Expand All @@ -319,7 +319,7 @@ async def test_validate_toolbox_with_invalid_openapi_spec(self) -> None:
assert e.value.status_code == 422
assert e.value.detail == "OpenAPI URL does not contain a valid OpenAPI spec"

@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_validate_toolbox_with_yaml_openapi_spec(self) -> None:
invalid_url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml"

Expand Down
24 changes: 12 additions & 12 deletions tests/auth_token/test_auth_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ def test_verify_auth_token() -> None:
assert not verify_auth_token("wrong_token", "wrong_hash")


@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_parse_expiry() -> None:
expiry = await parse_expiry("1d")
assert expiry is not None
assert isinstance(expiry, datetime)
assert expiry > datetime.utcnow()


@pytest.mark.asyncio()
@pytest.mark.asyncio
@pytest.mark.parametrize(
"expiry_str, expected", # noqa: PT006
[
Expand All @@ -75,8 +75,8 @@ async def test_parse_expiry_with_invalid_expiry(expiry_str: str, expected: str)
assert e.value.detail == expected


@pytest.mark.db()
@pytest.mark.asyncio()
@pytest.mark.db
@pytest.mark.asyncio
async def test_create_deployment_token(
user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand All @@ -99,8 +99,8 @@ async def mock_find_model(*args: Any, **kwargs: Any) -> Dict[str, Union[str, UUI
assert len(token.auth_token) == 32, token.auth_token


@pytest.mark.db()
@pytest.mark.asyncio()
@pytest.mark.db
@pytest.mark.asyncio
async def test_create_deployment_token_with_wrong_user_uuid(
user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand All @@ -125,8 +125,8 @@ async def mock_find_model(*args: Any, **kwargs: Any) -> Dict[str, Union[str, UUI
assert e.value.detail == "User does not have access to this deployment"


@pytest.mark.db()
@pytest.mark.asyncio()
@pytest.mark.db
@pytest.mark.asyncio
async def test_create_deployment_auth_token_route(
user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand All @@ -153,8 +153,8 @@ async def mock_find_model(*args: Any, **kwargs: Any) -> Dict[str, Union[str, UUI
assert response.json()["auth_token"] is not None


@pytest.mark.db()
@pytest.mark.asyncio()
@pytest.mark.db
@pytest.mark.asyncio
async def test_get_all_deployment_auth_tokens(
user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand Down Expand Up @@ -192,8 +192,8 @@ async def mock_find_model(*args: Any, **kwargs: Any) -> Dict[str, Union[str, UUI
assert response_json[0]["expiry"] == "99d"


@pytest.mark.db()
@pytest.mark.asyncio()
@pytest.mark.db
@pytest.mark.asyncio
async def test_delete_deployment_auth_token(
user_uuid: str, monkeypatch: pytest.MonkeyPatch
) -> None:
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,19 @@ def get_default_model_name(model_env_name: str) -> str:


@tag("llm_config")
@pytest.fixture()
@pytest.fixture
def azure_gpt35_turbo_16k_llm_config() -> Dict[str, Any]:
return azure_model_llm_config("AZURE_GPT35_MODEL")


@tag("llm_config")
@pytest.fixture()
@pytest.fixture
def azure_gpt4_llm_config() -> Dict[str, Any]:
return azure_model_llm_config("AZURE_GPT4_MODEL")


@tag("llm_config")
@pytest.fixture()
@pytest.fixture
def azure_gpt4o_llm_config() -> Dict[str, Any]:
return azure_model_llm_config("AZURE_GPT4o_MODEL")

Expand All @@ -159,7 +159,7 @@ def openai_llm_config(model: str) -> Dict[str, Any]:


@tag("llm_config")
@pytest.fixture()
@pytest.fixture
def openai_gpt35_turbo_16k_llm_config() -> Dict[str, Any]:
return openai_llm_config("gpt-3.5-turbo")

Expand Down
6 changes: 3 additions & 3 deletions tests/db/test_inmemory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from fastagency.models.llms.azure import AzureOAIAPIKey


@pytest.mark.asyncio()
@pytest.mark.asyncio
class TestInMemoryFrontendDB:
async def test_set(self) -> None:
frontend_db = InMemoryFrontendDB()
Expand Down Expand Up @@ -53,8 +53,8 @@ async def test_user_exception(self) -> None:
assert f"user_uuid {user_uuid} not found" == str(e.value)


@pytest.mark.db()
@pytest.mark.asyncio()
@pytest.mark.db
@pytest.mark.asyncio
class TestInMemoryBackendDB:
async def test_model_CRUD(self) -> None: # noqa: N802
# Setup
Expand Down
Loading

0 comments on commit e948a38

Please sign in to comment.