50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
from pathlib import Path
|
|
from typing import List
|
|
|
|
from agno.document import Document
|
|
from agno.utils.log import logger
|
|
from dotenv import load_dotenv
|
|
|
|
from agentic_rag import initialize_knowledge_base, get_reader, initialize_mingci_knowledge_base, get_question_agent, \
|
|
get_answer_agent, get_agentic_rag_agent
|
|
from app import initialize_agent
|
|
from ui import get_modul_option
|
|
|
|
# 加载.env文件
|
|
load_dotenv()
|
|
import os
|
|
|
|
def main():
|
|
print("Hello from agno-agentic-rag!")
|
|
|
|
model_id = get_modul_option(0)
|
|
|
|
query = "修改取费表名称"
|
|
|
|
gent = get_agentic_rag_agent(model_id)
|
|
response = gent.run(query)
|
|
print(response)
|
|
# 初始化知识库
|
|
#mingci_knowledge_base = initialize_mingci_knowledge_base()
|
|
|
|
#mingci_result = mingci_knowledge_base.search(query, num_documents=10)
|
|
#print(mingci_result)
|
|
|
|
question_agent = get_question_agent(model_id)
|
|
question_response = question_agent.run(query)
|
|
print(question_response)
|
|
|
|
#knowledge_base = initialize_knowledge_base()
|
|
|
|
#result = knowledge_base.search(query, num_documents=10)
|
|
#print(result)
|
|
|
|
answer_agent = get_answer_agent(model_id)
|
|
answer_response = answer_agent.run(question_response.content)
|
|
print(answer_response)
|
|
print(answer_response)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|