Initial commit: PROMETHEUS v0.1.0 - Prompt optimizer
- Clean architecture (domain/application/infrastructure) - DSPy-based evolution engine with scoring - CLI via pyproject.toml entry point - Unit + integration tests (~300 tests) - Configs for glm-5.1 and glm-4.5-air models - Z.AI endpoint integration
This commit is contained in:
29
tests/integration/test_dspy_adapters.py
Normal file
29
tests/integration/test_dspy_adapters.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""Integration tests for DSPy adapters using DSPy mock LM."""
|
||||
from __future__ import annotations
|
||||
|
||||
import dspy
|
||||
import pytest
|
||||
|
||||
from prometheus.domain.entities import Prompt
|
||||
from prometheus.infrastructure.llm_adapter import DSPyLLMAdapter
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_lm() -> dspy.LM:
|
||||
"""Create a DSPy mock LM that returns predictable responses."""
|
||||
lm = dspy.utils.DummyLM(
|
||||
[
|
||||
{"output": "Mock output response"},
|
||||
]
|
||||
)
|
||||
dspy.configure(lm=lm)
|
||||
return lm
|
||||
|
||||
|
||||
class TestDSPyLLMAdapter:
|
||||
def test_execute_returns_response(self, mock_lm: dspy.LM) -> None:
|
||||
adapter = DSPyLLMAdapter(model="openai/gpt-4o-mini")
|
||||
prompt = Prompt(text="Answer the question.")
|
||||
result = adapter.execute(prompt, "What is 2+2?")
|
||||
assert isinstance(result, str)
|
||||
assert len(result) > 0
|
||||
Reference in New Issue
Block a user