The simplest way to run queries is using the run_docmind function:
import asynciofrom starter import run_docmindasync def main(): response = await run_docmind("What are the penalties for late payment?") print(response)asyncio.run(main())
async def output_node(state: DocMindState) -> DocMindState: if state["judge_verdict"] and state["judge_verdict"].get("should_return", False): state["final_output"] = state["generated_response"] else: state["final_output"] = "Unable to provide a confident response. Please rephrase your query." return state
The starter.py script demonstrates running multiple queries:
starter.py:32-46
if __name__ == "__main__": async def main(): queries = [ "What are the penalties for late payment?", "What are the indemnification obligations?", "What happens if IP is infringed?" ] for i, query in enumerate(queries, 1): print(f"\n{'='*80}") print(f"Query {i}: {query}") print('='*80) response = await run_docmind(query) print(f"\nResponse: {response}\n") asyncio.run(main())
================================================================================Query 1: What are the penalties for late payment?================================================================================Response: If payment is not received within thirty (30) days, Client shall be assessed a late fee of 1.5% per month (18% annually) on the outstanding balance. (See Late Payment Penalties, page 8)
Pattern: late fee, overdue, penaltiesExample: “What are the penalties for late payment?”Intent: penaltyTarget Sections: Late Payment Penalties, Payment Terms
Payment Terms
Pattern: pay, invoice, paymentExample: “When is payment due?”Intent: payment_termsTarget Sections: Payment Terms, Late Payment Penalties
Intellectual Property
Pattern: owned by, license, IP, infringeExample: “What happens if IP is infringed?”Intent: intellectual_propertyTarget Sections: Intellectual Property Rights
Indemnification
Pattern: indemnify, indemnification, third-party claimsExample: “What are the indemnification obligations?”Intent: indemnificationTarget Sections: Indemnification
Termination
Pattern: terminate, termination, written noticeExample: “How can the contract be terminated?”Intent: terminationTarget Sections: Termination for Convenience
Confidentiality
Pattern: confidential, proprietary informationExample: “What are the confidentiality obligations?”Intent: confidentialityTarget Sections: Confidentiality
Scope of Services
Pattern: shall provide, servicesExample: “What services are provided?”Intent: scope_of_servicesTarget Sections: Scope of Services