Skip to content

Commit

Permalink
feat: add nodes for deciding tool and generating response
Browse files Browse the repository at this point in the history
  • Loading branch information
JonBergland committed Oct 29, 2024
1 parent 987d49c commit 24eaa8c
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions core/noder.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from graphstate import GraphState
from Agents.simpleagent import SimpleAgent
from langchain.prompts import PromptTemplate
from langchain_core.output_parsers import StrOutputParser


def jarvis_agent(state: GraphState):
"""Agent to determine how to answer user question"""
promt = PromptTemplate(
prompt = PromptTemplate(
template= """
Lorem ipsum....
Here are previous messages:
Expand All @@ -19,5 +20,37 @@ def jarvis_agent(state: GraphState):
TODO: Create options for the llm to answer
Answer with the option name and nothing else
"""
)
""",
)
chain = prompt | SimpleAgent.llm | StrOutputParser()

return chain.invoke({"messages": state["messages"], "data": state.get("data", {})})

def tool_decider(state: GraphState):
"""Agent to determine what tool to use"""
prompt = PromptTemplate(
template= """
Lorem ipsum....
Here are previous messages:
Message: {messages}
Data currently accumulated:
Data: {data}
TODO: Create options for the llm to answer
Answer with the option name and nothing else
""",
)

chain = prompt | SimpleAgent.llm | StrOutputParser()

return chain.invoke({"messages": state["messages"], "data": state.get("data", {})})

def response_generator(state: GraphState):
"""Agent that generates a response to user based on user request
and possible data from tool calls"""
#TODO Implement
return ""

0 comments on commit 24eaa8c

Please sign in to comment.