-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add message_output and refactor LCAgentComponent #2755
Merged
Conversation
This file contains 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
Pull Request Validation ReportThis comment is automatically generated by Conventional PR Whitelist Report
Result Pull request matches with one (or more) enabled whitelist criteria. Pull request validation is skipped. Last Modified at 17 Jul 24 13:18 UTC |
This pull request is automatically being deployed by Amplify Hosting (learn more). |
ogabrielluiz
force-pushed
the
add_text_output_agents
branch
from
July 17, 2024 16:09
2a8d9cd
to
82b1000
Compare
…Component to improve agent functionality and interaction with messages
This commit adds a new type alias `ToolEnabledLanguageModel` to the `constants.py` file in the `field_typing` module. This type alias is used to define the type of language models that have tooling enabled. It includes the `BaseLanguageModel`, `BaseLLM`, and `BaseChatModel` types. This change enhances the typing capabilities of the codebase and improves the clarity of the code.
This commit modifies the `agent.py` file to include support for the `ToolEnabledLanguageModel` in the `LCToolsAgentComponent` class. The `ToolEnabledLanguageModel` is now added as an input type in the `HandleInput` section. This change enhances the functionality of the agent by allowing it to work with language models that have tooling enabled. The addition of this input type improves the flexibility and versatility of the codebase.
This commit modifies the `agent.py` file to include support for the `ToolEnabledLanguageModel` in the `LCAgentComponent` class. The `ToolEnabledLanguageModel` is now added as an input type in the `HandleInput` section. This change enhances the functionality of the agent by allowing it to work with language models that have tooling enabled. The addition of this input type improves the flexibility and versatility of the codebase.
This commit adds the `AgentAsyncHandler` class to handle callbacks from langchain in the `callback.py` file. The `AgentAsyncHandler` is an async callback handler that can be used to handle various events such as tool start, tool end, agent action, and agent finish. This change enhances the functionality of the codebase by providing a convenient way to handle callbacks from langchain and log the events if a log function is provided.
…ization This commit adds the `field_serializer` decorator to the `Log` class in the `schema.py` file. The decorator is used to serialize the `message` attribute of the `Log` class, ensuring that all nested objects are properly serialized. This change improves the serialization process and enhances the functionality of the codebase.
ogabrielluiz
force-pushed
the
add_text_output_agents
branch
from
July 17, 2024 18:07
82b1000
to
e69f823
Compare
This commit fixes an issue in the `LangSmithTracer` class where logs were not being properly serialized. The `add_metadata` method now converts logs to dictionaries using the `model_dump` method if they are not already dictionaries. This ensures that all logs are correctly serialized and improves the functionality of the codebase.
This commit modifies the `LCAgentComponent` class in the `agent.py` file to handle list results in the `result` variable. If the `result` is a list, it is joined into a single string using the `text` attribute of each result dictionary. This change improves the functionality of the codebase by ensuring that the `result` variable is always a string, which is expected by the `Message` class.
This commit adds a "name" parameter to the `on_tool_start`, `on_tool_end`, `on_agent_action`, and `on_agent_finish` methods of the `AgentAsyncHandler` class in the `callback.py` file. The "name" parameter allows for specifying a name for the event, which can be useful for logging and tracking purposes. This change enhances the functionality of the codebase by providing more flexibility in handling callbacks and improves the clarity of the code.
dosubot
bot
added
the
size:L
This PR changes 100-499 lines, ignoring generated files.
label
Jul 17, 2024
namastex888
approved these changes
Jul 17, 2024
github-actions
bot
added
enhancement
New feature or request
and removed
enhancement
New feature or request
labels
Jul 17, 2024
…e loggable types This commit updates the `AgentAsyncHandler` constructor in the `callback.py` file to support logging multiple loggable types. The `log_function` parameter now accepts a callable that can handle either a single `LoggableType` or a list of `LoggableType` objects along with a string representing the event name. This change enhances the flexibility of the codebase by allowing for more versatile logging options and improves the clarity of the code.
…ctor and methods for better readability and accuracy refactor(callback.py): simplify on_tool_end method by using **kwargs for flexibility and consistency with other methods
nicoloboschi
pushed a commit
to datastax/ragstack-ai-langflow
that referenced
this pull request
Jul 30, 2024
) * feat(agent.py): add support for handling message responses in LCAgentComponent to improve agent functionality and interaction with messages * feat: add ToolEnabledLanguageModel type alias to constants.py This commit adds a new type alias `ToolEnabledLanguageModel` to the `constants.py` file in the `field_typing` module. This type alias is used to define the type of language models that have tooling enabled. It includes the `BaseLanguageModel`, `BaseLLM`, and `BaseChatModel` types. This change enhances the typing capabilities of the codebase and improves the clarity of the code. * feat: update agent.py to include support for ToolEnabledLanguageModel This commit modifies the `agent.py` file to include support for the `ToolEnabledLanguageModel` in the `LCToolsAgentComponent` class. The `ToolEnabledLanguageModel` is now added as an input type in the `HandleInput` section. This change enhances the functionality of the agent by allowing it to work with language models that have tooling enabled. The addition of this input type improves the flexibility and versatility of the codebase. * feat: add support for ToolEnabledLanguageModel in LCAgentComponent This commit modifies the `agent.py` file to include support for the `ToolEnabledLanguageModel` in the `LCAgentComponent` class. The `ToolEnabledLanguageModel` is now added as an input type in the `HandleInput` section. This change enhances the functionality of the agent by allowing it to work with language models that have tooling enabled. The addition of this input type improves the flexibility and versatility of the codebase. * feat: add AgentAsyncHandler for handling callbacks from Agents This commit adds the `AgentAsyncHandler` class to handle callbacks from langchain in the `callback.py` file. The `AgentAsyncHandler` is an async callback handler that can be used to handle various events such as tool start, tool end, agent action, and agent finish. This change enhances the functionality of the codebase by providing a convenient way to handle callbacks from langchain and log the events if a log function is provided. * chore: add field_serializer decorator to Log class for message serialization This commit adds the `field_serializer` decorator to the `Log` class in the `schema.py` file. The decorator is used to serialize the `message` attribute of the `Log` class, ensuring that all nested objects are properly serialized. This change improves the serialization process and enhances the functionality of the codebase. * feat: Fix issue with logs in LangSmithTracer This commit fixes an issue in the `LangSmithTracer` class where logs were not being properly serialized. The `add_metadata` method now converts logs to dictionaries using the `model_dump` method if they are not already dictionaries. This ensures that all logs are correctly serialized and improves the functionality of the codebase. * feat: Add support for Pydantic V1 models in Log serialization * fix: Update LCAgentComponent to handle list results in result variable This commit modifies the `LCAgentComponent` class in the `agent.py` file to handle list results in the `result` variable. If the `result` is a list, it is joined into a single string using the `text` attribute of each result dictionary. This change improves the functionality of the codebase by ensuring that the `result` variable is always a string, which is expected by the `Message` class. * feat: Add "name" parameter to AgentAsyncHandler methods This commit adds a "name" parameter to the `on_tool_start`, `on_tool_end`, `on_agent_action`, and `on_agent_finish` methods of the `AgentAsyncHandler` class in the `callback.py` file. The "name" parameter allows for specifying a name for the event, which can be useful for logging and tracking purposes. This change enhances the functionality of the codebase by providing more flexibility in handling callbacks and improves the clarity of the code. * feat: Update AgentAsyncHandler constructor to support logging multiple loggable types This commit updates the `AgentAsyncHandler` constructor in the `callback.py` file to support logging multiple loggable types. The `log_function` parameter now accepts a callable that can handle either a single `LoggableType` or a list of `LoggableType` objects along with a string representing the event name. This change enhances the flexibility of the codebase by allowing for more versatile logging options and improves the clarity of the code. * refactor(callback.py): update type hints in AgentAsyncHandler constructor and methods for better readability and accuracy refactor(callback.py): simplify on_tool_end method by using **kwargs for flexibility and consistency with other methods (cherry picked from commit 2c3e93b)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
lgtm
This PR has been approved by a maintainer
size:L
This PR changes 100-499 lines, ignoring generated files.
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 PR improves LCAgentComponent and adds output to all Agents.