add rag_agent
This commit is contained in:
@@ -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)
|
||||||
Reference in New Issue
Block a user