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

Files changed (77) hide show
  1. {MindsDB-25.1.2.1.dist-info → MindsDB-25.1.4.0.dist-info}/METADATA +244 -242
  2. {MindsDB-25.1.2.1.dist-info → MindsDB-25.1.4.0.dist-info}/RECORD +76 -67
  3. mindsdb/__about__.py +1 -1
  4. mindsdb/__main__.py +5 -3
  5. mindsdb/api/executor/__init__.py +0 -1
  6. mindsdb/api/executor/command_executor.py +2 -1
  7. mindsdb/api/executor/data_types/answer.py +1 -1
  8. mindsdb/api/executor/datahub/datanodes/integration_datanode.py +7 -2
  9. mindsdb/api/executor/datahub/datanodes/project_datanode.py +8 -1
  10. mindsdb/api/executor/sql_query/__init__.py +1 -0
  11. mindsdb/api/executor/sql_query/result_set.py +36 -21
  12. mindsdb/api/executor/sql_query/steps/apply_predictor_step.py +1 -1
  13. mindsdb/api/executor/sql_query/steps/join_step.py +4 -4
  14. mindsdb/api/executor/sql_query/steps/map_reduce_step.py +6 -39
  15. mindsdb/api/executor/utilities/sql.py +2 -10
  16. mindsdb/api/http/namespaces/knowledge_bases.py +3 -3
  17. mindsdb/api/http/namespaces/sql.py +3 -1
  18. mindsdb/api/mysql/mysql_proxy/executor/mysql_executor.py +2 -1
  19. mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +7 -0
  20. mindsdb/api/postgres/postgres_proxy/executor/executor.py +2 -1
  21. mindsdb/integrations/handlers/chromadb_handler/chromadb_handler.py +2 -2
  22. mindsdb/integrations/handlers/chromadb_handler/requirements.txt +1 -1
  23. mindsdb/integrations/handlers/file_handler/file_handler.py +1 -1
  24. mindsdb/integrations/handlers/file_handler/tests/test_file_handler.py +17 -1
  25. mindsdb/integrations/handlers/jira_handler/jira_handler.py +15 -1
  26. mindsdb/integrations/handlers/jira_handler/jira_table.py +52 -31
  27. mindsdb/integrations/handlers/langchain_embedding_handler/fastapi_embeddings.py +82 -0
  28. mindsdb/integrations/handlers/langchain_embedding_handler/langchain_embedding_handler.py +8 -1
  29. mindsdb/integrations/handlers/langchain_handler/requirements.txt +1 -1
  30. mindsdb/integrations/handlers/pgvector_handler/pgvector_handler.py +48 -16
  31. mindsdb/integrations/handlers/pinecone_handler/pinecone_handler.py +123 -72
  32. mindsdb/integrations/handlers/pinecone_handler/requirements.txt +1 -1
  33. mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +12 -6
  34. mindsdb/integrations/handlers/slack_handler/slack_handler.py +13 -2
  35. mindsdb/integrations/handlers/slack_handler/slack_tables.py +21 -1
  36. mindsdb/integrations/libs/ml_handler_process/learn_process.py +1 -1
  37. mindsdb/integrations/utilities/rag/loaders/vector_store_loader/pgvector.py +76 -27
  38. mindsdb/integrations/utilities/rag/loaders/vector_store_loader/vector_store_loader.py +18 -1
  39. mindsdb/integrations/utilities/rag/pipelines/rag.py +73 -18
  40. mindsdb/integrations/utilities/rag/rerankers/reranker_compressor.py +166 -108
  41. mindsdb/integrations/utilities/rag/retrievers/sql_retriever.py +36 -14
  42. mindsdb/integrations/utilities/rag/settings.py +8 -2
  43. mindsdb/integrations/utilities/sql_utils.py +1 -1
  44. mindsdb/interfaces/agents/agents_controller.py +3 -5
  45. mindsdb/interfaces/agents/langchain_agent.py +112 -150
  46. mindsdb/interfaces/agents/langfuse_callback_handler.py +0 -37
  47. mindsdb/interfaces/agents/mindsdb_database_agent.py +15 -13
  48. mindsdb/interfaces/chatbot/chatbot_controller.py +7 -11
  49. mindsdb/interfaces/chatbot/chatbot_task.py +16 -5
  50. mindsdb/interfaces/chatbot/memory.py +58 -13
  51. mindsdb/interfaces/database/projects.py +17 -15
  52. mindsdb/interfaces/database/views.py +12 -25
  53. mindsdb/interfaces/knowledge_base/controller.py +39 -15
  54. mindsdb/interfaces/model/functions.py +15 -4
  55. mindsdb/interfaces/model/model_controller.py +4 -7
  56. mindsdb/interfaces/skills/custom/text2sql/mindsdb_sql_toolkit.py +47 -38
  57. mindsdb/interfaces/skills/retrieval_tool.py +10 -3
  58. mindsdb/interfaces/skills/skill_tool.py +97 -53
  59. mindsdb/interfaces/skills/sql_agent.py +77 -36
  60. mindsdb/interfaces/storage/db.py +1 -1
  61. mindsdb/migrations/versions/2025-01-15_c06c35f7e8e1_project_company.py +88 -0
  62. mindsdb/utilities/cache.py +7 -4
  63. mindsdb/utilities/context.py +11 -1
  64. mindsdb/utilities/langfuse.py +264 -0
  65. mindsdb/utilities/log.py +20 -2
  66. mindsdb/utilities/otel/__init__.py +206 -0
  67. mindsdb/utilities/otel/logger.py +25 -0
  68. mindsdb/utilities/otel/meter.py +19 -0
  69. mindsdb/utilities/otel/metric_handlers/__init__.py +25 -0
  70. mindsdb/utilities/otel/tracer.py +16 -0
  71. mindsdb/utilities/partitioning.py +52 -0
  72. mindsdb/utilities/render/sqlalchemy_render.py +7 -1
  73. mindsdb/utilities/utils.py +34 -0
  74. mindsdb/utilities/otel.py +0 -72
  75. {MindsDB-25.1.2.1.dist-info → MindsDB-25.1.4.0.dist-info}/LICENSE +0 -0
  76. {MindsDB-25.1.2.1.dist-info → MindsDB-25.1.4.0.dist-info}/WHEEL +0 -0
  77. {MindsDB-25.1.2.1.dist-info → MindsDB-25.1.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,34 @@
1
+ import csv
2
+ import re
3
+ import typing
4
+
5
+
6
+ def parse_csv_attributes(csv_attributes: typing.Optional[str] = "") -> typing.Dict[str, str]:
7
+ """
8
+ Parse the raw_attributes variable, which uses the CSV format:
9
+ key=value,another=something_else
10
+
11
+ Returns:
12
+ dict: Parsed key-value pairs as a dictionary.
13
+ """
14
+ attributes = {}
15
+
16
+ if not csv_attributes:
17
+ return attributes # Return empty dictionary if the variable is not set
18
+
19
+ try:
20
+ # Use CSV reader to handle parsing the input
21
+ reader = csv.reader([csv_attributes])
22
+ for row in reader:
23
+ for pair in row:
24
+ # Match key=value pattern
25
+ match = re.match(r'^\s*([^=]+?)\s*=\s*(.+?)\s*$', pair)
26
+ if match:
27
+ key, value = match.groups()
28
+ attributes[key.strip()] = value.strip()
29
+ else:
30
+ raise ValueError(f"Invalid attribute format: {pair}")
31
+ except Exception as e:
32
+ raise ValueError(f"Failed to parse csv_attributes='{csv_attributes}': {e}")
33
+
34
+ return attributes
mindsdb/utilities/otel.py DELETED
@@ -1,72 +0,0 @@
1
- import os
2
-
3
- from opentelemetry import trace
4
- from opentelemetry.sdk.resources import Resource
5
- from opentelemetry.sdk.trace import TracerProvider, Span
6
- from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter
7
- from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
8
-
9
- from mindsdb.utilities import log
10
- logger = log.getLogger(__name__)
11
-
12
-
13
- # Check OpenTelemetry exporter type
14
- OTEL_EXPORTER_TYPE = os.getenv("OTEL_EXPORTER_TYPE", "console") # console or otlp
15
-
16
- # Define OTLP endpoint. If not set, the default OTLP endpoint will be used
17
- OTEL_OTLP_ENDPOINT = os.getenv("OTEL_OTLP_ENDPOINT", "http://localhost:4317")
18
-
19
- # Define service name
20
- OTEL_SERVICE_NAME = os.getenv("OTEL_SERVICE_NAME", "mindsdb")
21
-
22
- # The name of the environment we"re on, by default local for development, this is set differently per-env in our Helm chart values files
23
- OTEL_SERVICE_ENVIRONMENT = os.getenv("OTEL_SERVICE_ENVIRONMENT", "local").lower()
24
-
25
- # Define service release
26
- OTEL_SERVICE_RELEASE = os.getenv("OTEL_SERVICE_RELEASE", "local").lower()
27
-
28
- # By default we have Open Telemetry SDK enabled on all envs, except for local which is disabled by default
29
- # If you want to enable Open Telemetry on local for some reason please set OTEL_SDK_FORCE_RUN to true
30
- OTEL_SDK_DISABLED = os.getenv("OTEL_SDK_DISABLED", "false").lower() == "true" or os.getenv("OTEL_SERVICE_ENVIRONMENT", "local").lower() == "local"
31
- OTEL_SDK_FORCE_RUN = os.getenv("OTEL_SDK_FORCE_RUN", "false").lower() == "true"
32
-
33
- # Custom span processor to add global tags to spans
34
-
35
-
36
- class GlobalTaggingSpanProcessor(BatchSpanProcessor):
37
- def on_start(self, span: Span, parent_context):
38
- # Add environment and release to every span
39
- span.set_attribute("environment", OTEL_SERVICE_ENVIRONMENT)
40
- span.set_attribute("release", OTEL_SERVICE_RELEASE)
41
- super().on_start(span, parent_context)
42
-
43
-
44
- if not OTEL_SDK_DISABLED or OTEL_SDK_FORCE_RUN:
45
- logger.info("OpenTelemetry enabled")
46
- logger.info(f"OpenTelemetry exporter type: {OTEL_EXPORTER_TYPE}")
47
- logger.info(f"OpenTelemetry service name: {OTEL_SERVICE_NAME}")
48
- logger.info(f"OpenTelemetry service environment: {OTEL_SERVICE_ENVIRONMENT}")
49
- logger.info(f"OpenTelemetry service release: {OTEL_SERVICE_RELEASE}")
50
-
51
- # Define OpenTelemetry resources (e.g., service name)
52
- resource = Resource(attributes={"service.name": OTEL_SERVICE_NAME})
53
-
54
- # Set the tracer provider with the custom resource
55
- trace.set_tracer_provider(TracerProvider(resource=resource))
56
-
57
- # Configure the appropriate exporter based on the environment variable
58
- if OTEL_EXPORTER_TYPE == "otlp":
59
- logger.info("OpenTelemetry is using OTLP exporter")
60
-
61
- exporter = OTLPSpanExporter(
62
- endpoint=OTEL_OTLP_ENDPOINT, # Default OTLP endpoint
63
- insecure=True # Disable TLS for local testing
64
- )
65
-
66
- else:
67
- logger.info("OpenTelemetry is using Console exporter")
68
-
69
- exporter = ConsoleSpanExporter()
70
-
71
- # Replace the default span processor with the custom one
72
- trace.get_tracer_provider().add_span_processor(GlobalTaggingSpanProcessor(exporter))