Skip to content
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

fix: enhance robustness in AgentComponent by checking attributes before getting them #7251

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ogabrielluiz
Copy link
Contributor

Introduce a detailed thinking feature for NVIDIA models, improving user configuration options. Enhance the robustness of model kwargs construction in the AgentComponent to prevent potential errors. Standardize JSON files in the starter project for better code consistency and readability.

…sult handling

* Added support for a detailed thinking feature in the NVIDIAModelComponent, allowing users to enable this functionality through the build configuration.
* Refactored the get_chat_result method to prepend a detailed thinking prefix to the system message when the feature is enabled, with error handling for potential issues during this process.
* Removed the detailed thinking logic from the LCModelComponent to streamline the codebase.
* Updated the _build_llm_model method to include a check for the existence of attributes before adding them to model_kwargs, preventing potential AttributeError exceptions and improving robustness.
* Standardized the "value" field in multiple starter project JSON files to ensure uniformity in code formatting and structure.
* Improved readability by maintaining consistent import statements and function definitions across projects.
* This change affects the following files: Instagram Copywriter.json, Market Research.json, News Aggregator.json, Price Deal Finder.json, Research Agent.json, SaaS Pricing.json, and Sequential Tasks Agents.json.
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 24, 2025
@github-actions github-actions bot added the bug Something isn't working label Mar 24, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Mar 25, 2025
value=False,
info="Enable detailed thinking.",
advanced=True,
).to_dict()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this necessary? is this preferred to having it in inputs like it is:

        BoolInput(
            name="detailed_thinking",
            display_name="Detailed Thinking",
            info="If true, the model will return a detailed thought process. Only supported by reasoning models.",
            value=False,
            show=False,
        ),

Copy link
Contributor Author

@ogabrielluiz ogabrielluiz Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is only used by the NVIDIA componenent from what I understand and it was as base input.

I was having a lot of trouble getting this to work, by the way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand. On line 49 of src/backend/base/langflow/components/models/nvidia.py, there's already the detailed_thinking input. Was that not working for you? I seemed to work during my testing.

Copy link

codspeed-hq bot commented Mar 25, 2025

CodSpeed Performance Report

Merging #7251 will degrade performances by 41.77%

Comparing fix-agent-attributeerror (1085e1b) with main (58e0d42)

Summary

⚡ 1 improvements
❌ 2 regressions
✅ 16 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
test_build_flow_invalid_job_id 8 ms 12.4 ms -35.62%
test_cancel_build_with_cancelled_error 243.6 ms 219.1 ms +11.19%
test_cancel_nonexistent_build 7.7 ms 13.3 ms -41.77%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants