🚀 feat(constants.tsx): add tweaks parameter to getPythonCode function to allow for customization of flow behavior
The `getPythonCode` function now accepts a `tweaks` parameter which is used to customize the behavior of the flow. The `buildTweaks` function is called to generate the `tweaks` object which is then passed to the `load_flow_from_json` function. This allows for more flexibility in the usage of the flow.
This commit is contained in:
parent
76a1265eee
commit
8a5525f465
1 changed files with 3 additions and 2 deletions
|
|
@ -121,9 +121,10 @@ export const getCurlCode = (flow: FlowType): string => {
|
||||||
*/
|
*/
|
||||||
export const getPythonCode = (flow: FlowType): string => {
|
export const getPythonCode = (flow: FlowType): string => {
|
||||||
const flowName = flow.name;
|
const flowName = flow.name;
|
||||||
|
const tweaks = buildTweaks(flow);
|
||||||
return `from langflow import load_flow_from_json
|
return `from langflow import load_flow_from_json
|
||||||
|
TWEAKS = ${JSON.stringify(tweaks, null, 2)}
|
||||||
flow = load_flow_from_json("${flowName}.json")
|
flow = load_flow_from_json("${flowName}.json", tweaks=TWEAKS)
|
||||||
# Now you can use it like any chain
|
# Now you can use it like any chain
|
||||||
flow("Hey, have you heard of LangFlow?")`;
|
flow("Hey, have you heard of LangFlow?")`;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue