MindsDB 25.5.4.0__py3-none-any.whl → 25.5.4.1__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.

Potentially problematic release.


This version of MindsDB might be problematic. Click here for more details.

@@ -15,9 +15,7 @@ from appdirs import user_data_dir
15
15
  def _merge_key_recursive(target_dict, source_dict, key):
16
16
  if key not in target_dict:
17
17
  target_dict[key] = source_dict[key]
18
- elif not isinstance(target_dict[key], dict) or not isinstance(
19
- source_dict[key], dict
20
- ):
18
+ elif not isinstance(target_dict[key], dict) or not isinstance(source_dict[key], dict):
21
19
  target_dict[key] = source_dict[key]
22
20
  else:
23
21
  for k in list(source_dict[key].keys()):
@@ -109,9 +107,7 @@ class Config:
109
107
  elif "root" in self._user_config.get("paths", {}):
110
108
  self.storage_root_path = self.user_config["paths"]["root"]
111
109
  else:
112
- self.storage_root_path = os.path.join(
113
- user_data_dir("mindsdb", "mindsdb"), "var/"
114
- )
110
+ self.storage_root_path = os.path.join(user_data_dir("mindsdb", "mindsdb"), "var/")
115
111
  self.storage_root_path = Path(self.storage_root_path)
116
112
  create_data_dir(self.storage_root_path)
117
113
  # endregion
@@ -211,13 +207,15 @@ class Config:
211
207
  "default_project": "mindsdb",
212
208
  "default_llm": {},
213
209
  "default_embedding_model": {},
210
+ "default_reranking_model": {},
214
211
  "a2a": {
215
212
  "host": "localhost",
216
- "port": 10002,
213
+ "port": 47338,
217
214
  "mindsdb_host": "localhost",
218
215
  "mindsdb_port": 47334,
219
216
  "agent_name": "my_agent",
220
217
  "project_name": "mindsdb",
218
+ "enabled": False,
221
219
  },
222
220
  }
223
221
  # endregion
@@ -251,9 +249,7 @@ class Config:
251
249
 
252
250
  # region storage root path
253
251
  if os.environ.get("MINDSDB_STORAGE_DIR", "") != "":
254
- self._env_config["paths"] = {
255
- "root": Path(os.environ["MINDSDB_STORAGE_DIR"])
256
- }
252
+ self._env_config["paths"] = {"root": Path(os.environ["MINDSDB_STORAGE_DIR"])}
257
253
  # endregion
258
254
 
259
255
  # region vars: permanent storage disabled?
@@ -302,30 +298,20 @@ class Config:
302
298
  try:
303
299
  permanent_session_lifetime = int(env_value)
304
300
  except Exception:
305
- raise ValueError(
306
- f"Warning: Can't cast env var {env_name} value to int: {env_value}"
307
- )
308
- self._env_config["auth"][
309
- "http_permanent_session_lifetime"
310
- ] = permanent_session_lifetime
301
+ raise ValueError(f"Warning: Can't cast env var {env_name} value to int: {env_value}")
302
+ self._env_config["auth"]["http_permanent_session_lifetime"] = permanent_session_lifetime
311
303
  break
312
304
  # endregion
313
305
 
314
306
  # region logging
315
307
  if os.environ.get("MINDSDB_LOG_LEVEL", "") != "":
316
- self._env_config["logging"]["handlers"]["console"]["level"] = os.environ[
317
- "MINDSDB_LOG_LEVEL"
318
- ]
308
+ self._env_config["logging"]["handlers"]["console"]["level"] = os.environ["MINDSDB_LOG_LEVEL"]
319
309
  self._env_config["logging"]["handlers"]["console"]["enabled"] = True
320
310
  if os.environ.get("MINDSDB_CONSOLE_LOG_LEVEL", "") != "":
321
- self._env_config["logging"]["handlers"]["console"]["level"] = os.environ[
322
- "MINDSDB_LOG_LEVEL"
323
- ]
311
+ self._env_config["logging"]["handlers"]["console"]["level"] = os.environ["MINDSDB_LOG_LEVEL"]
324
312
  self._env_config["logging"]["handlers"]["console"]["enabled"] = True
325
313
  if os.environ.get("MINDSDB_FILE_LOG_LEVEL", "") != "":
326
- self._env_config["logging"]["handlers"]["file"]["level"] = os.environ[
327
- "MINDSDB_FILE_LOG_LEVEL"
328
- ]
314
+ self._env_config["logging"]["handlers"]["file"]["level"] = os.environ["MINDSDB_FILE_LOG_LEVEL"]
329
315
  self._env_config["logging"]["handlers"]["file"]["enabled"] = True
330
316
  # endregion
331
317
 
@@ -362,18 +348,18 @@ class Config:
362
348
  self._env_config["storage_db"] = os.environ["MINDSDB_DB_CON"]
363
349
 
364
350
  if os.environ.get("MINDSDB_DEFAULT_PROJECT", "") != "":
365
- self._env_config["default_project"] = os.environ[
366
- "MINDSDB_DEFAULT_PROJECT"
367
- ].lower()
351
+ self._env_config["default_project"] = os.environ["MINDSDB_DEFAULT_PROJECT"].lower()
368
352
 
369
353
  if os.environ.get("MINDSDB_DEFAULT_LLM_API_KEY", "") != "":
370
- self._env_config["default_llm"] = {
371
- "api_key": os.environ["MINDSDB_DEFAULT_LLM_API_KEY"]
372
- }
354
+ self._env_config["default_llm"] = {"api_key": os.environ["MINDSDB_DEFAULT_LLM_API_KEY"]}
373
355
  if os.environ.get("MINDSDB_DEFAULT_EMBEDDING_MODEL_API_KEY", "") != "":
374
356
  self._env_config["default_embedding_model"] = {
375
357
  "api_key": os.environ["MINDSDB_DEFAULT_EMBEDDING_MODEL_API_KEY"]
376
358
  }
359
+ if os.environ.get("MINDSDB_DEFAULT_RERANKING_MODEL_API_KEY", "") != "":
360
+ self._env_config["default_reranking_model"] = {
361
+ "api_key": os.environ["MINDSDB_DEFAULT_RERANKING_MODEL_API_KEY"]
362
+ }
377
363
 
378
364
  # region vars: a2a configuration
379
365
  a2a_config = {}
@@ -389,6 +375,13 @@ class Config:
389
375
  a2a_config["agent_name"] = os.environ.get("MINDSDB_AGENT_NAME")
390
376
  if os.environ.get("MINDSDB_PROJECT_NAME"):
391
377
  a2a_config["project_name"] = os.environ.get("MINDSDB_PROJECT_NAME")
378
+ if os.environ.get("MINDSDB_A2A_ENABLED") is not None:
379
+ a2a_config["enabled"] = os.environ.get("MINDSDB_A2A_ENABLED").lower() in (
380
+ "true",
381
+ "1",
382
+ "yes",
383
+ "y",
384
+ )
392
385
 
393
386
  if a2a_config:
394
387
  self._env_config["a2a"] = a2a_config
@@ -406,9 +399,7 @@ class Config:
406
399
  try:
407
400
  self._auto_config = json.loads(self.auto_config_path.read_text())
408
401
  except json.JSONDecodeError as e:
409
- raise ValueError(
410
- f"The 'auto' configuration file ({self.auto_config_path}) contains invalid JSON: {e}"
411
- )
402
+ raise ValueError(f"The 'auto' configuration file ({self.auto_config_path}) contains invalid JSON: {e}")
412
403
  self.auto_config_mtime = self.auto_config_path.stat().st_mtime
413
404
  return True
414
405
  return False
@@ -430,15 +421,11 @@ class Config:
430
421
  if isinstance(self.config_path, str):
431
422
  self.config_path = Path(self.config_path)
432
423
  if not self.config_path.is_file():
433
- raise FileNotFoundError(
434
- f"The configuration file was not found at the path: {self.config_path}"
435
- )
424
+ raise FileNotFoundError(f"The configuration file was not found at the path: {self.config_path}")
436
425
  try:
437
426
  self._user_config = json.loads(self.config_path.read_text())
438
427
  except json.JSONDecodeError as e:
439
- raise ValueError(
440
- f"The configuration file ({self.config_path}) contains invalid JSON: {e}"
441
- )
428
+ raise ValueError(f"The configuration file ({self.config_path}) contains invalid JSON: {e}")
442
429
  else:
443
430
  self._user_config = {}
444
431
  return True
@@ -471,34 +458,22 @@ class Config:
471
458
  cmd_args_config["a2a"] = {}
472
459
  cmd_args_config["a2a"]["port"] = self.cmd_args.a2a_port
473
460
 
474
- if (
475
- hasattr(self.cmd_args, "mindsdb_host")
476
- and self.cmd_args.mindsdb_host is not None
477
- ):
461
+ if hasattr(self.cmd_args, "mindsdb_host") and self.cmd_args.mindsdb_host is not None:
478
462
  if "a2a" not in cmd_args_config:
479
463
  cmd_args_config["a2a"] = {}
480
464
  cmd_args_config["a2a"]["mindsdb_host"] = self.cmd_args.mindsdb_host
481
465
 
482
- if (
483
- hasattr(self.cmd_args, "mindsdb_port")
484
- and self.cmd_args.mindsdb_port is not None
485
- ):
466
+ if hasattr(self.cmd_args, "mindsdb_port") and self.cmd_args.mindsdb_port is not None:
486
467
  if "a2a" not in cmd_args_config:
487
468
  cmd_args_config["a2a"] = {}
488
469
  cmd_args_config["a2a"]["mindsdb_port"] = self.cmd_args.mindsdb_port
489
470
 
490
- if (
491
- hasattr(self.cmd_args, "agent_name")
492
- and self.cmd_args.agent_name is not None
493
- ):
471
+ if hasattr(self.cmd_args, "agent_name") and self.cmd_args.agent_name is not None:
494
472
  if "a2a" not in cmd_args_config:
495
473
  cmd_args_config["a2a"] = {}
496
474
  cmd_args_config["a2a"]["agent_name"] = self.cmd_args.agent_name
497
475
 
498
- if (
499
- hasattr(self.cmd_args, "project_name")
500
- and self.cmd_args.project_name is not None
501
- ):
476
+ if hasattr(self.cmd_args, "project_name") and self.cmd_args.project_name is not None:
502
477
  if "a2a" not in cmd_args_config:
503
478
  cmd_args_config["a2a"] = {}
504
479
  cmd_args_config["a2a"]["project_name"] = self.cmd_args.project_name
@@ -510,7 +485,7 @@ class Config:
510
485
  # Ensure A2A port is never 0, which would prevent the A2A API from starting
511
486
  if "a2a" in new_config and isinstance(new_config["a2a"], dict):
512
487
  if "port" in new_config["a2a"] and (new_config["a2a"]["port"] == 0 or new_config["a2a"]["port"] is None):
513
- new_config["a2a"]["port"] = 10002 # Use the default port value
488
+ new_config["a2a"]["port"] = 47338 # Use the default port value
514
489
 
515
490
  # region create dirs
516
491
  for key, value in new_config["paths"].items():
@@ -551,14 +526,10 @@ class Config:
551
526
  """Show warnings about config options"""
552
527
 
553
528
  if "storage_dir" in self._config:
554
- logger.warning(
555
- "The 'storage_dir' config option is no longer supported. Use 'paths.root' instead."
556
- )
529
+ logger.warning("The 'storage_dir' config option is no longer supported. Use 'paths.root' instead.")
557
530
 
558
531
  if "log" in self._config:
559
- logger.warning(
560
- "The 'log' config option is no longer supported. Use 'logging' instead."
561
- )
532
+ logger.warning("The 'log' config option is no longer supported. Use 'logging' instead.")
562
533
 
563
534
  if os.environ.get("MINDSDB_DEFAULT_SERVER", "") != "":
564
535
  logger.warning(
@@ -586,9 +557,9 @@ class Config:
586
557
  return
587
558
 
588
559
  # if it is not mindsdb run, then set args to empty
589
- if (
590
- sys.modules["__main__"].__package__ or ""
591
- ).lower() != "mindsdb" and os.environ.get("MINDSDB_RUNTIME") != "1":
560
+ if (sys.modules["__main__"].__package__ or "").lower() != "mindsdb" and os.environ.get(
561
+ "MINDSDB_RUNTIME"
562
+ ) != "1":
592
563
  self._cmd_args = argparse.Namespace(
593
564
  api=None,
594
565
  config=None,
@@ -609,9 +580,7 @@ class Config:
609
580
  parser.add_argument("--verbose", action="store_true")
610
581
  parser.add_argument("--no_studio", action="store_true")
611
582
  parser.add_argument("-v", "--version", action="store_true")
612
- parser.add_argument(
613
- "--ml_task_queue_consumer", action="store_true", default=None
614
- )
583
+ parser.add_argument("--ml_task_queue_consumer", action="store_true", default=None)
615
584
  parser.add_argument(
616
585
  "--agent",
617
586
  type=str,
@@ -626,27 +595,17 @@ class Config:
626
595
  )
627
596
 
628
597
  # A2A specific arguments
629
- parser.add_argument(
630
- "--a2a-host", type=str, default=None, help="A2A server host"
631
- )
632
- parser.add_argument(
633
- "--a2a-port", type=int, default=None, help="A2A server port"
634
- )
635
- parser.add_argument(
636
- "--mindsdb-host", type=str, default=None, help="MindsDB server host"
637
- )
638
- parser.add_argument(
639
- "--mindsdb-port", type=int, default=None, help="MindsDB server port"
640
- )
598
+ parser.add_argument("--a2a-host", type=str, default=None, help="A2A server host")
599
+ parser.add_argument("--a2a-port", type=int, default=None, help="A2A server port")
600
+ parser.add_argument("--mindsdb-host", type=str, default=None, help="MindsDB server host")
601
+ parser.add_argument("--mindsdb-port", type=int, default=None, help="MindsDB server port")
641
602
  parser.add_argument(
642
603
  "--agent-name",
643
604
  type=str,
644
605
  default=None,
645
606
  help="MindsDB agent name to connect to",
646
607
  )
647
- parser.add_argument(
648
- "--project-name", type=str, default=None, help="MindsDB project name"
649
- )
608
+ parser.add_argument("--project-name", type=str, default=None, help="MindsDB project name")
650
609
 
651
610
  self._cmd_args = parser.parse_args()
652
611