From 265d71cf9f11a483cd86d296b42b97122ef191de Mon Sep 17 00:00:00 2001 From: lublagg Date: Wed, 15 Jan 2025 12:45:14 -0500 Subject: [PATCH] Sync assistant instructions files. --- .../instructions.txt | 52 ++++++++++++++++++- .../instructions.txt | 52 ++++++++++++++++++- 2 files changed, 102 insertions(+), 2 deletions(-) diff --git a/ai-assistant-settings/assistants/asst_cxo3mQuMYnNF2LLh7onizkDf/instructions.txt b/ai-assistant-settings/assistants/asst_cxo3mQuMYnNF2LLh7onizkDf/instructions.txt index 289e820..38328d5 100644 --- a/ai-assistant-settings/assistants/asst_cxo3mQuMYnNF2LLh7onizkDf/instructions.txt +++ b/ai-assistant-settings/assistants/asst_cxo3mQuMYnNF2LLh7onizkDf/instructions.txt @@ -1278,7 +1278,7 @@ They may be numeric or categorical (numbers or strings). "editable": /* {Boolean} Whether the values of the attribute can be edited by the user. Defaults to true. */, "formula": /* {String} Optional. An expression. If present, the value of this attribute will be the - result of evaluation of the expression. ToDo URL to help page */, + result of evaluation of the expression. Some formatting rules apply. See note below. */, "hidden": /* {Boolean} Whether the attribute is hidden. Caution: use with care as there is currently no UI support for managing hidden attributes from the CODAP side. */, "precision": /* {Number} For numeric attributes, the number of @@ -1289,6 +1289,56 @@ They may be numeric or categorical (numbers or strings). } ``` +#### Attribute formula property expression formatting rules + +- The whole expression should be wrapped in double-quotes + - Correct formatting: ``` "formula": "LifeSpan > 30" ``` + - Incorrect formatting: ``` "formula": LifeSpan > 30 ``` +- The names of attributes should not be wrapped in any quotation marks + - Correct formatting: ``` "formula": "LifeSpan > 30" ``` + - Incorrect formatting: ``` "formula": "'LifeSpan' > 30" ``` +- If an expression contains a value that is a string, it should be wrapped in single-quotes, or double-quotes with backwards slashes before them + - Correct formatting: + - ```"formula": "Diet='meat'"``` + - ```"formula": "Diet==\"meat\""``` + - Incorrect formatting: + - ```"formula": "Diet=meat"``` + - ```"formula": "Diet=”meat”"``` +- Numerical values do not need to be wrapped in quotation marks + - Correct formatting: ``` "formula": "LifeSpan > 30" ``` + - Incorrect formatting: ``` "formula": "LifeSpan > '30'" ``` +- Regardless of what collection level the new attribute with its formula is being created within, any attribute being used in the formula should be referenced ONLY by its name (i.e. Diet, not CollectionName.Diet) + - Correct formatting: + ``` + "action": "create", + "resource": "dataContext[Mammals].collection[Diets].attribute", + "values": [ + { + "name": "Average LifeSpan", + "type": "categorical", + "title": "Average LifeSpan", + "description": "The average lifespan for mammals that eat this diet", + "editable": false, + "formula": "mean(LifeSpan)" + } + ] + ``` + - Incorrect formatting: + ``` + "action": "create", + "resource": "dataContext[Mammals].collection[Diets].attribute", + "values": [ + { + "name": "Average LifeSpan", + "type": "categorical", + "title": "Average LifeSpan", + "description": "The average lifespan for mammals that eat this diet", + "editable": false, + "formula": "mean(Cases.LifeSpan)" + } + ] + ``` + #### Example: attribute create Notes: diff --git a/ai-assistant-settings/assistants/asst_xmAX5oxByssXrkBymMbcsVEm/instructions.txt b/ai-assistant-settings/assistants/asst_xmAX5oxByssXrkBymMbcsVEm/instructions.txt index 74ce144..8f2bf02 100644 --- a/ai-assistant-settings/assistants/asst_xmAX5oxByssXrkBymMbcsVEm/instructions.txt +++ b/ai-assistant-settings/assistants/asst_xmAX5oxByssXrkBymMbcsVEm/instructions.txt @@ -1290,7 +1290,7 @@ They may be numeric or categorical (numbers or strings). "editable": /* {Boolean} Whether the values of the attribute can be edited by the user. Defaults to true. */, "formula": /* {String} Optional. An expression. If present, the value of this attribute will be the - result of evaluation of the expression. ToDo URL to help page */, + result of evaluation of the expression. See the rules below for how to format the expression. */, "hidden": /* {Boolean} Whether the attribute is hidden. Caution: use with care as there is currently no UI support for managing hidden attributes from the CODAP side. */, "precision": /* {Number} For numeric attributes, the number of @@ -1301,6 +1301,56 @@ They may be numeric or categorical (numbers or strings). } ``` +#### Attribute formula property expression formatting rules + +- The whole expression should be wrapped in double-quotes + - Correct formatting: ` "formula": "LifeSpan > 30" ` + - Incorrect formatting: ` "formula": LifeSpan > 30 ` +- The names of attributes should not be wrapped in any quotation marks + - Correct formatting: ` "formula": "LifeSpan > 30" ` + - Incorrect formatting: ` "formula": "'LifeSpan' > 30" ` +- If an expression contains a value that is a string, it should be wrapped in single-quotes, or double-quotes with backwards slashes before them + - Correct formatting: + - `"formula": "Diet='meat'"` + - `"formula": "Diet==\"meat\""` + - Incorrect formatting: + - `"formula": "Diet=meat"` + - `"formula": "Diet=”meat”"` +- Numerical values do not need to be wrapped in quotation marks + - Correct formatting: ` "formula": "LifeSpan > 30" ` + - Incorrect formatting: ` "formula": "LifeSpan > '30'" ` +- Regardless of what collection level the new attribute with its formula is being created within, any attribute being used in the formula should be referenced ONLY by its name (i.e. Diet, not CollectionName.Diet) + - Correct formatting: + ``` + "action": "create", + "resource": "dataContext[Mammals].collection[Diets].attribute", + "values": [ + { + "name": "Average LifeSpan", + "type": "categorical", + "title": "Average LifeSpan", + "description": "The average lifespan for mammals that eat this diet", + "editable": false, + "formula": "mean(LifeSpan)" + } + ] + ``` + - Incorrect formatting: + ``` + "action": "create", + "resource": "dataContext[Mammals].collection[Diets].attribute", + "values": [ + { + "name": "Average LifeSpan", + "type": "categorical", + "title": "Average LifeSpan", + "description": "The average lifespan for mammals that eat this diet", + "editable": false, + "formula": "mean(Cases.LifeSpan)" + } + ] + ``` + #### Example: attribute create Notes: