larsql 2.0.4__tar.gz

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 (308) hide show
  1. larsql-2.0.4/.gitignore +18 -0
  2. larsql-2.0.4/PKG-INFO +422 -0
  3. larsql-2.0.4/README.md +354 -0
  4. larsql-2.0.4/lars/ECHO_INTEGRATION.md +448 -0
  5. larsql-2.0.4/lars/__init__.py +356 -0
  6. larsql-2.0.4/lars/agent.py +1478 -0
  7. larsql-2.0.4/lars/alice_generator.py +60 -0
  8. larsql-2.0.4/lars/analytics_worker.py +1807 -0
  9. larsql-2.0.4/lars/analyzer.py +493 -0
  10. larsql-2.0.4/lars/artifact_resolver.py +314 -0
  11. larsql-2.0.4/lars/auto_context.py +1089 -0
  12. larsql-2.0.4/lars/azure_cost.py +344 -0
  13. larsql-2.0.4/lars/blocking_cost.py +197 -0
  14. larsql-2.0.4/lars/browser/__init__.py +210 -0
  15. larsql-2.0.4/lars/browser/artifacts.py +240 -0
  16. larsql-2.0.4/lars/browser/commands.py +660 -0
  17. larsql-2.0.4/lars/browser/dom_extractor.py +359 -0
  18. larsql-2.0.4/lars/browser/server.py +528 -0
  19. larsql-2.0.4/lars/browser/session.py +548 -0
  20. larsql-2.0.4/lars/browser/stability.py +197 -0
  21. larsql-2.0.4/lars/browser/streaming.py +416 -0
  22. larsql-2.0.4/lars/browser/tools.py +793 -0
  23. larsql-2.0.4/lars/browser_manager.py +530 -0
  24. larsql-2.0.4/lars/caller_context.py +348 -0
  25. larsql-2.0.4/lars/cascade.py +1771 -0
  26. larsql-2.0.4/lars/checkpoints.py +980 -0
  27. larsql-2.0.4/lars/cli.py +6473 -0
  28. larsql-2.0.4/lars/client/__init__.py +9 -0
  29. larsql-2.0.4/lars/client/sql_client.py +238 -0
  30. larsql-2.0.4/lars/confidence_worker.py +422 -0
  31. larsql-2.0.4/lars/config.py +718 -0
  32. larsql-2.0.4/lars/console_style.py +306 -0
  33. larsql-2.0.4/lars/content_classifier.py +450 -0
  34. larsql-2.0.4/lars/context_cards.py +521 -0
  35. larsql-2.0.4/lars/cost.py +188 -0
  36. larsql-2.0.4/lars/credits.py +485 -0
  37. larsql-2.0.4/lars/db_adapter.py +1389 -0
  38. larsql-2.0.4/lars/demo_tools.py +187 -0
  39. larsql-2.0.4/lars/deterministic.py +815 -0
  40. larsql-2.0.4/lars/echo.py +325 -0
  41. larsql-2.0.4/lars/echo_enrichment.py +267 -0
  42. larsql-2.0.4/lars/echo_integration_example.py +440 -0
  43. larsql-2.0.4/lars/echoes.py +438 -0
  44. larsql-2.0.4/lars/elastic.py +625 -0
  45. larsql-2.0.4/lars/embedding_worker.py +366 -0
  46. larsql-2.0.4/lars/ephemeral_rag.py +883 -0
  47. larsql-2.0.4/lars/event_hooks.py +480 -0
  48. larsql-2.0.4/lars/extraction.py +79 -0
  49. larsql-2.0.4/lars/generative_ui.py +1005 -0
  50. larsql-2.0.4/lars/generative_ui_schema.py +485 -0
  51. larsql-2.0.4/lars/harbor.py +639 -0
  52. larsql-2.0.4/lars/harbor_mgmt.py +393 -0
  53. larsql-2.0.4/lars/hotornot.py +644 -0
  54. larsql-2.0.4/lars/human_ui.py +1127 -0
  55. larsql-2.0.4/lars/loaders.py +129 -0
  56. larsql-2.0.4/lars/local_models/__init__.py +122 -0
  57. larsql-2.0.4/lars/local_models/device.py +232 -0
  58. larsql-2.0.4/lars/local_models/executor.py +355 -0
  59. larsql-2.0.4/lars/local_models/helpers.py +205 -0
  60. larsql-2.0.4/lars/local_models/registry.py +299 -0
  61. larsql-2.0.4/lars/logs.py +119 -0
  62. larsql-2.0.4/lars/mcp_cli.py +690 -0
  63. larsql-2.0.4/lars/mcp_client.py +409 -0
  64. larsql-2.0.4/lars/mcp_discovery.py +419 -0
  65. larsql-2.0.4/lars/memory.py +425 -0
  66. larsql-2.0.4/lars/mermaid_terminal.py +98 -0
  67. larsql-2.0.4/lars/migrations/__init__.py +44 -0
  68. larsql-2.0.4/lars/migrations/runner.py +555 -0
  69. larsql-2.0.4/lars/migrations/sql/000_schema_migrations.sql +37 -0
  70. larsql-2.0.4/lars/migrations/sql/001_unified_logs.sql +147 -0
  71. larsql-2.0.4/lars/migrations/sql/002_checkpoints.sql +61 -0
  72. larsql-2.0.4/lars/migrations/sql/003_training_preferences.sql +66 -0
  73. larsql-2.0.4/lars/migrations/sql/004_rag_chunks.sql +36 -0
  74. larsql-2.0.4/lars/migrations/sql/005_rag_manifests.sql +25 -0
  75. larsql-2.0.4/lars/migrations/sql/006_evaluations.sql +31 -0
  76. larsql-2.0.4/lars/migrations/sql/007_tool_manifest_vectors.sql +25 -0
  77. larsql-2.0.4/lars/migrations/sql/008_cascade_template_vectors.sql +28 -0
  78. larsql-2.0.4/lars/migrations/sql/009_signals.sql +48 -0
  79. larsql-2.0.4/lars/migrations/sql/010_session_state.sql +77 -0
  80. larsql-2.0.4/lars/migrations/sql/011_research_sessions.sql +55 -0
  81. larsql-2.0.4/lars/migrations/sql/012_context_cards.sql +54 -0
  82. larsql-2.0.4/lars/migrations/sql/013_context_shadow_assessments.sql +85 -0
  83. larsql-2.0.4/lars/migrations/sql/014_intra_context_shadow_assessments.sql +69 -0
  84. larsql-2.0.4/lars/migrations/sql/015_ui_sql_log.sql +43 -0
  85. larsql-2.0.4/lars/migrations/sql/016_openrouter_models.sql +50 -0
  86. larsql-2.0.4/lars/migrations/sql/017_hf_spaces.sql +50 -0
  87. larsql-2.0.4/lars/migrations/sql/018_tag_definitions.sql +17 -0
  88. larsql-2.0.4/lars/migrations/sql/019_output_tags.sql +36 -0
  89. larsql-2.0.4/lars/migrations/sql/020_semantic_sql_cache.sql +45 -0
  90. larsql-2.0.4/lars/migrations/sql/021_sql_query_log.sql +63 -0
  91. larsql-2.0.4/lars/migrations/sql/022_mv_session_summary.sql +28 -0
  92. larsql-2.0.4/lars/migrations/sql/023_query_results_database.sql +52 -0
  93. larsql-2.0.4/lars/migrations/sql/024_query_results_actual_tables.sql +59 -0
  94. larsql-2.0.4/lars/migrations/sql/025_test_dashboard.sql +171 -0
  95. larsql-2.0.4/lars/migrations/sql/026_models_inference_type.sql +15 -0
  96. larsql-2.0.4/lars/migrations/sql/027_add_missing_unified_logs_columns.sql +59 -0
  97. larsql-2.0.4/lars/migrations/sql/028_credit_snapshots.sql +53 -0
  98. larsql-2.0.4/lars/migrations/sql/029_sql_query_log_result_columns.sql +19 -0
  99. larsql-2.0.4/lars/migrations/sql/030_cascade_sessions.sql +33 -0
  100. larsql-2.0.4/lars/migrations/sql/031_missing_tables_comprehensive.sql +542 -0
  101. larsql-2.0.4/lars/migrations/sql/032_test_results_session_id.sql +8 -0
  102. larsql-2.0.4/lars/migrations/sql/999_optimize_tables.sql +46 -0
  103. larsql-2.0.4/lars/model_metadata.py +395 -0
  104. larsql-2.0.4/lars/model_registry.py +724 -0
  105. larsql-2.0.4/lars/models_mgmt.py +1559 -0
  106. larsql-2.0.4/lars/monitor.py +47 -0
  107. larsql-2.0.4/lars/prompts.py +285 -0
  108. larsql-2.0.4/lars/rag/__init__.py +50 -0
  109. larsql-2.0.4/lars/rag/context.py +88 -0
  110. larsql-2.0.4/lars/rag/indexer.py +425 -0
  111. larsql-2.0.4/lars/rag/smart_search.py +497 -0
  112. larsql-2.0.4/lars/rag/store.py +242 -0
  113. larsql-2.0.4/lars/rag/tools.py +109 -0
  114. larsql-2.0.4/lars/reasoning.py +225 -0
  115. larsql-2.0.4/lars/research_cockpit.py +425 -0
  116. larsql-2.0.4/lars/runner.py +12955 -0
  117. larsql-2.0.4/lars/schema.py +1361 -0
  118. larsql-2.0.4/lars/screenshot_service.py +438 -0
  119. larsql-2.0.4/lars/semantic_sql/__init__.py +54 -0
  120. larsql-2.0.4/lars/semantic_sql/executor.py +908 -0
  121. larsql-2.0.4/lars/semantic_sql/fingerprint.py +384 -0
  122. larsql-2.0.4/lars/semantic_sql/registry.py +913 -0
  123. larsql-2.0.4/lars/semantic_sql/sql_macro.py +497 -0
  124. larsql-2.0.4/lars/server/__init__.py +25 -0
  125. larsql-2.0.4/lars/server/postgres_protocol.py +1064 -0
  126. larsql-2.0.4/lars/server/postgres_server.py +8306 -0
  127. larsql-2.0.4/lars/session_naming.py +173 -0
  128. larsql-2.0.4/lars/session_registry.py +436 -0
  129. larsql-2.0.4/lars/session_state.py +815 -0
  130. larsql-2.0.4/lars/shadow_assessment.py +1378 -0
  131. larsql-2.0.4/lars/signals.py +1024 -0
  132. larsql-2.0.4/lars/skill_registry.py +103 -0
  133. larsql-2.0.4/lars/skills/__init__.py +0 -0
  134. larsql-2.0.4/lars/skills/artifacts.py +469 -0
  135. larsql-2.0.4/lars/skills/base.py +56 -0
  136. larsql-2.0.4/lars/skills/basecoat_components.json +402 -0
  137. larsql-2.0.4/lars/skills/bash_session.py +317 -0
  138. larsql-2.0.4/lars/skills/bash_substrate.py +318 -0
  139. larsql-2.0.4/lars/skills/bodybuilder.py +733 -0
  140. larsql-2.0.4/lars/skills/branching.py +352 -0
  141. larsql-2.0.4/lars/skills/cascade_builder.py +522 -0
  142. larsql-2.0.4/lars/skills/cascade_validator.py +239 -0
  143. larsql-2.0.4/lars/skills/chart.py +339 -0
  144. larsql-2.0.4/lars/skills/data_tools.py +1245 -0
  145. larsql-2.0.4/lars/skills/display.py +202 -0
  146. larsql-2.0.4/lars/skills/embedding_storage.py +1047 -0
  147. larsql-2.0.4/lars/skills/extras.py +489 -0
  148. larsql-2.0.4/lars/skills/filesystem.py +1341 -0
  149. larsql-2.0.4/lars/skills/human.py +1725 -0
  150. larsql-2.0.4/lars/skills/image_gen.py +913 -0
  151. larsql-2.0.4/lars/skills/rabbitize.py +1146 -0
  152. larsql-2.0.4/lars/skills/research_db.py +241 -0
  153. larsql-2.0.4/lars/skills/research_sessions.py +540 -0
  154. larsql-2.0.4/lars/skills/rlm_tools.py +571 -0
  155. larsql-2.0.4/lars/skills/signal_tools.py +164 -0
  156. larsql-2.0.4/lars/skills/skill_executor.py +236 -0
  157. larsql-2.0.4/lars/skills/sql.py +106 -0
  158. larsql-2.0.4/lars/skills/state_tools.py +244 -0
  159. larsql-2.0.4/lars/skills/stt.py +337 -0
  160. larsql-2.0.4/lars/skills/system.py +419 -0
  161. larsql-2.0.4/lars/skills/tts.py +171 -0
  162. larsql-2.0.4/lars/skills/ui_components.py +379 -0
  163. larsql-2.0.4/lars/skills/web_search.py +133 -0
  164. larsql-2.0.4/lars/skills_manifest.py +283 -0
  165. larsql-2.0.4/lars/spec_validator.py +597 -0
  166. larsql-2.0.4/lars/sql_explain.py +1533 -0
  167. larsql-2.0.4/lars/sql_rewriter.py +1363 -0
  168. larsql-2.0.4/lars/sql_rewriter.py.backup +682 -0
  169. larsql-2.0.4/lars/sql_rewriter_messy.py +682 -0
  170. larsql-2.0.4/lars/sql_tools/__init__.py +23 -0
  171. larsql-2.0.4/lars/sql_tools/aggregate_registry.py +219 -0
  172. larsql-2.0.4/lars/sql_tools/block_operators.py +588 -0
  173. larsql-2.0.4/lars/sql_tools/cache_adapter.py +880 -0
  174. larsql-2.0.4/lars/sql_tools/config.py +423 -0
  175. larsql-2.0.4/lars/sql_tools/connector.py +1450 -0
  176. larsql-2.0.4/lars/sql_tools/dimension_rewriter.py +529 -0
  177. larsql-2.0.4/lars/sql_tools/discovery.py +329 -0
  178. larsql-2.0.4/lars/sql_tools/dynamic_operators.py +380 -0
  179. larsql-2.0.4/lars/sql_tools/field_reference.py +233 -0
  180. larsql-2.0.4/lars/sql_tools/lazy_attach.py +1425 -0
  181. larsql-2.0.4/lars/sql_tools/llm_agg_rewriter.py +1072 -0
  182. larsql-2.0.4/lars/sql_tools/llm_aggregates.py +2786 -0
  183. larsql-2.0.4/lars/sql_tools/metadata.py +534 -0
  184. larsql-2.0.4/lars/sql_tools/operator_inference.py +379 -0
  185. larsql-2.0.4/lars/sql_tools/prewarm_analyzer.py +408 -0
  186. larsql-2.0.4/lars/sql_tools/prewarm_sidecar.py +305 -0
  187. larsql-2.0.4/lars/sql_tools/semantic_operators.py +2234 -0
  188. larsql-2.0.4/lars/sql_tools/semantic_rewriter_v2.py +1140 -0
  189. larsql-2.0.4/lars/sql_tools/session_db.py +245 -0
  190. larsql-2.0.4/lars/sql_tools/sql_directives.py +598 -0
  191. larsql-2.0.4/lars/sql_tools/sql_inspector.py +694 -0
  192. larsql-2.0.4/lars/sql_tools/tools.py +710 -0
  193. larsql-2.0.4/lars/sql_tools/udf.py +2318 -0
  194. larsql-2.0.4/lars/sql_tools/unified_operator_rewriter.py +329 -0
  195. larsql-2.0.4/lars/sql_tools/vector_search_rewriter.py +700 -0
  196. larsql-2.0.4/lars/sql_trail.py +958 -0
  197. larsql-2.0.4/lars/starter/.env.example +75 -0
  198. larsql-2.0.4/lars/starter/.gitignore +49 -0
  199. larsql-2.0.4/lars/starter/README.md +88 -0
  200. larsql-2.0.4/lars/starter/cascades/examples/hello_world.yaml +24 -0
  201. larsql-2.0.4/lars/starter/cascades/examples/sql_demo.yaml +45 -0
  202. larsql-2.0.4/lars/starter/cell_types/ask_human.yaml +20 -0
  203. larsql-2.0.4/lars/starter/cell_types/await_signal.yaml +17 -0
  204. larsql-2.0.4/lars/starter/cell_types/bodybuilder.yaml +33 -0
  205. larsql-2.0.4/lars/starter/cell_types/browser.yaml +96 -0
  206. larsql-2.0.4/lars/starter/cell_types/candidates.yaml +24 -0
  207. larsql-2.0.4/lars/starter/cell_types/chart.yaml +20 -0
  208. larsql-2.0.4/lars/starter/cell_types/clojure_data.yaml +20 -0
  209. larsql-2.0.4/lars/starter/cell_types/fire_signal.yaml +16 -0
  210. larsql-2.0.4/lars/starter/cell_types/hitl_screen.yaml +26 -0
  211. larsql-2.0.4/lars/starter/cell_types/http_request.yaml +24 -0
  212. larsql-2.0.4/lars/starter/cell_types/image_gen.yaml +19 -0
  213. larsql-2.0.4/lars/starter/cell_types/js_data.yaml +20 -0
  214. larsql-2.0.4/lars/starter/cell_types/json_transform.yaml +25 -0
  215. larsql-2.0.4/lars/starter/cell_types/lars_data.yaml +31 -0
  216. larsql-2.0.4/lars/starter/cell_types/llm_cell.yaml +22 -0
  217. larsql-2.0.4/lars/starter/cell_types/map_cascade.yaml +17 -0
  218. larsql-2.0.4/lars/starter/cell_types/python_data.yaml +21 -0
  219. larsql-2.0.4/lars/starter/cell_types/research_query.yaml +18 -0
  220. larsql-2.0.4/lars/starter/cell_types/screenshot.yaml +18 -0
  221. larsql-2.0.4/lars/starter/cell_types/shell_command.yaml +15 -0
  222. larsql-2.0.4/lars/starter/cell_types/smart_sql.yaml +20 -0
  223. larsql-2.0.4/lars/starter/cell_types/spawn_cascade.yaml +16 -0
  224. larsql-2.0.4/lars/starter/cell_types/sql_data.yaml +19 -0
  225. larsql-2.0.4/lars/starter/cell_types/summarize.yaml +18 -0
  226. larsql-2.0.4/lars/starter/cell_types/tts_say.yaml +20 -0
  227. larsql-2.0.4/lars/starter/cell_types/web_search.yaml +20 -0
  228. larsql-2.0.4/lars/starter/config/mcp_servers.example.yaml +31 -0
  229. larsql-2.0.4/lars/starter/scripts/setup_sample_data.py +83 -0
  230. larsql-2.0.4/lars/starter/skills/.gitkeep +0 -0
  231. larsql-2.0.4/lars/starter/sql_connections/sample_data.yaml +40 -0
  232. larsql-2.0.4/lars/state.py +281 -0
  233. larsql-2.0.4/lars/terminal_image.py +174 -0
  234. larsql-2.0.4/lars/testing.py +1289 -0
  235. larsql-2.0.4/lars/tests/__init__.py +1 -0
  236. larsql-2.0.4/lars/tests/test_spec_validator.py +697 -0
  237. larsql-2.0.4/lars/token_budget.py +397 -0
  238. larsql-2.0.4/lars/tool_cache.py +225 -0
  239. larsql-2.0.4/lars/tool_definitions.py +830 -0
  240. larsql-2.0.4/lars/tools_mgmt.py +684 -0
  241. larsql-2.0.4/lars/toon_transport.py +443 -0
  242. larsql-2.0.4/lars/toon_utils.py +479 -0
  243. larsql-2.0.4/lars/tracing.py +26 -0
  244. larsql-2.0.4/lars/training_system.py +452 -0
  245. larsql-2.0.4/lars/triggers.py +665 -0
  246. larsql-2.0.4/lars/tui/__init__.py +31 -0
  247. larsql-2.0.4/lars/tui/alice.jpg +0 -0
  248. larsql-2.0.4/lars/tui/alice2.jpg +0 -0
  249. larsql-2.0.4/lars/tui/background.jpg +0 -0
  250. larsql-2.0.4/lars/tui/background5.jpg +0 -0
  251. larsql-2.0.4/lars/tui/background6.jpg +0 -0
  252. larsql-2.0.4/lars/tui/background_0.jpg +0 -0
  253. larsql-2.0.4/lars/tui/background_00.jpg +0 -0
  254. larsql-2.0.4/lars/tui/bk0.jpg +0 -0
  255. larsql-2.0.4/lars/tui/bk1.jpg +0 -0
  256. larsql-2.0.4/lars/tui/bk2.jpg +0 -0
  257. larsql-2.0.4/lars/tui/bk3.jpg +0 -0
  258. larsql-2.0.4/lars/tui/bk8.jpg +0 -0
  259. larsql-2.0.4/lars/tui/buckets.yaml +121 -0
  260. larsql-2.0.4/lars/tui/capecod.jpg +0 -0
  261. larsql-2.0.4/lars/tui/cascades copy.yaml +217 -0
  262. larsql-2.0.4/lars/tui/cascades.yaml +224 -0
  263. larsql-2.0.4/lars/tui/cheshire.jpg +0 -0
  264. larsql-2.0.4/lars/tui/culling_demo.yaml +189 -0
  265. larsql-2.0.4/lars/tui/events.yaml +369 -0
  266. larsql-2.0.4/lars/tui/gradients.yaml +132 -0
  267. larsql-2.0.4/lars/tui/grok4.jpeg +0 -0
  268. larsql-2.0.4/lars/tui/kate.jpg +0 -0
  269. larsql-2.0.4/lars/tui/lars_cascade_monitor.yaml +186 -0
  270. larsql-2.0.4/lars/tui/leaves.jpg +0 -0
  271. larsql-2.0.4/lars/tui/os.yaml +232 -0
  272. larsql-2.0.4/lars/tui/params.yaml +115 -0
  273. larsql-2.0.4/lars/tui/pipes.yaml +366 -0
  274. larsql-2.0.4/lars/tui/pipes.yaml.backup +18 -0
  275. larsql-2.0.4/lars/tui/process_to_charts.yaml +103 -0
  276. larsql-2.0.4/lars/tui/rolling.yaml +104 -0
  277. larsql-2.0.4/lars/tui/sql_filter.yaml +117 -0
  278. larsql-2.0.4/lars/tui/struct.yaml +135 -0
  279. larsql-2.0.4/lars/tui/templates.yaml +206 -0
  280. larsql-2.0.4/lars/tui/windows.yaml +135 -0
  281. larsql-2.0.4/lars/unified_logs.py +1068 -0
  282. larsql-2.0.4/lars/utils.py +804 -0
  283. larsql-2.0.4/lars/vendor/toon_format/LICENSE +1 -0
  284. larsql-2.0.4/lars/vendor/toon_format/__init__.py +40 -0
  285. larsql-2.0.4/lars/vendor/toon_format/__main__.py +13 -0
  286. larsql-2.0.4/lars/vendor/toon_format/_literal_utils.py +70 -0
  287. larsql-2.0.4/lars/vendor/toon_format/_parsing_utils.py +167 -0
  288. larsql-2.0.4/lars/vendor/toon_format/_scanner.py +289 -0
  289. larsql-2.0.4/lars/vendor/toon_format/_string_utils.py +169 -0
  290. larsql-2.0.4/lars/vendor/toon_format/_validation.py +150 -0
  291. larsql-2.0.4/lars/vendor/toon_format/cli.py +217 -0
  292. larsql-2.0.4/lars/vendor/toon_format/constants.py +84 -0
  293. larsql-2.0.4/lars/vendor/toon_format/decoder.py +788 -0
  294. larsql-2.0.4/lars/vendor/toon_format/encoder.py +56 -0
  295. larsql-2.0.4/lars/vendor/toon_format/encoders.py +456 -0
  296. larsql-2.0.4/lars/vendor/toon_format/logging_config.py +92 -0
  297. larsql-2.0.4/lars/vendor/toon_format/normalize.py +237 -0
  298. larsql-2.0.4/lars/vendor/toon_format/primitives.py +171 -0
  299. larsql-2.0.4/lars/vendor/toon_format/py.typed +0 -0
  300. larsql-2.0.4/lars/vendor/toon_format/types.py +64 -0
  301. larsql-2.0.4/lars/vendor/toon_format/utils.py +187 -0
  302. larsql-2.0.4/lars/vendor/toon_format/writer.py +53 -0
  303. larsql-2.0.4/lars/vertex_cost.py +322 -0
  304. larsql-2.0.4/lars/visual_compare.py +379 -0
  305. larsql-2.0.4/lars/visualizer.py +3938 -0
  306. larsql-2.0.4/lars/voice.py +238 -0
  307. larsql-2.0.4/lars/watcher.py +909 -0
  308. larsql-2.0.4/pyproject.toml +113 -0
@@ -0,0 +1,18 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.parquet
4
+ .env
5
+ .venv
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+
10
+ # artifacts
11
+ graphs
12
+ *.mmd
13
+ images
14
+ logs
15
+ states
16
+ echoes
17
+ **/graphs/*
18
+
larsql-2.0.4/PKG-INFO ADDED
@@ -0,0 +1,422 @@
1
+ Metadata-Version: 2.4
2
+ Name: larsql
3
+ Version: 2.0.4
4
+ Summary: LARS: Declarative agent framework with first class SQL integration
5
+ Project-URL: Homepage, https://github.com/ryrobes/larsql
6
+ Project-URL: Repository, https://github.com/ryrobes/larsql
7
+ Project-URL: Documentation, https://larsql.com/
8
+ Author-email: Ryan Robitaille <ryan.robitaille@gmail.com>
9
+ License: MIT
10
+ Keywords: agents,declarative,llm,semantic,sql,workflows
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: altair
22
+ Requires-Dist: chdb
23
+ Requires-Dist: clickhouse-driver
24
+ Requires-Dist: duckdb
25
+ Requires-Dist: gunicorn[gevent]
26
+ Requires-Dist: jinja2
27
+ Requires-Dist: jsonschema
28
+ Requires-Dist: kaleido
29
+ Requires-Dist: litellm
30
+ Requires-Dist: miniaudio
31
+ Requires-Dist: openpyxl
32
+ Requires-Dist: pandas
33
+ Requires-Dist: pillow
34
+ Requires-Dist: plotly
35
+ Requires-Dist: pyarrow
36
+ Requires-Dist: pydantic
37
+ Requires-Dist: pypdf
38
+ Requires-Dist: python-dotenv
39
+ Requires-Dist: readchar
40
+ Requires-Dist: requests
41
+ Requires-Dist: rich
42
+ Requires-Dist: ruamel-yaml
43
+ Requires-Dist: sqlglot
44
+ Requires-Dist: vl-convert-python
45
+ Provides-Extra: all
46
+ Requires-Dist: accelerate>=0.20.0; extra == 'all'
47
+ Requires-Dist: docker; extra == 'all'
48
+ Requires-Dist: fastapi>=0.100.0; extra == 'all'
49
+ Requires-Dist: httpx>=0.25.0; extra == 'all'
50
+ Requires-Dist: huggingface-hub<1.0,>=0.34.0; extra == 'all'
51
+ Requires-Dist: playwright>=1.40.0; extra == 'all'
52
+ Requires-Dist: torch>=2.0.0; extra == 'all'
53
+ Requires-Dist: transformers>=4.45.0; extra == 'all'
54
+ Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'all'
55
+ Provides-Extra: browser
56
+ Requires-Dist: fastapi>=0.100.0; extra == 'browser'
57
+ Requires-Dist: httpx>=0.25.0; extra == 'browser'
58
+ Requires-Dist: playwright>=1.40.0; extra == 'browser'
59
+ Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'browser'
60
+ Provides-Extra: docker
61
+ Requires-Dist: docker; extra == 'docker'
62
+ Provides-Extra: local-models
63
+ Requires-Dist: accelerate>=0.20.0; extra == 'local-models'
64
+ Requires-Dist: huggingface-hub<1.0,>=0.34.0; extra == 'local-models'
65
+ Requires-Dist: torch>=2.0.0; extra == 'local-models'
66
+ Requires-Dist: transformers>=4.45.0; extra == 'local-models'
67
+ Description-Content-Type: text/markdown
68
+
69
+ # LARS - AI That Speaks SQL
70
+
71
+ [![PyPI version](https://badge.fury.io/py/larsql.svg)](https://badge.fury.io/py/larsql)
72
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
73
+ [![License: O'SASSY](https://img.shields.io/badge/license-O'SASSY%20(basically%20MIT)-8A2BE2)](https://osaasy.dev/)
74
+ [![Docs](https://img.shields.io/badge/docs-larsql.com-cyan)](https://larsql.com/)
75
+
76
+ **Your team knows SQL. Why learn Python for AI?**
77
+
78
+ **Add AI operators directly to your SQL queries** — from your existing SQL client, on your existing databases.
79
+
80
+ ```sql
81
+ SELECT * FROM support_tickets
82
+ WHERE description MEANS 'urgent customer issue';
83
+ ```
84
+
85
+ That's it. No notebooks. No orchestration code. No vector database to provision.
86
+ Just SQL with semantic understanding (and a declarative workflow engine underneath).
87
+ Express intent, not patterns — especially when you don't know what you're looking for.
88
+
89
+ - **Use your existing SQL client**: PostgreSQL wire protocol (`lars serve sql`)
90
+ - **Your data never moves**: DuckDB federation across Postgres/MySQL/BigQuery/Snowflake/S3/files
91
+ - **Cached + cost-attributed**: query LLM calls via `all_data` / `sql_query_log`
92
+ - **Optional Studio UI**: inspect runs, takes, costs, and "what the model saw" (not required)
93
+
94
+ ## One line. That's all it takes.
95
+
96
+ **Before:** Regex, LIKE patterns, and brittle keyword matching.
97
+
98
+ ```sql
99
+ SELECT * FROM tickets
100
+ WHERE description LIKE '%urgent%'
101
+ OR description LIKE '%critical%'
102
+ OR description LIKE '%asap%'
103
+ -- still misses "need this fixed immediately"
104
+ ```
105
+
106
+ **After:** One line that understands meaning.
107
+
108
+ ```sql
109
+ SELECT * FROM tickets
110
+ WHERE description MEANS 'urgent customer issue'
111
+ ```
112
+
113
+ ## What Can You Do?
114
+
115
+ ```sql
116
+ -- Filter by meaning, not keywords
117
+ SELECT * FROM products
118
+ WHERE description MEANS 'eco-friendly'
119
+
120
+ -- Score relevance (0.0 to 1.0)
121
+ SELECT title, description ABOUT 'sustainability' AS relevance
122
+ FROM reports
123
+ ORDER BY relevance DESC
124
+
125
+ -- Semantic deduplication
126
+ SELECT SEMANTIC DISTINCT company_name FROM leads
127
+
128
+ -- Find contradictions (compliance, fact-checking)
129
+ SELECT * FROM disclosures
130
+ WHERE statement CONTRADICTS 'no material changes'
131
+
132
+ -- Summarize groups
133
+ SELECT category, SUMMARIZE(reviews) AS summary
134
+ FROM feedback
135
+ GROUP BY category
136
+
137
+ -- Group by auto-discovered topics
138
+ SELECT TOPICS(title, 5) AS topic, COUNT(*) AS count
139
+ FROM articles
140
+ GROUP BY topic
141
+
142
+ -- Vector similarity search
143
+ SELECT * FROM docs
144
+ WHERE title SIMILAR_TO 'quarterly earnings report'
145
+ LIMIT 10
146
+
147
+ -- Ask arbitrary questions
148
+ SELECT
149
+ product_name,
150
+ ASK('Is this suitable for children? yes/no', description) AS kid_friendly
151
+ FROM products
152
+ ```
153
+
154
+ **50+ built-in operators** for filtering, logic, transformation, aggregation, data quality, parsing, and more.
155
+
156
+ ## Quick Start
157
+
158
+ ```bash
159
+ # Install
160
+ pip install larsql
161
+
162
+ # Set your LLM API key (OpenRouter, or see docs for others)
163
+ export OPENROUTER_API_KEY=sk-or-v1-...
164
+
165
+ # Start the SQL server (PostgreSQL wire protocol)
166
+ lars serve sql --port 15432
167
+
168
+ # Connect with any SQL client
169
+ psql postgresql://localhost:15432/default
170
+ ```
171
+
172
+ That's it. Run semantic queries from DBeaver, DataGrip, psql, Tableau, or any PostgreSQL client.
173
+ For a full end-to-end setup (ClickHouse + sample data + Studio UI), see the [Quickstart Guide](https://larsql.com/docs.html#quickstart).
174
+
175
+ <details>
176
+ <summary>Screenshot: DataGrip connected over pgwire</summary>
177
+
178
+ <p>
179
+ <a href="https://raw.githubusercontent.com/ryrobes/larsql/master/gh_jpg/datagrip.jpg">
180
+ <img src="https://raw.githubusercontent.com/ryrobes/larsql/master/gh_jpg/datagrip.jpg" width="520" alt="DataGrip querying LARS via PostgreSQL wire protocol" />
181
+ </a>
182
+ </p>
183
+ </details>
184
+
185
+ ## How It Works
186
+
187
+ LARS uses **query rewriting** - your semantic SQL is transformed into standard SQL with UDF calls that execute LLM operations. Your database stays untouched.
188
+
189
+ ```
190
+ WHERE description MEANS 'urgent'
191
+
192
+ WHERE semantic_matches('urgent', description)
193
+
194
+ UDF runs LLM → returns true/false
195
+ ```
196
+
197
+ Results are **cached** - same query on same data costs zero after the first run.
198
+
199
+ Every semantic UDF call is also logged (model, tokens, cost, duration) into queryable "magic tables":
200
+
201
+ ```sql
202
+ SELECT session_id, cell_name, model, cost, duration_ms
203
+ FROM all_data
204
+ WHERE is_sql_udf = true
205
+ ORDER BY timestamp DESC
206
+ LIMIT 20;
207
+ ```
208
+
209
+ <details>
210
+ <summary>Screenshot: costs + context (optional Studio UI)</summary>
211
+
212
+ <p>
213
+ <a href="https://raw.githubusercontent.com/ryrobes/larsql/master/gh_jpg/gh-image1.jpg">
214
+ <img src="https://raw.githubusercontent.com/ryrobes/larsql/master/gh_jpg/gh-image1.jpg" width="100%" alt="Studio showing context inspector, query logs, takes, and cost analytics" />
215
+ </a>
216
+ </p>
217
+ </details>
218
+
219
+ Every semantic operator is backed by a cascade file under `cascades/semantic_sql/` - edit YAML to change behavior or create your own operator.
220
+ If you want a visual view of the same execution data, Studio is a UI over these logs (optional).
221
+
222
+ ## Wait, it gets weirder.
223
+
224
+ Semantic SQL is just the beginning. Under the hood, LARS is a **declarative agent framework** for building sophisticated LLM workflows.
225
+
226
+ ### The Problem It Solves
227
+
228
+ Every LLM project eventually becomes this:
229
+
230
+ ```python
231
+ for attempt in range(max_retries):
232
+ try:
233
+ result = llm.call(prompt)
234
+ if validate(result):
235
+ return result
236
+ prompt += f"\nError: {validation.error}. Try again."
237
+ except JSONDecodeError as e:
238
+ prompt += f"\nFailed to parse: {e}"
239
+ # 47 lines later... still doesn't work reliably
240
+ ```
241
+
242
+ ### The LARS Solution
243
+
244
+ **Run multiple attempts in parallel. Filter errors naturally. Pick the best.**
245
+
246
+ ```yaml
247
+ - name: generate_analysis
248
+ instructions: "Analyze the sales data..."
249
+ takes:
250
+ factor: 3 # Run 3 times in parallel
251
+ evaluator_instructions: "Pick the most thorough analysis"
252
+ ```
253
+
254
+ Instead of serial retries hoping one succeeds, run N attempts simultaneously and select the winner. Same cost, faster execution, higher quality output.
255
+
256
+ ### Declarative Workflows (Cascades)
257
+
258
+ Define multi-step agent workflows in YAML:
259
+
260
+ ```yaml
261
+ cascade_id: analyze_data
262
+ cells:
263
+ - name: query_data
264
+ tool: sql_data
265
+ tool_inputs:
266
+ query: "SELECT * FROM sales WHERE date > '2024-01-01'"
267
+
268
+ - name: analyze
269
+ instructions: |
270
+ Analyze this sales data: {{ outputs.query_data }}
271
+ Create visualizations and summarize key trends.
272
+ skills:
273
+ - create_chart
274
+ - smart_sql_run
275
+ takes:
276
+ factor: 3
277
+ evaluator_instructions: "Pick the most insightful analysis"
278
+ handoffs: [review]
279
+
280
+ - name: review
281
+ instructions: "Summarize the findings"
282
+ context:
283
+ from: [analyze]
284
+ ```
285
+
286
+ ### Key Concepts
287
+
288
+ | Concept | What It Does |
289
+ |---------|--------------|
290
+ | **Cascades** | Declarative YAML workflows |
291
+ | **Cells** | Execution stages (LLM, deterministic, or human-in-the-loop) |
292
+ | **Takes** | Parallel execution → filter errors → pick best |
293
+ | **Reforge** | Iterative refinement of winning output |
294
+ | **Wards** | Validation barriers (blocking, retry, advisory) |
295
+ | **Skills** | Tools available to agents (are also FULL multi-cell cascades!) |
296
+
297
+ ## Database Support
298
+
299
+ LARS connects to your existing databases:
300
+
301
+ - **DuckDB** (default, in-memory or file)
302
+ - **PostgreSQL**, **MySQL**, **ClickHouse**
303
+ - **BigQuery**, **Snowflake**
304
+ - **S3**, **Azure**, **GCS** (Parquet, CSV, JSON)
305
+
306
+ Your data stays where it is. LARS queries it federated-style. Join across DB boundaries.
307
+
308
+ ## LLM Providers
309
+
310
+ Works with any LLM via [LiteLLM](https://docs.litellm.ai/):
311
+
312
+ - **OpenRouter** (default) - access to 200+ models, excellently granular cost tracking
313
+ - **OpenAI**, **Anthropic**, **Google**
314
+ - **Ollama** (local & remote models, zero cost)
315
+ - **Azure OpenAI**, **AWS Bedrock**, **Vertex AI**
316
+
317
+ ## Installation Options
318
+
319
+ ```bash
320
+ # Basic
321
+ pip install larsql
322
+
323
+ # With browser automation (Playwright)
324
+ pip install larsql[browser]
325
+
326
+ # With local models (HuggingFace)
327
+ pip install larsql[local-models]
328
+
329
+ # Everything
330
+ pip install larsql[all]
331
+ ```
332
+
333
+ ## Running Cascades
334
+
335
+ ```bash
336
+ # Run a workflow
337
+ lars run cascades/example.yaml --input '{"task": "analyze sales data"}'
338
+
339
+ # With model override
340
+ lars run cascades/example.yaml --model "anthropic/claude-sonnet-4"
341
+ ```
342
+
343
+ ## Studio Web UI (Optional)
344
+
345
+ ```bash
346
+ # Launch the visual interface
347
+ lars serve studio
348
+
349
+ # Access at http://localhost:5050
350
+ # - SQL IDE with semantic operators
351
+ # - Cascade runner (incl. takes + winners)
352
+ # - Context inspector ("what the model saw")
353
+ # - Cost explorer (by query/cascade/model)
354
+ ```
355
+
356
+ <details>
357
+ <summary>Screenshots: Studio overview</summary>
358
+
359
+ <p>
360
+ <a href="https://raw.githubusercontent.com/ryrobes/larsql/master/gh_jpg/gh-image2.jpg">
361
+ <img src="https://raw.githubusercontent.com/ryrobes/larsql/master/gh_jpg/gh-image2.jpg" width="100%" alt="Studio overview screenshots" />
362
+ </a>
363
+ </p>
364
+ </details>
365
+
366
+ ## Documentation
367
+
368
+ **Full documentation at [larsql.com](https://larsql.com/)**
369
+
370
+ - [Docs hub](https://larsql.com/docs.html) - Full reference
371
+
372
+ - [Quickstart Guide](https://larsql.com/docs.html#quickstart) - Get running in 10 minutes
373
+ - [Studio Web UI](https://larsql.com/docs.html#quickstart#studio) - Optional UI for debugging cost/context/takes
374
+ - [Semantic SQL](https://larsql.com/docs.html#semantic-sql) - Query rewriting, caching, annotations, observability
375
+ - [Built-in Operators](https://larsql.com/docs.html#operators) - All 50+ operators
376
+ - [Vector Search & Embedding](https://larsql.com/docs.html#embedding) - SIMILAR_TO, LARS EMBED, hybrid search
377
+ - [Cascade DSL](https://larsql.com/docs.html#cascade-dsl) - Workflow configuration
378
+ - [Takes & Evaluation](https://larsql.com/docs.html#candidates) - Parallel execution patterns
379
+ - [SQL Connections](https://larsql.com/docs.html#sql-connections) - Connect 18+ data sources via DuckDB
380
+ - [AI Providers](https://larsql.com/docs.html#providers) - OpenRouter, Vertex AI, Bedrock, Azure, Ollama
381
+ - [Tools Reference](https://larsql.com/docs.html#tools) - Available skills & integrations
382
+
383
+ ## Example: Create Your Own Operator
384
+
385
+ Any cascade can become a SQL operator. No Python required.
386
+
387
+ ```yaml
388
+ # cascades/semantic_sql/sentiment_score.cascade.yaml
389
+ cascade_id: sentiment_score
390
+ sql_function:
391
+ name: SENTIMENT_SCORE
392
+ operators:
393
+ - "SENTIMENT_SCORE({{ text }})"
394
+ returns: DOUBLE
395
+ shape: SCALAR
396
+ cells:
397
+ - name: score
398
+ model: google/gemini-2.5-flash-lite
399
+ instructions: |
400
+ Rate the sentiment of this text from -1.0 to 1.0.
401
+ TEXT: {{ input.text }}
402
+ Return only the number.
403
+ ```
404
+
405
+ Worried about the output? Me too. Run validations or multiple takes (on multiple models), all within a SQL call.
406
+
407
+ Now use it:
408
+
409
+ ```sql
410
+ SELECT product_id, AVG(SENTIMENT_SCORE(review)) AS sentiment
411
+ FROM reviews
412
+ GROUP BY product_id
413
+ HAVING sentiment < -0.3
414
+ ```
415
+
416
+ ## Contributing
417
+
418
+ Issues welcome at [github.com/ryrobes/larsql](https://github.com/ryrobes/larsql)
419
+
420
+ ## License
421
+
422
+ [O'SASSY License](https://osaasy.dev/) (basically MIT)