From 3eadd5000185aaeee7292cd433ec492687c7771d 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 14:30:35 +0000 Subject: [PATCH] add rag_agent --- rag_agent.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 rag_agent.py diff --git a/rag_agent.py b/rag_agent.py new file mode 100644 index 0000000..33a21a0 --- /dev/null +++ b/rag_agent.py @@ -0,0 +1,9 @@ +from langchain.agents import create_openai_functions_agent, AgentExecutor +from langchain.llms import Ollama +from tools import search_knowledge_base, add_to_knowledge_base + +def get_agent(): + llm = Ollama(model="llama3") + tools_list = [search_knowledge_base, add_to_knowledge_base] + agent = create_openai_functions_agent(llm=llm, tools=tools_list, system_prompt="You are an assistant that uses a knowledge base.") + return AgentExecutor(agent=agent, tools=tools_list)