Skip to content

Conversation

@naga-k
Copy link

@naga-k naga-k commented Nov 23, 2025

\ud83d\udd27 Automated Fix\n\nThis PR addresses issue #10694: Add documentation/examples for file uploads via Python API\n\n### \ud83d\udccb Issue Reference\nCloses #10694\nOriginal issue: https://github.com/langflow-ai/langflow/issues/10694\n\n### \ud83e\udd16 How This Was Generated\nThis fix was automatically generated using AI-powered code analysis and remediation:\n- Tool: Kilo AI Code Assistant\n- Analysis: Analyzed the issue description and codebase context\n- Implementation: Applied targeted fixes based on best practices\n\n### \u2705 Changes Made\nPlease review the changes in the Files Changed tab. The modifications were made to address the specific requirements outlined in the issue.\n\n### \ud83e\uddea Testing\nPlease verify:\n1. The fix addresses the issue as described\n2. No regressions are introduced\n3. Code quality and style are maintained\n\n---\nGenerated by Soulcaster AI Agent\n

Summary by CodeRabbit

  • Documentation
    • Added comprehensive API request examples in multiple programming languages (curl, Python)
    • Introduced complete file upload workflow guide with practical code samples and frontend integration patterns
    • Added Streamlit application integration documentation for document upload, flow execution, and interactive chat
    • Added vector store file injection guide for advanced file-based data integration workflows
    • Expanded documentation navigation with new guides in the Develop section

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added the community Pull Request from an external contributor label Nov 23, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 23, 2025

Walkthrough

Documentation update introducing file upload integration workflows, expanded multi-language API examples, Streamlit integration guide, and vector store API injection documentation. Adds two new Develop documentation entries to sidebar configuration with comprehensive examples for file handling and vector store operations.

Changes

Cohort / File(s) Summary
API Reference Documentation
docs/docs/API-Reference/api-files.mdx, docs/docs/API-Reference/api-reference-api-examples.mdx
Adds reusable tip blocks with linked resources to API files documentation. Expands API examples with multi-tab, multi-language interaction showcase (curl, Python requests/httpx) and introduces comprehensive "Complete File Upload Workflow" section with Python client class (LangflowFileUploadClient), end-to-end example function, and React frontend integration example for file upload workflows.
Develop Integration Guides
docs/docs/Develop/streamlit-integration-example.mdx, docs/docs/Develop/vector-store-api-integration.mdx
Introduces Streamlit integration example with LangflowClient methods for file uploads, user identification, and flow execution, including UI components (sidebar, file uploader, chat interface) and error handling. Adds comprehensive guide for vector store file injection via API tweaks mechanism with examples for ChromaDB, Pinecone, FAISS, AstraDB configurations, multi-component RAG flows, and best practices.
Sidebar Configuration
docs/sidebars.js
Adds two new documentation entries under Develop category: streamlit-integration-example and vector-store-api-integration as sibling items after existing configuration-cli entry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas requiring attention:
    • Accuracy of LangflowFileUploadClient implementation and method signatures in API examples
    • Completeness and correctness of component ID identification examples in vector store integration guide
    • Verification that file upload workflow examples align with actual Langflow API behavior
    • Consistency of Python code examples across curl, requests, and httpx implementations
    • Accuracy of Streamlit integration implementation and configuration guidance

Possibly related PRs

Suggested labels

documentation, size:XL, lgtm

Suggested reviewers

  • mendonk
  • ogabrielluiz
  • carlosrcoelho

Pre-merge checks and finishing touches

✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding documentation and examples for file uploads via Python API. It is clear, concise, and directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Test Coverage For New Implementations ✅ Passed This is a documentation-only PR with no new production code implementations requiring test coverage.
Test Quality And Coverage ✅ Passed This is a documentation-only PR with no new source code implementations requiring tests.
Test File Naming And Structure ✅ Passed PR contains only documentation changes (MDX files and sidebar config); no test files were introduced or modified.
Excessive Mock Usage Warning ✅ Passed The PR contains only documentation changes (4 MDX files and 1 JavaScript config file) with no test files, making the excessive mock usage check non-applicable.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
docs/docs/API-Reference/api-reference-api-examples.mdx (1)

399-484: React example is functional but incomplete.

The React component demonstrates the integration pattern well, but references undefined variables and functions (FLOW_ID, FILE_COMPONENT_ID, extractChatResponse). For documentation purposes, this is acceptable as it focuses on the core integration logic.

Consider adding a brief note that this is a simplified example and users should:

  • Define the constants (FLOW_ID, FILE_COMPONENT_ID) from their flow configuration
  • Implement extractChatResponse similar to the Python client's method
  • Add proper error handling UI

Alternatively, add comments in the code:

// Define these constants from your Langflow flow configuration
const FLOW_ID = process.env.REACT_APP_FLOW_ID;
const FILE_COMPONENT_ID = process.env.REACT_APP_FILE_COMPONENT_ID;

// Extract response (implementation similar to Python client)
const extractChatResponse = (result) => {
  // ... implementation
};
docs/docs/Develop/streamlit-integration-example.mdx (1)

268-270: Streamlit API usage is correct; version documentation is optional.

The code at line 270 correctly uses st.rerun(), which is the current stable API in Streamlit 2025 and has been since version 1.27.0. The stable API is st.rerun() (replaces the deprecated st.experimental_rerun).

Adding a minimum Streamlit version requirement to the prerequisites or installation section would be a good practice for clarity, but is not required for correctness. The code as written is compatible with current Streamlit versions.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f6c9a7 and e7f4ec7.

📒 Files selected for processing (5)
  • docs/docs/API-Reference/api-files.mdx (1 hunks)
  • docs/docs/API-Reference/api-reference-api-examples.mdx (3 hunks)
  • docs/docs/Develop/streamlit-integration-example.mdx (1 hunks)
  • docs/docs/Develop/vector-store-api-integration.mdx (1 hunks)
  • docs/sidebars.js (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-07-11T21:32:57.160Z
Learnt from: namastex888
Repo: langflow-ai/langflow PR: 9018
File: src/frontend/src/modals/apiModal/utils/get-curl-code.tsx:139-184
Timestamp: 2025-07-11T21:32:57.160Z
Learning: In TypeScript/JavaScript cURL code generation for Langflow, PowerShell commands must use backticks (`) for line continuation and follow the pattern: `curl --request POST \` followed by `--url`, `--header` flags on separate lines. Unix commands use backslashes (\) for line continuation. File upload commands should maintain platform-specific formatting just like other cURL commands in the codebase.

Applied to files:

  • docs/docs/API-Reference/api-reference-api-examples.mdx
📚 Learning: 2025-07-23T21:19:22.567Z
Learnt from: deon-sanchez
Repo: langflow-ai/langflow PR: 9158
File: src/backend/base/langflow/api/v1/mcp_projects.py:404-404
Timestamp: 2025-07-23T21:19:22.567Z
Learning: In langflow MCP projects configuration, prefer using dynamically computed URLs (like the `sse_url` variable) over hardcoded localhost URLs to ensure compatibility across different deployment environments.

Applied to files:

  • docs/docs/API-Reference/api-reference-api-examples.mdx
📚 Learning: 2025-10-29T03:55:50.216Z
Learnt from: ricofurtado
Repo: langflow-ai/langflow PR: 10430
File: src/backend/base/langflow/api/v2/registration.py:0-0
Timestamp: 2025-10-29T03:55:50.216Z
Learning: In the langflow project, user registration endpoints in API v2 (`src/backend/base/langflow/api/v2/registration.py`) are intentionally designed to be unauthenticated to support Desktop application initialization and onboarding flows.

Applied to files:

  • docs/docs/API-Reference/api-reference-api-examples.mdx
📚 Learning: 2025-08-07T20:23:23.569Z
Learnt from: edwinjosechittilappilly
Repo: langflow-ai/langflow PR: 0
File: :0-0
Timestamp: 2025-08-07T20:23:23.569Z
Learning: The Langflow codebase has an excellent structlog implementation that follows best practices, with proper global configuration, environment-based output formatting, and widespread adoption across components. The main cleanup needed is updating starter project templates and documentation examples that still contain legacy `from loguru import logger` imports.

Applied to files:

  • docs/docs/Develop/streamlit-integration-example.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test Docs Build / Test Docs Build
🔇 Additional comments (15)
docs/docs/API-Reference/api-files.mdx (1)

296-302: LGTM! Helpful cross-references added.

The tip block provides useful navigation to comprehensive examples and guides, well-placed after the basic file upload instructions. The links align with the new documentation being added in this PR.

docs/sidebars.js (1)

163-172: LGTM! Sidebar entries properly configured.

The new documentation entries are correctly formatted and logically placed in the Develop section. The IDs match the slugs defined in the corresponding MDX files.

docs/docs/Develop/vector-store-api-integration.mdx (5)

52-157: LGTM! Well-structured example with good practices.

The complete workflow example demonstrates proper error handling, clear step-by-step process, and helpful console output. The placeholder credentials and component IDs are appropriately marked as examples that users need to replace.


167-214: LGTM! Comprehensive vector store configurations.

The examples cover multiple popular vector store types with appropriate configuration parameters for each, helping users understand the tweaks structure for different backends.


220-304: LGTM! Excellent advanced RAG flow example.

The multi-component configuration demonstrates a realistic RAG pipeline with proper component organization and comprehensive tweaks. The component ID dictionary pattern is a good practice that improves maintainability.


358-396: LGTM! Useful debugging utility.

The debug function provides clear, actionable feedback for troubleshooting flow execution issues. The hierarchical error checking pattern is well-designed.


398-423: LGTM! Comprehensive best practices guidance.

The best practices section covers key areas including security, performance, and maintainability with practical, actionable recommendations.

docs/docs/Develop/streamlit-integration-example.mdx (4)

31-103: LGTM! Well-designed client class for Streamlit.

The LangflowClient class provides a clean interface for Langflow integration with proper method separation and error handling. The implementation correctly handles Streamlit's UploadedFile objects in the upload_file method.


104-158: LGTM! Well-structured Streamlit configuration UI.

The sidebar configuration provides clear inputs with helpful guidance. Good use of environment variables for defaults and proper handling of sensitive API keys with password input type.


164-191: LGTM! Robust file upload implementation.

The file upload section handles multiple files with proper error handling for individual failures, progress indication, and clear user feedback. The file type restrictions are appropriate for document processing workflows.


276-323: LGTM! Clear configuration guidance.

The flow configuration guide provides step-by-step instructions for setting up the integration, including a helpful visual diagram of the component flow and practical tweaks examples.

docs/docs/API-Reference/api-reference-api-examples.mdx (4)

29-136: LGTM! Excellent multi-language examples.

The tabbed examples provide clear progression from cURL to synchronous and asynchronous Python implementations. The consistency across examples helps users understand the same operation in different contexts.


228-341: LGTM! Professional-quality client implementation.

The LangflowFileUploadClient class is well-architected with proper type hints, comprehensive error handling, and thoughtful method design. The run_flow_with_files method's **component_tweaks parameter provides good extensibility for additional component configuration.


342-397: LGTM! Complete end-to-end workflow example.

The complete_workflow_example function demonstrates the entire process clearly with helpful console output and proper error handling. The step-by-step structure makes it easy for users to adapt to their needs.


211-484: LGTM! Comprehensive file upload workflow documentation.

The new "Complete File Upload Workflow" section significantly enhances the API documentation by providing production-ready examples that bridge the gap between basic API calls and real-world application integration. The progression from Python client to complete workflow to frontend examples is well-structured.

Comment on lines +369 to +373
## Next Steps

- [Explore more Langflow API examples](../API-Reference/api-reference-api-examples)
- [Learn about file management in Langflow](../concepts-file-management)
- [Build custom Streamlit interfaces with different Langflow flows](https://github.com/langflow-ai/langflow/discussions) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Verify documentation link path.

Line 372 references ../concepts-file-management, but based on the sidebar structure, the file management documentation is located at ../Develop/concepts-file-management (under the Develop section, Storage and memory subsection).

Run the following script to verify the correct path:


🏁 Script executed:

#!/bin/bash
# Find the file management documentation
fd -t f "concepts-file-management.mdx" docs/
# Check its location relative to Develop directory
fd -t f "concepts-file-management.mdx" docs/ --exec echo "Found: {}"

Length of output: 100


Fix incorrect relative link path.

Line 372 references ../concepts-file-management, but since concepts-file-management.mdx is located in the same Develop directory as streamlit-integration-example.mdx, the correct relative path should be ./concepts-file-management (or simply concepts-file-management).

🤖 Prompt for AI Agents
In docs/docs/Develop/streamlit-integration-example.mdx around lines 369 to 373,
the relative link to the concepts-file-management page is incorrect (uses
../concepts-file-management) even though concepts-file-management.mdx is in the
same Develop directory; update the link to use a same-directory relative path
such as ./concepts-file-management or simply concepts-file-management so it
resolves correctly.

Comment on lines +310 to +352
```python
def detect_flow_components(flow_id: str):
"""Get component information from a flow"""

# First, get the flow details
response = requests.get(
f"{langflow_url}/api/v1/flows/{flow_id}",
headers={"x-api-key": api_key}
)

if response.status_code == 200:
flow_data = response.json()

# Extract component information
vertices = flow_data.get("data", {}).get("vertices", {})

component_map = {}
for vertex_id, vertex_data in vertices.items():
component_type = vertex_data.get("type", "")
display_name = vertex_data.get("template", {}).get("display_name", "")

# Map common component types
if "File" in component_type:
component_map["file"] = vertex_id
elif any(store in component_type for store in ["Chroma", "Pinecone", "FAISS", "Astra"]):
component_map["vector_store"] = vertex_id
elif "Embeddings" in component_type:
component_map["embeddings"] = vertex_id
elif "Splitter" in component_type or "Text" in component_type:
component_map["text_splitter"] = vertex_id
elif "Retriever" in component_type:
component_map["retriever"] = vertex_id
elif "LLM" in component_type or "OpenAI" in component_type or "Model" in component_type:
component_map["llm"] = vertex_id

return component_map

return {}

# Usage
component_map = detect_flow_components(flow_id)
print("Detected components:", component_map)
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix missing function parameters.

The detect_flow_components function references langflow_url and api_key variables (lines 316, 317) that are not defined in the function parameters. This will cause a NameError when the function is called.

Apply this diff to fix the issue:

-def detect_flow_components(flow_id: str):
+def detect_flow_components(flow_id: str, langflow_url: str, api_key: str):
     """Get component information from a flow"""
     
     # First, get the flow details

Also update the usage example:

 # Usage
-component_map = detect_flow_components(flow_id)
+component_map = detect_flow_components(flow_id, langflow_url, api_key)
 print("Detected components:", component_map)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```python
def detect_flow_components(flow_id: str):
"""Get component information from a flow"""
# First, get the flow details
response = requests.get(
f"{langflow_url}/api/v1/flows/{flow_id}",
headers={"x-api-key": api_key}
)
if response.status_code == 200:
flow_data = response.json()
# Extract component information
vertices = flow_data.get("data", {}).get("vertices", {})
component_map = {}
for vertex_id, vertex_data in vertices.items():
component_type = vertex_data.get("type", "")
display_name = vertex_data.get("template", {}).get("display_name", "")
# Map common component types
if "File" in component_type:
component_map["file"] = vertex_id
elif any(store in component_type for store in ["Chroma", "Pinecone", "FAISS", "Astra"]):
component_map["vector_store"] = vertex_id
elif "Embeddings" in component_type:
component_map["embeddings"] = vertex_id
elif "Splitter" in component_type or "Text" in component_type:
component_map["text_splitter"] = vertex_id
elif "Retriever" in component_type:
component_map["retriever"] = vertex_id
elif "LLM" in component_type or "OpenAI" in component_type or "Model" in component_type:
component_map["llm"] = vertex_id
return component_map
return {}
# Usage
component_map = detect_flow_components(flow_id)
print("Detected components:", component_map)
```
def detect_flow_components(flow_id: str, langflow_url: str, api_key: str):
"""Get component information from a flow"""
# First, get the flow details
response = requests.get(
f"{langflow_url}/api/v1/flows/{flow_id}",
headers={"x-api-key": api_key}
)
if response.status_code == 200:
flow_data = response.json()
# Extract component information
vertices = flow_data.get("data", {}).get("vertices", {})
component_map = {}
for vertex_id, vertex_data in vertices.items():
component_type = vertex_data.get("type", "")
display_name = vertex_data.get("template", {}).get("display_name", "")
# Map common component types
if "File" in component_type:
component_map["file"] = vertex_id
elif any(store in component_type for store in ["Chroma", "Pinecone", "FAISS", "Astra"]):
component_map["vector_store"] = vertex_id
elif "Embeddings" in component_type:
component_map["embeddings"] = vertex_id
elif "Splitter" in component_type or "Text" in component_type:
component_map["text_splitter"] = vertex_id
elif "Retriever" in component_type:
component_map["retriever"] = vertex_id
elif "LLM" in component_type or "OpenAI" in component_type or "Model" in component_type:
component_map["llm"] = vertex_id
return component_map
return {}
# Usage
component_map = detect_flow_components(flow_id, langflow_url, api_key)
print("Detected components:", component_map)
🤖 Prompt for AI Agents
In docs/docs/Develop/vector-store-api-integration.mdx around lines 310 to 352,
the detect_flow_components function uses undefined globals langflow_url and
api_key; change the function signature to accept langflow_url and api_key as
parameters, replace references to the globals with those parameters, and update
the usage example to call detect_flow_components(flow_id, langflow_url, api_key)
(or pass concrete values/variables) so the function has the required inputs.

Comment on lines +424 to +429
## Next Steps

- [Complete Streamlit integration example](./streamlit-integration-example)
- [Langflow API reference](../API-Reference/api-reference-api-examples)
- [Vector store documentation](../Components/components-vector-stores)
- [Best practices for RAG flows](https://github.com/langflow-ai/langflow/discussions) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Verify the vector store documentation link.

Line 428 references ../Components/components-vector-stores, but based on the sidebar structure in sidebars.js, there doesn't appear to be a dedicated vector stores documentation page. Vector store components are likely covered in the bundles section or the data components section.

Run the following script to check if the referenced documentation file exists:


🏁 Script executed:

#!/bin/bash
# Check if the vector stores documentation exists
fd -t f "components-vector-stores.mdx" docs/
# Also search for vector store related documentation
fd -t f -e mdx . docs/docs/Components/ | xargs grep -l "vector store" -i

Length of output: 1177


Fix broken vector store documentation link.

Line 428 references a non-existent file. The path ../Components/components-vector-stores should be ../Components/components-bundles, which contains vector store component documentation.

🤖 Prompt for AI Agents
In docs/docs/Develop/vector-store-api-integration.mdx around lines 424 to 429,
the "Vector store documentation" link points to a non-existent path
../Components/components-vector-stores; update that link to
../Components/components-bundles so it points to the actual vector store
component documentation, keeping the link text the same and preserving Markdown
list formatting.

@naga-k naga-k closed this Nov 23, 2025
@naga-k naga-k deleted the fix/issue-10694 branch November 23, 2025 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Pull Request from an external contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant