Class: Llm::Agents::Reviewer
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(name, config, logger) ⇒ Reviewer
constructor
A new instance of Reviewer.
- #lgtm? ⇒ Boolean
-
#work(source_path: raise("source_path is required"), test_path: nil, switch_assignee_function: raise("switch_assignee_function is required")) ⇒ Object
skip test for this method.
Methods inherited from Base
Constructor Details
#initialize(name, config, logger) ⇒ Reviewer
Returns a new instance of Reviewer.
4 5 6 7 |
# File 'lib/llm/agents/reviewer.rb', line 4 def initialize(name, config, logger) super(name, config, logger) @record_lgtm_function = Llm::Functions::RecordLgtm.new end |
Instance Method Details
#lgtm? ⇒ Boolean
9 10 11 |
# File 'lib/llm/agents/reviewer.rb', line 9 def lgtm? @record_lgtm_function.lgtm? end |
#work(source_path: raise("source_path is required"), test_path: nil, switch_assignee_function: raise("switch_assignee_function is required")) ⇒ Object
skip test for this method
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/llm/agents/reviewer.rb', line 14 def work( source_path: raise("source_path is required"), test_path: nil, switch_assignee_function: raise("switch_assignee_function is required")) say("start to work for #{source_path}") = Llm::MessageContainer.new test_path ||= self.config.language_klass.convert_source_path_to_test_path(source_path) .(self.agent_config.system_prompt.gsub("%{source_path}", source_path).gsub("%{test_path}", test_path)) if switch_assignee_function..size > 0 .(I18n.t('ghostest.agents.reviewer.last_assignee_comment', last_assignee: switch_assignee_function.last_assignee, comment: switch_assignee_function.)) end azure_open_ai = Llm::Clients::AzureOpenAi.new io = azure_open_ai.chat_with_function_calling_loop( messages: , functions: [ @record_lgtm_function, Llm::Functions::GetFilesList.new, Llm::Functions::ReadFile.new, Llm::Functions::AddToMemory.new(), switch_assignee_function, ] + self.config.language_klass.create_functions, agent: self, ) comment = io.rewind && io.read say(comment) comment end |