Create Relay Bot MVP
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from app.proactive.classifier import MessageClassifier
|
||||
|
||||
|
||||
class StubLLM:
|
||||
def __init__(self, payload):
|
||||
self.payload = payload
|
||||
|
||||
async def json(self, _messages):
|
||||
return self.payload
|
||||
|
||||
|
||||
async def test_classifier_accepts_named_confidence_and_string_flags() -> None:
|
||||
result = await MessageClassifier(
|
||||
StubLLM({"is_question": "true", "project_related": "yes", "confidence": "high"})
|
||||
).classify("Где конфиг?")
|
||||
assert result.is_question and result.project_related
|
||||
assert result.confidence == 0.9
|
||||
|
||||
|
||||
async def test_classifier_falls_back_safely_for_invalid_confidence() -> None:
|
||||
result = await MessageClassifier(StubLLM({"confidence": "unknown"})).classify("text")
|
||||
assert result.confidence == 0.0
|
||||
Reference in New Issue
Block a user