Skip to content

Instantly share code, notes, and snippets.

@lopinho
Created September 12, 2025 19:33
Show Gist options
  • Select an option

  • Save lopinho/0f0a65d430e80bf74e5b5c3dc1930236 to your computer and use it in GitHub Desktop.

Select an option

Save lopinho/0f0a65d430e80bf74e5b5c3dc1930236 to your computer and use it in GitHub Desktop.
{
"success": true,
"message": "NLP2SQL conversion completed successfully",
"thread_id": "73d4ca58-d32c-4498-865c-94109cfb5064",
"result": {
"success": true,
"user_query": "what is the most recent price value of the bitcoin in the market_data table?",
"workflow_completed_at": "2025-09-12T15:40:58.322220+00:00",
"relevant_metadata": {
"success": true,
"query": "what is the most recent price value of the bitcoin in the market_data table?",
"keywords": [
"most",
"recent",
"price",
"value",
"bitcoin",
"market_data",
"table"
],
"relevant_tables": [
{
"name": "market_data",
"type": "BASE TABLE",
"comment": null,
"row_count": [
{
"row_count": 84112
}
],
"relevance_score": 12.0,
"columns": [
{
"column_name": "price",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 10.0
},
{
"column_name": "coin",
"data_type": "character varying",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": 255,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": true,
"relevance_score": 2.0
},
{
"column_name": "time",
"data_type": "date",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": true,
"relevance_score": 2.0
},
{
"column_name": "market_cap",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "total_volume",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
}
],
"foreign_keys": []
},
{
"name": "coinstats",
"type": "BASE TABLE",
"comment": null,
"row_count": [
{
"row_count": 0
}
],
"relevance_score": 8.0,
"columns": [
{
"column_name": "largest_transaction_24h_value_usd",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 10.0
},
{
"column_name": "market_price_usd",
"data_type": "integer",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 32,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 10.0
},
{
"column_name": "market_price_btc",
"data_type": "integer",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 32,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 10.0
},
{
"column_name": "market_price_usd_change_24h_percentage",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 10.0
},
{
"column_name": "time",
"data_type": "timestamp with time zone",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "coin",
"data_type": "text",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "addresses_balance_count_1",
"data_type": "bigint",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "addresses_balance_count_2",
"data_type": "bigint",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "addresses_balance_count_3",
"data_type": "bigint",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "addresses_balance_count_4",
"data_type": "bigint",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "addresses_balance_count_5",
"data_type": "bigint",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "addresses_balance_count_6",
"data_type": "bigint",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "blocks",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "transactions",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "outputs",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "circulation",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "blocks_24h",
"data_type": "integer",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 32,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "transactions_24h",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "difficulty",
"data_type": "numeric",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "volume_24h",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "mempool_transactions",
"data_type": "integer",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 32,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "mempool_size",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "mempool_tps",
"data_type": "numeric",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "mempool_total_fee_usd",
"data_type": "numeric",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "best_block_height",
"data_type": "integer",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 32,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "best_block_hash",
"data_type": "text",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "best_block_time",
"data_type": "timestamp without time zone",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "blockchain_size",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "average_transaction_fee_24h",
"data_type": "integer",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 32,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "inflation_24h",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "median_transaction_fee_24h",
"data_type": "integer",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 32,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "cdd_24h",
"data_type": "numeric",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "largest_transaction_24h_hash",
"data_type": "text",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "nodes",
"data_type": "integer",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 32,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "hashrate_24h",
"data_type": "text",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "inflation_usd_24h",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "average_transaction_fee_usd_24h",
"data_type": "numeric",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "median_transaction_fee_usd_24h",
"data_type": "numeric",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "market_cap_usd",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "market_dominance_percentage",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "next_retarget_time_estimate",
"data_type": "timestamp without time zone",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "next_difficulty_estimate",
"data_type": "bigint",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 64,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "suggested_transaction_fee_per_byte_sat",
"data_type": "integer",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 32,
"numeric_scale": 0,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "holding_addresses",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "mempool_outputs",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
}
],
"foreign_keys": []
},
{
"name": "coinmetrics",
"type": "BASE TABLE",
"comment": null,
"row_count": [
{
"row_count": 294
}
],
"relevance_score": 4.0,
"columns": [
{
"column_name": "price",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 10.0
},
{
"column_name": "total_bitcoins",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 10.0
},
{
"column_name": "time",
"data_type": "timestamp with time zone",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "marketCap",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "active_addresses",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "hashrate",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "volatility",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "txtfrcnt",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
}
],
"foreign_keys": []
},
{
"name": "collection_scores",
"type": "BASE TABLE",
"comment": null,
"row_count": [
{
"row_count": 0
}
],
"relevance_score": 4.0,
"columns": [
{
"column_name": "listing_price",
"data_type": "double precision",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 10.0
},
{
"column_name": "last_sale_price",
"data_type": "double precision",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 10.0
},
{
"column_name": "id",
"data_type": "uuid",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": true,
"relevance_score": 2.0
},
{
"column_name": "collection",
"data_type": "text",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "name",
"data_type": "text",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "link",
"data_type": "text",
"is_nullable": "NO",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "open_sea_slug",
"data_type": "text",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "token",
"data_type": "text",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "thumbnail",
"data_type": "text",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
},
{
"column_name": "updated_on",
"data_type": "timestamp with time zone",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
}
],
"foreign_keys": []
},
{
"name": "blocks_daily",
"type": "BASE TABLE",
"comment": null,
"row_count": [
{
"row_count": 0
}
],
"relevance_score": 2.0,
"columns": [
{
"column_name": "spotPrice",
"data_type": "double precision",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": 53,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 10.0
},
{
"column_name": "time",
"data_type": "timestamp with time zone",
"is_nullable": "YES",
"column_default": null,
"character_maximum_length": null,
"numeric_precision": null,
"numeric_scale": null,
"column_comment": null,
"is_primary_key": false,
"relevance_score": 0.0
}
],
"foreign_keys": []
}
],
"total_tables_found": 22,
"database": null,
"schema": "public"
},
"sql_generation": {
"generated_sql": "SELECT price FROM market_data WHERE LOWER(coin) = 'bitcoin' ORDER BY time DESC LIMIT 1;",
"validation": {
"valid": true,
"errors": [],
"warnings": []
},
"need_more_data": false,
"success": true
},
"sql_execution": {
"success": true,
"rows": [
{
"price": 115134.0078202292
}
],
"row_count": 1,
"columns": [
"price"
],
"execution_time": 0.131077,
"error": null
}
},
"error": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment