Skip to content

chat

Genie chat driver.

Drives a single turn against a Genie space from one content string; multi-turn conversations are the caller’s job (thread the conversation_id returned on each GenieMessage back into the next turn’s options.conversationId).

Two layers serve two kinds of consumer. The low-level layer yields every poll-observed GenieMessage (validated against GenieMessageSchema, falling back to the raw snapshot on a schema miss) and owns the messy parts

  • cancellation, conversation seeding, distinct-filtering, and SDK quirks (Waiter stripping); reach for it when you want the raw stream. The high-level layer wraps it and emits semantic, deduplicated { type, payload } events (see GenieChatEvent), always closing a successful turn with a terminal result event carrying the final GenieMessage; errors propagate by throwing, with no error variant. Iterating UI / agent code that wants every message verbatim takes the low-level stream; subscribers reacting to “Genie is thinking about X” or “Genie produced text Y” take the event layer.