Praison AI
Enterprise
Agents
Bot
Use Cases
University
Docs
Mini-project: Evaluated multi-document knowledge assistant
Run
from praisonai import Agent from praisonai.knowledge import KeywordIndex idx = KeywordIndex() idx.add_documents([ '[SEC-1] API keys rotate every 90 days via Security Portal.', '[BILL-2] Annual plans receive a 20% discount paid upfront.', ]) assistant = Agent(instructions='Answer strictly from Source in one sentence with its [TAG].', output='silent') def ask(question: str) -> str: hits = [h for h in idx.query(question, top_k=1) if h.get('score', 0) > 0.5] if not hits: return 'Not in the docs.' return assistant.start(f"Source: {hits[0]['text']}\nQuestion: {question}") print('In-scope :', ask('How often do API keys rotate?')) print('Out-scope:', ask('CEO favorite espresso brand?'))
Press Run. The result appears here.
Esc
Search in
All
Docs
University