⚡️ Speed up function apply_tweaks by 14% in PR #10880 (fix/image-upload-gemini-anthropic-chat-output)#10889
Conversation
* Revert "Revert "docs: update component documentation links to individual pages"" This reverts commit 0bc27d6. * [autofix.ci] apply automated fixes * llm-selector-renamed * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * Apply suggestions from code review * [autofix.ci] apply automated fixes * Apply suggestions from code review * [autofix.ci] apply automated fixes * rebuild-component-index * update-component-index * [autofix.ci] apply automated fixes * build-index * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…10586) * fix: resolved merge conflict * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * fix: create a new message to avoid mutating shared instances * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * fix: resolved merge conflict * [autofix.ci] apply automated fixes * fix: resolved merge conflict * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * fix: added a check for using exisiting message object * fix: remove unwanted import * fix: resolve merge conflict * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * fix: add None checks to prevent errors * fix: resolve merge conflict * [autofix.ci] apply automated fixes * fix: backend unit test * fix: resolve merge conflict * [autofix.ci] apply automated fixes * fix: ruff styling errors * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* feat: optimize dropdown filtering and output resolution misc: remove commented out code feat: add refresh button and sort flows by updated_at date from most to least recent ruff (flow.py imports) improve fn contracts in runflow and improve flow id retrieval logic based on graph exec context add dynamic outputs and optimize db lookups add flow cache and db query for getting a single flow by id or name cache run outputs and add refresh context to build config misc misc use ids for flow retrieval misc fix missing flow_id bug add unit and integration tests add input field flag to persist hidden fields at runtime move unit tests and change input and output display names chore: update component index fix: fix tool mode when flow has multiple inputs by dynamically creating resolvers chore: update component index ruff (run_flow and tests) add resolvers to outputs map for non tool mode runtime fix tests (current flow excluded in db fetch) mypy (helpers/flow.py) chore: update component index remove unused code and clean up comments fix: persist user messages in chat-based flows via session injection chore: update component index empty string fallback for sessionid in chat.py chore: update component index chore: update component index cache invalidation with timestamps misc add cache invalidation chore: update component index chore: update comp idx ruff (run_flow.py) change session_id input type to MessageTextInput chore: update component index chore: update component index chore: update component index chore: update component index sync starter projects with main chore: update component index chore: update component index chore: update component index remove dead code + impl coderabbit suggestions chore: update component index chore: update component index clear options metadata before updating chore: update component index sync starter projects with main sync starter projects with main default param val (list flows) * chore: update component index * add integration tests * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: Cristhian Zanforlin <criszl@192.168.15.88> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* Add OpenSearch multimodal multi-embedding component Introduces OpenSearchVectorStoreComponentMultimodalMultiEmbedding, supporting multi-model hybrid semantic and keyword search with dynamic vector fields, parallel embedding generation, advanced filtering, and flexible authentication. Enables ingestion and search across multiple embedding models in OpenSearch, with robust index management and UI configuration handling. * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes * Add EmbeddingsWithModels and sync model fetching Introduces EmbeddingsWithModels class for wrapping embeddings and available models. Updates EmbeddingModelComponent to provide available model lists for OpenAI, Ollama, and IBM watsonx.ai providers, including synchronous Ollama model fetching using httpx. Updates starter project and component index metadata to reflect new dependencies and code changes. * Refactor embedding model component to use async Ollama model fetch Updated the EmbeddingModelComponent to fetch Ollama models asynchronously using await get_ollama_models instead of a synchronous httpx call. Removed httpx from dependencies in Nvidia Remix starter project and updated related metadata. This change improves consistency and reliability when fetching available models for the Ollama provider. * update to embeddings to support multiple models * Add Notion integration components Added several Notion-related components to the component index, including AddContentToPage, NotionDatabaseProperties, NotionListPages, NotionPageContent, NotionPageCreator, NotionPageUpdate, and NotionSearch. These components enable interaction with Notion databases and pages, such as querying, updating, creating, and retrieving content. * Add tests for multi-model embeddings and OpenSearch Added unit tests for EmbeddingsWithModels class and OpenSearchVectorStoreComponentMultimodalMultiEmbedding, including model normalization, authentication modes, and integration scenarios. Updated embedding model component tests to support async build_embeddings and verify multi-model support. Created necessary test package __init__.py files. * Update component_index.json * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * Fix session_id handling in ChatInput and ChatOutput Updated ChatInput and ChatOutput components in starter project JSONs to use the session_id from the graph if not provided, ensuring consistent session management. This change improves message storage and retrieval logic for chat flows. * Update test_opensearch_multimodal.py * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* feat(storybook): add Storybook setup and Button component stories - Add Storybook configuration files (.storybook/main.ts, preview.ts, css.d.ts) - Add Button component stories with interaction testing - Add Storybook dependencies and scripts to package.json - Support dark mode in stories via decorator - Include play functions for automated interaction testing * ci(storybook): add GitHub Pages deployment workflow - Add automated deployment workflow for Storybook - Deploy on push to main when Storybook files change - Support manual trigger via workflow_dispatch - Use official GitHub Actions for Pages deployment * fix(storybook): align Storybook versions and fix TypeScript issues - Update all @storybook/* packages from ^8.4.7 to ^8.6.14 to match main storybook version - Fix CSS type declarations in css.d.ts (Record<string, string> instead of Record<string, never>) - Remove @ts-ignore comments from preview.ts (CSS imports now properly typed) - Fix darkMode type issue in button.stories.tsx with proper ArgTypes type assertion * feat(storybook): replace Button stories with Dropdown component stories - Remove Button stories (shadcn already has documentation) - Add comprehensive Dropdown component stories showcasing: - Default, with value, combobox mode - With metadata, disabled, loading states - Many options, searchable filtering - Dark mode support - Add store initialization decorator for Storybook - Include interaction testing with play functions * feat(storybook): add SettingsPage stories and remove dropdown stories - Remove dropdown component stories - Add SettingsPage stories with router, store, and dark mode decorators - Include variants: default, with general settings, and dark mode * feat(storybook): fix SettingsPage stories to show full page and add play functions - Fix router setup to properly render SettingsPage with nested routes - Add Routes configuration for all settings sub-pages (General, MCP Servers, Global Variables, Shortcuts, Messages) - Add play functions to test page visibility and navigation - Add stories for different routes: Default, WithGeneralSettings, NavigateToShortcuts, NavigateToGlobalVariables, DarkMode * revert(storybook): restore SettingsPage stories to original working version - Revert to simpler router setup without Routes configuration - Remove play functions and complex routing - Restore original three stories: Default, WithGeneralSettings, DarkMode * feat(storybook): add stories for ShortcutsPage and GlobalVariablesPage with tables - Add ShortcutsPage stories showing the shortcuts table - Add GlobalVariablesPage stories showing the global variables table - Include store setup for shortcuts data - Add play functions to verify table visibility - Support dark mode for both pages * fix(storybook): add QueryClientProvider to GlobalVariablesPage stories - Add QueryClientProvider decorator to support React Query hooks - Configure QueryClient with retry disabled for Storybook * fix(storybook): remove WithGeneralSettings story to fix nested router error - Remove WithGeneralSettings story that was causing nested Router error - Keep Default and DarkMode stories only * feat(storybook): enhance SettingsPage stories with multiple states and logic variations - Add stories showcasing different store configurations (autoLogin, hasStore) - Demonstrate conditional General settings visibility logic - Add interactive sidebar navigation story - Show full configuration with all features - Include play functions to verify state-based behavior - Showcase how page adapts to different user/auth states * fix(storybook): initialize Zustand stores synchronously in SettingsPage stories - Set store state before component render instead of in useEffect - Ensures stores are accessible when SettingsPage component mounts - Fixes state access errors in Storybook * feat(storybook): add story to verify store state accessibility - Add VerifyStoreState story that demonstrates accessing Zustand store state - Verify store values match expected configuration - Show that state is accessible from play functions * fix(storybook): remove router from SettingsPage stories to fix errors - Remove MemoryRouter decorator that was causing errors - Keep store setup and dark mode decorators - Stories now work without router dependency * fix(storybook): add router back to SettingsPage stories for useNavigate support - Add MemoryRouter back to support useCustomNavigate hook in PageLayout - Router is needed for navigation hooks to work properly - Keep router at decorator level to avoid nested router errors * fix(storybook): fix router decorator order in SettingsPage stories - Move router decorator to be outermost (last in array) - Decorators run bottom-to-top, so router should wrap everything - Ensures useNavigate context is available to all components * feat(storybook): add PlaygroundPage story as example for complex page stories - Add PlaygroundPage story demonstrating how to create stories for complex pages - Include darkMode toggle control as example for interactive story controls - Set up decorators for query client, router, and theme switching - Hide publish elements (Theme buttons, Built with Langflow) in story view - Center chat title header in story view - Configure Storybook preview and CSS types This story serves as a reference for creating stories for full page components rather than simple UI components, which are already documented in shadcn docs. * chore(storybook): remove SettingsPage stories Keep only PlaygroundPage story as the example for complex page stories. * chore: restore pyproject.toml to match main branch * chore: restore pyproject.toml to match main branch * Revert "chore: restore pyproject.toml to match main branch" This reverts commit a2b75a4. * chore: remove src/frontend/pyproject.toml as it doesn't exist in main * fix gitignore and add make commands * update package-json * chore(storybook): migrate from v8.6.14 to v10.1.0 - Update all Storybook packages to v10.1.0 - Replace @storybook/addon-essentials with @storybook/addon-docs - Remove @storybook/addon-interactions (moved to core) - Remove @storybook/blocks and @storybook/test (consolidated) - Fix import in PlaygroundPage.stories.tsx to use @storybook/react - Update tsconfig.json moduleResolution to 'bundler' for better compatibility - Add explicit types configuration for @storybook/react * fix: update package-lock.json to sync with package.json * fix: regenerate package-lock.json with all optional dependencies --------- Co-authored-by: Olfa Maslah <olfamaslah@Olfas-MacBook-Pro.local> Co-authored-by: Cristhian Zanforlin <criszl@MacBook-Pro-di-Cristhian.local> Co-authored-by: Olfa Maslah <olfamaslah@macbookpro.war.can.ibm.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix file as tool when the prompt is generic * [autofix.ci] apply automated fixes * ruff fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* add validations to check if loop component is freezed to prevent flow loop * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * fix ruff style * [autofix.ci] apply automated fixes * adjust tests * [autofix.ci] apply automated fixes --------- Co-authored-by: Cristhian Zanforlin <criszl@MacBook-Pro-di-Cristhian.local> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* Catching Anthropic and other exceptions. * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* add profile picture call on main routine * add tests to profile pic * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * add validation to images read file compnent * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * ruff fixes * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * add timeout error * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* removed unnecessary buttons on the flows page * added the asChild prop and hid button so they are not accessible by tabbing * added tab index to ensure that buttons as not selectable using the tab * made sure that accessibility is possible one bulk selection is enabled * made sure that accessibility is possible one bulk selection is enabled * Fix: added testcases and refactor * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * [autofix.ci] apply automated fixes --------- Co-authored-by: Olayinka Adelakun <olayinkaadelakun@Olayinkas-MacBook-Pro.local> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* add profile picture nullable validation * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * add tests profile pic * [autofix.ci] apply automated fixes * ruff fixes * add validation to images read file compnent * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * fix ruff * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* remove console warnings * [autofix.ci] apply automated fixes --------- Co-authored-by: Olayinka Adelakun <olayinkaadelakun@mac.war.can.ibm.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix: restore cuga version to correct one * chore: update component index --------- Co-authored-by: Jordan Frazier <jordan.frazier@datastax.com>
* fix: mask value to hide null field being returned * [autofix.ci] apply automated fixes * fix: added testcase and updated functionality --------- Co-authored-by: Olayinka Adelakun <olayinkaadelakun@mac.war.can.ibm.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Carlos Coelho <80289056+carlosrcoelho@users.noreply.github.com> Co-authored-by: Olayinka Adelakun <olayinkaadelakun@Olayinkas-MacBook-Pro.local>
…10777) * remove sticky as it was causing the refresh list to float on safari * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes --------- Co-authored-by: Olayinka Adelakun <olayinkaadelakun@mac.war.can.ibm.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix: made sure the tab is visible * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * Fix: added typing * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * fix: added testcases * fix: added handleOnValue change function and created a helper file --------- Co-authored-by: Olayinka Adelakun <olayinkaadelakun@mac.war.can.ibm.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Olayinka Adelakun <olayinkaadelakun@Olayinkas-MacBook-Pro.local> Co-authored-by: Carlos Coelho <80289056+carlosrcoelho@users.noreply.github.com>
* fix: freeze-icon image * [autofix.ci] apply automated fixes * fix: update icon * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes * fix: adjust height and width * fix: adjust height and width * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* add validation to images read file compnent * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * add image mismatch type validation * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * ruff fixes * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* feat: Add support for vLLMs and custom URL support. (#10335) * feat: add vLLM Embeddings * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com> Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
* Update embedding_model.py * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * Add fail-safe mode to EmbeddingModel component Introduces a 'fail_safe_mode' option to the EmbeddingModel component, allowing errors to be logged and None returned instead of raising exceptions. Updates the build_embeddings and update_build_config logic to support this mode for OpenAI, Ollama, and IBM watsonx.ai providers. * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * ruff * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: phact <estevezsebastian@gmail.com>
* Allow REST tweaks to MCP server * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * Test update to mcp component for cache * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * Update priority unit tests * Trigger build pipeline * [autofix.ci] apply automated fixes * feat: implement code review recommendations for MCP component tests - Extract resolve_mcp_config pure function for better testability - Add direct unit tests for config resolution logic - Refactor existing tests to use fixtures instead of heavy mocking - Add fixture-based integration test with real data structures - Add parametrized test for field types in test_process.py - Fix linting issues (unused variables, line length) All tests passing (11 tests total) * Update component_index.json * [autofix.ci] apply automated fixes * chore: trigger build * Regenerate component_index.json to match main structure * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: Steve Haertel <shaertel@ca.ibm.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
…ls (#10807) * fix mcp tool event loop usage * [autofix.ci] apply automated fixes * ruff * [autofix.ci] apply automated fixes * update corresponding test * upgrade altk to 0.4.4 * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
) * Update embedding_model.py * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * Add fail-safe mode to EmbeddingModel component Introduces a 'fail_safe_mode' option to the EmbeddingModel component, allowing errors to be logged and None returned instead of raising exceptions. Updates the build_embeddings and update_build_config logic to support this mode for OpenAI, Ollama, and IBM watsonx.ai providers. * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * ruff * [autofix.ci] apply automated fixes * Update opensearch_multimodal.py * Update component_index.json * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * Refactor available_models variable usage Renamed the local variable 'available_models' to 'available_models_attr' for clarity and consistency. Updated all references to use the new variable name within logging and conditional checks. * Update component_index.json * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: phact <estevezsebastian@gmail.com>
When documenting larger flows with sticky notes and grouping larger sections of the flow, the size constraints are very limiting. No more than three elements can effectively fit on a sticky note. By removing the size constraint, we enable users to more effectively create visual groups in a flow. Co-authored-by: Deon Sanchez <69873175+deon-sanchez@users.noreply.github.com>
* fixed counts * remove zero
* fix: Support Batch Run with watsonX * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * Update batch_run.py * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…thropic-chat-output
…://github.com/langflow-ai/langflow into fix/image-upload-gemini-anthropic-chat-output
* Fix image upload for Gemini/Anthropic and ChatOutput session_id preservation * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * fix ruff erros * [autofix.ci] apply automated fixes * resolve conflicts * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * [autofix.ci] apply automated fixes * build component index * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* Fix image upload for Gemini/Anthropic and ChatOutput session_id preservation * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * fix ruff erros * [autofix.ci] apply automated fixes * resolve conflicts * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) * [autofix.ci] apply automated fixes * build component index * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-Authored-By: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fixed counts * use customization to get api base urls --------- Co-authored-by: Deon Sanchez <69873175+deon-sanchez@users.noreply.github.com>
…://github.com/langflow-ai/langflow into fix/image-upload-gemini-anthropic-chat-output
…thropic-chat-output
The optimized code achieves a **13% speedup** through several targeted micro-optimizations that reduce Python method call overhead and dictionary lookup costs in the hot loop:
**Key Performance Improvements:**
1. **Early returns for missing data**: The original code used chained `.get()` calls (`node.get("data", {}).get("node", {}).get("template")`) which creates temporary empty dictionaries. The optimized version splits this into separate checks with early returns, avoiding unnecessary object creation when data is missing.
2. **Cached method references**: Pre-fetches `template_data.get` and `entry.__setitem__` to avoid repeated attribute lookups in the tight loop. This is particularly beneficial since the loop processes 5,000+ iterations in the profiler data.
3. **String constant hoisting**: Moves frequently-used string literals ("code", "NestedDict", "file_path", etc.) outside the loop to eliminate repeated string object creation and interning overhead.
4. **Reduced dictionary operations**: Instead of checking `tweak_name not in template_data` followed by `tweak_name in template_data`, it directly calls `template_data.get(tweak_name)` and checks for `None`, eliminating one dictionary lookup per iteration.
5. **Optimized inner loops**: For the `isinstance(tweak_value, dict)` branch, caches `entry.__setitem__` to avoid repeated method lookups when updating multiple key-value pairs.
**Impact on Performance:**
The profiler shows the main bottlenecks are in the dictionary operations and the `validate_and_repair_json` call (which remains unchanged). The optimizations primarily target the ~70% of execution time spent on dictionary lookups and method calls, explaining the meaningful 13% improvement.
**Test Case Analysis:**
The optimizations are most effective for large-scale scenarios like `test_large_scale_many_fields` (1000 fields) and `test_large_scale_partial_tweaks`, where the reduced per-iteration overhead compounds significantly. Basic functionality remains identical across all test cases.
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (19.44%) is below the target coverage (40.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## release-1.7.0 #10889 +/- ##
=================================================
+ Coverage 32.45% 32.54% +0.09%
=================================================
Files 1367 1370 +3
Lines 63315 63565 +250
Branches 9357 9393 +36
=================================================
+ Hits 20547 20690 +143
- Misses 41736 41835 +99
- Partials 1032 1040 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
1337430 to
3e4faae
Compare
|
Closing automated codeflash PR. |
⚡️ This pull request contains optimizations for PR #10880
If you approve this dependent PR, these changes will be merged into the original PR branch
fix/image-upload-gemini-anthropic-chat-output.📄 14% (0.14x) speedup for
apply_tweaksinsrc/backend/base/langflow/processing/process.py⏱️ Runtime :
2.22 milliseconds→1.96 milliseconds(best of149runs)📝 Explanation and details
The optimized code achieves a 13% speedup through several targeted micro-optimizations that reduce Python method call overhead and dictionary lookup costs in the hot loop:
Key Performance Improvements:
Early returns for missing data: The original code used chained
.get()calls (node.get("data", {}).get("node", {}).get("template")) which creates temporary empty dictionaries. The optimized version splits this into separate checks with early returns, avoiding unnecessary object creation when data is missing.Cached method references: Pre-fetches
template_data.getandentry.__setitem__to avoid repeated attribute lookups in the tight loop. This is particularly beneficial since the loop processes 5,000+ iterations in the profiler data.String constant hoisting: Moves frequently-used string literals ("code", "NestedDict", "file_path", etc.) outside the loop to eliminate repeated string object creation and interning overhead.
Reduced dictionary operations: Instead of checking
tweak_name not in template_datafollowed bytweak_name in template_data, it directly callstemplate_data.get(tweak_name)and checks forNone, eliminating one dictionary lookup per iteration.Optimized inner loops: For the
isinstance(tweak_value, dict)branch, cachesentry.__setitem__to avoid repeated method lookups when updating multiple key-value pairs.Impact on Performance:
The profiler shows the main bottlenecks are in the dictionary operations and the
validate_and_repair_jsoncall (which remains unchanged). The optimizations primarily target the ~70% of execution time spent on dictionary lookups and method calls, explaining the meaningful 13% improvement.Test Case Analysis:
The optimizations are most effective for large-scale scenarios like
test_large_scale_many_fields(1000 fields) andtest_large_scale_partial_tweaks, where the reduced per-iteration overhead compounds significantly. Basic functionality remains identical across all test cases.✅ Correctness verification report:
⚙️ Existing Unit Tests and Runtime
🌀 Generated Regression Tests and Runtime
To edit these changes
git checkout codeflash/optimize-pr10880-2025-12-04T19.03.38and push.