Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dev = [
"mypy>=1.16.0",
"types-PyYAML>=6.0.2",
"ruff>=0.11.13",
"aiosqlite",
]

[tool.pytest.ini_options]
Expand Down
6 changes: 6 additions & 0 deletions tests/configuration/minimal-stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '2'
image_name: llamastack-minimal-stack
container_image: null

apis: []
providers: {}
14 changes: 5 additions & 9 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,41 @@
"""Unit tests for functions defined in src/client.py."""

import os
import pytest
from unittest.mock import patch

from client import get_llama_stack_client
from models.config import LLamaStackConfiguration


# [tisnik] Need to resolve dependencies on CI to be able to run this tests
@patch.dict(os.environ, {"INFERENCE_MODEL": "llama3.2:3b-instruct-fp16"})
def _test_get_llama_stack_library_client() -> None:
def test_get_llama_stack_library_client() -> None:
cfg = LLamaStackConfiguration(
url=None,
api_key=None,
use_as_library_client=True,
library_client_config_path="ollama",
library_client_config_path="./tests/configuration/minimal-stack.yaml",
)

client = get_llama_stack_client(cfg)
assert client is not None


@patch.dict(os.environ, {"INFERENCE_MODEL": "llama3.2:3b-instruct-fp16"})
def test_get_llama_stack_remote_client() -> None:
cfg = LLamaStackConfiguration(
url="http://localhost:8321",
api_key=None,
use_as_library_client=False,
library_client_config_path="ollama",
library_client_config_path="./tests/configuration/minimal-stack.yaml",
)
client = get_llama_stack_client(cfg)
assert client is not None


@patch.dict(os.environ, {"INFERENCE_MODEL": "llama3.2:3b-instruct-fp16"})
def test_get_llama_stack_wrong_configuration() -> None:
cfg = LLamaStackConfiguration(
url=None,
api_key=None,
use_as_library_client=True,
library_client_config_path="ollama",
library_client_config_path="./tests/configuration/minimal-stack.yaml",
)
cfg.library_client_config_path = None
with pytest.raises(
Expand Down