19 lines
491 B
Python
19 lines
491 B
Python
from stream_agent import StreamingAIAgent
|
|
|
|
|
|
def test_stream_returns_chunks(monkeypatch):
|
|
monkeypatch.delenv("OPENAI_API_KEY", raising=False)
|
|
agent = StreamingAIAgent()
|
|
|
|
chunks = list(agent.stream("test question"))
|
|
|
|
assert len(chunks) > 3
|
|
assert "".join(chunks).strip()
|
|
|
|
|
|
def test_invoke_matches_stream(monkeypatch):
|
|
monkeypatch.delenv("OPENAI_API_KEY", raising=False)
|
|
agent = StreamingAIAgent()
|
|
|
|
assert agent.invoke("hello") == "".join(agent.stream("hello"))
|