querymind-cli 0.1.0__tar.gz → 0.1.1__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 (48) hide show
  1. {querymind_cli-0.1.0/querymind_cli.egg-info → querymind_cli-0.1.1}/PKG-INFO +2 -2
  2. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/agents/InterpreterAgent.py +34 -11
  3. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/agents/insights_generator.py +14 -9
  4. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/pyproject.toml +2 -2
  5. {querymind_cli-0.1.0 → querymind_cli-0.1.1/querymind_cli.egg-info}/PKG-INFO +2 -2
  6. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/LICENSE +0 -0
  7. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/README.md +0 -0
  8. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/agents/__init__.py +0 -0
  9. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/agents/intent_corrector.py +0 -0
  10. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/agents/llm_intepreter.py +0 -0
  11. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/agents/narrator.py +0 -0
  12. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/agents/planner.py +0 -0
  13. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/cli/__init__.py +0 -0
  14. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/cli/main.py +0 -0
  15. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/cli/tui_app.py +0 -0
  16. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/cli/ui.py +0 -0
  17. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/core/__init__.py +0 -0
  18. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/core/context.py +0 -0
  19. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/core/logger.py +0 -0
  20. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/core/pipeline.py +0 -0
  21. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/data/__init__.py +0 -0
  22. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/data/connectors/csv_connector.py +0 -0
  23. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/data/connectors/excel_connector.py +0 -0
  24. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/data/connectors/no_sql_db_connector.py +0 -0
  25. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/data/connectors/sql_db_connector.py +0 -0
  26. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/data/schema_engine.py +0 -0
  27. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/data/type_caster.py +0 -0
  28. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/executor/__init__.py +0 -0
  29. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/executor/db_executor.py +0 -0
  30. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/executor/sheet_selector.py +0 -0
  31. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/llm/ollama_client.py +0 -0
  32. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/prompts/interpreter_prompt.txt +0 -0
  33. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/security/__init__.py +0 -0
  34. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/security/input_guard.py +0 -0
  35. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/security/schema_filter.py +0 -0
  36. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/tests/__init__.py +0 -0
  37. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/tests/llm_test.py +0 -0
  38. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/tools/__init__.py +0 -0
  39. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/tools/analyzer.py +0 -0
  40. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/tools/join_resolver.py +0 -0
  41. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/tools/sql_writer.py +0 -0
  42. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/app/tools/validator.py +0 -0
  43. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/querymind_cli.egg-info/SOURCES.txt +0 -0
  44. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/querymind_cli.egg-info/dependency_links.txt +0 -0
  45. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/querymind_cli.egg-info/entry_points.txt +0 -0
  46. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/querymind_cli.egg-info/requires.txt +0 -0
  47. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/querymind_cli.egg-info/top_level.txt +0 -0
  48. {querymind_cli-0.1.0 → querymind_cli-0.1.1}/setup.cfg +0 -0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: querymind-cli
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: CLI AI Data Analyst — query CSV and Excel files in plain English
5
- Author-email: Siddhesh <siddhesh.codemaster.github@gmail.com>
5
+ Author-email: Siddhesh <siddhesh.codemaster.github@email.com>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/SiddheshCodeMaster/QueryMind
8
8
  Project-URL: Repository, https://github.com/SiddheshCodeMaster/QueryMind
@@ -304,8 +304,15 @@ class InterpreterAgent:
304
304
  elif not intent.get("no_time_column"):
305
305
  intent["no_time_column"] = True
306
306
 
307
- # ── Sort order detection ─────────────────────────────────────────
308
- # Explicit order phrases take priority over implicit min/max words.
307
+ # ── Sort order + focus detection ──────────────────────────────────
308
+ # Two separate concepts:
309
+ # - sort_ascending: how to ORDER the table (asc or desc)
310
+ # - focus_min: which END to HIGHLIGHT in the insight text
311
+ #
312
+ # "lowest sales in descending order" →
313
+ # sort_ascending=False (table high→low), focus_min=True (highlight South)
314
+ # "highest sales in ascending order" →
315
+ # sort_ascending=True (table low→high), focus_min=False (highlight East)
309
316
 
310
317
  ASC_PHRASES = {
311
318
  "ascending order",
@@ -333,12 +340,6 @@ class InterpreterAgent:
333
340
  "best to worst",
334
341
  "most to least",
335
342
  }
336
-
337
- # Check explicit order phrases first
338
- explicit_asc = any(p in query for p in ASC_PHRASES)
339
- explicit_desc = any(p in query for p in DESC_PHRASES)
340
-
341
- # Implicit: min/low/worst words suggest ascending (lowest first)
342
343
  MIN_WORDS = {
343
344
  "minimum",
344
345
  "min",
@@ -350,15 +351,37 @@ class InterpreterAgent:
350
351
  "fewest",
351
352
  "smallest",
352
353
  }
353
- implicit_asc = any(w in query for w in MIN_WORDS)
354
+ MAX_WORDS = {
355
+ "maximum",
356
+ "max",
357
+ "most",
358
+ "highest",
359
+ "greatest",
360
+ "best",
361
+ "top",
362
+ "largest",
363
+ "biggest",
364
+ }
354
365
 
366
+ explicit_asc = any(p in query for p in ASC_PHRASES)
367
+ explicit_desc = any(p in query for p in DESC_PHRASES)
368
+ implicit_min = any(w in query for w in MIN_WORDS)
369
+ implicit_max = any(w in query for w in MAX_WORDS)
370
+
371
+ # Sort order: explicit phrase wins; implicit min → asc; default → desc
355
372
  if explicit_asc and not explicit_desc:
356
373
  intent["ascending"] = True
357
374
  elif explicit_desc and not explicit_asc:
358
375
  intent["ascending"] = False
359
- elif implicit_asc and not explicit_desc:
376
+ elif implicit_min and not implicit_max:
360
377
  intent["ascending"] = True
361
- # else: default (False = descending/highest first) stays
378
+ # else: default False (descending) already set
379
+
380
+ # Focus: driven only by min/max intent words, not sort phrase
381
+ if implicit_min and not implicit_max:
382
+ intent["focus_min"] = True
383
+ else:
384
+ intent["focus_min"] = False
362
385
 
363
386
  # ── Sheet scope ──────────────────────────────────────────────────
364
387
  # Detect "in sheet Orders", "from Returns sheet", "across all sheets"
@@ -36,13 +36,15 @@ class InsightGenerator:
36
36
  total = result.sum()
37
37
  abs_max = result.abs().max() or 1
38
38
 
39
- # Always display table high→low for non-trend queries.
40
- # Always derive featured item from idxmax/idxmin never rely
41
- # on sort orderso the insight is correct regardless of how
42
- # the analyzer returned the result.
39
+ # Display table: sort_ascending controls table order.
40
+ # focus_min controls which item is featured in insight text.
41
+ # These are now independent "lowest in descending order"
42
+ # shows table high→low but still highlights the minimum.
43
+ focus_min = intent.get("focus_min", ascending)
44
+
43
45
  if query_type != "trend":
44
- display_result = result.sort_values(ascending=False)
45
- if ascending:
46
+ display_result = result.sort_values(ascending=ascending)
47
+ if focus_min:
46
48
  featured_value = result.min()
47
49
  featured_category = result.idxmin()
48
50
  else:
@@ -64,13 +66,16 @@ class InsightGenerator:
64
66
  table = "\n".join(table_rows)
65
67
 
66
68
  # --- Direction-aware language ---
67
- if ascending:
69
+ # verb uses focus_min (what user CARES about)
70
+ # heading_pfx uses ascending (how table is SORTED)
71
+ if focus_min:
68
72
  verb = "has the least"
69
- heading_pfx = "Bottom"
70
73
  else:
71
74
  verb = "leads with"
75
+ if ascending:
76
+ heading_pfx = "Bottom"
77
+ else:
72
78
  heading_pfx = "Top"
73
-
74
79
  # --- Compose answer ---
75
80
  if query_type in ("comparison", "top_n"):
76
81
  limit = intent.get("limit")
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "querymind-cli"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "CLI AI Data Analyst — query CSV and Excel files in plain English"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
11
11
  requires-python = ">=3.10"
12
12
  authors = [
13
- { name = "Siddhesh", email = "siddhesh.codemaster.github@gmail.com" }
13
+ { name = "Siddhesh", email = "siddhesh.codemaster.github@email.com" }
14
14
  ]
15
15
  keywords = [
16
16
  "data analysis", "cli", "natural language", "csv", "excel",
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: querymind-cli
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: CLI AI Data Analyst — query CSV and Excel files in plain English
5
- Author-email: Siddhesh <siddhesh.codemaster.github@gmail.com>
5
+ Author-email: Siddhesh <siddhesh.codemaster.github@email.com>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/SiddheshCodeMaster/QueryMind
8
8
  Project-URL: Repository, https://github.com/SiddheshCodeMaster/QueryMind
File without changes
File without changes
File without changes