SimpleBot and AsyncSimpleBot — EARS
Parent LLD: ./LLD.md
Construction and streaming
-
[x] CORE-SIMPLE-001: The system shall provide a class
SimpleBotwhose constructor acceptsstream_targetonly from the setstdout,panel,api,none; any other value shall raiseValueError. -
[x] CORE-SIMPLE-002: Where
model_nameiso1-previeworo1-mini, the system shall set the system prompt to aHumanMessagewith the same content, settemperatureto1.0, and setstream_targettonone. -
[x] CORE-SIMPLE-003: The system shall build LiteLLM chat messages via
completion_kwargs_for_messagesusing onlyroleandcontentfields from eachBaseMessage. -
[x] CORE-SIMPLE-004: Where
json_modeis true and the bot has nopydantic_modelattribute, orpydantic_modelis not a subclass ofpydantic.BaseModel,completion_kwargs_for_messagesshall raiseValueError.
Message composition and memory
-
[x] CORE-SIMPLE-010: When
memoryis set (document store),compose_messages_for_human_messagesshall prepend the system prompt plusmemory.retrieve(...)before the user messages converted viato_basemessage. -
[x] CORE-SIMPLE-011:
SimpleBot.__call__shall append the last processed user message and the assistantAIMessagetomemorywhenmemoryis configured.
Completion and logging
-
[x] CORE-SIMPLE-020:
SimpleBot.__call__shall record a span (child of the current span when one exists), callmake_response/stream_chunks, construct anAIMessagewithextract_contentandextract_tool_calls, invokesqlite_logfor the full turn, and return thatAIMessage. -
[x] CORE-SIMPLE-021:
extract_tool_callsshall return structuredtool_callswhen present; when absent andmessage.contentis JSON describing tool calls (including single-object or list forms), the system shall synthesizeChatCompletionMessageToolCallobjects.
AsyncSimpleBot
- [x] CORE-SIMPLE-030:
AsyncSimpleBot.__call__shall stream viastream_tokens_for_messagesand shall raiseRuntimeErrorif no assistant message is produced after streaming completes.
Verification
| ID | Tests / code |
|---|---|
| CORE-SIMPLE-001–002 | tests/bot/test_simplebot.py (test_simple_bot_init_invalid_stream_target, o1 branches) |
| CORE-SIMPLE-003–004 | tests/bot/test_simplebot.py (completion_kwargs_for_messages / JSON mode) |
| CORE-SIMPLE-010–011 | tests/bot/test_simplebot.py (memory + __call__ mocks) |
| CORE-SIMPLE-020–021 | tests/bot/test_simplebot.py (extract_tool_calls, extract_content, __call__) |
| CORE-SIMPLE-030 | llamabot/bot/simplebot.py (AsyncSimpleBot.__call__); streaming coverage in tests/test_streaming_async.py (stream_async) |