banko-ai-assistant 1.0.15__py3-none-any.whl → 1.0.16__py3-none-any.whl

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.
banko_ai/cli.py CHANGED
@@ -60,6 +60,7 @@ def run(host, port, debug, generate_data, no_data, clear_data, background):
60
60
  # Generate data if not explicitly disabled
61
61
  if not no_data:
62
62
  click.echo("🔍 Checking database setup...")
63
+ click.echo(f"Using database: {config.database_url}")
63
64
  click.echo(f"Generating {generate_data} sample expense records...")
64
65
  generator = EnhancedExpenseGenerator(config.database_url)
65
66
 
@@ -207,6 +208,7 @@ def start(host, port, generate_data, no_data, clear_data):
207
208
  # Generate data if not explicitly disabled
208
209
  if not no_data:
209
210
  click.echo("🔍 Checking database setup...")
211
+ click.echo(f"Using database: {config.database_url}")
210
212
  click.echo(f"Generating {generate_data} sample expense records...")
211
213
  generator = EnhancedExpenseGenerator(config.database_url)
212
214
 
@@ -331,14 +331,31 @@ class EnhancedExpenseGenerator:
331
331
  def get_expense_count(self) -> int:
332
332
  """Get the current number of expenses in the database."""
333
333
  try:
334
+ # Ensure tables exist first
335
+ self._ensure_tables_exist()
336
+
334
337
  from sqlalchemy import text
335
338
  with self.engine.connect() as conn:
336
339
  result = conn.execute(text("SELECT COUNT(*) FROM expenses"))
337
340
  return result.scalar()
338
341
  except Exception as e:
339
342
  print(f"Error getting expense count: {e}")
343
+ if "connection" in str(e).lower() or "refused" in str(e).lower():
344
+ print("💡 Make sure CockroachDB is running:")
345
+ print(" cockroach start --insecure")
346
+ print(" Or set DATABASE_URL to your database connection string")
340
347
  return 0
341
348
 
349
+ def _ensure_tables_exist(self):
350
+ """Ensure database tables exist."""
351
+ try:
352
+ from ..utils.database import DatabaseManager
353
+ db_manager = DatabaseManager(self.database_url)
354
+ db_manager.create_tables()
355
+ except Exception as e:
356
+ print(f"Error creating tables: {e}")
357
+ # Continue anyway - tables might already exist
358
+
342
359
  def generate_and_save(
343
360
  self,
344
361
  count: int,
@@ -70,9 +70,9 @@ class VectorSearchEngine:
70
70
  merchant,
71
71
  shopping_type,
72
72
  expense_amount,
73
- embedding <=> :search_embedding as similarity_score
73
+ embedding <-> :search_embedding as similarity_score
74
74
  FROM expenses
75
- ORDER BY embedding <=> :search_embedding
75
+ ORDER BY embedding <-> :search_embedding
76
76
  LIMIT :limit
77
77
  """)
78
78
 
@@ -465,7 +465,7 @@ class VectorSearchEngine:
465
465
  merchant,
466
466
  expense_amount,
467
467
  expense_date,
468
- 1 - (embedding <=> %s) as similarity_score,
468
+ 1 - (embedding <-> %s) as similarity_score,
469
469
  shopping_type,
470
470
  payment_method,
471
471
  recurring,
banko_ai/web/app.py CHANGED
@@ -620,7 +620,7 @@ def create_app() -> Flask:
620
620
  def ai_status():
621
621
  """Endpoint to check the status of AI services and database."""
622
622
  # Check database status
623
- db_connected, db_message, table_exists, record_count = db_manager.test_connection()
623
+ db_connected, db_message, table_exists, record_count = check_database_connection(config.database_url)
624
624
 
625
625
  status = {
626
626
  'current_service': config.ai_service,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: banko-ai-assistant
3
- Version: 1.0.15
3
+ Version: 1.0.16
4
4
  Summary: AI-powered expense analysis and RAG system with CockroachDB vector search and multi-provider AI support
5
5
  Author-email: Virag Tripathi <virag.tripathi@gmail.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  banko_ai/__init__.py,sha256=G1InyKemqQxP9xx6yGZgolBmrmOLSpBXqGYY8LaFOeo,568
2
2
  banko_ai/__main__.py,sha256=U-KkrXtL8JNIyV25PE5v_eYhlhjR7jd6kG-txfYfs0M,709
3
- banko_ai/cli.py,sha256=mInMRG4JK-iQoauNvJ8ZVzkWHemTW9GwC2xhXY_SX1g,13762
3
+ banko_ai/cli.py,sha256=7lMeDRIuJjeAkrVMzw2YmJp4t10KLGP7TRIywUSOkeU,13884
4
4
  banko_ai/ai_providers/__init__.py,sha256=JdBgw5Mji2pe9nU-aiRYUmJuZk0q8KbcMtbpMJC5Dq8,483
5
5
  banko_ai/ai_providers/aws_provider.py,sha256=-tR-8tlEeSL-Fspx05tTMFguvQylkW_pz0PI2XJEByM,13074
6
6
  banko_ai/ai_providers/base.py,sha256=zbuAgkHIfJ0YkG83LXzieJuvXBcB2-nx7NhbL-I4Pf0,4725
@@ -151,14 +151,14 @@ banko_ai/utils/database.py,sha256=sJYAFTApkWReEJuMbbBDiz7XfgiiEd6lPSSyF6BQDpk,77
151
151
  banko_ai/utils/migration.py,sha256=j1lYUVZyYMcMvxZUOFymoK19QTPqkDZFXD-iysVCnQo,4764
152
152
  banko_ai/vector_search/__init__.py,sha256=vYksnkUU4FA8XBNzYZIH4FoGjXCx9oIbrDeapSzrNuE,621
153
153
  banko_ai/vector_search/enrichment.py,sha256=tgAImLehkp2kL46vI5GEHsE8B5E4gT3PweXZLqqKei4,8097
154
- banko_ai/vector_search/generator.py,sha256=9fIuWdp_RCO49Ua7jDOYQOyHa6QvDbXei8T-AHccxKQ,17071
155
- banko_ai/vector_search/search.py,sha256=I-DgxTqib_VbRKX0Ttk9QmzGcAW2hLYm0_Y9HXSaibQ,18763
154
+ banko_ai/vector_search/generator.py,sha256=6SV6_RZ4M4-TfJvxlXHZY1p-zcLKpIJm0p871nmEjmI,17837
155
+ banko_ai/vector_search/search.py,sha256=RiDxqcRblAFSmxMvxy9nRRrw22OtVMHP5_rsvQsS_MU,18763
156
156
  banko_ai/web/__init__.py,sha256=hjWVVxYpIZhOAN1qBf4xTd36a5AUHM03Q8BF8pykhJQ,363
157
- banko_ai/web/app.py,sha256=Qdd9gIccFJ5NeEYFiwKS3evFNbba6t5LNs733isloWE,32127
157
+ banko_ai/web/app.py,sha256=Temx39TX19idHrlrUwb_2QLr1GSZZVjqhyJC299NFMY,32145
158
158
  banko_ai/web/auth.py,sha256=js6qIixSFHyLbETDm8GNLCPrDkCDcaQZPFOrqtZP1uw,2125
159
- banko_ai_assistant-1.0.15.dist-info/licenses/LICENSE,sha256=skG0LkywIClj8fgSIXiG6o9vUDJ678BKBObIyJ19OMw,1075
160
- banko_ai_assistant-1.0.15.dist-info/METADATA,sha256=x07Gebx_90JhzCMnMMYfa_PQzqK2AZpSd_9aH5k-_Y8,13505
161
- banko_ai_assistant-1.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
162
- banko_ai_assistant-1.0.15.dist-info/entry_points.txt,sha256=IxPjBjMvbpCp-ikCA43bOSbYboTGPX4HYcZlvu2_vcA,47
163
- banko_ai_assistant-1.0.15.dist-info/top_level.txt,sha256=xNMa9Z67UssefOQ2ubFObtqUYIfYmCIclfz0xdo5OPE,9
164
- banko_ai_assistant-1.0.15.dist-info/RECORD,,
159
+ banko_ai_assistant-1.0.16.dist-info/licenses/LICENSE,sha256=skG0LkywIClj8fgSIXiG6o9vUDJ678BKBObIyJ19OMw,1075
160
+ banko_ai_assistant-1.0.16.dist-info/METADATA,sha256=BuVSoi6etHKRv2qq6rLW5FucRSzlUSuZip87XXi0y-g,13505
161
+ banko_ai_assistant-1.0.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
162
+ banko_ai_assistant-1.0.16.dist-info/entry_points.txt,sha256=IxPjBjMvbpCp-ikCA43bOSbYboTGPX4HYcZlvu2_vcA,47
163
+ banko_ai_assistant-1.0.16.dist-info/top_level.txt,sha256=xNMa9Z67UssefOQ2ubFObtqUYIfYmCIclfz0xdo5OPE,9
164
+ banko_ai_assistant-1.0.16.dist-info/RECORD,,