feat: Implement Trillium notes executor for searching and creating notes via ETAPI

- Added `trillium.py` for searching and creating notes with Trillium's ETAPI.
- Implemented `search_notes` and `create_note` functions with appropriate error handling and validation.

feat: Add web search functionality using DuckDuckGo

- Introduced `web_search.py` for performing web searches without API keys.
- Implemented `search_web` function with result handling and validation.

feat: Create provider-agnostic function caller for iterative tool calling

- Developed `function_caller.py` to manage LLM interactions with tools.
- Implemented iterative calling logic with error handling and tool execution.

feat: Establish a tool registry for managing available tools

- Created `registry.py` to define and manage tool availability and execution.
- Integrated feature flags for enabling/disabling tools based on environment variables.

feat: Implement event streaming for tool calling processes

- Added `stream_events.py` to manage Server-Sent Events (SSE) for tool calling.
- Enabled real-time updates during tool execution for enhanced user experience.

test: Add tests for tool calling system components

- Created `test_tools.py` to validate functionality of code execution, web search, and tool registry.
- Implemented asynchronous tests to ensure proper execution and result handling.

chore: Add Dockerfile for sandbox environment setup

- Created `Dockerfile` to set up a Python environment with necessary dependencies for code execution.

chore: Add debug regex script for testing XML parsing

- Introduced `debug_regex.py` to validate regex patterns against XML tool calls.

chore: Add HTML template for displaying thinking stream events

- Created `test_thinking_stream.html` for visualizing tool calling events in a user-friendly format.

test: Add tests for OllamaAdapter XML parsing

- Developed `test_ollama_parser.py` to validate XML parsing with various test cases, including malformed XML.
This commit is contained in:
serversdwn
2025-12-26 03:49:20 -05:00
parent f1471cde84
commit 64429b19e6
37 changed files with 3238 additions and 23 deletions

View File

@@ -22,5 +22,37 @@
{
"role": "assistant",
"content": "Sure thing, Brian! I can help you with Python scripting. What specifically do you need assistance with? Whether it's a simple script or something more complex, just let me know the details!"
},
{
"role": "user",
"content": "im wanting to make some toolls for an AI agent to use."
},
{
"role": "assistant",
"content": "Great! To get started, what kind of tools are you thinking about creating for your AI agent? Are they related to data processing, decision-making, or something else? Providing more details will help me assist you better."
},
{
"role": "user",
"content": "dscision making"
},
{
"role": "assistant",
"content": "Got it! For decision-making tools, you might want to consider scripts that handle conditional logic, use machine learning models for predictions, or integrate with other AI services. Do you have a specific scenario in mind, such as deciding based on user input or data analysis? Let me know the details so I can provide more tailored assistance."
},
{
"role": "user",
"content": "Im thinking some kind of orchestrator, i ask the agent to do something and it figures out how to do it"
},
{
"role": "assistant",
"content": "That sounds like a great idea! An orchestrator for your AI agent could involve scripting logic that coordinates different tasks based on user requests. Heres a simple example using Python:\n\n```python\ndef task_orchestrator(request):\n # Define the tasks\n tasks = {\n 'search': search_function,\n 'analyze_data': analyze_data_function,\n 'send_email': send_email_function,\n 'execute_script': execute_script_function\n }\n \n # Check if the request is valid\n if request in tasks:\n task = tasks[request]\n result = task()\n return result\n else:\n return \"Invalid request\"\n\ndef search_function():\n print(\"Searching...\")\n return \"Search completed.\"\n\ndef analyze_data_function():\n print(\"Analyzing data...\")\n return \"Data analysis complete.\"\n\ndef send_email_function():\n print(\"Sending email...\")\n return \"Email sent.\"\n\ndef execute_script_function():\n print(\"Executing script...\")\n return \"Script executed.\"\n\n# Example usage\nrequest = input(\"Enter a task (search, analyze_data, send_email, execute_script): \")\nresult = task_orchestrator(request)\nprint(result)\n```\n\nThis script defines an orchestrator function `task_orchestrator` that maps user requests to specific functions. You can expand this by adding more tasks and complexity as needed.\n\nDo you want to add more features or modify this example in any way?"
},
{
"role": "user",
"content": "can you write me a full program?"
},
{
"role": "assistant",
"content": "Certainly! Heres a more comprehensive Python script for an orchestrator that handles different tasks based on user input. This example includes functions for searching, analyzing data, sending emails, and executing scripts.\n\n```python\ndef search_function(query):\n print(f\"Searching for: {query}\")\n return f\"Search results for '{query}'\"\n\ndef analyze_data_function(data):\n print(\"Analyzing data...\")\n # Simulate some analysis\n result = \"Data analysis complete.\"\n return result\n\ndef send_email_function(to, subject, body):\n print(f\"Sending email to {to} with subject: {subject}\")\n return f\"Email sent to {to}\"\n\ndef execute_script_function(script_path):\n print(f\"Executing script at path: {script_path}\")\n # Simulate execution\n result = \"Script executed.\"\n return result\n\ndef task_orchestrator(request, *args, **kwargs):\n tasks = {\n 'search': search_function,\n 'analyze_data': analyze_data_function,\n 'send_email': send_email_function,\n 'execute_script': execute_script_function\n }\n \n if request in tasks:\n func = tasks[request]\n return func(*args, **kwargs)\n else:\n return \"Invalid request\"\n\n# Example usage\nif __name__ == \"__main__\":\n while True:\n request = input(\"Enter a task (search, analyze_data, send_email, execute_script) or 'exit' to quit: \")\n if request.lower() == 'exit':\n break\n \n # Determine the function and arguments based on the request\n if request == 'search':\n query = input(\"Enter search query: \")\n result = task_orchestrator(request, query)\n elif request == 'analyze_data':\n data = input(\"Enter data to analyze (or leave blank): \")\n result = task_orchestrator(request, data)\n elif request == 'send_email':\n to = input(\"Enter recipient email: \")\n subject = input(\"Enter email subject: \")\n body = input(\"Enter email body: \")\n result = task_orchestrator(request, to, subject, body)\n elif request == 'execute_script':\n script_path = input(\"Enter path to script: \")\n result = task_orchestrator(request, script_path)\n \n print(result)\n```\n\nThis program includes:\n- A `task_orchestrator` function that maps user requests to specific functions.\n- Example functions for searching, analyzing data, sending emails, and executing scripts.\n- Interactive input prompts to guide the user through different tasks.\n\nYou can run this script in your Python environment. It will prompt you to enter a task and then provide additional details as needed for each task.\n\nDo you have any specific requirements or modifications in mind?"
}
]