Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert personality txt files to yaml, replace print with log, and update app.py #144

Merged
merged 11 commits into from
Jan 7, 2025
8 changes: 4 additions & 4 deletions ai_ref_kits/agentic_llm_rag/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _handle_user_message(user_message, history):


def _generate_response(chat_history, log_history):
print("log_history", log_history)
log.info(f"log_history {log_history}")
if not isinstance(log_history, list):
log_history = []

Expand Down Expand Up @@ -283,7 +283,7 @@ def run():
parser.add_argument("--chat_model", type=str, default="model/llama3.1-8B-INT4", help="Path to the chat model directory")
parser.add_argument("--embedding_model", type=str, default="model/bge-large-FP32", help="Path to the embedding model directory")
parser.add_argument("--rag_pdf", type=str, default="test_painting_llm_rag.pdf", help="Path to a RAG PDF file with additional knowledge the chatbot can rely on.")
parser.add_argument("--personality", type=str, default="paint_concierge_personality.txt", help="Path to the TXT file with chatbot personality")
parser.add_argument("--personality", type=str, default="paint_concierge_personality.yaml", help="Path to the yaml file with chatbot personality")

args = parser.parse_args()

Expand All @@ -299,7 +299,7 @@ def run():
# Step 4: Load documents and create the VectorStoreIndex
text_example_en_path = Path(args.rag_pdf)
index = load_documents(text_example_en_path)
print("loading in", index)
log.info(f"loading in {index}")
vector_tool = QueryEngineTool(
index.as_query_engine(streaming=True),
metadata=ToolMetadata(
Expand All @@ -317,7 +317,7 @@ def run():
chatbot_config = f.read()

react_system_prompt = PromptTemplate(chatbot_config)
print("react_system_prompt", react_system_prompt)
log.info(f"react_system_prompt {react_system_prompt}")
#Define agent and available tools
agent = ReActAgent.from_tools([multiply_tool, divide_tool, add_tool, subtract_tool, paint_cost_calculator, vector_tool],
llm=llm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
Do not refer to any external documents directly unless they are a part of the provided RAG document.
Do not ask for or store any personal information from the customer.
Ensure every interaction remains ethical and within the guidelines of professional and courteous retail service.'
"""
"""
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
Do not refer to any external documents directly unless they are a part of the provided RAG document.
Do not ask for or store any personal information from the customer.
Ensure every interaction remains ethical and within the guidelines of professional and courteous retail service.'
"""
"""
Loading