Class BBjAdminAIQueryResult

java.lang.Object
com.basis.api.admin.BBjAdminAIQueryResult
All Implemented Interfaces:
Serializable

public class BBjAdminAIQueryResult extends Object implements Serializable
The result of a natural-language-to-SQL conversion returned by BBjAdminAI.buildQuery(String).

Always check isSuccessful() before using getGeneratedSql().

 BBjAdminAIQueryResult result = ai.buildQuery("Show all invoices for ACME Corp");
 if (result.isSuccessful()) {
     String sql = result.getGeneratedSql();
 } else {
     System.err.println(result.getErrorMessage());
 }
 
See Also:
  • Constructor Details

    • BBjAdminAIQueryResult

      public BBjAdminAIQueryResult(String naturalLanguageQuery, String generatedSql, List<String> tablesReferenced, String schemaContextUsed, boolean successful, String errorMessage)
  • Method Details

    • getNaturalLanguageQuery

      public String getNaturalLanguageQuery()
      The original natural-language question provided by the caller.
    • getGeneratedSql

      public String getGeneratedSql()
      The SQL SELECT statement generated by the LLM. Returns null when isSuccessful() is false.
    • getTablesReferenced

      public List<String> getTablesReferenced()
      Names of the tables the LLM believes are referenced by the generated query. May be empty.
    • getSchemaContextUsed

      public String getSchemaContextUsed()
      The schema fragment injected into the LLM prompt. Useful for debugging RAG retrieval quality.
    • isSuccessful

      public boolean isSuccessful()
      Returns true if a SQL statement was successfully generated.
    • getErrorMessage

      public String getErrorMessage()
      Human-readable error description when isSuccessful() is false. Returns null on success.
    • toString

      public String toString()
      Overrides:
      toString in class Object