Add tests for LlmSession and LlmSessionCaptionsAndKeywords in both integration and mocked scenarios
Tests / test_and_lint (push) Successful in 13s
Tests / test_and_lint (push) Successful in 13s
This commit is contained in:
@@ -7,7 +7,21 @@ from photools3.llm_session import LlmSession
|
||||
not LlmSession(system_prompt="").is_api_reachable(), reason="API not available"
|
||||
)
|
||||
def test_llm_session(llm_session, test_photo):
|
||||
llm_session.system_prompt = "Return only JSON format: {'keywords': ['...']}"
|
||||
result = llm_session.call(
|
||||
prompt="keywords for the attached picture", photos=[test_photo]
|
||||
)
|
||||
assert result
|
||||
assert result is not None
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not LlmSession(system_prompt="").is_api_reachable(), reason="API not available"
|
||||
)
|
||||
def test_llm_session_captions_and_keywords(
|
||||
llm_session_captions_and_keywords, test_photo
|
||||
):
|
||||
result = llm_session_captions_and_keywords.call(photos=[test_photo])
|
||||
assert "caption" in result
|
||||
assert "tags" in result
|
||||
assert isinstance(result["caption"], str)
|
||||
assert isinstance(result["tags"], list)
|
||||
|
||||
Reference in New Issue
Block a user