Class: PredictabilityEngine::Agents::Assistant

Inherits:
Object
  • Object
show all
Defined in:
lib/predictability_engine/agents/assistant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_manager) ⇒ Assistant

Returns a new instance of Assistant.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/predictability_engine/agents/assistant.rb', line 8

def initialize(data_manager)
  # Using OpenAI as default. Requires OPENAI_API_KEY in .env
  @llm = Langchain::LLM::OpenAI.new(api_key: ENV.fetch('OPENAI_API_KEY', nil))
  @tools = [PredictabilityEngine::Agents::Tools.new(data_manager)]

  @assistant = Langchain::Assistant.new(
    llm: @llm,
    tools: @tools,
    instructions: "You are an expert in Actionable Agile Metrics and Daniel Vacanti's predictability methods.
                  Your job is to answer 'When will it be done?' questions based on historical data.
                  Always explain the statistical confidence (p85) to the user.
                  You can also analyze Cumulative Flow Diagrams for anomalies like growing WIP."
  )
end

Instance Attribute Details

#assistantObject (readonly)

Returns the value of attribute assistant.



6
7
8
# File 'lib/predictability_engine/agents/assistant.rb', line 6

def assistant
  @assistant
end

#llmObject (readonly)

Returns the value of attribute llm.



6
7
8
# File 'lib/predictability_engine/agents/assistant.rb', line 6

def llm
  @llm
end

#toolsObject (readonly)

Returns the value of attribute tools.



6
7
8
# File 'lib/predictability_engine/agents/assistant.rb', line 6

def tools
  @tools
end

Instance Method Details

#ask(question) ⇒ Object



23
24
25
26
# File 'lib/predictability_engine/agents/assistant.rb', line 23

def ask(question)
  @assistant.add_message(question)
  @assistant.run
end