Commit Graph

6 Commits

Author SHA1 Message Date
mykonos-ibiza 564c3ad63f Refactor imports and enhance XML formatting in utils
- Updated import statements in `example.py` to remove relative imports for better clarity.
- Introduced ANSI color formatting for various log messages in `utils.py` to improve readability.
- Added XML formatting functionality to `print_stream` for better output presentation when handling XML content.
- Implemented syntax highlighting for XML tags and attributes to enhance visual distinction in logs.
2025-08-01 19:29:09 +05:30
mykonos-ibiza eb53999291 Refactor whitespace and formatting in async stream printer
- Cleaned up whitespace throughout the `print_stream` function for improved readability.
- Standardized output formatting for function call detection and tool result messages, enhancing clarity in logs.
- Ensured consistent handling of empty lines and message content, contributing to better overall code quality.
2025-07-31 23:33:30 +05:30
mykonos-ibiza ac9dbd7127 Enhance assistant message processing in async stream printer
- Introduced chunk accumulation for assistant messages to handle multi-part responses more effectively.
- Implemented a function to rebuild full text from sorted chunks, improving the accuracy of message content.
- Added state management for parsing function calls, allowing detection and handling of tool usage within messages.
- Updated output formatting to provide clearer logs for assistant messages and tool interactions.
2025-07-31 23:28:17 +05:30
mykonos-ibiza be05cc8348 Update assistant message handling in async stream printer
- Modified the `print_stream` function to include a check for `message_id` before processing assistant messages, ensuring only valid messages are printed.
- Changed output labels from `[MESSAGE]` to `[ASSISTANT]` for clarity in logs, improving the distinction between different message types.
2025-07-31 23:11:39 +05:30
mykonos-ibiza 891e232ce2 Enhance JSON parsing and output formatting in async stream printer
- Updated the `print_stream` function to utilize a new utility function `try_parse_json` for safer JSON parsing, improving error handling for invalid input.
- Enhanced output formatting for various event types, including status updates, assistant messages, and tool execution results, ensuring clearer and more informative logs.
- Added checks for empty content and improved handling of parsing failures to maintain robustness in stream processing.
2025-07-31 23:09:12 +05:30
mykonos-ibiza 076064a976 Add async stream printer utility for handling event streams
- Introduced a new utility function `print_stream` in `utils.py` to process and print events from an asynchronous string generator.
- The function handles various event types including status updates, assistant responses, and tool execution results, providing formatted output for each case.
- Added error handling for JSON parsing to ensure robustness against invalid input.
2025-07-31 22:17:00 +05:30