docs: correct toAi() reference and document conversational context - #294
Merged
Conversation
The existing toAi() documentation predated the real implementation and
described a fictional interface: a toAi(target, name) signature, a
coldbox.system.web.routing.IAiRunnable with invoke/stream/batch/info(event,
rc, prc) actions, and {prompt, context} request bodies. None of that matches
the actual bx-ai IAiRunnable (run/stream/getName/getDescription) or the real
{input, params, options} request shape. Rewrites the toAi() section to match
the real implementation, and adds the new userId/conversationId/threadId
conversational context support merged in coldbox-platform PR #681 - resolved
server-side, merged into options before the runnable is called, and echoed
back via the JSON response, an X-Thread-Id header, and a leading SSE
"thread" frame.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tigigAXbCK3JEuvn5c32R
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
the-basics/routing/routing-dsl/ai-routing.md'stoAi()section, which predated the real implementation and described a fictional API surface:toAi( target, [name] )→ corrected to the real single-argumenttoAi( runnable )signaturecoldbox.system.web.routing.IAiRunnablewithinvoke()/stream()/batch()/info()actions taking(event, rc, prc)→ corrected to the real bx-aiIAiRunnable(run()/stream()/getName()/getDescription()){"prompt": ..., "context": ...}/{"response": ..., "model": ..., "tokens": ...}bodies → corrected to the real{"input": ..., "params": {}, "options": {}}/{"output": ..., "success": true}shapeuserId/conversationId/threadIdresolution thattoAi()'sinvoke/stream/batchsub-routes now perform, merging resolved context intooptionsand echoingthreadIdback via the JSON body, anX-Thread-Idheader, and a leading SSEthreadframe.toMCP()section and the closing "Using Both Together" section were verified accurate against the current implementation and are unchanged.Source of truth for the conversational-context behavior: ColdBox/coldbox-platform#681
Why
Two issues, addressed together to avoid leaving corrected content next to inaccurate content on the same page:
toAi()documentation had drifted from the actualRouter.cfcimplementation well before this change.coldbox-platformPR #681 added conversational-context resolution totoAi()'s sub-routes, which needed documenting.Validation
../../event-handlers/server-sent-events.md→the-basics/event-handlers/server-sent-events.md, and../../../digging-deeper/ai/agentic-coldbox.md→digging-deeper/ai/agentic-coldbox.md. Both files exist in the repo.#conversational-contextanchor link targets the new### Conversational Contextheading added later on the same page.ai-routing.md(e.g.ai-routing.md#invoke-endpoint) — none found.SUMMARY.mdchanges needed — content-only edit to an already-listed page.Generated by Claude Code