feat: add new openai reasoning models#8786
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis update refines the handling and categorization of OpenAI model names throughout the backend and starter project configurations. It introduces new chat and reasoning model identifiers, segregates chat and reasoning models, updates filtering logic, and ensures all components and tests use the new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI
participant LanguageModelComponent
participant ModelConstants
User->>UI: Selects provider (e.g., OpenAI)
UI->>LanguageModelComponent: Requests model options
LanguageModelComponent->>ModelConstants: Fetches OPENAI_CHAT_MODEL_NAMES
ModelConstants-->>LanguageModelComponent: Returns filtered chat model list
LanguageModelComponent-->>UI: Populates model dropdown with chat models
Note over LanguageModelComponent: If reasoning model selected, hide/show fields accordingly
Possibly related PRs
Suggested labels
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 6
🔭 Outside diff range comments (4)
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (1)
3120-3150:streamingparameter is invalid for Anthropic & Google clients
ChatAnthropicexpectsstream=True(note the missing “ing”) andChatGoogleGenerativeAIcurrently has no streaming flag at all.
Passingstreaming=…will raise aTypeErrorat runtime.- return ChatAnthropic( - model=model_name, - temperature=temperature, - streaming=stream, + return ChatAnthropic( + model=model_name, + temperature=temperature, + stream=stream, anthropic_api_key=self.api_key, ) … - return ChatGoogleGenerativeAI( - model=model_name, - temperature=temperature, - streaming=stream, + return ChatGoogleGenerativeAI( + model=model_name, + temperature=temperature, google_api_key=self.api_key, )src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json (1)
2701-2735:update_build_configstill unaware of the new reasoning-model listThe PR description mentions the separation between chat and reasoning models, but the switch-case here updates the dropdown exclusively with
OPENAI_CHAT_MODEL_NAMESfor the OpenAI branch.
If a “reasoning” provider flag or a dedicated field was introduced elsewhere, this component will silently ignore it, showing only chat models.@@ - if field_value == "OpenAI": - build_config["model_name"]["options"] = OPENAI_CHAT_MODEL_NAMES - build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0] + if field_value == "OpenAI": + from langflow.base.models.openai_constants import ( + OPENAI_CHAT_MODEL_NAMES, + OPENAI_REASONING_MODEL_NAMES, + ) + target_list = ( + OPENAI_REASONING_MODEL_NAMES + if build_config.get("reasoning", {}).get("value") is True + else OPENAI_CHAT_MODEL_NAMES + ) + build_config["model_name"]["options"] = target_list + build_config["model_name"]["value"] = target_list[0]src/backend/base/langflow/initial_setup/starter_projects/SEO Keyword Generator.json (1)
966-1003: Pass a copy ofOPENAI_CHAT_MODEL_NAMES, not the original list
OPENAI_CHAT_MODEL_NAMESis (presumably) a mutable list defined in a shared constants module.
By attaching the same list instance to the component’sDropdownInput.optionsand later tobuild_config["model_name"]["options"], any downstream mutation (intentional or accidental) performed by the UI or other code paths will mutate the global constant for the entire process.Guard against this by passing a copy (
list(...)orOPENAI_CHAT_MODEL_NAMES[:]) instead of the original object.- DropdownInput( - name="model_name", - display_name="Model Name", - options=OPENAI_CHAT_MODEL_NAMES, - value=OPENAI_CHAT_MODEL_NAMES[0], + DropdownInput( + name="model_name", + display_name="Model Name", + options=list(OPENAI_CHAT_MODEL_NAMES), + value=OPENAI_CHAT_MODEL_NAMES[0], ... - build_config["model_name"]["options"] = OPENAI_CHAT_MODEL_NAMES + build_config["model_name"]["options"] = list(OPENAI_CHAT_MODEL_NAMES)Same defensive copy is advisable wherever the constant is exposed to caller-modifiable structures.
src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json (1)
2985-3005: Incorrect keyword for Anthropic streaming – will raiseTypeErrorIn the
ChatAnthropicconstructor the parameter should bestream, notstreaming. With the current code any call tobuild_model()for an Anthropic provider will fail:- return ChatAnthropic( - model=model_name, - temperature=temperature, - streaming=stream, - anthropic_api_key=self.api_key, - ) + return ChatAnthropic( + model=model_name, + temperature=temperature, + stream=stream, + anthropic_api_key=self.api_key, + )Please adjust before users attempt to run Anthropic models.
♻️ Duplicate comments (2)
src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json (1)
2343-2352: Same update as earlier block – comment already provided above.src/backend/base/langflow/initial_setup/starter_projects/Hybrid Search RAG.json (1)
2341-2362: Same duplication concern as above – see earlier note.
No additional action beyond keeping the two definitions in sync.
🧹 Nitpick comments (18)
src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (1)
1017-1040: Prefer an explicit default overOPENAI_CHAT_MODEL_NAMES[0]Coupling the default
model_nameto the first element of the constant list is brittle—any future re-ordering ofOPENAI_CHAT_MODEL_NAMESsilently changes the default and could surprise users. Define a dedicated constant (e.g.,DEFAULT_OPENAI_CHAT_MODEL = "gpt-4o-mini") or choose the default explicitly in theDropdownInput/update_build_configcalls.-from langflow.base.models.openai_constants import OPENAI_CHAT_MODEL_NAMES +from langflow.base.models.openai_constants import ( + OPENAI_CHAT_MODEL_NAMES, +) +# Explicitly state the default to decouple from list order +DEFAULT_OPENAI_CHAT_MODEL = "gpt-4o-mini"Then:
- value=OPENAI_CHAT_MODEL_NAMES[0], + value=DEFAULT_OPENAI_CHAT_MODEL,and in
update_build_config:- build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0] + build_config["model_name"]["value"] = DEFAULT_OPENAI_CHAT_MODELThis minor change improves long-term stability with negligible effort.
src/backend/base/langflow/utils/constants.py (1)
24-33: Reasoning-model list added but unused in this module
REASONING_OPENAI_MODELSis declared but nothing here references it.
If the canonical definition lives inbase/models/openai_constants.py, keep it there to avoid drift; otherwise add the appropriate wiring inoptions_map(or similar) from this module.Until it is actually consumed this block is dead code.
src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json (1)
1931-1960: Good switch toOPENAI_CHAT_MODEL_NAMESbut watch duplicationThe embedded component now imports
langflow.base.models.openai_constants import OPENAI_CHAT_MODEL_NAMES, matching the new constant.
No functional issues spotted here.Just note that the same component exists as real Python under
base/models/...; editing both places is easy to forget.
Consider removing the in-JSON code duplication and reference the Python module instead.src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (2)
4557-4557: Minor param-name inconsistency for Anthropic client
ChatAnthropicacceptsmodel_name(aliased tomodel) in recentlangchain-anthropicreleases. Supplying the alias works today, but anchoring to the canonicalmodel_namekeeps the code self-explanatory and guards against future de-aliasing.- return ChatAnthropic( - model=model_name, + return ChatAnthropic( + model_name=model_name,
4557-4557: Avoid copy-pasted switch logic inupdate_build_configThe triple
if-elifblock repeats the same three mutations (options,value,display_name). A tiny mapping table eliminates duplication, curbs drift, and simplifies maintenance as providers grow.- if field_name == "provider": - if field_value == "OpenAI": - build_config["model_name"]["options"] = OPENAI_CHAT_MODEL_NAMES - build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0] - build_config["api_key"]["display_name"] = "OpenAI API Key" - elif field_value == "Anthropic": - build_config["model_name"]["options"] = ANTHROPIC_MODELS - build_config["model_name"]["value"] = ANTHROPIC_MODELS[0] - build_config["api_key"]["display_name"] = "Anthropic API Key" - elif field_value == "Google": - build_config["model_name"]["options"] = GOOGLE_GENERATIVE_AI_MODELS - build_config["model_name"]["value"] = GOOGLE_GENERATIVE_AI_MODELS[0] - build_config["api_key"]["display_name"] = "Google API Key" + if field_name == "provider": + provider_map = { + "OpenAI": ( + OPENAI_CHAT_MODEL_NAMES, + "OpenAI API Key", + ), + "Anthropic": ( + ANTHROPIC_MODELS, + "Anthropic API Key", + ), + "Google": ( + GOOGLE_GENERATIVE_AI_MODELS, + "Google API Key", + ), + } + if field_value in provider_map: + models, key_label = provider_map[field_value] + build_config["model_name"]["options"] = models + build_config["model_name"]["value"] = models[0] + build_config["api_key"]["display_name"] = key_labelsrc/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (1)
3375-3383: Duplicate component code detectedThe full
LanguageModelComponentdefinition is embedded twice (nodes…cPCaH&…mMKmF).
This duplication invites drift and inflates bundle size. Prefer referencing a single module or sharing the code via an import instead of copy-pasting.src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (3)
1396-1397: Import path & constant name look correct, but remember to update duplicated static options
OPENAI_CHAT_MODEL_NAMESis the right constant to use after the refactor – good catch.
However, the static dropdown options defined further down in the same template (lines 1430-1441) hard-code the model list. If the constant is ever updated (e.g., new chat models added or reordered) those hard-coded values will silently diverge from the runtime options injected byupdate_build_config. Consider removing the staticoptionsarray altogether or generating it from the constant when the starter project is (re)built to avoid future drift.
1419-1452: Default value should be taken from the constant, not a literal
"value": "gpt-4o-mini"is hard-coded while the dropdown options are programmatically replaced byOPENAI_CHAT_MODEL_NAMES[0]. If the constant’s first element ever changes, the default will be inconsistent until the user changes provider. Recommend:- "value": "gpt-4o-mini" + "value": "__DYNAMIC_DEFAULT__"and let
update_build_config(or an initialization hook) set the actual default, ensuring alignment with the constant.
1361-1390: Minor duplication inupdate_build_configThe provider-switch block repeats the same three-line pattern (update options, value, and API-key label). Extracting that into a small helper would reduce future maintenance risk:
def _set_provider(self, build_config, models, api_label): build_config["model_name"]["options"] = models build_config["model_name"]["value"] = models[0] build_config["api_key"]["display_name"] = api_labelNot critical for a starter-project snippet, but worth keeping in mind.
src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json (1)
2681-2745: Default dropdown values are now inconsistent with the new “OpenAI”-first intentInside the code snippet the default provider is
"OpenAI"and the default model list isOPENAI_CHAT_MODEL_NAMES.
However, the surrounding node JSON (fields undertemplate) still sets"provider": "Anthropic"and hard-codes Anthropic model names. This will produce a mismatched UI on first load.Align the JSON-level defaults with the snippet or vice-versa so that the starter project opens in a coherent state.
src/backend/base/langflow/initial_setup/starter_projects/Basic Prompting.json (1)
991-991: Updateupdate_build_configto reflect provider-specific key placeholdersWhile the API-key label is switched (
"OpenAI API Key","Anthropic API Key", …), the underlying default value remains"OPENAI_API_KEY". This misleads users and breaks the sentinel logic proposed above.@@ - build_config["api_key"]["display_name"] = "Anthropic API Key" + build_config["api_key"]["display_name"] = "Anthropic API Key" + build_config["api_key"]["value"] = "ANTHROPIC_API_KEY" @@ - build_config["api_key"]["display_name"] = "Google API Key" + build_config["api_key"]["display_name"] = "Google API Key" + build_config["api_key"]["value"] = "GOOGLE_API_KEY"Keeps the UI consistent and enables proper empty-key detection.
src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json (2)
2680-2682: Guard against empty constant to avoidIndexErrorBoth the constructor and
update_build_configaccessOPENAI_CHAT_MODEL_NAMES[0].
If the constant were ever shipped empty (e.g., as part of a hot-fix that temporarily disables all chat models), the starter project would crash on load.Add a simple sanity check:
- value=OPENAI_CHAT_MODEL_NAMES[0], + value=OPENAI_CHAT_MODEL_NAMES[0] if OPENAI_CHAT_MODEL_NAMES else "",and raise a descriptive error if the list is empty.
2972-2974: Duplicate inlinedLanguageModelComponentcode – consider DRYingThe identical ~200-line
LanguageModelComponentdefinition is embedded twice in the JSON (nodesLanguageModelComponent-Wd1thandLanguageModelComponent-gDIcu).
Keeping two copies in sync is error-prone and bloats the starter file.Instead, reference a single shared template or use the
clone_nodefacility in the flow exporter so only node-specific overrides are materialised.
This reduces maintenance overhead when the component evolves again (e.g., adding reasoning-model support).src/backend/base/langflow/initial_setup/starter_projects/Blog Writer.json (1)
1409-1420: Remove the hard-coded model list to avoid drifting fromOPENAI_CHAT_MODEL_NAMESInside the
LanguageModelComponentcode you correctly switched the dropdown’s options toOPENAI_CHAT_MODEL_NAMES, but the JSON block that follows still embeds a fixed list of model names ("gpt-4o-mini", "gpt-4o", …).
Keeping both sources guarantees they will diverge the next time the constant is updated.Prefer a single source of truth:
- "options": [ - "gpt-4o-mini", - "gpt-4o", - "gpt-4.1", - "gpt-4.1-mini", - "gpt-4.1-nano", - "gpt-4.5-preview", - "gpt-4-turbo", - "gpt-4-turbo-preview", - "gpt-4", - "gpt-3.5-turbo" - ], + "options": "__OPENAI_CHAT_MODEL_NAMES__" # pseudocode – ensure the UI is populated programmaticallyIf the starter-project generator does not yet support placeholders, consider pruning the duplicated list on generation so the runtime code alone defines the choices.
This small change will save maintenance headaches when OpenAI adds or deprecates models.src/backend/base/langflow/initial_setup/starter_projects/Market Research.json (1)
1818-1867: Guard against emptyOPENAI_CHAT_MODEL_NAMESbefore indexing
value=OPENAI_CHAT_MODEL_NAMES[0](and the identical assignment insideupdate_build_config) will raiseIndexErrorif, for any reason (e.g., future filtering, env-specific override) the constant becomes an empty list. Cheap defensive fix:- value=OPENAI_CHAT_MODEL_NAMES[0], + value=OPENAI_CHAT_MODEL_NAMES[0] if OPENAI_CHAT_MODEL_NAMES else "",and
- build_config["model_name"]["value"] = OPENAI_CHAT_MODEL_NAMES[0] + build_config["model_name"]["value"] = ( + OPENAI_CHAT_MODEL_NAMES[0] if OPENAI_CHAT_MODEL_NAMES else "" + )Keeps the component functional even when the constant list is accidentally emptied.
src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (1)
1786-1794: Repeated component code bloats the starter fileThe exact same
LanguageModelComponentimplementation appears in three different nodes (qFXT1,Wp3pC,gYAmH). Duplicating ~160 lines of code three times inflates the JSON (>8 KB) and increases maintenance cost when the class evolves.Consider:
- Storing the component once in
src/.../custom_components/and referencing it by name in the starter JSON, or- Using a helper to inject the code during flow-generation so the starter file stays lean.
This keeps the starter project diff-friendly and avoids silent drift between copies.
src/backend/base/langflow/base/models/openai_constants.py (1)
13-13: Fix line length violation.The line exceeds the 120-character limit as flagged by the linter.
- create_model_metadata(provider="OpenAI", name="gpt-4-turbo-preview", icon="OpenAI", tool_calling=True, preview=True), + create_model_metadata( + provider="OpenAI", name="gpt-4-turbo-preview", icon="OpenAI", tool_calling=True, preview=True + ),src/backend/base/langflow/initial_setup/starter_projects/Hybrid Search RAG.json (1)
2053-2074: Static model list may drift fromOPENAI_CHAT_MODEL_NAMES.The code now pulls the authoritative list from
OPENAI_CHAT_MODEL_NAMES, but the template JSON still contains its own hard-codedmodel_name.optionsarray (see lines 2087-2099).
If the constant is updated in the future, the starter-project UI may display an outdated list until this JSON is regenerated.Consider removing the duplicated list from the template or populating
optionsat runtime viaupdate_build_configto guarantee a single source of truth.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (28)
src/backend/base/langflow/base/models/model.py(2 hunks)src/backend/base/langflow/base/models/openai_constants.py(4 hunks)src/backend/base/langflow/components/icosacomputing/combinatorial_reasoner.py(2 hunks)src/backend/base/langflow/components/models/language_model.py(3 hunks)src/backend/base/langflow/components/openai/openai_chat_model.py(5 hunks)src/backend/base/langflow/initial_setup/starter_projects/Basic Prompt Chaining.json(3 hunks)src/backend/base/langflow/initial_setup/starter_projects/Basic Prompting.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Blog Writer.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Financial Report Parser.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Hybrid Search RAG.json(2 hunks)src/backend/base/langflow/initial_setup/starter_projects/Image Sentiment Analysis.json(2 hunks)src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json(2 hunks)src/backend/base/langflow/initial_setup/starter_projects/Market Research.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json(3 hunks)src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json(2 hunks)src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/SEO Keyword Generator.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json(3 hunks)src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json(1 hunks)src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json(1 hunks)src/backend/base/langflow/utils/constants.py(1 hunks)src/backend/base/langflow/utils/util.py(1 hunks)src/backend/tests/unit/components/agents/test_agent_component.py(2 hunks)src/backend/tests/unit/components/models/test_language_model_component.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
`src/backend/**/*.py`: Run make format_backend to format Python code early and often Run make lint to check for linting issues in backend Python code
src/backend/**/*.py: Run make format_backend to format Python code early and often
Run make lint to check for linting issues in backend Python code
📄 Source: CodeRabbit Inference Engine (.cursor/rules/backend_development.mdc)
List of files the instruction was applied to:
src/backend/base/langflow/utils/util.pysrc/backend/base/langflow/components/icosacomputing/combinatorial_reasoner.pysrc/backend/tests/unit/components/models/test_language_model_component.pysrc/backend/base/langflow/base/models/model.pysrc/backend/base/langflow/components/models/language_model.pysrc/backend/tests/unit/components/agents/test_agent_component.pysrc/backend/base/langflow/base/models/openai_constants.pysrc/backend/base/langflow/utils/constants.pysrc/backend/base/langflow/components/openai/openai_chat_model.py
`src/backend/base/langflow/components/**/*.py`: Add new backend components to th...
src/backend/base/langflow/components/**/*.py: Add new backend components to the appropriate subdirectory under src/backend/base/langflow/components/
Implement async component methods using async def and await for asynchronous operations
Use asyncio.create_task for background work in async components and ensure proper cleanup on cancellation
Use asyncio.Queue for non-blocking queue operations in async components and handle timeouts appropriately
📄 Source: CodeRabbit Inference Engine (.cursor/rules/backend_development.mdc)
List of files the instruction was applied to:
src/backend/base/langflow/components/icosacomputing/combinatorial_reasoner.pysrc/backend/base/langflow/components/models/language_model.pysrc/backend/base/langflow/components/openai/openai_chat_model.py
`src/backend/**/components/**/*.py`: In your Python component class, set the `icon` attribute to a string matching the frontend icon mapping exactly (case-sensitive).
src/backend/**/components/**/*.py: In your Python component class, set theiconattribute to a string matching the frontend icon mapping exactly (case-sensitive).
📄 Source: CodeRabbit Inference Engine (.cursor/rules/icons.mdc)
List of files the instruction was applied to:
src/backend/base/langflow/components/icosacomputing/combinatorial_reasoner.pysrc/backend/tests/unit/components/models/test_language_model_component.pysrc/backend/base/langflow/components/models/language_model.pysrc/backend/tests/unit/components/agents/test_agent_component.pysrc/backend/base/langflow/components/openai/openai_chat_model.py
`src/backend/tests/unit/components/**/*.py`: Mirror the component directory stru...
src/backend/tests/unit/components/**/*.py: Mirror the component directory structure in unit tests under src/backend/tests/unit/components/
Use ComponentTestBaseWithClient or ComponentTestBaseWithoutClient as base classes for component unit tests
Provide file_names_mapping in tests for backward compatibility version testing
Create comprehensive unit tests for all new components
Use the client fixture from conftest.py for FastAPI API endpoint tests
Test authenticated FastAPI endpoints using logged_in_headers in tests
📄 Source: CodeRabbit Inference Engine (.cursor/rules/backend_development.mdc)
List of files the instruction was applied to:
src/backend/tests/unit/components/models/test_language_model_component.pysrc/backend/tests/unit/components/agents/test_agent_component.py
`src/backend/tests/unit/**/*.py`: Use in-memory SQLite for database tests Test c...
src/backend/tests/unit/**/*.py: Use in-memory SQLite for database tests
Test component integration within flows using create_flow, build_flow, and get_build_events utilities
Use pytest.mark.api_key_required and pytest.mark.no_blockbuster for tests involving external APIs
📄 Source: CodeRabbit Inference Engine (.cursor/rules/backend_development.mdc)
List of files the instruction was applied to:
src/backend/tests/unit/components/models/test_language_model_component.pysrc/backend/tests/unit/components/agents/test_agent_component.py
`src/backend/**/*component*.py`: In your Python component class, set the `icon` attribute to a string matching the frontend icon mapping exactly (case-sensitive).
src/backend/**/*component*.py: In your Python component class, set theiconattribute to a string matching the frontend icon mapping exactly (case-sensitive).
📄 Source: CodeRabbit Inference Engine (.cursor/rules/icons.mdc)
List of files the instruction was applied to:
src/backend/tests/unit/components/models/test_language_model_component.pysrc/backend/tests/unit/components/agents/test_agent_component.py
`src/backend/tests/**/*.py`: Unit tests for backend code should be located in 's...
src/backend/tests/**/*.py: Unit tests for backend code should be located in 'src/backend/tests/' and organized by component subdirectory for component tests.
Test files should use the same filename as the component with an appropriate test prefix or suffix (e.g., 'my_component.py' → 'test_my_component.py').
Use the 'client' fixture (an async httpx.AsyncClient) for API tests, as defined in 'src/backend/tests/conftest.py'.
Skip client creation in tests by marking them with '@pytest.mark.noclient' when the 'client' fixture is not needed.
Inherit from the appropriate ComponentTestBase class ('ComponentTestBase', 'ComponentTestBaseWithClient', or 'ComponentTestBaseWithoutClient') and provide the required fixtures: 'component_class', 'default_kwargs', and 'file_names_mapping' when adding a new component test.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/testing.mdc)
List of files the instruction was applied to:
src/backend/tests/unit/components/models/test_language_model_component.pysrc/backend/tests/unit/components/agents/test_agent_component.py
`{src/backend/tests/**/*.py,src/frontend/**/*.test.{ts,tsx,js,jsx},src/frontend/...
{src/backend/tests/**/*.py,src/frontend/**/*.test.{ts,tsx,js,jsx},src/frontend/**/*.spec.{ts,tsx,js,jsx},tests/**/*.py}: Each test should have a clear docstring explaining its purpose.
Complex test setups should be commented, and mock usage should be documented within the test code.
Expected behaviors should be explicitly stated in test docstrings or comments.
Create comprehensive unit tests for all new components.
Test both sync and async code paths in components.
Mock external dependencies appropriately in tests.
Test error handling and edge cases in components.
Validate input/output behavior in tests.
Test component initialization and configuration.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/testing.mdc)
List of files the instruction was applied to:
src/backend/tests/unit/components/models/test_language_model_component.pysrc/backend/tests/unit/components/agents/test_agent_component.py
`{src/backend/tests/**/*.py,tests/**/*.py}`: Use '@pytest.mark.asyncio' for asyn...
{src/backend/tests/**/*.py,tests/**/*.py}: Use '@pytest.mark.asyncio' for async test functions.
Test queue operations in async tests using 'asyncio.Queue' and non-blocking put/get methods.
Use the 'no_blockbuster' pytest marker to skip the blockbuster plugin in tests.
Be aware of ContextVar propagation in async tests and test both direct event loop execution and 'asyncio.to_thread' scenarios.
Each test should ensure proper resource cleanup, especially in async fixtures using 'try/finally' and cleanup methods.
Test that operations respect timeout constraints and assert elapsed time is within tolerance.
Test Langflow's 'Message' objects and chat functionality by asserting correct properties and structure.
Use predefined JSON flows and utility functions for flow testing (e.g., 'create_flow', 'build_flow', 'get_build_events', 'consume_and_assert_stream').
Test components that need external APIs with proper pytest markers such as '@pytest.mark.api_key_required' and '@pytest.mark.no_blockbuster'.
Use 'MockLanguageModel' for testing language model components without external API calls.
Use 'anyio' and 'aiofiles' for async file operations in tests.
Test Langflow's REST API endpoints using the async 'client' fixture and assert correct status codes and response structure.
Test component configuration updates by asserting changes in build config dictionaries.
Test real-time event streaming endpoints by consuming NDJSON event streams and validating event structure.
Test backward compatibility across Langflow versions by mapping component files to supported versions using 'VersionComponentMapping'.
Test webhook endpoints by posting payloads and asserting correct processing and status codes.
Test error handling by monkeypatching internal functions to raise exceptions and asserting correct error responses.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/testing.mdc)
List of files the instruction was applied to:
src/backend/tests/unit/components/models/test_language_model_component.pysrc/backend/tests/unit/components/agents/test_agent_component.py
🧠 Learnings (27)
src/backend/base/langflow/components/icosacomputing/combinatorial_reasoner.py (1)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components
src/backend/tests/unit/components/models/test_language_model_component.py (8)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Use 'MockLanguageModel' for testing language model components without external API calls.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Test component configuration updates by asserting changes in build config dictionaries.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Test backward compatibility across Langflow versions by mapping component files to supported versions using 'VersionComponentMapping'.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Provide file_names_mapping in tests for backward compatibility version testing
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Test Langflow's 'Message' objects and chat functionality by asserting correct properties and structure.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Use ComponentTestBaseWithClient or ComponentTestBaseWithoutClient as base classes for component unit tests
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Test Langflow's REST API endpoints using the async 'client' fixture and assert correct status codes and response structure.
src/backend/base/langflow/initial_setup/starter_projects/Document Q&A.json (5)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Use 'MockLanguageModel' for testing language model components without external API calls.
src/backend/base/langflow/base/models/model.py (1)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Test Langflow's 'Message' objects and chat functionality by asserting correct properties and structure.
src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json (5)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-23T12:46:29.953Z
Learning: All terminology such as 'Langflow', 'Component', 'Flow', 'API', and 'JSON' must be capitalized or uppercased as specified in the terminology section.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components
src/backend/base/langflow/components/models/language_model.py (2)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Use 'MockLanguageModel' for testing language model components without external API calls.
src/backend/tests/unit/components/agents/test_agent_component.py (8)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Test backward compatibility across Langflow versions by mapping component files to supported versions using 'VersionComponentMapping'.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Use ComponentTestBaseWithClient or ComponentTestBaseWithoutClient as base classes for component unit tests
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Create comprehensive unit tests for all new components
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Provide file_names_mapping in tests for backward compatibility version testing
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Test component configuration updates by asserting changes in build config dictionaries.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to src/backend/tests/**/*.py : Inherit from the appropriate ComponentTestBase class ('ComponentTestBase', 'ComponentTestBaseWithClient', or 'ComponentTestBaseWithoutClient') and provide the required fixtures: 'component_class', 'default_kwargs', and 'file_names_mapping' when adding a new component test.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/tests/unit/components/**/*.py : Mirror the component directory structure in unit tests under src/backend/tests/unit/components/
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Use 'MockLanguageModel' for testing language model components without external API calls.
src/backend/base/langflow/initial_setup/starter_projects/Financial Report Parser.json (5)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-23T12:46:29.953Z
Learning: All terminology such as 'Langflow', 'Component', 'Flow', 'API', and 'JSON' must be capitalized or uppercased as specified in the terminology section.
src/backend/base/langflow/initial_setup/starter_projects/Basic Prompting.json (5)
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components
src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json (6)
undefined
<retrieved_learning>
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the module_name parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/init.py : Update init.py with alphabetical imports when adding new components
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-23T12:46:29.953Z
Learning: All terminology such as 'Langflow', 'Component', 'Flow', 'API', and 'JSON' must be capitalized or uppercased as specified in the terminology section.
</retrieved_learning>
src/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.json (3)
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json (4)
undefined
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
</retrieved_learning>
<retrieved_learning>
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the module_name parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).
</retrieved_learning>
src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json (4)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-23T12:46:29.953Z
Learning: All terminology such as 'Langflow', 'Component', 'Flow', 'API', and 'JSON' must be capitalized or uppercased as specified in the terminology section.
src/backend/base/langflow/initial_setup/starter_projects/SEO Keyword Generator.json (4)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-23T12:46:29.953Z
Learning: All terminology such as 'Langflow', 'Component', 'Flow', 'API', and 'JSON' must be capitalized or uppercased as specified in the terminology section.
src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json (5)
undefined
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/init.py : Update init.py with alphabetical imports when adding new components
</retrieved_learning>
<retrieved_learning>
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the module_name parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).
</retrieved_learning>
src/backend/base/langflow/initial_setup/starter_projects/Market Research.json (2)
undefined
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
</retrieved_learning>
src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (6)
undefined
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
</retrieved_learning>
<retrieved_learning>
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the module_name parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-23T12:46:29.953Z
Learning: All terminology such as 'Langflow', 'Component', 'Flow', 'API', and 'JSON' must be capitalized or uppercased as specified in the terminology section.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/init.py : Update init.py with alphabetical imports when adding new components
</retrieved_learning>
src/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.json (6)
undefined
<retrieved_learning>
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the module_name parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/init.py : Update init.py with alphabetical imports when adding new components
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-23T12:46:29.953Z
Learning: All terminology such as 'Langflow', 'Component', 'Flow', 'API', and 'JSON' must be capitalized or uppercased as specified in the terminology section.
</retrieved_learning>
src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (3)
undefined
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
</retrieved_learning>
<retrieved_learning>
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the module_name parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
</retrieved_learning>
src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json (2)
undefined
<retrieved_learning>
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the module_name parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
</retrieved_learning>
src/backend/base/langflow/base/models/openai_constants.py (1)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-30T14:40:50.836Z
Learning: Use clear, recognizable, and consistent icon names for both backend and frontend (e.g., 'AstraDB', 'Postgres', 'OpenAI').
src/backend/base/langflow/utils/constants.py (1)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Test Langflow's 'Message' objects and chat functionality by asserting correct properties and structure.
src/backend/base/langflow/initial_setup/starter_projects/Image Sentiment Analysis.json (6)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: When implementing a new component icon in Langflow, ensure the icon name is clear, recognizable, and used consistently across both backend (Python 'icon' attribute) and frontend (React/TypeScript mapping).
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/*.py : Add new backend components to the appropriate subdirectory under src/backend/base/langflow/components/
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
src/backend/base/langflow/initial_setup/starter_projects/Blog Writer.json (3)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
src/backend/base/langflow/initial_setup/starter_projects/Basic Prompt Chaining.json (3)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
src/backend/base/langflow/components/openai/openai_chat_model.py (4)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Applies to src/backend/base/langflow/components/**/__init__.py : Update __init__.py with alphabetical imports when adding new components
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the `module_name` parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Use 'MockLanguageModel' for testing language model components without external API calls.
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-06-30T14:41:58.837Z
Learning: Applies to {src/backend/tests/**/*.py,tests/**/*.py} : Test backward compatibility across Langflow versions by mapping component files to supported versions using 'VersionComponentMapping'.
src/backend/base/langflow/initial_setup/starter_projects/Hybrid Search RAG.json (3)
undefined
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/docs_development.mdc:0-0
Timestamp: 2025-06-30T14:40:02.667Z
Learning: Applies to docs/docs/**/*.{md,mdx} : Use consistent terminology: always capitalize 'Langflow', 'Component', and 'Flow' when referring to Langflow concepts; always uppercase 'API' and 'JSON'.
</retrieved_learning>
<retrieved_learning>
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-06-30T14:39:17.428Z
Learning: Starter project files are auto-formatted after langflow run; these changes can be committed or ignored
</retrieved_learning>
<retrieved_learning>
Learnt from: ogabrielluiz
PR: langflow-ai/langflow#0
File: :0-0
Timestamp: 2025-06-26T19:43:18.260Z
Learning: In langflow custom components, the module_name parameter is now propagated through template building functions to add module metadata and code hashes to frontend nodes for better component tracking and debugging.
</retrieved_learning>
🪛 Pylint (3.3.7)
src/backend/tests/unit/components/models/test_language_model_component.py
[error] 9-9: No name 'base' in module 'langflow'
(E0611)
🪛 Ruff (0.11.9)
src/backend/base/langflow/base/models/openai_constants.py
13-13: Line too long (121 > 120)
(E501)
src/backend/base/langflow/utils/constants.py
22-22: Trailing whitespace
Remove trailing whitespace
(W291)
src/backend/base/langflow/components/openai/openai_chat_model.py
118-118: Line too long (153 > 120)
(E501)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Optimize new Python code in this PR
- GitHub Check: Ruff Style Check (3.13)
- GitHub Check: Update Starter Projects
- GitHub Check: Run Ruff Check and Format
🔇 Additional comments (25)
src/backend/base/langflow/components/icosacomputing/combinatorial_reasoner.py (1)
4-4: LGTM: Correct migration to chat-specific OpenAI models.The update from
OPENAI_MODEL_NAMEStoOPENAI_CHAT_MODEL_NAMESis appropriate for this component since it uses OpenAI models for conversational prompt optimization.Also applies to: 46-47
src/backend/base/langflow/utils/util.py (1)
385-385: Verified: REASONING_OPENAI_MODELS constant is present and correctly populatedThe
REASONING_OPENAI_MODELSconstant insrc/backend/base/langflow/utils/constants.pyincludes the expected reasoning model identifiers:
- "o1", "o1-mini", "o1-pro"
- "o3-mini", "o3", "o3-pro"
- "o4-mini", "o4-mini-high"
LGTM! 🚀
src/backend/tests/unit/components/models/test_language_model_component.py (2)
69-70: LGTM: Test assertions correctly updated for new model constants.The test properly verifies that the build config uses the new
OPENAI_CHAT_MODEL_NAMESconstant for both options and default value.
9-9: Import path is valid—adjust static analysis configurationThe module
langflow.base.models.openai_constantsis defined in
src/backend/base/langflow/base/models/openai_constants.pyand containsOPENAI_CHAT_MODEL_NAMES. The import in your test is correct. The “No name 'base' in module 'langflow'” error comes from static analysis not using the project’ssrc/backend/basedirectory on its Python path.• No changes to the code are needed.
• Update your linter/IDE/PYTHONPATH to includesrc/backend/baseso thatlangflow.base.modelsis recognized.src/backend/base/langflow/components/models/language_model.py (1)
10-10: LGTM: Comprehensive migration to chat-specific OpenAI models.The changes correctly update the import, input configuration, and dynamic build config to use
OPENAI_CHAT_MODEL_NAMES. This maintains consistency between the static input definition and runtime configuration updates.Also applies to: 38-39, 120-121
src/backend/base/langflow/base/models/model.py (1)
89-89: LGTM: Good refactoring to simplify method call.The direct use of
selfattributes in the method call is cleaner and more readable than the previous approach with intermediate variables.src/backend/tests/unit/components/agents/test_agent_component.py (2)
11-11: LGTM: Import updated to use new constant name.The import change aligns with the refactoring that separates chat models from reasoning models.
145-145: All relevant models are covered by the updated test.The agent tests now iterate over
OPENAI_CHAT_MODEL_NAMESandOPENAI_REASONING_MODEL_NAMES, which matches the LLM types supported byAgentComponent.
Search- and embedding-only models aren’t applicable here, so no models have been inadvertently omitted.src/backend/base/langflow/initial_setup/starter_projects/Financial Report Parser.json (1)
1082-1128: Constant swap looks fine – just double-check the constant is populatedGood call switching from
OPENAI_MODEL_NAMEStoOPENAI_CHAT_MODEL_NAMES; this keeps the starter aligned with the new chat-only list.
Please verify at runtime thatOPENAI_CHAT_MODEL_NAMESis not an empty list; otherwise the default value assignment (value=OPENAI_CHAT_MODEL_NAMES[0]) and the index access inupdate_build_configwill raiseIndexError.If the constant can ever be empty in downstream builds, guard with a fallback:
- value=OPENAI_CHAT_MODEL_NAMES[0], + value=OPENAI_CHAT_MODEL_NAMES[0] if OPENAI_CHAT_MODEL_NAMES else "",Same for the
update_build_configbranch.src/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.json (1)
3080-3088: Verify availability of the new constantThe embedded code now imports
OPENAI_CHAT_MODEL_NAMES.
Please ensure this symbol is exported bylangflow.base.models.openai_constantsand that no other module still references the removedOPENAI_MODEL_NAMES, otherwise the starter project will crash on import.src/backend/base/langflow/initial_setup/starter_projects/Custom Component Maker.json (1)
2656-2700: ✅ Confirmed:OPENAI_CHAT_MODEL_NAMESis defined as expectedThe constant is present in
src/backend/base/langflow/base/models/openai_constants.py(line 62), so the import path is correct and will not fail at runtime.src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json (1)
2051-2060: Constant rename correctly scopes to chat-capable OpenAI models – LGTM
OPENAI_CHAT_MODEL_NAMEScleanly replaces the deprecated catch-all list, and the dropdown’s default (OPENAI_CHAT_MODEL_NAMES[0]) remains safe as long as the constant is non-empty. Import path is valid after the recent refactor, so no action needed.src/backend/base/langflow/initial_setup/starter_projects/Market Research.json (1)
1818-1834: 👍 Correct constant swap toOPENAI_CHAT_MODEL_NAMESReplacing the legacy
OPENAI_MODEL_NAMESwithOPENAI_CHAT_MODEL_NAMESaligns this starter project with the new chat-only model taxonomy introduced in the PR. No further action needed here.src/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.json (2)
2082-2089: Import list now accurate — LGTM
OPENAI_MODEL_NAMES→OPENAI_CHAT_MODEL_NAMESis reflected both in the import and every subsequent use. No other dangling references observed in the snippet.
1490-1498: Ignore empty-list guard for OPENAI_CHAT_MODEL_NAMESOPENAI_CHAT_MODEL_NAMES is a static constant derived at import from OPENAI_MODELS_DETAILED in code—not from an environment override—so it will never be “empty” in a properly configured repo. Introducing a fallback of
""would only conceal a deeper misconfiguration (no supported models) that should fail loudly. All existing code and tests rely on this list being non-empty.Likely an incorrect or invalid review comment.
src/backend/base/langflow/initial_setup/starter_projects/Image Sentiment Analysis.json (1)
1527-1540: Switched toOPENAI_CHAT_MODEL_NAMES— looks correctUsing the new chat-specific constant in both the import and the
DropdownInput/update_build_configlogic cleanly scopes the selectable models to chat-capable ones. Nothing else in the snippet requires adjustment.
👍 No further action needed.Also applies to: 1815-1830
src/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.json (1)
2953-2976: Constant switch toOPENAI_CHAT_MODEL_NAMESlooks goodImporting
OPENAI_CHAT_MODEL_NAMESand wiring it into theDropdownInputplus theupdate_build_configlogic keeps the starter project aligned with the revised constant set. No functional issues spotted here.src/backend/base/langflow/base/models/openai_constants.py (3)
19-25: LGTM! New reasoning models added correctly.The new reasoning models (o1-mini, o1-pro, o3-mini, o3, o3-pro, o4-mini, o4-mini-high) follow OpenAI's naming conventions and are properly configured with the
reasoning=Trueattribute.
62-68: Excellent improvement to model filtering logic.The renaming to
OPENAI_CHAT_MODEL_NAMESis more descriptive, and the addition ofnot_supportedfiltering ensures that unsupported models are properly excluded from the chat model list.
91-91: Good backward compatibility maintenance.The alias update ensures existing code continues to work while pointing to the more accurately named constant.
src/backend/base/langflow/initial_setup/starter_projects/Basic Prompt Chaining.json (1)
1299-1299: LGTM! Consistent import updates across embedded components.The import statements have been consistently updated from
OPENAI_MODEL_NAMEStoOPENAI_CHAT_MODEL_NAMESacross all three embedded LanguageModelComponent instances in this starter project. This aligns with the broader refactoring to separate chat models from reasoning models.Also applies to: 1586-1586, 1873-1873
src/backend/base/langflow/components/openai/openai_chat_model.py (4)
8-10: LGTM! Consistent import updates.The import has been correctly updated to use
OPENAI_CHAT_MODEL_NAMESand addsOPENAI_REASONING_MODEL_NAMES, aligning with the model categorization refactoring.
48-49: LGTM! Appropriate model options expansion.The dropdown now includes both chat and reasoning models while maintaining the chat model as the default value. This provides users with access to all available OpenAI models while preserving backward compatibility.
100-100: LGTM! Useful debug logging.The debug log statement will help with troubleshooting by clearly showing which model is being used for each request.
146-156: LGTM! Well-structured field visibility logic.The
update_build_configmethod now properly handles field visibility based on model type:
- Hides
temperature,seed, andsystem_messagefor reasoning models (especially o1 models)- Shows all fields for chat models
This provides a better user experience by only displaying relevant configuration options for each model type.
| "type": "code", | ||
| "value": "from typing import Any\n\nfrom langchain_anthropic import ChatAnthropic\nfrom langchain_google_genai import ChatGoogleGenerativeAI\nfrom langchain_openai import ChatOpenAI\n\nfrom langflow.base.models.anthropic_constants import ANTHROPIC_MODELS\nfrom langflow.base.models.google_generative_ai_constants import GOOGLE_GENERATIVE_AI_MODELS\nfrom langflow.base.models.model import LCModelComponent\nfrom langflow.base.models.openai_constants import OPENAI_MODEL_NAMES\nfrom langflow.field_typing import LanguageModel\nfrom langflow.field_typing.range_spec import RangeSpec\nfrom langflow.inputs.inputs import BoolInput\nfrom langflow.io import DropdownInput, MessageInput, MultilineInput, SecretStrInput, SliderInput\nfrom langflow.schema.dotdict import dotdict\n\n\nclass LanguageModelComponent(LCModelComponent):\n display_name = \"Language Model\"\n description = \"Runs a language model given a specified provider. \"\n icon = \"brain-circuit\"\n category = \"models\"\n priority = 0 # Set priority to 0 to make it appear first\n\n inputs = [\n DropdownInput(\n name=\"provider\",\n display_name=\"Model Provider\",\n options=[\"OpenAI\", \"Anthropic\", \"Google\"],\n value=\"OpenAI\",\n info=\"Select the model provider\",\n real_time_refresh=True,\n options_metadata=[{\"icon\": \"OpenAI\"}, {\"icon\": \"Anthropic\"}, {\"icon\": \"GoogleGenerativeAI\"}],\n ),\n DropdownInput(\n name=\"model_name\",\n display_name=\"Model Name\",\n options=OPENAI_MODEL_NAMES,\n value=OPENAI_MODEL_NAMES[0],\n info=\"Select the model to use\",\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"OpenAI API Key\",\n info=\"Model Provider API key\",\n required=False,\n show=True,\n real_time_refresh=True,\n ),\n MessageInput(\n name=\"input_value\",\n display_name=\"Input\",\n info=\"The input text to send to the model\",\n ),\n MultilineInput(\n name=\"system_message\",\n display_name=\"System Message\",\n info=\"A system message that helps set the behavior of the assistant\",\n advanced=True,\n ),\n BoolInput(\n name=\"stream\",\n display_name=\"Stream\",\n info=\"Whether to stream the response\",\n value=False,\n advanced=True,\n ),\n SliderInput(\n name=\"temperature\",\n display_name=\"Temperature\",\n value=0.1,\n info=\"Controls randomness in responses\",\n range_spec=RangeSpec(min=0, max=1, step=0.01),\n advanced=True,\n ),\n ]\n\n def build_model(self) -> LanguageModel:\n provider = self.provider\n model_name = self.model_name\n temperature = self.temperature\n stream = self.stream\n\n if provider == \"OpenAI\":\n if not self.api_key:\n msg = \"OpenAI API key is required when using OpenAI provider\"\n raise ValueError(msg)\n return ChatOpenAI(\n model_name=model_name,\n temperature=temperature,\n streaming=stream,\n openai_api_key=self.api_key,\n )\n if provider == \"Anthropic\":\n if not self.api_key:\n msg = \"Anthropic API key is required when using Anthropic provider\"\n raise ValueError(msg)\n return ChatAnthropic(\n model=model_name,\n temperature=temperature,\n streaming=stream,\n anthropic_api_key=self.api_key,\n )\n if provider == \"Google\":\n if not self.api_key:\n msg = \"Google API key is required when using Google provider\"\n raise ValueError(msg)\n return ChatGoogleGenerativeAI(\n model=model_name,\n temperature=temperature,\n streaming=stream,\n google_api_key=self.api_key,\n )\n msg = f\"Unknown provider: {provider}\"\n raise ValueError(msg)\n\n def update_build_config(self, build_config: dotdict, field_value: Any, field_name: str | None = None) -> dotdict:\n if field_name == \"provider\":\n if field_value == \"OpenAI\":\n build_config[\"model_name\"][\"options\"] = OPENAI_MODEL_NAMES\n build_config[\"model_name\"][\"value\"] = OPENAI_MODEL_NAMES[0]\n build_config[\"api_key\"][\"display_name\"] = \"OpenAI API Key\"\n elif field_value == \"Anthropic\":\n build_config[\"model_name\"][\"options\"] = ANTHROPIC_MODELS\n build_config[\"model_name\"][\"value\"] = ANTHROPIC_MODELS[0]\n build_config[\"api_key\"][\"display_name\"] = \"Anthropic API Key\"\n elif field_value == \"Google\":\n build_config[\"model_name\"][\"options\"] = GOOGLE_GENERATIVE_AI_MODELS\n build_config[\"model_name\"][\"value\"] = GOOGLE_GENERATIVE_AI_MODELS[0]\n build_config[\"api_key\"][\"display_name\"] = \"Google API Key\"\n return build_config\n" | ||
| "value": "from typing import Any\n\nfrom langchain_anthropic import ChatAnthropic\nfrom langchain_google_genai import ChatGoogleGenerativeAI\nfrom langchain_openai import ChatOpenAI\n\nfrom langflow.base.models.anthropic_constants import ANTHROPIC_MODELS\nfrom langflow.base.models.google_generative_ai_constants import GOOGLE_GENERATIVE_AI_MODELS\nfrom langflow.base.models.model import LCModelComponent\nfrom langflow.base.models.openai_constants import OPENAI_CHAT_MODEL_NAMES\nfrom langflow.field_typing import LanguageModel\nfrom langflow.field_typing.range_spec import RangeSpec\nfrom langflow.inputs.inputs import BoolInput\nfrom langflow.io import DropdownInput, MessageInput, MultilineInput, SecretStrInput, SliderInput\nfrom langflow.schema.dotdict import dotdict\n\n\nclass LanguageModelComponent(LCModelComponent):\n display_name = \"Language Model\"\n description = \"Runs a language model given a specified provider. \"\n icon = \"brain-circuit\"\n category = \"models\"\n priority = 0 # Set priority to 0 to make it appear first\n\n inputs = [\n DropdownInput(\n name=\"provider\",\n display_name=\"Model Provider\",\n options=[\"OpenAI\", \"Anthropic\", \"Google\"],\n value=\"OpenAI\",\n info=\"Select the model provider\",\n real_time_refresh=True,\n options_metadata=[{\"icon\": \"OpenAI\"}, {\"icon\": \"Anthropic\"}, {\"icon\": \"GoogleGenerativeAI\"}],\n ),\n DropdownInput(\n name=\"model_name\",\n display_name=\"Model Name\",\n options=OPENAI_CHAT_MODEL_NAMES,\n value=OPENAI_CHAT_MODEL_NAMES[0],\n info=\"Select the model to use\",\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"OpenAI API Key\",\n info=\"Model Provider API key\",\n required=False,\n show=True,\n real_time_refresh=True,\n ),\n MessageInput(\n name=\"input_value\",\n display_name=\"Input\",\n info=\"The input text to send to the model\",\n ),\n MultilineInput(\n name=\"system_message\",\n display_name=\"System Message\",\n info=\"A system message that helps set the behavior of the assistant\",\n advanced=True,\n ),\n BoolInput(\n name=\"stream\",\n display_name=\"Stream\",\n info=\"Whether to stream the response\",\n value=False,\n advanced=True,\n ),\n SliderInput(\n name=\"temperature\",\n display_name=\"Temperature\",\n value=0.1,\n info=\"Controls randomness in responses\",\n range_spec=RangeSpec(min=0, max=1, step=0.01),\n advanced=True,\n ),\n ]\n\n def build_model(self) -> LanguageModel:\n provider = self.provider\n model_name = self.model_name\n temperature = self.temperature\n stream = self.stream\n\n if provider == \"OpenAI\":\n if not self.api_key:\n msg = \"OpenAI API key is required when using OpenAI provider\"\n raise ValueError(msg)\n return ChatOpenAI(\n model_name=model_name,\n temperature=temperature,\n streaming=stream,\n openai_api_key=self.api_key,\n )\n if provider == \"Anthropic\":\n if not self.api_key:\n msg = \"Anthropic API key is required when using Anthropic provider\"\n raise ValueError(msg)\n return ChatAnthropic(\n model=model_name,\n temperature=temperature,\n streaming=stream,\n anthropic_api_key=self.api_key,\n )\n if provider == \"Google\":\n if not self.api_key:\n msg = \"Google API key is required when using Google provider\"\n raise ValueError(msg)\n return ChatGoogleGenerativeAI(\n model=model_name,\n temperature=temperature,\n streaming=stream,\n google_api_key=self.api_key,\n )\n msg = f\"Unknown provider: {provider}\"\n raise ValueError(msg)\n\n def update_build_config(self, build_config: dotdict, field_value: Any, field_name: str | None = None) -> dotdict:\n if field_name == \"provider\":\n if field_value == \"OpenAI\":\n build_config[\"model_name\"][\"options\"] = OPENAI_CHAT_MODEL_NAMES\n build_config[\"model_name\"][\"value\"] = OPENAI_CHAT_MODEL_NAMES[0]\n build_config[\"api_key\"][\"display_name\"] = \"OpenAI API Key\"\n elif field_value == \"Anthropic\":\n build_config[\"model_name\"][\"options\"] = ANTHROPIC_MODELS\n build_config[\"model_name\"][\"value\"] = ANTHROPIC_MODELS[0]\n build_config[\"api_key\"][\"display_name\"] = \"Anthropic API Key\"\n elif field_value == \"Google\":\n build_config[\"model_name\"][\"options\"] = GOOGLE_GENERATIVE_AI_MODELS\n build_config[\"model_name\"][\"value\"] = GOOGLE_GENERATIVE_AI_MODELS[0]\n build_config[\"api_key\"][\"display_name\"] = \"Google API Key\"\n return build_config\n" | ||
| }, |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Potential mismatch between dynamic constant & hard-coded options
The DropdownInput for model_name is now populated from OPENAI_CHAT_MODEL_NAMES, but farther down in the template the same field is still rendered with a hard-coded list of model strings.
If the constant is updated (e.g., adding new chat models or pruning deprecated ones) the UI will present two divergent lists depending on which code path is hit, causing confusing UX and brittle tests.
Consider eliminating the static list and sourcing the options exclusively from the constant, e.g.:
- options=[...hard-coded list...]
+ options=OPENAI_CHAT_MODEL_NAMESor drop the duplicate JSON entry altogether so that update_build_config owns the truth.
This keeps the starter project auto-sync’d with core constant changes.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Instagram
Copywriter.json around lines 2680 to 2682, the DropdownInput for model_name uses
a hard-coded list of model strings that can diverge from the dynamic constant
OPENAI_CHAT_MODEL_NAMES used elsewhere. To fix this, remove the static
hard-coded list for model_name options and instead source all model_name options
exclusively from the relevant constants like OPENAI_CHAT_MODEL_NAMES,
ANTHROPIC_MODELS, and GOOGLE_GENERATIVE_AI_MODELS. Alternatively, eliminate the
duplicate JSON entry for model_name options so that update_build_config fully
controls the options, ensuring the UI stays consistent and in sync with core
constant updates.
|
@jordanrfrazier can you add them to the agent testing also? To ensure the models support Tool calling. |
I believe that's already in the PR. Am I missing a test? |
|
Testing |
|
@jordanrfrazier In the language model component, by default, the system message is in advanced=True to make the core component simple. If you want to disable the system message for a certain model, you might need to change show=False, using the update build config. @coderabbitai suggest the above changes and code changes with respect to the above changes. |
mfortman11
left a comment
There was a problem hiding this comment.
Works for me just a couple nits
734a6df to
9bec48b
Compare
…nt definitions across various templates. Ensure consistent imports and component descriptions for improved clarity and documentation.
… models Updated the LanguageModelComponent and OpenAIModelComponent to check for the presence of "system_message" in build_config before modifying its visibility based on model_name. This change improves the robustness of the configuration handling for different model types.
* Add new openai reasoning models * [autofix.ci] apply automated fixes * Updates language model, but FE doesn't send a POST for updating template atm * use chatopenai constants * [autofix.ci] apply automated fixes * Add reasoning to language model test * Remove temp from all reasoning models * t [autofix.ci] apply automated fixes * refactor: Update template notes (#8816) * update templates * small-changes * template cleanup --------- Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> * ruff * uv lock * starter projects update * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Mike Fortman <michael.fortman@datastax.com> Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
* Add new openai reasoning models * [autofix.ci] apply automated fixes * Updates language model, but FE doesn't send a POST for updating template atm * use chatopenai constants * [autofix.ci] apply automated fixes * Add reasoning to language model test * Remove temp from all reasoning models * t [autofix.ci] apply automated fixes * refactor: Update template notes (#8816) * update templates * small-changes * template cleanup --------- Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> * ruff * uv lock * starter projects update * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Mike Fortman <michael.fortman@datastax.com> Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
* Add new openai reasoning models * [autofix.ci] apply automated fixes * Updates language model, but FE doesn't send a POST for updating template atm * use chatopenai constants * [autofix.ci] apply automated fixes * Add reasoning to language model test * Remove temp from all reasoning models * t [autofix.ci] apply automated fixes * refactor: Update template notes (#8816) * update templates * small-changes * template cleanup --------- Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> * ruff * uv lock * starter projects update * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Mike Fortman <michael.fortman@datastax.com> Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
* Add new openai reasoning models * [autofix.ci] apply automated fixes * Updates language model, but FE doesn't send a POST for updating template atm * use chatopenai constants * [autofix.ci] apply automated fixes * Add reasoning to language model test * Remove temp from all reasoning models * t [autofix.ci] apply automated fixes * refactor: Update template notes (langflow-ai#8816) * update templates * small-changes * template cleanup --------- Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> * ruff * uv lock * starter projects update * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Mike Fortman <michael.fortman@datastax.com> Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
Adds new openai reasoning models. Also adds reasoning models to LanguageModel component.
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Tests