module RailsAiAdmin::Assistant::Runtime
Rebinds tools, instructions and provider settings for each claimed turn. A loaded chat carries none of them, so nothing survives from an earlier authority, worker or request.
Constants
- PROMPT
- PROMPT_VERSION
-
2: typed tool values, scope/sort/count tools and match modes (RAA-007/017/021). 3: native change proposals, record history and page context.
Public Instance Methods
Source
# File lib/rails_ai_admin/assistant/runtime.rb, line 33 def bind(chat, llm) chat.context = llm chat.protocol = RailsAiAdmin.configuration.assistant_protocol&.to_sym chat end
RubyLLM 2.2 builds the provider chat when a message is first saved, so the provider settings must be bound before the turn’s message is.
Source
# File lib/rails_ai_admin/assistant/runtime.rb, line 39 def configure(chat, session, llm) bind(chat, llm) chat.with_instructions(format(PROMPT, title: RailsAiAdmin.configuration.title.to_s.truncate(80)), persist: false) tools = TOOLS.map { |klass| klass.new(session) } tools.push(ProposeOperation.new(session), ProposeChange.new(session)) if RailsAiAdmin.configuration.surfaces chat.with_tools(*tools) chat end