Fix/example - #88
Merged
Merged
Conversation
…ed structure and validation
…t logic, and enhance tool integration - Deleted unused example files: react_sync.py, test_react_sync.py, react_di2.py, stop_stream_litellm.py, stream1.py. - Refactored react_di.py to improve imports and structure. - Updated react_mcp.py to utilize the Agent class for main agent logic. - Streamlined stream-related examples to use the Agent class for better clarity and maintainability. - Enhanced tool invocation and response handling across various examples.
…arity; update imports and enhance streaming response handling
- Updated import paths in various test files to reflect the transition from 'agentflow' to 'agentflow.runtime' and 'agentflow.storage'. - Adjusted mock patches in tests to ensure compatibility with the new structure, particularly in OpenAI, Google, and Redis embedding tests. - Ensured that all relevant tests are correctly referencing the updated module paths for consistent functionality.
…rs in async generator type hints
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several important improvements to the LLM adapters in the
agentflow.runtime.adapters.llmpackage, focusing on lazy loading of converters, improved type checking, and a major refactor of theOpenAIConverterto enhance maintainability and streaming support. The changes also include minor fixes and code quality improvements across the runtime module.LLM Adapter Refactoring and Improvements
Lazy Import and API Surface Changes:
agentflow.runtime.adapters.llmpackage now uses lazy loading for concrete converter implementations, exposing a minimal, stable API surface and avoiding import cycles during test collection. This is achieved by removing eager imports and adding a__getattr__for dynamic attribute access. [1] [2]Type Checking and Imports:
from __future__ import annotationsand conditional imports withTYPE_CHECKINGin several modules (base_converter.py,model_response_converter.py) to improve type safety and avoid unnecessary runtime imports. [1] [2]OpenAI Converter Refactor
Major Refactor of
OpenAIConverter:convert_responsemethod inopenai_converter.pywas refactored for clarity and maintainability. Extraction of usage, message content, reasoning, audio, images, and tool calls is now handled by dedicated helper methods, reducing duplication and improving readability. [1] [2] [3]Delegation and Import Fixes:
OpenAIResponsesConverteris now cleaner, with imports moved to the top and redundant code removed. [1] [2]Minor Improvements and Housekeeping
Code Quality and Compatibility:
__all__construction inagentflow/runtime/__init__.pyfor compatibility.dataclassimport inopenai_responses_converter.pyfor future extensibility.Agentclass constructor parameter count.These changes collectively improve the modularity, maintainability, and testability of the LLM adapter subsystem, while laying groundwork for future extensions and better streaming support.