Skip to main content

Chat Module

The Chat module provides functions to interact with the chat-based query generation and response system.

Overview

The Chat module allows users to send chat requests and receive chat responses, including query results, charts, and semantic context information.

Classes

Chat

The main class for interacting with the Chat module.

Constructor

public Chat(WaiiHttpClient httpClient)
  • httpClient: An instance of WaiiHttpClient to handle HTTP requests.

Methods

public ChatResponse chat(ChatRequest params) throws IOException
  • params: An instance of ChatRequest containing the chat request parameters.
  • Returns: An instance of ChatResponse containing the chat response.

ChatRequest

A class representing the request to generate a chat response. Extends LLMBasedRequest.

Fields

  • private String ask: The user's question or prompt.
  • private boolean streaming: Indicates if the response should be streamed.
  • @SerializedName("parent_uuid") private String parentUuid: The UUID of the parent chat message, if any.
  • private ChartType chartType: Specifies the type of chart to be generated.
  • private List<ChatModule> modules: Specifies which modules should be used to process the request (e.g., TABLES, QUERY, DATA, CHART).

Methods

  • public String getAsk(): Gets the user's question or prompt.
  • public void setAsk(String ask): Sets the user's question or prompt.
  • public boolean isStreaming(): Gets the streaming status.
  • public void setStreaming(boolean streaming): Sets the streaming status.
  • public String getParentUuid(): Gets the parent chat message UUID.
  • public void setParentUuid(String parentUuid): Sets the parent chat message UUID.
  • private Integer responseModuleLimit: Limits the number of modules that can be included in the response.

ChatResponse

A class representing the chat response.

Fields

  • private String response: The template response.
  • @SerializedName("response_data") private ChatResponseData responseData: Additional response data.
  • @SerializedName("is_new") private Boolean isNew: Indicates if the response uses any previous chat history.
  • private long timestamp: The timestamp of the response.
  • @SerializedName("chat_uuid") private String chatUuid: The unique identifier of the response.
  • @SerializedName("response_selected_fields") private List<ChatModule> responseSelectedFields: Indicates which modules (e.g., QUERY, DATA, CHART) were used in the generated response.

Methods

  • public String getResponse(): Gets the template response.
  • public void setResponse(String response): Sets the template response.
  • public ChatResponseData getResponseData(): Gets the additional response data.
  • public void setResponseData(ChatResponseData responseData): Sets the additional response data.
  • public Boolean getIsNew(): Gets the status indicating if the response is new.
  • public void setIsNew(Boolean isNew): Sets the status indicating if the response is new.
  • public long getTimestamp(): Gets the timestamp of the response.
  • public void setTimestamp(long timestamp): Sets the timestamp of the response.
  • public String getChatUuid(): Gets the unique identifier of the response.
  • public void setChatUuid(String chatUuid): Sets the unique identifier of the response.

ChatResponseData

A class representing additional response data in the chat response.

Fields

  • private GetQueryResultResponse data: The query result data.
  • private GeneratedQuery query: The generated SQL query.
  • @SerializedName("chart") private ChartGenerationResponse chart: The chart specifications.
  • @SerializedName("python_plot") private Object pythonPlot: The Python plot (if any).
  • @SerializedName("semantic_context") private GetSemanticContextResponse semanticContext: The semantic context.
  • private Catalog tables: The catalog information.

Methods

  • public GetQueryResultResponse getData(): Gets the query result data.
  • public void setData(GetQueryResultResponse data): Sets the query result data.
  • public GeneratedQuery getQuery(): Gets the generated SQL query.
  • public void setQuery(GeneratedQuery query): Sets the generated SQL query.
  • public ChartGenerationResponse getChart(): Gets the chart specifications.
  • public void setChart(ChartGenerationResponse chartSpec): Sets the chart specifications.
  • public Object getPythonPlot(): Gets the Python plot (if any).
  • public void setPythonPlot(Object pythonPlot): Sets the Python plot (if any).
  • public GetSemanticContextResponse getSemanticContext(): Gets the semantic context.
  • public void setSemanticContext(GetSemanticContextResponse semanticContext): Sets the semantic context.
  • public Catalog getTables(): Gets the catalog information.
  • public void setTables(Catalog catalog): Sets the catalog information.

LLMBasedRequest

A base class for requests that use language models.

Fields

  • private String model: The language model to use.
  • @SerializedName("use_cache") private boolean useCache: Indicates if the cache should be used.

Methods

  • public String getModel(): Gets the language model to use.
  • public void setModel(String model): Sets the language model to use.
  • public boolean isUseCache(): Gets the cache usage status.
  • public void setUseCache(boolean useCache): Sets the cache usage status.