Spaces:
Sleeping
Sleeping
| """ | |
| Example usage of the document reader tools with the agent. | |
| This file demonstrates how to integrate the document reading tools | |
| with your Innoscribe chatbot agent. | |
| """ | |
| from agents import Agent | |
| from config.chabot_config import model | |
| from instructions.chatbot_instructions import innscribe_dynamic_instructions | |
| from guardrails.guardrails_input_function import guardrail_input_function | |
| from tools.document_reader_tool import read_document_data, list_available_documents | |
| # Example 1: Agent with document reading capabilities | |
| innscribe_assistant_with_docs = Agent( | |
| name="Innoscribe Assistant with Document Access", | |
| instructions=innscribe_dynamic_instructions, | |
| model=model, | |
| input_guardrails=[guardrail_input_function], | |
| tools=[read_document_data, list_available_documents] # Add the document tools here | |
| ) | |
| # Example 2: How the agent will use the tools | |
| """ | |
| When a user asks a question that requires information from documents: | |
| User: "What information do you have about our products?" | |
| The agent will automatically: | |
| 1. Try to read from local data.docx and any PDF files first | |
| 2. If not found or insufficient, try to read from Firebase Firestore | |
| 3. Return the relevant information | |
| User: "List all available documents" | |
| The agent will use list_available_documents() to show all docs | |
| """ | |
| # Example 3: Manual tool usage (for testing) | |
| if __name__ == "__main__": | |
| # Test reading documents | |
| print("Testing document reader tool...") | |
| result = read_document_data("company information", source="auto") | |
| print(result) | |
| print("\n" + "="*50 + "\n") | |
| # Test listing documents | |
| print("Testing list documents tool...") | |
| docs = list_available_documents() | |
| print(docs) | |