insights.ask

Prev Next

Description

Asks Dr. Know Copilot a question and returns the answer as a message insight that persists for the lifetime of an app.


Input Parameters

Name Type Required Description
key Text Yes Unique identifier for conversation
category Text Yes Category to group insight within
question Text Yes Question you want answered by Dr. Know Copilot
[continue] Boolean No Specify true to continue the conversation when your question changes (e.g. user specifies new input); otherwise specify false (default)
[promptId] Text No Curated prompt ID used when asking your question

Returns

No return value.

This is an asynchronous function and will not block the user interface.


Examples

// ask a question; the response will appear in a 'Copilot' insights category
ai.insights.ask("1", "Copilot", "How old is the universe?");
// ask a question using an object token and curated prompt id
// the response will appear in a 'Colors' insights category
// when the value for [2] changes, the conversation will continue where it left off
ai.insights.ask("2", "Colors", "How many people like the color [2]?", true, "ABC123");

Remarks

This is an asynchronous function and will not block the user interface. Rather, when Dr. Know Copilot responds, the response will be displayed as a message insight.

You can include inputs to your question by embedding object tokens within your question. These tokens will be replaced with their current values prior to being sent to Dr. Know Copilot.