From da6b35f52016d4d35dba3b6ed1169cc3fc51345d Mon Sep 17 00:00:00 2001 From: "Nguyen Trung Duc (john)" Date: Fri, 13 Oct 2023 10:26:48 +0700 Subject: [PATCH] Allow persisting the expected output in the code (#46) By allowing specifying the UI outputs in the code, any time user runs `kh export ...`, that outputs in the code will be included in the UI YAML file. Otherwise, any time the user runs `kh export ...`, the output section in the UI YAML file will be reset to the default output. --- knowledgehub/contribs/promptui/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/knowledgehub/contribs/promptui/config.py b/knowledgehub/contribs/promptui/config.py index 684f96f..cf1287d 100644 --- a/knowledgehub/contribs/promptui/config.py +++ b/knowledgehub/contribs/promptui/config.py @@ -146,11 +146,14 @@ def export_pipeline_to_config( }, } else: + outputs = [{"step": ".", "getter": "_get_output", "component": "text"}] + if hasattr(pipeline, "_promptui_outputs"): + outputs = pipeline._promptui_outputs config_obj = { "ui-type": ui_type, "params": handle_node(pipeline_def), "inputs": handle_input(pipeline), - "outputs": [{"step": ".", "getter": "_get_output", "component": "text"}], + "outputs": outputs, "logs": { "full_pipeline": { "input": {