Class: RailsAgents::Message

Inherits:
Data
  • Object
show all
Defined in:
lib/rails_agents/message.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



4
5
6
# File 'lib/rails_agents/message.rb', line 4

def content
  @content
end

#raw_contentObject (readonly)

Returns the value of attribute raw_content

Returns:

  • (Object)

    the current value of raw_content



4
5
6
# File 'lib/rails_agents/message.rb', line 4

def raw_content
  @raw_content
end

#roleObject (readonly)

Returns the value of attribute role

Returns:

  • (Object)

    the current value of role



4
5
6
# File 'lib/rails_agents/message.rb', line 4

def role
  @role
end

#tool_call_idObject (readonly)

Returns the value of attribute tool_call_id

Returns:

  • (Object)

    the current value of tool_call_id



4
5
6
# File 'lib/rails_agents/message.rb', line 4

def tool_call_id
  @tool_call_id
end

#tool_callsObject (readonly)

Returns the value of attribute tool_calls

Returns:

  • (Object)

    the current value of tool_calls



4
5
6
# File 'lib/rails_agents/message.rb', line 4

def tool_calls
  @tool_calls
end

Class Method Details

.assistant(content, tool_calls: nil, raw_content: nil) ⇒ Object



7
8
9
# File 'lib/rails_agents/message.rb', line 7

def self.assistant(content, tool_calls: nil, raw_content: nil)
  new(role: :assistant, content:, tool_calls:, tool_call_id: nil, raw_content:)
end

.system(content) ⇒ Object



5
# File 'lib/rails_agents/message.rb', line 5

def self.system(content) = new(role: :system, content:, tool_calls: nil, tool_call_id: nil, raw_content: nil)

.tool(content, tool_call_id:) ⇒ Object



10
# File 'lib/rails_agents/message.rb', line 10

def self.tool(content, tool_call_id:) = new(role: :tool, content:, tool_calls: nil, tool_call_id:, raw_content: nil)

.user(content) ⇒ Object



6
# File 'lib/rails_agents/message.rb', line 6

def self.user(content) = new(role: :user, content:, tool_calls: nil, tool_call_id: nil, raw_content: nil)