Class: AnalyticalBrain::Tools::RenameSession
Overview
Renames the main session with an emoji and short descriptive name. Operates on the main session passed through the registry context, not on the phantom analytical brain session.
The analytical brain calls this when a conversation’s topic becomes clear or shifts significantly enough to warrant a new name.
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Tools::Base
schema, truncation_threshold
Constructor Details
#initialize(main_session:) ⇒ RenameSession
Returns a new instance of RenameSession.
28
29
30
|
# File 'lib/analytical_brain/tools/rename_session.rb', line 28
def initialize(main_session:, **)
@main_session = main_session
end
|
Class Method Details
.description ⇒ Object
14
|
# File 'lib/analytical_brain/tools/rename_session.rb', line 14
def self.description = "Rename the session."
|
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/analytical_brain/tools/rename_session.rb', line 16
def self.input_schema
{
type: "object",
properties: {
emoji: {type: "string"},
name: {type: "string", description: "1-3 words."}
},
required: %w[emoji name]
}
end
|
12
|
# File 'lib/analytical_brain/tools/rename_session.rb', line 12
def self.tool_name = "rename_session"
|
Instance Method Details
#execute(input) ⇒ String, Hash
35
36
37
38
39
40
41
42
|
# File 'lib/analytical_brain/tools/rename_session.rb', line 35
def execute(input)
error = validate(input)
return error if error
full_name = build_name(input)
@main_session.update!(name: full_name)
"Session renamed to: #{full_name}"
end
|