@clickzetta/cz-cli-darwin-arm64 0.5.16 → 0.5.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/bin/cz-cli +0 -0
  2. package/bin/skills/lakehouse-doc-en/SKILL.md +6 -11
  3. package/bin/skills/lakehouse-doc-en/references/AIGateway.md +58 -13
  4. package/bin/skills/lakehouse-doc-en/references/Computation.md +1 -1
  5. package/bin/skills/lakehouse-doc-en/references/DataSource_Amazon_DocumentDB.md +3 -1
  6. package/bin/skills/lakehouse-doc-en/references/Foreach.md +14 -14
  7. package/bin/skills/lakehouse-doc-en/references/JDBC-Driver.md +0 -1
  8. package/bin/skills/lakehouse-doc-en/references/LakehouseAI-overview.md +21 -8
  9. package/bin/skills/lakehouse-doc-en/references/LakehouseDataGPT-tour.md +4 -9
  10. package/bin/skills/lakehouse-doc-en/references/LakehouseStudio-tour.md +14 -19
  11. package/bin/skills/lakehouse-doc-en/references/Lakehouse_Zilliz_MakeDataReadyforBIandAI.md +1 -1
  12. package/bin/skills/lakehouse-doc-en/references/Logstash.md +3 -3
  13. package/bin/skills/lakehouse-doc-en/references/Migrate_Spark_DataEngineeringBestPractices_Project_to_Lakehouse.md +1 -1
  14. package/bin/skills/lakehouse-doc-en/references/Notebook.md +17 -17
  15. package/bin/skills/lakehouse-doc-en/references/RemoteFunction-as-udf.md +14 -14
  16. package/bin/skills/lakehouse-doc-en/references/SQL_External_Catalog_Guide.md +1 -9
  17. package/bin/skills/lakehouse-doc-en/references/SUMMARY.md +59 -29
  18. package/bin/skills/lakehouse-doc-en/references/WINDOWFUNCTION.md +99 -57
  19. package/bin/skills/lakehouse-doc-en/references/Zettapark_Data_Engineering_Demo.md +1 -1
  20. package/bin/skills/lakehouse-doc-en/references/access-control-configuration.md +1 -8
  21. package/bin/skills/lakehouse-doc-en/references/aigw-2026-2-5-1.0.md +16 -0
  22. package/bin/skills/lakehouse-doc-en/references/aigw-2026-3-29-1.0.2.md +14 -0
  23. package/bin/skills/lakehouse-doc-en/references/aigw-2026-3-8-1.0.1.md +16 -0
  24. package/bin/skills/lakehouse-doc-en/references/aigw-2026-4-28-1.1.md +29 -0
  25. package/bin/skills/lakehouse-doc-en/references/aigw-2026-5-12-1.1.1.md +18 -0
  26. package/bin/skills/lakehouse-doc-en/references/aigw-2026-5-15-1.2.md +9 -0
  27. package/bin/skills/lakehouse-doc-en/references/aigw-2026-5-21-1.3.md +9 -0
  28. package/bin/skills/lakehouse-doc-en/references/aigw-2026-5-28-1.4.md +10 -0
  29. package/bin/skills/lakehouse-doc-en/references/aigw-2026-6-3-1.5.md +9 -0
  30. package/bin/skills/lakehouse-doc-en/references/alicloud-arn-externalid.md +0 -5
  31. package/bin/skills/lakehouse-doc-en/references/answer-accuracy-improve.md +120 -103
  32. package/bin/skills/lakehouse-doc-en/references/application-list.md +1 -3
  33. package/bin/skills/lakehouse-doc-en/references/approval-list.md +16 -17
  34. package/bin/skills/lakehouse-doc-en/references/batch-load-parquet-file-into-lakehouse.md +1 -1
  35. package/bin/skills/lakehouse-doc-en/references/batch_sync.md +9 -9
  36. package/bin/skills/lakehouse-doc-en/references/batch_sync_Sop.md +2 -2
  37. package/bin/skills/lakehouse-doc-en/references/batchloadparquetfileintoLakehouse.md +1 -1
  38. package/bin/skills/lakehouse-doc-en/references/bulkloadv1-python-sdk.md +3 -3
  39. package/bin/skills/lakehouse-doc-en/references/chart-auto-refresh-guide.md +12 -6
  40. package/bin/skills/lakehouse-doc-en/references/clickzetta-sample-data.md +3 -3
  41. package/bin/skills/lakehouse-doc-en/references/code_approval.md +1 -5
  42. package/bin/skills/lakehouse-doc-en/references/composite_task.md +31 -42
  43. package/bin/skills/lakehouse-doc-en/references/comprehensive_guide_to_ingesting_environment_and_data_generate.md +6 -9
  44. package/bin/skills/lakehouse-doc-en/references/comprehensive_guide_to_ingesting_javasdk_bulkload_realtime.md +4 -10
  45. package/bin/skills/lakehouse-doc-en/references/comprehensive_guide_to_ingesting_kafka_realtime_sync.md +1 -10
  46. package/bin/skills/lakehouse-doc-en/references/comprehensive_guide_to_ingesting_local_file_into_table_by_studio.md +0 -6
  47. package/bin/skills/lakehouse-doc-en/references/comprehensive_guide_to_ingesting_studio_batchload_public_network.md +0 -5
  48. package/bin/skills/lakehouse-doc-en/references/comprehensive_guide_to_ingesting_studio_python_node.md +2 -7
  49. package/bin/skills/lakehouse-doc-en/references/comprehensive_guide_to_ingesting_studio_realtime_cdc_public_network.md +13 -18
  50. package/bin/skills/lakehouse-doc-en/references/comprehensive_guide_to_ingesting_studio_sql_insert.md +0 -1
  51. package/bin/skills/lakehouse-doc-en/references/concepts.md +1 -1
  52. package/bin/skills/lakehouse-doc-en/references/config-datasource.md +5 -7
  53. package/bin/skills/lakehouse-doc-en/references/connect-with-cli.md +116 -72
  54. package/bin/skills/lakehouse-doc-en/references/connect-with-cz-cli.md +151 -0
  55. package/bin/skills/lakehouse-doc-en/references/continue-job.md +9 -17
  56. package/bin/skills/lakehouse-doc-en/references/create-api-connection.md +315 -286
  57. package/bin/skills/lakehouse-doc-en/references/create-catalog-connection.md +1 -0
  58. package/bin/skills/lakehouse-doc-en/references/create-dynamic-table.md +4 -4
  59. package/bin/skills/lakehouse-doc-en/references/create-external-catalog.md +85 -22
  60. package/bin/skills/lakehouse-doc-en/references/create-table-ddl.md +45 -0
  61. package/bin/skills/lakehouse-doc-en/references/creating_alicloud_privatelinkendpoint.md +4 -6
  62. package/bin/skills/lakehouse-doc-en/references/creating_alicloud_privatelinkservice.md +4 -7
  63. package/bin/skills/lakehouse-doc-en/references/creating_tencentcloud_privatelinkendpoint.md +2 -7
  64. package/bin/skills/lakehouse-doc-en/references/creating_tencentcloud_privatelinkservice.md +1 -5
  65. package/bin/skills/lakehouse-doc-en/references/cz-cli-agent.md +15 -10
  66. package/bin/skills/lakehouse-doc-en/references/cz-cli-datasource.md +0 -8
  67. package/bin/skills/lakehouse-doc-en/references/cz-cli-sql.md +2 -45
  68. package/bin/skills/lakehouse-doc-en/references/cz-cli.md +53 -42
  69. package/bin/skills/lakehouse-doc-en/references/dashboard-version-management-guide.md +12 -4
  70. package/bin/skills/lakehouse-doc-en/references/data-integration-intro.md +1 -1
  71. package/bin/skills/lakehouse-doc-en/references/data-integration.md +29 -27
  72. package/bin/skills/lakehouse-doc-en/references/data-load-summary.md +3 -3
  73. package/bin/skills/lakehouse-doc-en/references/data-quality.md +25 -25
  74. package/bin/skills/lakehouse-doc-en/references/data-sharing.md +31 -54
  75. package/bin/skills/lakehouse-doc-en/references/data-sources.md +45 -45
  76. package/bin/skills/lakehouse-doc-en/references/data_catalog.md +23 -25
  77. package/bin/skills/lakehouse-doc-en/references/data_privacy.md +5 -2
  78. package/bin/skills/lakehouse-doc-en/references/data_sharing_between_accounts_guide.md +0 -4
  79. package/bin/skills/lakehouse-doc-en/references/data_visualization.md +4 -15
  80. package/bin/skills/lakehouse-doc-en/references/dataagent.md +39 -7
  81. package/bin/skills/lakehouse-doc-en/references/databricks-delta-to-lakehouse-migration.md +168 -0
  82. package/bin/skills/lakehouse-doc-en/references/databricks-dlt-to-lakehouse-migration.md +331 -0
  83. package/bin/skills/lakehouse-doc-en/references/databricks-external-catalog-practice.md +367 -0
  84. package/bin/skills/lakehouse-doc-en/references/databricks-jobs-to-studio-migration.md +199 -0
  85. package/bin/skills/lakehouse-doc-en/references/databricks-notebook-to-studio-migration.md +350 -0
  86. package/bin/skills/lakehouse-doc-en/references/databricks-uc-governance-to-lakehouse-migration.md +327 -0
  87. package/bin/skills/lakehouse-doc-en/references/datagpt-model-config.md +34 -0
  88. package/bin/skills/lakehouse-doc-en/references/datagpt_data_source.md +50 -37
  89. package/bin/skills/lakehouse-doc-en/references/datagpt_introduction.md +55 -79
  90. package/bin/skills/lakehouse-doc-en/references/datagpt_quickstart.md +50 -64
  91. package/bin/skills/lakehouse-doc-en/references/datalake-acceleration.md +75 -2
  92. package/bin/skills/lakehouse-doc-en/references/dbt-databricks-to-clickzetta-migration.md +242 -0
  93. package/bin/skills/lakehouse-doc-en/references/dynamic-mask.md +30 -30
  94. package/bin/skills/lakehouse-doc-en/references/dynamic-table-bestpractice.md +1 -1
  95. package/bin/skills/lakehouse-doc-en/references/dynamic-table-introduce.md +1 -1
  96. package/bin/skills/lakehouse-doc-en/references/dynamic_table_summary.md +1 -1
  97. package/bin/skills/lakehouse-doc-en/references/eco_integration/streamlit.md +1 -1
  98. package/bin/skills/lakehouse-doc-en/references/eco_integration/superset.md +1 -1
  99. package/bin/skills/lakehouse-doc-en/references/ecosystem-all.md +1 -3
  100. package/bin/skills/lakehouse-doc-en/references/ecosystem.md +145 -0
  101. package/bin/skills/lakehouse-doc-en/references/external-catalog-summary.md +33 -38
  102. package/bin/skills/lakehouse-doc-en/references/external-function-combo-practice.md +466 -0
  103. package/bin/skills/lakehouse-doc-en/references/f6fc6447ee.md +7 -9
  104. package/bin/skills/lakehouse-doc-en/references/federation-query.md +56 -6
  105. package/bin/skills/lakehouse-doc-en/references/finebi-mysql.md +2 -0
  106. package/bin/skills/lakehouse-doc-en/references/get-started-with-sample-data.md +10 -11
  107. package/bin/skills/lakehouse-doc-en/references/gitfolder.md +2 -3
  108. package/bin/skills/lakehouse-doc-en/references/grant-privileges.md +2 -0
  109. package/bin/skills/lakehouse-doc-en/references/iceberg-rest-catalog-databricks.md +166 -0
  110. package/bin/skills/lakehouse-doc-en/references/ide.md +1 -1
  111. package/bin/skills/lakehouse-doc-en/references/if_else_task.md +59 -57
  112. package/bin/skills/lakehouse-doc-en/references/input_output.md +10 -7
  113. package/bin/skills/lakehouse-doc-en/references/jobprofile-bestpractices.md +60 -64
  114. package/bin/skills/lakehouse-doc-en/references/kafka-connection.md +0 -1
  115. package/bin/skills/lakehouse-doc-en/references/key-concepts.md +146 -117
  116. package/bin/skills/lakehouse-doc-en/references/lakehouse-ai-gateway-cz-cli.md +317 -0
  117. package/bin/skills/lakehouse-doc-en/references/lakehouse-ai-sql-analysis.md +345 -0
  118. package/bin/skills/lakehouse-doc-en/references/lakehouse-dqc-guide.md +300 -0
  119. package/bin/skills/lakehouse-doc-en/references/lakehouse-medallion-sql-dt-guide.md +543 -0
  120. package/bin/skills/lakehouse-doc-en/references/lakehouse-multi-cloud-acceleration.md +274 -0
  121. package/bin/skills/lakehouse-doc-en/references/lakehouse-multimodal-ai-pipeline.md +198 -0
  122. package/bin/skills/lakehouse-doc-en/references/lakehouse-quick-experience_guide.md +49 -52
  123. package/bin/skills/lakehouse-doc-en/references/lakehouse-volume-pipe-acceleration-guide.md +380 -0
  124. package/bin/skills/lakehouse-doc-en/references/langchain-plug-installation.md +1 -1
  125. package/bin/skills/lakehouse-doc-en/references/management.md +4 -9
  126. package/bin/skills/lakehouse-doc-en/references/medallion-lakehouse-from-scratch.md +2 -1
  127. package/bin/skills/lakehouse-doc-en/references/metrics_answer_build.md +58 -21
  128. package/bin/skills/lakehouse-doc-en/references/migrate-spark-data-engineering-best-practices-to-lakehouse.md +1 -1
  129. package/bin/skills/lakehouse-doc-en/references/mindsdb.md +1 -1
  130. package/bin/skills/lakehouse-doc-en/references/monitoring_and_alerting.md +65 -60
  131. package/bin/skills/lakehouse-doc-en/references/monitoring_item_specification.md +33 -33
  132. package/bin/skills/lakehouse-doc-en/references/multitable_batch_sync.md +16 -16
  133. package/bin/skills/lakehouse-doc-en/references/multitable_realtime_sync.md +65 -72
  134. package/bin/skills/lakehouse-doc-en/references/multitable_realtime_sync_sop.md +54 -52
  135. package/bin/skills/lakehouse-doc-en/references/navicat-mysql.md +2 -0
  136. package/bin/skills/lakehouse-doc-en/references/om-dynamic-table.md +71 -66
  137. package/bin/skills/lakehouse-doc-en/references/om-vcluster.md +2 -0
  138. package/bin/skills/lakehouse-doc-en/references/open-api-create-session.md +79 -0
  139. package/bin/skills/lakehouse-doc-en/references/open-api-generate-auth-token.md +63 -0
  140. package/bin/skills/lakehouse-doc-en/references/open-api-overview.md +96 -0
  141. package/bin/skills/lakehouse-doc-en/references/open-api-quick-start.md +286 -0
  142. package/bin/skills/lakehouse-doc-en/references/open-api-response-guide.md +264 -0
  143. package/bin/skills/lakehouse-doc-en/references/open-api-safe-question-poll.md +201 -0
  144. package/bin/skills/lakehouse-doc-en/references/open-api-text2insight-query.md +99 -0
  145. package/bin/skills/lakehouse-doc-en/references/open-api-text2insight-stop.md +74 -0
  146. package/bin/skills/lakehouse-doc-en/references/overview.md +6 -7
  147. package/bin/skills/lakehouse-doc-en/references/permission-application.md +5 -5
  148. package/bin/skills/lakehouse-doc-en/references/pipe-introduction.md +1 -0
  149. package/bin/skills/lakehouse-doc-en/references/pipe-kafka-table-stream.md +72 -70
  150. package/bin/skills/lakehouse-doc-en/references/pipe-kafka.md +105 -110
  151. package/bin/skills/lakehouse-doc-en/references/pipe-overview.md +40 -40
  152. package/bin/skills/lakehouse-doc-en/references/pipe-storage-object.md +43 -48
  153. package/bin/skills/lakehouse-doc-en/references/pipe-summary.md +14 -4
  154. package/bin/skills/lakehouse-doc-en/references/pipe-syntax.md +58 -151
  155. package/bin/skills/lakehouse-doc-en/references/practice_python_task.md +4 -4
  156. package/bin/skills/lakehouse-doc-en/references/pricing-ai-gateway.md +181 -0
  157. package/bin/skills/lakehouse-doc-en/references/pricing-lakehouse.md +316 -0
  158. package/bin/skills/lakehouse-doc-en/references/pricing.md +44 -288
  159. package/bin/skills/lakehouse-doc-en/references/private-link-general.md +0 -2
  160. package/bin/skills/lakehouse-doc-en/references/pyspark-to-zettapark-migration-f1.md +1 -1
  161. package/bin/skills/lakehouse-doc-en/references/python-igs.md +7 -3
  162. package/bin/skills/lakehouse-doc-en/references/python-sample-put-github-rt-events.md +1 -1
  163. package/bin/skills/lakehouse-doc-en/references/python-task.md +1 -1
  164. package/bin/skills/lakehouse-doc-en/references/python_reference/connector.md +3 -3
  165. package/bin/skills/lakehouse-doc-en/references/python_reference/connector_advanced.md +2 -2
  166. package/bin/skills/lakehouse-doc-en/references/python_reference/connector_examples.md +2 -2
  167. package/bin/skills/lakehouse-doc-en/references/python_sdk_guide.md +1 -1
  168. package/bin/skills/lakehouse-doc-en/references/python_shell_datasource.md +11 -9
  169. package/bin/skills/lakehouse-doc-en/references/quick_start_batch_sync_data.md +9 -18
  170. package/bin/skills/lakehouse-doc-en/references/quick_start_bi_analysis.md +8 -25
  171. package/bin/skills/lakehouse-doc-en/references/quick_start_create_workspace.md +4 -6
  172. package/bin/skills/lakehouse-doc-en/references/quick_start_data_quality.md +8 -8
  173. package/bin/skills/lakehouse-doc-en/references/quick_start_etl.md +16 -20
  174. package/bin/skills/lakehouse-doc-en/references/quick_start_monitoring_and_alerting.md +10 -18
  175. package/bin/skills/lakehouse-doc-en/references/quick_start_sql_query.md +7 -10
  176. package/bin/skills/lakehouse-doc-en/references/quick_start_upload_data.md +5 -7
  177. package/bin/skills/lakehouse-doc-en/references/quick_start_user_management.md +8 -8
  178. package/bin/skills/lakehouse-doc-en/references/quick_start_workspace.md +0 -5
  179. package/bin/skills/lakehouse-doc-en/references/quick_start_workspace_user.md +8 -8
  180. package/bin/skills/lakehouse-doc-en/references/quickstart.md +69 -56
  181. package/bin/skills/lakehouse-doc-en/references/quickstart_datashare_between_companies.md +0 -5
  182. package/bin/skills/lakehouse-doc-en/references/quickstart_envirment_for_team.md +0 -24
  183. package/bin/skills/lakehouse-doc-en/references/realtime-pipeline-selection-guide.md +1 -2
  184. package/bin/skills/lakehouse-doc-en/references/realtime-sales-dashboard-with-dynamic-table.md +3 -3
  185. package/bin/skills/lakehouse-doc-en/references/realtime_sync.md +0 -1
  186. package/bin/skills/lakehouse-doc-en/references/release-note-2026-05-19.md +5 -3
  187. package/bin/skills/lakehouse-doc-en/references/revoke-privileges.md +3 -1
  188. package/bin/skills/lakehouse-doc-en/references/roles.md +2 -3
  189. package/bin/skills/lakehouse-doc-en/references/row-filter.md +165 -0
  190. package/bin/skills/lakehouse-doc-en/references/row_level_permission.md +30 -19
  191. package/bin/skills/lakehouse-doc-en/references/scheduled_task.md +28 -21
  192. package/bin/skills/lakehouse-doc-en/references/security_overview.md +99 -21
  193. package/bin/skills/lakehouse-doc-en/references/set-command.md +1 -1
  194. package/bin/skills/lakehouse-doc-en/references/setup.md +13 -15
  195. package/bin/skills/lakehouse-doc-en/references/show-grants.md +1 -1
  196. package/bin/skills/lakehouse-doc-en/references/snowflake-dynamic-tables-to-lakehouse.md +2 -2
  197. package/bin/skills/lakehouse-doc-en/references/spark-connector-summary.md +1 -1
  198. package/bin/skills/lakehouse-doc-en/references/sql_functions/context_functions/current_vcluster.md +1 -1
  199. package/bin/skills/lakehouse-doc-en/references/sso-configuration.md +2 -2
  200. package/bin/skills/lakehouse-doc-en/references/streaming_pipeline_with_dynamic_table.md +0 -1
  201. package/bin/skills/lakehouse-doc-en/references/studio-incremental-sync-practice.md +27 -23
  202. package/bin/skills/lakehouse-doc-en/references/studio-shell-task.md +1 -1
  203. package/bin/skills/lakehouse-doc-en/references/supported-cloud-platforms.md +32 -0
  204. package/bin/skills/lakehouse-doc-en/references/table_rendering.md +18 -12
  205. package/bin/skills/lakehouse-doc-en/references/task-develop.md +89 -91
  206. package/bin/skills/lakehouse-doc-en/references/task_development.md +19 -17
  207. package/bin/skills/lakehouse-doc-en/references/task_group.md +16 -14
  208. package/bin/skills/lakehouse-doc-en/references/task_instance.md +21 -21
  209. package/bin/skills/lakehouse-doc-en/references/task_param.md +38 -35
  210. package/bin/skills/lakehouse-doc-en/references/task_param_reference.md +81 -79
  211. package/bin/skills/lakehouse-doc-en/references/task_scheduling_dependency.md +20 -21
  212. package/bin/skills/lakehouse-doc-en/references/tencentcloud_arn_and_externalid.md +1 -5
  213. package/bin/skills/lakehouse-doc-en/references/trial-account-quotas-and-limits.md +1 -3
  214. package/bin/skills/lakehouse-doc-en/references/tutorial_connect_to_lakehouse.md +69 -0
  215. package/bin/skills/lakehouse-doc-en/references/tutorials.md +4 -1
  216. package/bin/skills/lakehouse-doc-en/references/unique-key.md +167 -0
  217. package/bin/skills/lakehouse-doc-en/references/usageandbillingview.md +138 -0
  218. package/bin/skills/lakehouse-doc-en/references/use-dbt-dev.md +3 -3
  219. package/bin/skills/lakehouse-doc-en/references/use-java-sdk-realtime-uploaddata.md +1 -1
  220. package/bin/skills/lakehouse-doc-en/references/use-java-sdk-upload-data-local.md +3 -3
  221. package/bin/skills/lakehouse-doc-en/references/use-models.md +128 -0
  222. package/bin/skills/lakehouse-doc-en/references/use-mysql-client.md +81 -81
  223. package/bin/skills/lakehouse-doc-en/references/use-python-sdk-upload-data.md +10 -12
  224. package/bin/skills/lakehouse-doc-en/references/user-identification.md +2 -3
  225. package/bin/skills/lakehouse-doc-en/references/user_permission_grand_guide.md +1 -1
  226. package/bin/skills/lakehouse-doc-en/references/using-udf-in-dynamic-table.md +1 -1
  227. package/bin/skills/lakehouse-doc-en/references/vc_cache.md +18 -22
  228. package/bin/skills/lakehouse-doc-en/references/vcluster_size_description.md +33 -31
  229. package/bin/skills/lakehouse-doc-en/references/virtual-cluster.md +43 -45
  230. package/bin/skills/lakehouse-doc-en/references/web-job-history.md +94 -108
  231. package/bin/skills/lakehouse-doc-en/references/web_search.md +16 -7
  232. package/bin/skills/lakehouse-doc-en/references/zettapark-data-engineering-demo.md +1 -1
  233. package/bin/skills/lakehouse-doc-en/references/zettapark-dataframe-guide.md +144 -70
  234. package/bin/skills/lakehouse-doc-en/references/zettapark-dynamic-table-guide.md +2 -2
  235. package/bin/skills/lakehouse-doc-en/references/zettapark-etl-guide.md +73 -33
  236. package/bin/skills/lakehouse-doc-en/references/zettapark-feature-engineering.md +2 -2
  237. package/bin/skills/lakehouse-doc-en/references/zettapark-functions-guide.md +75 -46
  238. package/bin/skills/lakehouse-doc-en/references/zettapark-quick-start.md +2 -2
  239. package/bin/skills/lakehouse-doc-en/references/zettapark-stream-guide.md +4 -4
  240. package/bin/skills/lakehouse-doc-en/references/zettapark-volume-guide.md +93 -29
  241. package/package.json +1 -1
  242. package/bin/skills/lakehouse-doc-en/references/CLAUDE.md +0 -606
  243. package/bin/skills/lakehouse-doc-en/references/modelprice.md +0 -155
@@ -0,0 +1,317 @@
1
+ # AI Gateway Model Management: cz-cli Command Line Operations
2
+
3
+ AI Gateway model management is typically handled through the Studio UI, but cz-cli provides a corresponding command-line interface — for creating and configuring virtual Keys, browsing available models, and registering them as cz-cli Agent LLMs. It is well suited for automation scripts and CI/CD pipelines, as well as quickly querying model lists from the terminal.
4
+
5
+ ---
6
+
7
+ ## Core Flow
8
+
9
+ ![](.topwrite/assets/14-ai-gateway-czcli.svg)
10
+
11
+ ---
12
+
13
+ ## Commands Overview
14
+
15
+ | Command | Purpose |
16
+ |------|------|
17
+ | `cz-cli ai-gateway key list` | List all virtual Keys |
18
+ | `cz-cli ai-gateway key create` | Create a virtual Key |
19
+ | `cz-cli ai-gateway key upsert` | Create or update a Key (idempotent, recommended) |
20
+ | `cz-cli ai-gateway key get` | Retrieve the full Key value |
21
+ | `cz-cli ai-gateway key enable/disable` | Enable or disable a Key |
22
+ | `cz-cli ai-gateway key delete` | Delete a Key |
23
+ | `cz-cli ai-gateway key set-quota` | Set the token quota for a Key |
24
+ | `cz-cli ai-gateway model list` | View models accessible with a Key |
25
+ | `cz-cli agent llm add ... --provider clickzetta` | Register a Key as an Agent LLM |
26
+
27
+ ---
28
+
29
+ ## Managing Virtual Keys
30
+
31
+ ### List Existing Keys
32
+
33
+ ```bash
34
+ cz-cli ai-gateway key list
35
+ ```
36
+
37
+ ```json
38
+ {
39
+ "data": [
40
+ {
41
+ "id": 716,
42
+ "alias": "qiliang",
43
+ "vApiKey": "50db****7f61",
44
+ "status": 1
45
+ }
46
+ ],
47
+ "count": 1,
48
+ "ai_message": "Page 1, showing 1 of 1 virtual keys."
49
+ }
50
+ ```
51
+
52
+ | Field | Description |
53
+ |------|------|
54
+ | `id` | Unique ID of the Key |
55
+ | `alias` | Key alias, specified at creation time |
56
+ | `vApiKey` | Key value, shown masked (first 4 + last 4 characters). The full value is required for all subsequent operations; the masked value and alias cannot be used |
57
+ | `status` | 1 = enabled, 0 = disabled |
58
+
59
+ ### Create a Key
60
+
61
+ ```bash
62
+ cz-cli ai-gateway key create my_key
63
+ ```
64
+
65
+ ```json
66
+ {
67
+ "data": {
68
+ "id": 736,
69
+ "alias": "my_key",
70
+ "vApiKey": "c081****dae5"
71
+ },
72
+ "ai_message": "Virtual key created. To use it with the agent run: cz-cli agent llm add my_key --provider clickzetta --api-key <vApiKey> --base-url https://... --use"
73
+ }
74
+ ```
75
+
76
+ > **Note**: `vApiKey` is only returned in full when `key create` is called. In `key list` it is displayed masked (e.g., `a12f****950c`). All subsequent operations (`get`, `disable`, `enable`, `delete`, `set-quota`, `model list`) require the **full vApiKey** — the alias and masked value cannot be used. Save the full Key immediately after creation.
77
+
78
+ ### Create or Update a Key (upsert, recommended)
79
+
80
+ `upsert` is idempotent — if the Key already exists it updates the configuration, if it does not exist it creates one. Suitable for repeated execution in scripts:
81
+
82
+ ```bash
83
+ # Basic creation
84
+ cz-cli ai-gateway key upsert prod_key \
85
+ --quota 1000000 --period monthly
86
+
87
+ # Create and immediately register as an Agent LLM (skip manual add)
88
+ cz-cli ai-gateway key upsert my_agent \
89
+ --quota 500000 --period daily \
90
+ --add-to-llm --use
91
+ ```
92
+
93
+ **upsert parameter descriptions:**
94
+
95
+ | Parameter | Description |
96
+ |------|------|
97
+ | `--quota` | Token quota value |
98
+ | `--period` | Quota period: `daily` / `weekly` / `monthly` / `total` (long-term) |
99
+ | `--route-type` | Routing rule: `default` (built-in models) / `provider` (specific provider) / `byok` (bring your own key) |
100
+ | `--providers` | Specify provider IDs (used when `route-type=provider`) |
101
+ | `--provider-sort` | Sorting strategy (used when `route-type=default`): `price` / `throughput` / `latency` |
102
+ | `--private-keys` | List of BYOK Key aliases (used when `route-type=byok`) |
103
+ | `--add-to-llm` | Automatically register as `[llm.<name>]` in `~/.clickzetta/profiles.toml`, using alias as value |
104
+ | `--use` | Also set as the active LLM |
105
+
106
+ ### Update Quota
107
+
108
+ ```bash
109
+ cz-cli ai-gateway key set-quota \
110
+ --key "<full vApiKey>" \
111
+ --period daily \
112
+ --quota 2000000
113
+ ```
114
+
115
+ ```json
116
+ {
117
+ "data": {
118
+ "id": 716,
119
+ "period": "daily",
120
+ "quota": 2000000
121
+ }
122
+ }
123
+ ```
124
+
125
+ ### Enable / Disable / Delete
126
+
127
+ ```bash
128
+ # Requires the full vApiKey; alias and masked values are not accepted
129
+ cz-cli ai-gateway key disable "<full vApiKey>"
130
+ cz-cli ai-gateway key enable "<full vApiKey>"
131
+ cz-cli ai-gateway key delete "<full vApiKey>"
132
+ ```
133
+
134
+ | Operation | Output |
135
+ |------|------|
136
+ | disable | `{"data": {"id": 738, "status": 0}}` |
137
+ | enable | `{"data": {"id": 738, "status": 1}}` |
138
+ | delete | `{"data": {"id": 738, "deleted": true}}` |
139
+
140
+
141
+ ---
142
+
143
+ ## Browsing Available Models
144
+
145
+ ```bash
146
+ cz-cli ai-gateway model list "<full vApiKey>"
147
+ ```
148
+
149
+ > **Note**: Passing a masked value (e.g., `a12f****950c`) will silently return `{"data":[],"count":0}` without an error, which can make it appear as though no models are available. You must pass the full value obtained when `key create` was called.
150
+
151
+ The output is the list of models visible to that Key, in the following format (the actual response returns 42 models):
152
+
153
+ ```json
154
+ {
155
+ "data": [
156
+ {"modelIdentifier": "qwen/qwen3.7-max", "modelName": "Qwen3.7 Max"},
157
+ {"modelIdentifier": "byteplus/dola-seed-2-0-pro", "modelName": "ByteDance Dola Seed 2.0 pro"},
158
+ {"modelIdentifier": "minimax/MiniMax-M2.7", "modelName": "MiniMax M2.7"},
159
+ {"modelIdentifier": "openai/gpt-4.1", "modelName": "GPT-4.1"},
160
+ {"modelIdentifier": "deepseek/deepseek-v4-pro", "modelName": "DeepSeek V4 Pro"}
161
+ ],
162
+ "count": 42
163
+ }
164
+ ```
165
+
166
+ | Field | Description |
167
+ |------|------|
168
+ | `modelIdentifier` | Unique model identifier, e.g., `deepseek/deepseek-v4-pro`, used in `AI_COMPLETE()` |
169
+ | `modelName` | Display name of the model, e.g., `DeepSeek V4 Pro` |
170
+ | `modelInvokeStatus` | 1 = callable |
171
+
172
+ The model identifier format is `<provider>/<model-name>`, which is the full name used in AI_COMPLETE calls.
173
+
174
+ ---
175
+
176
+ ## Registering as an Agent LLM
177
+
178
+ The built-in AI Agent in cz-cli requires an LLM backend. A virtual Key from AI Gateway can be used as the Agent LLM.
179
+
180
+ ### Option 1: Complete in One Step with upsert
181
+
182
+ ```bash
183
+ cz-cli ai-gateway key upsert my_agent \
184
+ --quota 500000 --period daily \
185
+ --add-to-llm --use
186
+ ```
187
+
188
+ ```json
189
+ {
190
+ "data": {
191
+ "id": 737,
192
+ "alias": "demo-key",
193
+ "vApiKey": "ed42****f942"
194
+ }
195
+ }
196
+ ```
197
+
198
+ `--add-to-llm` writes the Key into the `[llm.my_agent]` section of `~/.clickzetta/profiles.toml`, and `--use` sets it as the default LLM.
199
+
200
+ ### Option 2: Manual Registration
201
+
202
+ Retrieve the full Key value with `key get`, then add it manually:
203
+
204
+ ```bash
205
+ cz-cli agent llm add my_agent \
206
+ --provider clickzetta \
207
+ --api-key "<full virtual Key>" \
208
+ --base-url "https://cn-shanghai-alicloud-aimesh.api.clickzetta.com/gateway/v1" \
209
+ --use
210
+ ```
211
+
212
+ When provider is `clickzetta`, `--base-url` must be set to the AI Gateway Base URL.
213
+
214
+ AI Gateway Base URL by region:
215
+
216
+ | Region | Base URL |
217
+ |------|----------|
218
+ | Alibaba Cloud Shanghai | `https://cn-shanghai-alicloud-aimesh.api.clickzetta.com/gateway/v1` |
219
+ | Tencent Cloud Shanghai | `https://ap-shanghai-tencentcloud-aimesh.api.clickzetta.com/gateway/v1` |
220
+ | AWS Singapore | `https://ap-southeast-1-aws-aimesh.api.singdata.com/gateway/v1` |
221
+
222
+ ### Test the Connection
223
+
224
+ ```bash
225
+ cz-cli agent llm test my_agent
226
+ ```
227
+
228
+ ```json
229
+ {
230
+ "data": {
231
+ "message": "[llm.my_agent] test passed.",
232
+ "name": "my_agent",
233
+ "provider": "clickzetta",
234
+ "url": "https://cn-shanghai-alicloud-aimesh.api.clickzetta.com/gateway/v1/chat/completions",
235
+ "probe": "chat.completions",
236
+ "source": "llm"
237
+ }
238
+ }
239
+ ```
240
+
241
+ ### View and Switch LLMs
242
+
243
+ ```bash
244
+ cz-cli agent llm show # View all LLM configurations
245
+ cz-cli agent llm list # List all [llm.*] entries
246
+ cz-cli agent llm use my_agent # Switch active LLM
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Usage Examples
252
+
253
+ ### Scenario: Bulk-create AI Gateway Keys for a Development Team
254
+
255
+ ```bash
256
+ # Create a Key for each developer
257
+ for name in alice bob carol; do
258
+ cz-cli ai-gateway key upsert "dev_${name}" \
259
+ --quota 100000 --period daily \
260
+ --route-type default --provider-sort price
261
+ done
262
+
263
+ # View all Keys
264
+ cz-cli ai-gateway key list
265
+ ```
266
+
267
+ ### Scenario: Query Models from a Specific Provider
268
+
269
+ ```bash
270
+ # Get the Key and view available models
271
+ cz-cli ai-gateway model list "<full vApiKey>"
272
+
273
+ # Filter for DeepSeek provider models
274
+ cz-cli ai-gateway model list "<full vApiKey>" --format json | \
275
+ python3 -c "
276
+ import json, sys
277
+ data = json.load(sys.stdin)
278
+ for m in data['data']:
279
+ if m['modelIdentifier'].startswith('deepseek'):
280
+ print(m['modelIdentifier'], m['modelName'])
281
+ "
282
+ ```
283
+
284
+ ### Scenario: Register an Agent LLM and Switch to It
285
+
286
+ ```bash
287
+ # Complete in one step
288
+ cz-cli ai-gateway key upsert agent_prod \
289
+ --quota 5000000 --period monthly \
290
+ --add-to-llm --use
291
+
292
+ # Verify
293
+ cz-cli agent llm test agent_prod
294
+ ```
295
+
296
+ ---
297
+
298
+ ## Notes
299
+
300
+ | Note | Description |
301
+ |--------|------|
302
+ | **vApiKey security** | `key list` returns a masked value; `key get` returns the full value. Do not write the full Key into logs or commit it to git |
303
+ | **Key naming** | Use `alias` to indicate purpose: `dev_alice`, `prod_agent`, `staging_test` |
304
+ | **Quota takes effect immediately** | Quota changes apply right away without restarting any service |
305
+ | **model list output** | When the output is large, use `--format json` and pipe for filtering |
306
+ | **clickzetta provider** | Requires both `--api-key` and `--base-url`; neither can be omitted. Alternatively, use `--add-to-llm` during upsert for automatic injection |
307
+ | **provider options** | `agent llm add` supports `clickzetta` / `openai` / `openai-compatible` / `anthropic` / `bedrock` / `google` / `azure` / `openrouter` |
308
+
309
+ ---
310
+
311
+ ## Related Documentation
312
+
313
+ - [AI Gateway Quick Start](quickstart.md) — Creating API Keys and routing policies in Studio
314
+ - [AI Gateway Product Introduction](Introduction.md) — Endpoint management, quotas, monitoring
315
+ - [AI Gateway in Practice: Calling LLMs with SQL](lakehouse-ai-sql-analysis.md) — AI_COMPLETE text mode
316
+ - [Analyzing Images in SQL](lakehouse-multimodal-ai-pipeline.md) — AI_COMPLETE image mode
317
+ - [cz-cli Installation and Setup Guide](setup_cz_cli.md) — Setting up the cz-cli environment
@@ -0,0 +1,345 @@
1
+ # AI Gateway in Practice: Calling LLMs with SQL
2
+
3
+ Calling large language models (LLMs) directly in SQL queries is the key leap that takes data analysis from "querying data" to "understanding data." Singdata Lakehouse, through **AI Gateway + the AI_COMPLETE function**, lets you complete text analysis, sentiment evaluation, content generation, and intelligent classification within standard SQL — all processing happens inside the same query engine, with no need to export data to a Python environment.
4
+
5
+ This article uses the Kimi K2.6 (Moonshot AI) model together with NHL hockey data to demonstrate practical patterns for SQL + AI.
6
+
7
+ ---
8
+
9
+ ## Core Capabilities
10
+
11
+ | Capability | Traditional approach | SQL + AI approach |
12
+ |---|---|---|
13
+ | Text sentiment analysis | Python + Transformers | `SELECT AI_COMPLETE(model, prompt)` |
14
+ | Content classification | Export CSV → Python script | Built-in SQL function, batch processing |
15
+ | Intelligent report generation | BI tool with external scripts | SQL query outputs analysis text directly |
16
+ | Multilingual translation | API call + ETL write-back | `AI_COMPLETE` join-based translation |
17
+ | Data augmentation | Manual annotation | LLM auto-labeling, evaluation, enrichment |
18
+
19
+ ---
20
+
21
+ ## Architecture Overview
22
+
23
+ ![](.topwrite/assets/13-ai-gateway-architecture.svg)
24
+
25
+ The SQL engine forwards `AI_COMPLETE()` calls to AI Gateway. The Gateway handles authentication, rate limiting, and quota management, then routes requests to the configured LLM. The entire process is transparent to SQL users — you only need to write SQL, with no API Key management or rate-limit retry handling required.
26
+
27
+ ---
28
+
29
+ ## Configuring the AI Gateway Connection
30
+
31
+ ### Option 1: AI Gateway Endpoint (Recommended, requires Studio UI)
32
+
33
+ In Studio → API Key Management → New API Key; in Model Marketplace → select a model → View → check Endpoint Management and model invocation examples.
34
+
35
+ ```sql
36
+ -- Use a pre-configured Endpoint
37
+ SELECT AI_COMPLETE('endpoint:kimi-k2.6', 'Hello');
38
+ ```
39
+
40
+ ### Option 2: API Connection (Create directly in SQL)
41
+
42
+ ```sql
43
+ -- Create once, reused by all subsequent queries
44
+ CREATE API CONNECTION ai_gateway_conn
45
+ TYPE ai_function
46
+ PROVIDER = 'openai' -- AI Gateway follows the OpenAI interface specification
47
+ BASE_URL = 'https://<region>-aimesh.api.clickzetta.com/gateway/v1'
48
+ API_KEY = '<your_api_key>';
49
+ ```
50
+
51
+ AI Gateway Base URLs vary by region:
52
+
53
+ | Region | Base URL |
54
+ |---|---|
55
+ | Alibaba Cloud Shanghai | `https://cn-shanghai-alicloud-aimesh.api.clickzetta.com/gateway/v1` |
56
+ | Tencent Cloud Shanghai | `https://ap-shanghai-tencentcloud-aimesh.api.clickzetta.com/gateway/v1` |
57
+ | AWS Singapore | `https://ap-southeast-1-aws-aimesh.api.singdata.com/gateway/v1` |
58
+
59
+ ### Format
60
+
61
+ ```sql
62
+ -- Format: <connection_name>:<model_name>
63
+ 'ai_gateway_conn:moonshotai/kimi-k2.6'
64
+
65
+ -- Full call
66
+ SELECT AI_COMPLETE('ai_gateway_conn:moonshotai/kimi-k2.6', 'Your prompt here');
67
+ ```
68
+
69
+ > The connection name and model name are separated by an **English colon** with no spaces.
70
+
71
+ ---
72
+
73
+ ## AI_COMPLETE Basic Usage
74
+
75
+ ### Connectivity Test
76
+
77
+ ```sql
78
+ SELECT AI_COMPLETE('ai_gateway_conn:moonshotai/kimi-k2.6',
79
+ 'hello, introduce yourself in one sentence'
80
+ );
81
+ ```
82
+
83
+ **Response** (measured at 3.1 seconds):
84
+
85
+ > I am Kimi, a large language model created by Moonshot AI, here to help you with information, writing, analysis, and conversation.
86
+
87
+ ### General Prompt Templates
88
+
89
+ ```sql
90
+ -- Summarization
91
+ SELECT AI_COMPLETE('conn:model',
92
+ CONCAT('Summarize in one sentence: ', content)
93
+ ) FROM articles;
94
+
95
+ -- Sentiment evaluation
96
+ SELECT AI_COMPLETE('conn:model',
97
+ CONCAT('Determine sentiment (positive/negative/neutral), reply with one word only: ', review)
98
+ ) FROM reviews;
99
+
100
+ -- Content classification
101
+ SELECT AI_COMPLETE('conn:model',
102
+ CONCAT('Classify the following text as sports/finance/tech/health: ', text)
103
+ ) FROM contents;
104
+
105
+ -- Translation
106
+ SELECT AI_COMPLETE('conn:model',
107
+ CONCAT('Translate the following English text to Chinese: ', english_text)
108
+ ) FROM docs;
109
+ ```
110
+
111
+ > **Tip**: Adding "reply with one word only" or "reply with the category name only" to the prompt controls output format, making downstream GROUP BY or WHERE filtering easier.
112
+
113
+ ---
114
+
115
+ ## Practice: AI-Enhanced NHL Data Analysis
116
+
117
+ ### Scenario 1: Player Scouting Reports
118
+
119
+ Feed Gold layer aggregated data (career goals, assists, points) into the LLM to generate professional scouting evaluations:
120
+
121
+ ```sql
122
+ SELECT
123
+ player_name,
124
+ position,
125
+ total_goals,
126
+ total_points,
127
+ AI_COMPLETE('ai_gateway_conn:moonshotai/kimi-k2.6',
128
+ CONCAT('Summarize this NHL player''s career style in one sentence: ',
129
+ player_name,
130
+ ', position: ', position,
131
+ ', career goals: ', CAST(total_goals AS STRING),
132
+ ', total points: ', CAST(total_points AS STRING))
133
+ ) AS ai_scout_report
134
+ FROM gold.player_career_stats
135
+ ORDER BY total_points DESC
136
+ LIMIT 5;
137
+ ```
138
+
139
+ Query results (5 rows, 10.2 seconds):
140
+
141
+ | Player | AI Scouting Report |
142
+ |---|---|
143
+ | Alex Ovechkin | A goal-scorer who redefined the left wing position with unstoppable heavy shots and dominant presence in the slot, combining violent aesthetics with remarkable longevity across nearly two decades at the peak |
144
+ | Sidney Crosby | A generational center defined by complete two-way play, relentless competitiveness, and exceptional hockey IQ, who set the modern benchmark for an elite NHL core player through intelligence and hard work |
145
+ | Joe Thornton | A traditional center renowned for elite playmaking vision and organizational ability, whose career assists far outnumber goals, embodying an unselfish and all-around style of play |
146
+ | Patrick Kane | A technically brilliant and highly creative offensive force, who became one of the most entertaining wingers in NHL history with his ghostly puck-handling and clutch game-winning ability |
147
+ | Evgeni Malkin | An elite offensive center who blends Eastern European technical finesse with North American physicality, celebrated at his peak for his unstoppable puck possession and improvisational creativity |
148
+
149
+ > AI-generated evaluations accurately captured each player's style characteristics with fluent language and clear perspectives.
150
+
151
+ ### Scenario 2: Team Season Reviews
152
+
153
+ Generate season summaries from team standings:
154
+
155
+ ```sql
156
+ SELECT
157
+ team_abbr,
158
+ wins, losses, goals_for, goals_against,
159
+ AI_COMPLETE('ai_gateway_conn:moonshotai/kimi-k2.6',
160
+ CONCAT('Summarize this NHL team''s season performance in one sentence: ',
161
+ team_abbr, ', season 2019-20, ',
162
+ 'wins: ', CAST(wins AS STRING),
163
+ ', losses: ', CAST(losses AS STRING),
164
+ ', goals for: ', CAST(goals_for AS STRING),
165
+ ', goals against: ', CAST(goals_against AS STRING))
166
+ ) AS season_review
167
+ FROM gold.team_season_summary
168
+ WHERE season = 20192020
169
+ ORDER BY wins DESC
170
+ LIMIT 5;
171
+ ```
172
+
173
+ Query results (5 rows, 10.1 seconds):
174
+
175
+ | Team | AI Season Review |
176
+ |---|---|
177
+ | TBL (Lightning) | An outstanding season with powerful offense and solid defense, ultimately winning the Stanley Cup championship |
178
+ | VGK (Golden Knights) | A solid season with offense slightly outpacing defense and an overall winning record above .500 |
179
+ | COL (Avalanche) | Decent offensive output but inconsistent defense, with an overall winning rate approaching .500 |
180
+
181
+ ### Scenario 3: Sentiment Analysis + Classification
182
+
183
+ Perform instant analysis on any text without a pre-trained model:
184
+
185
+ ```sql
186
+ SELECT
187
+ AI_COMPLETE('ai_gateway_conn:moonshotai/kimi-k2.6',
188
+ 'Determine sentiment (positive/negative/neutral), reply with one word only: '
189
+ || 'The Lightning played an incredible game tonight!'
190
+ ) AS sentiment_1,
191
+
192
+ AI_COMPLETE('ai_gateway_conn:moonshotai/kimi-k2.6',
193
+ 'Determine sentiment (positive/negative/neutral), reply with one word only: '
194
+ || 'Terrible officiating tonight.'
195
+ ) AS sentiment_2,
196
+
197
+ AI_COMPLETE('ai_gateway_conn:moonshotai/kimi-k2.6',
198
+ 'Classify the text as sports/finance/tech/health. Reply with category only: '
199
+ || 'NHL playoffs start next week with 16 teams.'
200
+ ) AS category;
201
+ ```
202
+
203
+ Query results:
204
+
205
+ | sentiment_1 | sentiment_2 | category |
206
+ |---|---|---|
207
+ | positive | negative | sports |
208
+
209
+ ---
210
+
211
+ ## Batch AI Processing Patterns
212
+
213
+ ### Pattern A: Row-by-row Processing
214
+
215
+ Suitable for small datasets (< 1000 rows) — use SELECT + AI_COMPLETE directly:
216
+
217
+ ```sql
218
+ SELECT id, content,
219
+ AI_COMPLETE('conn:model', CONCAT('Summarize: ', content)) AS summary
220
+ FROM articles
221
+ WHERE created_date = CURRENT_DATE();
222
+ ```
223
+
224
+ ### Pattern B: Dynamic Table Auto-batch Processing
225
+
226
+ Persist AI analysis results into a Dynamic Table for zero-latency subsequent queries:
227
+
228
+ ```sql
229
+ -- Create an AI-enhanced analysis table
230
+ CREATE OR REPLACE DYNAMIC TABLE gold.player_ai_scouting
231
+ REFRESH INTERVAL 1 DAY VCLUSTER DEFAULT
232
+ COMMENT 'AI scouting reports - auto-updated daily'
233
+ AS
234
+ SELECT
235
+ player_id,
236
+ player_name,
237
+ position,
238
+ total_goals,
239
+ total_points,
240
+ pts_per_game,
241
+ AI_COMPLETE('ai_gateway_conn:moonshotai/kimi-k2.6',
242
+ CONCAT('Summarize this NHL player in one sentence: ',
243
+ player_name, ', position: ', position,
244
+ ', goals: ', CAST(total_goals AS STRING),
245
+ ', points: ', CAST(total_points AS STRING),
246
+ ', points per game: ', CAST(pts_per_game AS STRING))
247
+ ) AS scouting_report
248
+ FROM gold.player_career_stats
249
+ WHERE total_points > 500; -- only analyze players with 500+ points to control cost
250
+
251
+ -- Application layer queries directly, zero AI call latency
252
+ SELECT player_name, scouting_report
253
+ FROM gold.player_ai_scouting
254
+ WHERE player_name = 'Alex Ovechkin';
255
+ ```
256
+
257
+ > **Note**: Each DT REFRESH re-invokes AI_COMPLETE for all rows that satisfy the WHERE condition. Recommendations:
258
+ > - Only run AI analysis on key rows (use WHERE filtering)
259
+ > - Use a `1 DAY` or longer refresh interval
260
+ > - Use a regular table instead of DT to manually control refresh timing
261
+
262
+ ### Pattern C: Materialize AI Results into a Regular Table
263
+
264
+ More granular cost control — manually trigger only when needed:
265
+
266
+ ```sql
267
+ -- Create a results table
268
+ CREATE TABLE gold.player_scouting_reports (
269
+ player_id BIGINT,
270
+ player_name STRING,
271
+ report STRING,
272
+ generated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
273
+ );
274
+
275
+ -- Generate once
276
+ INSERT INTO gold.player_scouting_reports (player_id, player_name, report)
277
+ SELECT
278
+ player_id,
279
+ player_name,
280
+ AI_COMPLETE('ai_gateway_conn:moonshotai/kimi-k2.6',
281
+ CONCAT('Evaluate this NHL player: ', player_name,
282
+ ', ', CAST(total_points AS STRING), ' points')
283
+ )
284
+ FROM gold.player_career_stats
285
+ WHERE total_points > 1000;
286
+ ```
287
+
288
+ ---
289
+
290
+ ## Performance and Cost
291
+
292
+ ### Measured Performance (Kimi K2.6, Alibaba Cloud Shanghai)
293
+
294
+ | Scenario | Rows | Total time | Average per row |
295
+ |---|---|---|---|
296
+ | Single call | 1 | 1.9-3.1s | ~2.5s |
297
+ | Scouting reports (with data concatenation) | 5 | 10.2s | 2.0s |
298
+ | Season reviews (with data concatenation) | 5 | 10.1s | 2.0s |
299
+ | Sentiment + classification (simple output) | 3 | 2.4s | 0.8s |
300
+
301
+ > Single-row AI call latency is ~2-3 seconds. Batch processing 100 rows is expected to take 3-5 minutes. For tens of thousands of rows, use the DT materialization pattern to avoid repeated calls.
302
+
303
+ ### Three Cost Control Principles
304
+
305
+ | Principle | Method |
306
+ |---|---|
307
+ | **Reduce call count** | Filter key rows with WHERE, materialize results to a table, use DT to only analyze incremental rows |
308
+ | **Shorten output length** | Add "in one sentence", "reply with one word only", or set max_tokens in the prompt |
309
+ | **Control refresh frequency** | Lower DT refresh from `1 HOUR` to `1 DAY` or `7 DAY` |
310
+
311
+ ### AI Gateway Quota Management
312
+
313
+ AI Gateway provides tenant-level and Endpoint-level quota controls:
314
+
315
+ - **Tenant quota**: Monthly total token cap for the organization (e.g., 5 million/month)
316
+ - **Endpoint quota**: Independent quota per model (e.g., Kimi 1 million/month)
317
+ - **Actual available = min(tenant remaining, Endpoint quota)**
318
+
319
+ View real-time consumption in Studio → AI Model Management → Usage.
320
+
321
+ ---
322
+
323
+ ## Notes
324
+
325
+ | Note | Description |
326
+ |---|---|
327
+ | **AI_COMPLETE does not support OR REPLACE** | The function is built-in and does not need to be created |
328
+ | **AI_SUMMARIZE / AI_SENTIMENT and other specialized functions coming soon** | Only `AI_COMPLETE` is available in the current version; other functions will be released in the next version. All capabilities can be implemented in advance using `AI_COMPLETE` + prompts |
329
+ | **Output format is non-deterministic** | LLM output may contain extra text; add "reply with one word only" constraints |
330
+ | **AI_COMPLETE cost in DT must be evaluated** | DT recomputes everything on each REFRESH; recommend analyzing only incremental rows |
331
+ | **Connection name and model name use an English colon** | `'conn:model'`; do not use the `connection:` prefix |
332
+ | **Do not SELECT AI_COMPLETE directly on production tables** | Materialize results first then query, to avoid repeated API calls |
333
+ | **Function call timeout** | The default SQL timeout may not be sufficient; use asynchronous processing for long text |
334
+
335
+ ---
336
+
337
+ ## Related Documentation
338
+
339
+ - [AI Gateway Product Overview](AI_Gateway.md) — Endpoint management, quotas, monitoring
340
+ - [AI Functions Overview](ai_functions_overview.md) — Detailed parameters for all AI functions
341
+ - [AI_COMPLETE Detailed Documentation](ai_complete.md) — options parameters, image mode
342
+ - [AI_EMBEDDING Detailed Documentation](ai_embedding.md) — Embedding and semantic search
343
+ - [CREATE API CONNECTION](create-api-connection.md) — Full syntax
344
+ - [Medallion Pure-SQL DT Architecture](lakehouse-medallion-sql-dt-guide.md) — NHL data layered modeling
345
+ - [Multi-cloud Unified Data Lake Acceleration](lakehouse-multi-cloud-acceleration.md) — Volume + Pipe + DT cross-cloud solution