Skip to content

Genie API

Databricks Genie AI/BI spaces can be queried programmatically via the Databricks Genie Conversation API. Energy Copilot’s 12 Genie spaces are accessible both through the embedded UI and via API.

The following Genie spaces are created by setup/04_create_genie_spaces.py. Space IDs are UUIDs assigned by Databricks at creation time:

Space NameEnvironment VariablePrimary Tables
NEM Prices & DemandGENIE_SPACE_NEM_PRICESnem_prices_5min, weather_nem_regions
Generation & Fuel MixGENIE_SPACE_GENERATIONnem_generation_by_fuel
Interconnectors & ConstraintsGENIE_SPACE_INTERCONNECTORSnem_interconnectors
FCAS MarketsGENIE_SPACE_FCASnem_fcas_prices
Settlement & FinanceGENIE_SPACE_SETTLEMENTsettlement_statements, deals
DNSP ComplianceGENIE_SPACE_DNSP_COMPLIANCEdnsp_aio_metrics, dnsp_stpis_metrics
Asset IntelligenceGENIE_SPACE_ASSETSdnsp_asset_register
Vegetation RiskGENIE_SPACE_VEGETATIONdnsp_vegetation_risk
Workforce AnalyticsGENIE_SPACE_WORKFORCEdnsp_workforce_metrics
Environmental & LGCsGENIE_SPACE_ENVIRONMENTALlgc_registry, emissions_factors
Forward CurvesGENIE_SPACE_FORWARD_CURVESasx_futures_eod, forward_curves
Gas MarketsGENIE_SPACE_GASgas_hub_prices

Genie uses a conversation model: start a conversation, then send messages.

Terminal window
POST https://{workspace_host}/api/2.0/genie/spaces/{space_id}/start-conversation
Authorization: Bearer {DATABRICKS_TOKEN}
Content-Type: application/json
{
"content": "What was the average spot price in SA1 last week?"
}
# Response
{
"conversation_id": "conv_01HXYZ123ABC",
"message_id": "msg_01HXYZ123DEF",
"status": "EXECUTING"
}
Terminal window
GET https://{workspace_host}/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}
Authorization: Bearer {DATABRICKS_TOKEN}
# When complete:
{
"id": "msg_01HXYZ123DEF",
"status": "COMPLETED",
"query_result": {
"statement_id": "stmt_01HXYZ456",
"statement_text": "SELECT AVG(rrp) as avg_price FROM energy_copilot.gold.nem_prices_30min WHERE region_id = 'SA1' AND interval_date >= CURRENT_DATE() - INTERVAL 7 DAYS",
"rows": [
{"avg_price": 187.42}
],
"schema": [
{"name": "avg_price", "type_text": "DOUBLE", "type_name": "DOUBLE"}
]
}
}

Send a follow-up question in the same conversation context:

Terminal window
POST https://{workspace_host}/api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages
Authorization: Bearer {DATABRICKS_TOKEN}
Content-Type: application/json
{
"content": "Now show me the breakdown by day of the week"
}

Energy Copilot provides a proxy endpoint that wraps the Databricks Genie API, handling authentication and conversation management:

Terminal window
# Start a Genie query (proxied through Energy Copilot backend)
POST /api/genie/query
Content-Type: application/json
{
"space": "nem_prices", // Space name (resolves to space ID internally)
"question": "What was the average spot price in SA1 last week?",
"conversation_id": null // null to start new; provide ID to continue
}
# Response (when complete)
{
"conversation_id": "conv_01HXYZ123ABC",
"question": "What was the average spot price in SA1 last week?",
"sql": "SELECT AVG(rrp) as avg_price FROM ...",
"result": {
"rows": [{"avg_price": 187.42}],
"schema": [{"name": "avg_price", "type": "DOUBLE"}],
"chart_type": "bar" // Genie's suggested chart type
}
}
Proxy space ParameterResolves To
nem_pricesNEM Prices & Demand space
generationGeneration & Fuel Mix space
interconnectorsInterconnectors & Constraints space
fcasFCAS Markets space
settlementSettlement & Finance space
dnsp_complianceDNSP Compliance space
assetsAsset Intelligence space
vegetationVegetation Risk space
workforceWorkforce Analytics space
environmentalEnvironmental & LGCs space
forward_curvesForward Curves space
gasGas Markets space
"What was the average spot price in SA1 over the last 7 days?"
"Show me the top 10 highest price intervals in VIC1 this month"
"How many times did QLD1 prices exceed $500/MWh in the past 30 days?"
"Compare demand-weighted average prices across all regions for today"
"What is the hourly average price for NSW1 on weekdays vs weekends this year?"
"What percentage of NEM generation came from renewables yesterday?"
"Show coal generation declining trend over the past 2 years"
"What was the highest wind output recorded in SA1?"
"Compare solar penetration by state for the past month"
"Which feeders have the highest SAIDI contribution this financial year?"
"Show SAIDI trend for Ausgrid over the past 5 years"
"Which AIO obligations are overdue for Essential Energy?"
"List feeders where SAIDI is within 10% of the AER target"