From 1a1c746db59485925ee4b75dc0dde71f32701377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=B4=D0=B5=D0=BB=D0=B8=D0=BD=D0=B0=20=D0=A1=D0=B0?= =?UTF-8?q?=D1=82=D1=82=D0=B0=D1=80=D0=BE=D0=B2=D0=B0?= Date: Thu, 28 May 2026 13:24:24 +0000 Subject: [PATCH] Add rag_agent --- rag_agent.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 rag_agent.py diff --git a/rag_agent.py b/rag_agent.py new file mode 100644 index 0000000..956fb95 --- /dev/null +++ b/rag_agent.py @@ -0,0 +1,16 @@ +from langchain.agents import create_openai_functions_agent, AgentExecutor +from rag_tools import search_knowledge_base, add_to_knowledge_base +from langchain.schema import HumanMessage + +def run_agent(): + tools=[search_knowledge_base,add_to_knowledge_base] + agent=create_openai_functions_agent(tools=tools, llm=None) + executor=AgentExecutor(agent=agent, tools=tools, verbose=True) + while True: + inp=input("> ") + if inp.strip().lower()=="/quit": + break + response=executor.invoke({"input":inp}) + print(response["output"]) +if __name__=="__main__": + run_agent()