Skip to content

Commit e533c7a

Browse files
[py][easy] Set Deleted Outputs as None (#811)
[py][easy] Set Deleted Outputs as None Inside the python sdk, `delete_output` previously set attribute outputs of prompts to []. While this does delete the outputs, it also retains an empty list as the value of prompt.output When executing config.save(), the config would have persisted empty arrays. This behaviour is not what we want. Instead, set to None. When config.save() is called, None values can be ignored and removed from the resulting aiconfig.json ## Testplan 1. Run prompt 2. delete output 3. Save config.validate that config doesn't have "outputs" field for config | ipynb | resulting config | | ------------- | ------------- | | <img width="768" alt="Screenshot 2024-01-08 at 3 26 05 PM" src="https://github.com/lastmile-ai/aiconfig/assets/141073967/616d8fce-bf54-488b-8cc4-57b83b76744b"> | <img width="704" alt="Screenshot 2024-01-08 at 3 27 40 PM" src="https://github.com/lastmile-ai/aiconfig/assets/141073967/10600037-04cb-400a-919d-11a60cedbc0c"> | came up in #791
2 parents 584a19a + 338c990 commit e533c7a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/src/aiconfig/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ def delete_output(self, prompt_name: str):
873873
"""
874874
prompt = self.get_prompt(prompt_name)
875875
existing_outputs = prompt.outputs
876-
prompt.outputs = []
876+
prompt.outputs = None
877877

878878
return existing_outputs
879879

0 commit comments

Comments
 (0)