langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Add "Export to python code" functionality

Open dhruv-anand-aintech opened this issue 2 years ago • 3 comments

Couldn't find this anywhere in the UI. Would be nice to have.

dhruv-anand-aintech avatar Mar 17 '23 08:03 dhruv-anand-aintech

In the backend we are not actually generating a python code, we are using the load functions from LangChain.

ibiscp avatar Mar 17 '23 14:03 ibiscp

In the UI there are two buttons close to the canvas controls (zoom) and they allow you to export as a JSON to later import in python into a langchain object.

We will improve the visibility of those buttons very soon.

ogabrielluiz avatar Mar 17 '23 14:03 ogabrielluiz

We improved the position of the import and export buttons in #49. With that, you can follow the instructions in the README.md to load the exported JSON to python.

It should be something like this:

from langflow import load_flow_from_json

flow = load_flow_from_json("path/to/flow.json")
# Now you can use it like any chain
flow("Hey, have you heard of LangFlow?")

ogabrielluiz avatar Mar 21 '23 15:03 ogabrielluiz

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 16 '23 20:05 stale[bot]

Although this is not an issue per se, a tool like langflow would actually be useful if it offered a python export. There are instances where a flow code might need to be modified for some custom use. I love the tool though. Thanks 😊

KSVQ avatar May 24 '23 15:05 KSVQ