Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read Flow API return an inconsistent model when header_flows is set to true #5353

Open
dariosaltarelli opened this issue Dec 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@dariosaltarelli
Copy link
Contributor

Bug Description

FlowHeader models includes endpoint_name but when invoking the read flow api (https://docs.langflow.org/api/read-flows) with parameter header_flows=true it always return None.

There seems to be a missing mapping

Reproduction

  1. Start Langflow
  2. Create a new flow and set the endpoint name to a value (i.e "my-example-endpoint")
  3. Invoke the API via curl (curl --verbose --fail http://127.0.0.1:7860/api/v1/flows/get_all=true&header_flows=true&remove_example_flows=true) or check results from DevTools in the browser)

Results looks something like:

[ {"id":"19c8256f-95ad-4c81-991c-ec6a871848f1", "name":"Test Endpoint Name", "folder_id":"5bf5bd1a-8c12-48f8-9050-94ae84874926", "is_component":false, **"endpoint_name":null,** "description":"Building Intelligent Interactions."}]

Expected behavior

Result should be:

[ {"id":"19c8256f-95ad-4c81-991c-ec6a871848f1", "name":"Test Endpoint Name", "folder_id":"5bf5bd1a-8c12-48f8-9050-94ae84874926", "is_component":false, **"endpoint_name":"my-example-endpoint",** "description":"Building Intelligent Interactions."}]

Who can help?

No response

Operating System

Linux

Langflow Version

1.1.1

Python Version

3.12

Screenshot

No response

Flow File

{
"endpoint_name": "my-example-endpoint",
"id": "19c8256f-95ad-4c81-991c-ec6a871848f1",
"tags": null,
"locked": null,
"gradient": null,
"folder_id": "5bf5bd1a-8c12-48f8-9050-94ae84874926",
"is_component": false,
"data": {
"nodes": [],
"edges": [],
"viewport": {
"zoom": 1,
"x": 0,
"y": 0
}
},
"updated_at": "2024-12-19T09:33:10+00:00",
"icon": null,
"name": "Test Endpoint Name",
"icon_bg_color": null,
"webhook": false,
"user_id": "ddbc389b-fb22-4ff9-9a79-ba6177d01762",
"description": "Building Intelligent Interactions."
}

@dariosaltarelli dariosaltarelli added the bug Something isn't working label Dec 19, 2024
Copy link

dosubot bot commented Dec 19, 2024

Hey @dariosaltarelli! I'm here to help you with any bugs, questions, or contributions. Let's tackle this together!

The issue you're encountering with the read flow API in Langflow, where the endpoint_name field returns null when header_flows is set to true, seems to be related to how the API is currently implemented. The read_flows function, when header_flows is true, returns a list of flow headers but does not include the endpoint_name in its response structure [1].

To resolve this, you would need to modify the read_flows function to include the endpoint_name in the response when header_flows is true. This would involve updating the part of the code that constructs the response to ensure that endpoint_name is included and correctly populated from the flow data.

Here's a conceptual example of how you might adjust the response structure:

if header_flows:
    return [
        {
            "id": flow.id,
            "name": flow.name,
            "folder_id": flow.folder_id,
            "is_component": flow.is_component,
            "description": flow.description,
            "endpoint_name": flow.endpoint_name,  # Ensure this field is included
        }
        for flow in flows
    ]

This change would ensure that the endpoint_name is part of the response when header_flows is true, and it should be populated with the correct value from the flow data.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

github-merge-queue bot pushed a commit that referenced this issue Dec 19, 2024
* fix: add endpoint_name whem mapping results for headers_flow parameter (#5353)

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Dario Saltarelli <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant