Files
task-6a02e23da6fe2e4ac16acf…/rag_agent.py
T
2026-05-28 14:30:35 +00:00

10 lines
477 B
Python

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)