Update get-python-api-code.tsx (#2130)

This commit is contained in:
Edwin Jose 2024-06-10 18:06:06 -04:00 committed by GitHub
commit 4f2e582cf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,