Updated LLMs
Browse files- app.py +234 -53
- requirements.txt +5 -3
- test_hf_space.py +1 -1
- tools.py +1 -1
app.py
CHANGED
|
@@ -29,45 +29,133 @@ PASSING_SCORE = 30 # Need this to get my certificate!
|
|
| 29 |
|
| 30 |
def setup_llm():
|
| 31 |
"""
|
| 32 |
-
Setting up the LLM - trying
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
"""
|
| 35 |
-
logger.info("Setting up LLM...")
|
| 36 |
|
| 37 |
-
# Try
|
| 38 |
-
|
| 39 |
-
if
|
| 40 |
try:
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
max_tokens=1024,
|
| 46 |
-
temperature=0.1
|
| 47 |
)
|
| 48 |
-
logger.info("Got
|
| 49 |
return llm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
except Exception as e:
|
| 51 |
-
logger.warning(f"
|
| 52 |
|
| 53 |
-
# Fallback to HuggingFace (free but
|
| 54 |
hf_token = os.getenv("HF_TOKEN")
|
| 55 |
if hf_token:
|
| 56 |
try:
|
| 57 |
from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
|
| 58 |
llm = HuggingFaceInferenceAPI(
|
| 59 |
-
model_name="
|
| 60 |
token=hf_token,
|
| 61 |
max_new_tokens=512,
|
| 62 |
temperature=0.1
|
| 63 |
)
|
| 64 |
-
logger.info("Using HuggingFace
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
return llm
|
| 66 |
except Exception as e:
|
| 67 |
-
logger.
|
| 68 |
|
| 69 |
# If we get here, nothing worked
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
class MyGAIAAgent:
|
| 73 |
"""
|
|
@@ -347,7 +435,7 @@ Required to pass: {PASSING_SCORE}%
|
|
| 347 |
logger.error(error_msg)
|
| 348 |
return error_msg, pd.DataFrame(results)
|
| 349 |
|
| 350 |
-
# Create the Gradio interface
|
| 351 |
with gr.Blocks(title="My GAIA Agent") as demo:
|
| 352 |
gr.Markdown("# π€ My GAIA Benchmark Agent")
|
| 353 |
gr.Markdown("""
|
|
@@ -360,37 +448,109 @@ with gr.Blocks(title="My GAIA Agent") as demo:
|
|
| 360 |
- π₯ Query a database of personas
|
| 361 |
|
| 362 |
**Goal:** Score 30%+ on GAIA benchmark to pass the course!
|
| 363 |
-
|
| 364 |
-
**Instructions:**
|
| 365 |
-
1. **Login** to HuggingFace using the button below
|
| 366 |
-
2. **Click "Run GAIA Evaluation"** and wait (takes 5-10 minutes)
|
| 367 |
-
3. **See your results** and hopefully pass with 30%+!
|
| 368 |
""")
|
| 369 |
|
| 370 |
# Login button (template pattern)
|
| 371 |
gr.LoginButton()
|
| 372 |
|
| 373 |
-
|
| 374 |
-
gr.
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 394 |
|
| 395 |
gr.Markdown("---")
|
| 396 |
gr.Markdown("π€ Fingers crossed I pass this course!")
|
|
@@ -399,18 +559,39 @@ if __name__ == "__main__":
|
|
| 399 |
print("π― My GAIA Agent - Final Course Project")
|
| 400 |
print("=" * 50)
|
| 401 |
|
| 402 |
-
# Check my environment
|
| 403 |
-
|
|
|
|
|
|
|
|
|
|
| 404 |
hf_token = os.getenv("HF_TOKEN")
|
|
|
|
| 405 |
|
| 406 |
-
|
| 407 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
if hf_token:
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
|
| 413 |
-
print(f"π― Need {PASSING_SCORE}% to pass the course")
|
| 414 |
print("π Starting my agent...")
|
| 415 |
|
| 416 |
demo.launch(debug=True, share=False, show_error=True)
|
|
|
|
| 29 |
|
| 30 |
def setup_llm():
|
| 31 |
"""
|
| 32 |
+
Setting up the LLM - trying multiple free/cheap providers since OpenAI is expensive!
|
| 33 |
+
|
| 34 |
+
Priority order:
|
| 35 |
+
1. Groq (fast and often has generous free tier)
|
| 36 |
+
2. Together AI (good open models, reasonable pricing)
|
| 37 |
+
3. HuggingFace (free fallback)
|
| 38 |
+
4. OpenAI (if I have credits)
|
| 39 |
"""
|
| 40 |
+
logger.info("Setting up LLM with multiple provider options...")
|
| 41 |
|
| 42 |
+
# Try Groq first (often has generous free tier and is very fast)
|
| 43 |
+
groq_key = os.getenv("GROQ_API_KEY")
|
| 44 |
+
if groq_key:
|
| 45 |
try:
|
| 46 |
+
# Try the official Groq import
|
| 47 |
+
from llama_index.llms.groq import Groq
|
| 48 |
+
llm = Groq(
|
| 49 |
+
api_key=groq_key,
|
| 50 |
+
model="llama3-groq-70b-8192-tool-use-preview", # Known working Groq model
|
| 51 |
+
max_tokens=1024,
|
| 52 |
+
temperature=0.1
|
| 53 |
+
)
|
| 54 |
+
logger.info("π Got Groq working!")
|
| 55 |
+
return llm
|
| 56 |
+
except ImportError:
|
| 57 |
+
logger.warning("Groq LlamaIndex integration not available, trying generic OpenAI-compatible...")
|
| 58 |
+
try:
|
| 59 |
+
# Fallback: Use OpenAI client with Groq endpoint
|
| 60 |
+
from llama_index.llms.openai import OpenAI
|
| 61 |
+
llm = OpenAI(
|
| 62 |
+
api_key=groq_key,
|
| 63 |
+
model="llama3-groq-70b-8192-tool-use-preview",
|
| 64 |
+
api_base="https://api.groq.com/openai/v1",
|
| 65 |
+
max_tokens=1024,
|
| 66 |
+
temperature=0.1
|
| 67 |
+
)
|
| 68 |
+
logger.info("π Got Groq working via OpenAI-compatible API!")
|
| 69 |
+
return llm
|
| 70 |
+
except Exception as e:
|
| 71 |
+
logger.warning(f"Groq didn't work: {e}")
|
| 72 |
+
except Exception as e:
|
| 73 |
+
logger.warning(f"Groq didn't work: {e}")
|
| 74 |
+
|
| 75 |
+
# Try Together AI (good selection of open models)
|
| 76 |
+
together_key = os.getenv("TOGETHER_API_KEY")
|
| 77 |
+
if together_key:
|
| 78 |
+
try:
|
| 79 |
+
# Try the official Together import
|
| 80 |
+
from llama_index.llms.together import Together
|
| 81 |
+
llm = Together(
|
| 82 |
+
api_key=together_key,
|
| 83 |
+
model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", # Known working Together model
|
| 84 |
max_tokens=1024,
|
| 85 |
+
temperature=0.1
|
| 86 |
)
|
| 87 |
+
logger.info("π€ Got Together AI working!")
|
| 88 |
return llm
|
| 89 |
+
except ImportError:
|
| 90 |
+
logger.warning("Together AI LlamaIndex integration not available, trying generic OpenAI-compatible...")
|
| 91 |
+
try:
|
| 92 |
+
# Fallback: Use OpenAI client with Together endpoint
|
| 93 |
+
from llama_index.llms.openai import OpenAI
|
| 94 |
+
llm = OpenAI(
|
| 95 |
+
api_key=together_key,
|
| 96 |
+
model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
|
| 97 |
+
api_base="https://api.together.xyz/v1",
|
| 98 |
+
max_tokens=1024,
|
| 99 |
+
temperature=0.1
|
| 100 |
+
)
|
| 101 |
+
logger.info("π€ Got Together AI working via OpenAI-compatible API!")
|
| 102 |
+
return llm
|
| 103 |
+
except Exception as e:
|
| 104 |
+
logger.warning(f"Together AI didn't work: {e}")
|
| 105 |
except Exception as e:
|
| 106 |
+
logger.warning(f"Together AI didn't work: {e}")
|
| 107 |
|
| 108 |
+
# Fallback to HuggingFace (free but slower)
|
| 109 |
hf_token = os.getenv("HF_TOKEN")
|
| 110 |
if hf_token:
|
| 111 |
try:
|
| 112 |
from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
|
| 113 |
llm = HuggingFaceInferenceAPI(
|
| 114 |
+
model_name="meta-llama/Llama-3.1-70B-Instruct", # Good HF model
|
| 115 |
token=hf_token,
|
| 116 |
max_new_tokens=512,
|
| 117 |
temperature=0.1
|
| 118 |
)
|
| 119 |
+
logger.info("π€ Using HuggingFace as fallback")
|
| 120 |
+
return llm
|
| 121 |
+
except Exception as e:
|
| 122 |
+
logger.warning(f"HuggingFace failed: {e}")
|
| 123 |
+
|
| 124 |
+
# Try OpenAI last (in case I get more credits)
|
| 125 |
+
openai_key = os.getenv("OPENAI_API_KEY")
|
| 126 |
+
if openai_key:
|
| 127 |
+
try:
|
| 128 |
+
from llama_index.llms.openai import OpenAI
|
| 129 |
+
llm = OpenAI(
|
| 130 |
+
api_key=openai_key,
|
| 131 |
+
model="gpt-4o-mini",
|
| 132 |
+
max_tokens=1024,
|
| 133 |
+
temperature=0.1
|
| 134 |
+
)
|
| 135 |
+
logger.info("π Trying OpenAI...")
|
| 136 |
return llm
|
| 137 |
except Exception as e:
|
| 138 |
+
logger.warning(f"OpenAI still having issues: {e}")
|
| 139 |
|
| 140 |
# If we get here, nothing worked
|
| 141 |
+
error_msg = """
|
| 142 |
+
No LLM available! Please set one of these API keys in your Space secrets:
|
| 143 |
+
|
| 144 |
+
π― RECOMMENDED (Free/Cheap):
|
| 145 |
+
- GROQ_API_KEY (Fast, generous free tier)
|
| 146 |
+
- TOGETHER_API_KEY (Good open models)
|
| 147 |
+
|
| 148 |
+
π ALTERNATIVES:
|
| 149 |
+
- HF_TOKEN (Free but slower)
|
| 150 |
+
- OPENAI_API_KEY (If you get more credits)
|
| 151 |
+
|
| 152 |
+
Get keys from:
|
| 153 |
+
- Groq: https://console.groq.com/
|
| 154 |
+
- Together: https://api.together.xyz/
|
| 155 |
+
"""
|
| 156 |
+
|
| 157 |
+
logger.error(error_msg)
|
| 158 |
+
raise RuntimeError(error_msg)
|
| 159 |
|
| 160 |
class MyGAIAAgent:
|
| 161 |
"""
|
|
|
|
| 435 |
logger.error(error_msg)
|
| 436 |
return error_msg, pd.DataFrame(results)
|
| 437 |
|
| 438 |
+
# Create the Gradio interface with chat + GAIA evaluation
|
| 439 |
with gr.Blocks(title="My GAIA Agent") as demo:
|
| 440 |
gr.Markdown("# π€ My GAIA Benchmark Agent")
|
| 441 |
gr.Markdown("""
|
|
|
|
| 448 |
- π₯ Query a database of personas
|
| 449 |
|
| 450 |
**Goal:** Score 30%+ on GAIA benchmark to pass the course!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 451 |
""")
|
| 452 |
|
| 453 |
# Login button (template pattern)
|
| 454 |
gr.LoginButton()
|
| 455 |
|
| 456 |
+
# Create tabs for different functionalities
|
| 457 |
+
with gr.Tabs():
|
| 458 |
+
|
| 459 |
+
# Tab 1: GAIA Evaluation (main functionality)
|
| 460 |
+
with gr.TabItem("π― GAIA Evaluation"):
|
| 461 |
+
gr.Markdown("### Run the Official GAIA Evaluation")
|
| 462 |
+
gr.Markdown("β° This might take 5-10 minutes...")
|
| 463 |
+
|
| 464 |
+
run_btn = gr.Button("π Run GAIA Evaluation", variant="primary", size="lg")
|
| 465 |
+
|
| 466 |
+
status_text = gr.Textbox(
|
| 467 |
+
label="π My Results",
|
| 468 |
+
lines=10,
|
| 469 |
+
interactive=False,
|
| 470 |
+
placeholder="Results will show here..."
|
| 471 |
+
)
|
| 472 |
+
|
| 473 |
+
results_df = gr.DataFrame(label="π Question by Question Results", wrap=True)
|
| 474 |
+
|
| 475 |
+
# Button connection (template pattern)
|
| 476 |
+
run_btn.click(
|
| 477 |
+
fn=run_gaia_evaluation,
|
| 478 |
+
outputs=[status_text, results_df]
|
| 479 |
+
)
|
| 480 |
+
|
| 481 |
+
# Tab 2: Chat Interface (for testing)
|
| 482 |
+
with gr.TabItem("π¬ Test Chat"):
|
| 483 |
+
gr.Markdown("### Chat with My Agent")
|
| 484 |
+
gr.Markdown("Test your agent here before running the official evaluation!")
|
| 485 |
+
|
| 486 |
+
# Simple chat interface
|
| 487 |
+
chatbot = gr.Chatbot(label="Chat with My Agent", height=400)
|
| 488 |
+
msg_input = gr.Textbox(
|
| 489 |
+
label="Your Message",
|
| 490 |
+
placeholder="Ask me anything! Try: 'What is 15% of 847?' or 'Search for recent AI news'",
|
| 491 |
+
lines=2
|
| 492 |
+
)
|
| 493 |
+
|
| 494 |
+
with gr.Row():
|
| 495 |
+
send_btn = gr.Button("Send", variant="primary")
|
| 496 |
+
clear_btn = gr.Button("Clear Chat")
|
| 497 |
+
|
| 498 |
+
# Chat functionality
|
| 499 |
+
def chat_with_agent(message, history):
|
| 500 |
+
"""Simple chat function to test my agent"""
|
| 501 |
+
if not message.strip():
|
| 502 |
+
return history, ""
|
| 503 |
+
|
| 504 |
+
try:
|
| 505 |
+
# Create agent if needed (cache it)
|
| 506 |
+
if not hasattr(chat_with_agent, 'agent'):
|
| 507 |
+
logger.info("Creating agent for chat...")
|
| 508 |
+
chat_with_agent.agent = MyGAIAAgent()
|
| 509 |
+
logger.info("Chat agent ready!")
|
| 510 |
+
|
| 511 |
+
# Get response from agent
|
| 512 |
+
response = chat_with_agent.agent(message)
|
| 513 |
+
|
| 514 |
+
# Add to chat history
|
| 515 |
+
history.append((message, response))
|
| 516 |
+
|
| 517 |
+
except Exception as e:
|
| 518 |
+
error_response = f"Sorry, I had an error: {str(e)}"
|
| 519 |
+
history.append((message, error_response))
|
| 520 |
+
|
| 521 |
+
return history, "" # Return updated history and clear input
|
| 522 |
+
|
| 523 |
+
def clear_chat():
|
| 524 |
+
"""Clear the chat history"""
|
| 525 |
+
return [], ""
|
| 526 |
+
|
| 527 |
+
# Connect chat functions
|
| 528 |
+
send_btn.click(
|
| 529 |
+
fn=chat_with_agent,
|
| 530 |
+
inputs=[msg_input, chatbot],
|
| 531 |
+
outputs=[chatbot, msg_input]
|
| 532 |
+
)
|
| 533 |
+
|
| 534 |
+
msg_input.submit( # Allow Enter key to send
|
| 535 |
+
fn=chat_with_agent,
|
| 536 |
+
inputs=[msg_input, chatbot],
|
| 537 |
+
outputs=[chatbot, msg_input]
|
| 538 |
+
)
|
| 539 |
+
|
| 540 |
+
clear_btn.click(
|
| 541 |
+
fn=clear_chat,
|
| 542 |
+
outputs=[chatbot, msg_input]
|
| 543 |
+
)
|
| 544 |
+
|
| 545 |
+
# Some example questions
|
| 546 |
+
gr.Markdown("""
|
| 547 |
+
**Try these example questions:**
|
| 548 |
+
- `What is 25 * 17?`
|
| 549 |
+
- `Search for recent news about AI`
|
| 550 |
+
- `Find creative people in the persona database`
|
| 551 |
+
- `What's the weather in Paris?`
|
| 552 |
+
- `Analyze this CSV: name,age\\nAlice,25\\nBob,30`
|
| 553 |
+
""")
|
| 554 |
|
| 555 |
gr.Markdown("---")
|
| 556 |
gr.Markdown("π€ Fingers crossed I pass this course!")
|
|
|
|
| 559 |
print("π― My GAIA Agent - Final Course Project")
|
| 560 |
print("=" * 50)
|
| 561 |
|
| 562 |
+
# Check my environment and available LLM providers
|
| 563 |
+
print("\nπ Available LLM Providers:")
|
| 564 |
+
|
| 565 |
+
groq_key = os.getenv("GROQ_API_KEY")
|
| 566 |
+
together_key = os.getenv("TOGETHER_API_KEY")
|
| 567 |
hf_token = os.getenv("HF_TOKEN")
|
| 568 |
+
openai_key = os.getenv("OPENAI_API_KEY")
|
| 569 |
|
| 570 |
+
providers_found = []
|
| 571 |
+
|
| 572 |
+
if groq_key:
|
| 573 |
+
providers_found.append("Groq")
|
| 574 |
+
print("β
GROQ_API_KEY found - Groq available!")
|
| 575 |
+
if together_key:
|
| 576 |
+
providers_found.append("Together AI")
|
| 577 |
+
print("β
TOGETHER_API_KEY found - Together AI available!")
|
| 578 |
if hf_token:
|
| 579 |
+
providers_found.append("HuggingFace")
|
| 580 |
+
print("β
HF_TOKEN found - HuggingFace available!")
|
| 581 |
+
if openai_key:
|
| 582 |
+
providers_found.append("OpenAI")
|
| 583 |
+
print("β
OPENAI_API_KEY found - OpenAI available!")
|
| 584 |
+
|
| 585 |
+
if providers_found:
|
| 586 |
+
print(f"\nπ Found {len(providers_found)} LLM provider(s): {', '.join(providers_found)}")
|
| 587 |
+
print(f" Will use: {providers_found[0]} (highest priority)")
|
| 588 |
+
else:
|
| 589 |
+
print("\nβ οΈ No API keys found! Add at least one to Space secrets:")
|
| 590 |
+
print(" - GROQ_API_KEY (recommended - fast & often free)")
|
| 591 |
+
print(" - TOGETHER_API_KEY (good open models)")
|
| 592 |
+
print(" - HF_TOKEN (free fallback)")
|
| 593 |
|
| 594 |
+
print(f"\nπ― Need {PASSING_SCORE}% to pass the course")
|
| 595 |
print("π Starting my agent...")
|
| 596 |
|
| 597 |
demo.launch(debug=True, share=False, show_error=True)
|
requirements.txt
CHANGED
|
@@ -9,9 +9,11 @@ pandas>=1.5.0
|
|
| 9 |
# Main LlamaIndex stuff - this is the core framework we learned about
|
| 10 |
llama-index-core>=0.10.0
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
llama-index-llms-openai
|
| 14 |
-
llama-index-llms-huggingface-api
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# For the RAG part with embeddings and vector search
|
| 17 |
llama-index-retrievers-bm25
|
|
|
|
| 9 |
# Main LlamaIndex stuff - this is the core framework we learned about
|
| 10 |
llama-index-core>=0.10.0
|
| 11 |
|
| 12 |
+
# Multiple LLM options - using correct package names
|
| 13 |
+
llama-index-llms-openai # OpenAI (if I have credits)
|
| 14 |
+
llama-index-llms-huggingface-api # HuggingFace (free option)
|
| 15 |
+
llama-index-llms-groq # Groq (fast and often free)
|
| 16 |
+
llama-index-llms-together # Together AI (good models)
|
| 17 |
|
| 18 |
# For the RAG part with embeddings and vector search
|
| 19 |
llama-index-retrievers-bm25
|
test_hf_space.py
CHANGED
|
@@ -137,7 +137,7 @@ def test_my_persona_database():
|
|
| 137 |
print("\nπ₯ Testing My Persona Database...")
|
| 138 |
|
| 139 |
try:
|
| 140 |
-
from
|
| 141 |
|
| 142 |
# Run the built-in test
|
| 143 |
success = test_my_personas()
|
|
|
|
| 137 |
print("\nπ₯ Testing My Persona Database...")
|
| 138 |
|
| 139 |
try:
|
| 140 |
+
from retriever import test_my_personas
|
| 141 |
|
| 142 |
# Run the built-in test
|
| 143 |
success = test_my_personas()
|
tools.py
CHANGED
|
@@ -236,7 +236,7 @@ def create_persona_tool(llm=None):
|
|
| 236 |
try:
|
| 237 |
# Try to load the persona data first
|
| 238 |
try:
|
| 239 |
-
from
|
| 240 |
query_engine = get_persona_query_engine(llm=llm)
|
| 241 |
except ImportError:
|
| 242 |
# Fallback if my_retriever doesn't exist
|
|
|
|
| 236 |
try:
|
| 237 |
# Try to load the persona data first
|
| 238 |
try:
|
| 239 |
+
from retriever import get_persona_query_engine
|
| 240 |
query_engine = get_persona_query_engine(llm=llm)
|
| 241 |
except ImportError:
|
| 242 |
# Fallback if my_retriever doesn't exist
|