From 4f2e582cf743dfd4793012d34cfe3d746e390c2c Mon Sep 17 00:00:00 2001 From: Edwin Jose Date: Mon, 10 Jun 2024 18:06:06 -0400 Subject: [PATCH] Update get-python-api-code.tsx (#2130) --- .../src/modals/apiModal/utils/get-python-api-code.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/modals/apiModal/utils/get-python-api-code.tsx b/src/frontend/src/modals/apiModal/utils/get-python-api-code.tsx index e51403acb..e7999b69b 100644 --- a/src/frontend/src/modals/apiModal/utils/get-python-api-code.tsx +++ b/src/frontend/src/modals/apiModal/utils/get-python-api-code.tsx @@ -12,6 +12,9 @@ export default function getPythonApiCode( endpointName?: string ): string { const tweaksObject = tweaksBuildedObject[0]; + const tweaksString = JSON.stringify(tweaksObject, null, 2) + .replace(/true/g, "True") + .replace(/false/g, "False"); return `import argparse import json from argparse import RawTextHelpFormatter @@ -34,7 +37,7 @@ ENDPOINT = "${endpointName || ""}" ${ # You can tweak the flow by adding a tweaks dictionary # e.g {"OpenAI-XXXXX": {"model_name": "gpt-4"}} -TWEAKS = ${JSON.stringify(tweaksObject, null, 2)} +TWEAKS = ${tweaksString} def run_flow(message: str, endpoint: str,