Interface EssCubeAi
- All Known Implementing Classes:
EssCubeAiImpl
EssCube.getAi().
All of them need setup that lives outside the cube - an AI connection on the server, that
connection associated with the cube's application, a chat profile on the connection - and the
server reports any gap in that setup as the same HTTP 400 regardless of which piece is missing.
getReadiness() is the way to find out which, and it is worth calling before a capability
rather than after: it turns one opaque error into a specific one, and it says who has to fix it.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclearConversationHistory(String profileName) Forgets a conversation on the server, so a later question doesn't inherit its context.generateMdx(String question) Asks the model to write an MDX query answering a question posed in English, starting a new conversation.generateMdx(String question, String conversationId) Asks a follow-up in an existing conversation, so the model reads the question in the context of what it was already asked.Which AI capabilities this server has switched on, in one request.Works out whether the AI features on this cube can run, and if not, which prerequisite is missing.getReadiness(EssAiFeature feature) The same diagnosis, narrowed to one capability, which is what you usually want: the server reports a separate on/off flag per capability, so "is AI available here" is a question with no single answer and asking about the feature you are about to use is strictly better.Questions the server suggests as a starting point for this cube - what the web interface offers as examples before anyone has typed anything.withProfile(String profileName) The chat profile capability calls are made against.
-
Method Details
-
getReadiness
EssAiReadiness getReadiness()Works out whether the AI features on this cube can run, and if not, which prerequisite is missing. Never throws - an unreachable server comes back asEssAiReadiness.State.UNDETERMINED.Costs one or two small requests and is not cached, so hold on to the result rather than asking again per capability.
- Returns:
- the diagnosis, never null
-
getReadiness
The same diagnosis, narrowed to one capability, which is what you usually want: the server reports a separate on/off flag per capability, so "is AI available here" is a question with no single answer and asking about the feature you are about to use is strictly better.- Parameters:
feature- the capability to ask about, or null for AI in general- Returns:
- the diagnosis, never null
-
getEnabledFeatures
Set<EssAiFeature> getEnabledFeatures()Which AI capabilities this server has switched on, in one request.Says nothing about whether they are configured - a capability can be switched on and still have no AI connection behind it, which is the usual state of a fresh server. This is the inventory;
getReadiness(EssAiFeature)is the diagnosis.- Returns:
- the enabled capabilities, empty on a server too old to have any
-
generateMdx
Asks the model to write an MDX query answering a question posed in English, starting a new conversation.- Parameters:
question- the question, e.g. "what were sales of Colas in the East in Qtr1?"- Returns:
- the generated query and the conversation it started
-
generateMdx
Asks a follow-up in an existing conversation, so the model reads the question in the context of what it was already asked.- Parameters:
question- the follow-upconversationId- the id from the previous answer, or null to start a new conversation- Returns:
- the generated query
-
getSampleQuestions
Questions the server suggests as a starting point for this cube - what the web interface offers as examples before anyone has typed anything.- Returns:
- the sample questions, empty if the server offers none
-
clearConversationHistory
Forgets a conversation on the server, so a later question doesn't inherit its context.- Parameters:
profileName- the chat profile the conversation belongs to
-
withProfile
The chat profile capability calls are made against. Every one of them requires a profile name, and the server ships one calleddefault; set this when a site has made its own.- Parameters:
profileName- the profile name- Returns:
- this, for chaining
-