AI
Artificial Intelligence functions work with natural language inputs and relies on external providers to generate outputs. These functions should be considered as incubating and may change or may be removed without warning. Different AI providers and models will yield different results.
answer(prompt)
Provides an answer based on the given prompt. Note that depending on the provider and model configured, the answer will greatly vary, and this method is nondeterministic.
| Name | Required | Type | Description |
|---|---|---|---|
prompt |
Yes |
Text |
The question prompt to answer |
Text |
ai.answer("What is a synonym of decision modeling?") => "\"Decision analysis or decision calculus\""
choose(context, question, options)
Choose the best potential option answering the question on the context. Requires at least two options.
| Name | Required | Type | Description |
|---|---|---|---|
context |
Yes |
Text | context |
The context of the question |
question |
Yes |
Text |
The question to answer on the context |
options |
Yes |
list |
A list of options to choose from, requires at least 2 options |
Text |
ai.choose("This is urgent", "Rate the urgency", ["High", "Low"]) => "\"High\""
ai.choose({"urgency": "extreme"}, "Rate the urgency", ["High", "Low"]) => "\"High\""
decide yes or no(context, question, [yes threshold])
Decide between a positive (yes) or negative (no) answer based on the answer to the question in a context. The answer is based on the context of the question and the information provided in the context.
| Name | Required | Type | Description |
|---|---|---|---|
context |
Yes |
Text | context |
The context of the question |
question |
Yes |
Text |
The question to answer on the context |
yes threshold |
No |
Number |
The confidence from 0 to 1 to consider a yes answer, default is 0.5 |
Boolean |
ai.decide yes or no("It is sunny", "Does it rain?") => false
ai.decide yes or no({name: "John Smith"}, "Is the user a men?") => true
scale(context, question, options)
Returns the position of the question in the given context on a scale created by the options. The first option is 1, the second option is 2, … The returned value could be between two integer number denoting that the scale is between two options. For example, if the answer is between the first and second option.
| Name | Required | Type | Description |
|---|---|---|---|
context |
Yes |
Text | context |
The context of the question |
question |
Yes |
Text |
The question to answer on the context |
options |
Yes |
list |
The options to create the scale, requires at least 2 options |
Number |
ai.scale("I need an answer tomorrow at the latest.", "Rate the urgency", ["Low", "High"]) => "1.76"
ai.scale({"dueDate": "PT1H"}, "Rate the urgency", ["Low", "High"]) => 1.97