# Define a minimal mock SeekrFlow client
class MockSeekrClient:
"""Mock SeekrFlow API client that mimics the real API structure."""
class MockChat:
"""Mock Chat object with a completions method."""
class MockCompletions:
"""Mock Completions object with a create method."""
def create(self, *args, **kwargs):
return {
"choices": [{"message": {"content": "Mock response"}}]
} # Mimic API response
completions = MockCompletions()
chat = MockChat()
def test_initialization_errors():
"""Test that invalid ChatSeekrFlow initializations raise expected errors."""
test_cases = [
{
"name": "Missing Client",
"args": {"client": None, "model_name": "seekrflow-model"},
"expected_error": "SeekrFlow client cannot be None.",
},
{
"name": "Missing Model Name",
"args": {"client": MockSeekrClient(), "model_name": ""},
"expected_error": "A valid model name must be provided.",
},
]
for test in test_cases:
try:
print(f"Running test: {test['name']}")
faulty_llm = ChatSeekrFlow(**test["args"])
# If no error is raised, fail the test
print(f"❌ Test '{test['name']}' failed: No error was raised!")
except Exception as e:
error_msg = str(e)
assert test["expected_error"] in error_msg, f"Unexpected error: {error_msg}"
print(f"✅ Expected Error: {error_msg}")
# Run test
test_initialization_errors()