MindsDB 25.9.2.0a1__py3-none-any.whl → 25.9.3rc1__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.
- mindsdb/__about__.py +1 -1
- mindsdb/__main__.py +39 -20
- mindsdb/api/a2a/agent.py +7 -9
- mindsdb/api/a2a/common/server/server.py +3 -3
- mindsdb/api/a2a/common/server/task_manager.py +4 -4
- mindsdb/api/a2a/task_manager.py +15 -17
- mindsdb/api/common/middleware.py +9 -11
- mindsdb/api/executor/command_executor.py +2 -4
- mindsdb/api/executor/datahub/datanodes/datanode.py +2 -2
- mindsdb/api/executor/datahub/datanodes/integration_datanode.py +100 -48
- mindsdb/api/executor/datahub/datanodes/project_datanode.py +8 -4
- mindsdb/api/executor/datahub/datanodes/system_tables.py +1 -1
- mindsdb/api/executor/exceptions.py +29 -10
- mindsdb/api/executor/planner/plan_join.py +17 -3
- mindsdb/api/executor/sql_query/sql_query.py +74 -74
- mindsdb/api/executor/sql_query/steps/fetch_dataframe.py +1 -2
- mindsdb/api/executor/sql_query/steps/subselect_step.py +0 -1
- mindsdb/api/executor/utilities/functions.py +6 -6
- mindsdb/api/executor/utilities/sql.py +32 -16
- mindsdb/api/http/gui.py +5 -11
- mindsdb/api/http/initialize.py +8 -10
- mindsdb/api/http/namespaces/agents.py +10 -12
- mindsdb/api/http/namespaces/analysis.py +13 -20
- mindsdb/api/http/namespaces/auth.py +1 -1
- mindsdb/api/http/namespaces/config.py +15 -11
- mindsdb/api/http/namespaces/databases.py +140 -201
- mindsdb/api/http/namespaces/file.py +15 -4
- mindsdb/api/http/namespaces/handlers.py +7 -2
- mindsdb/api/http/namespaces/knowledge_bases.py +8 -7
- mindsdb/api/http/namespaces/models.py +94 -126
- mindsdb/api/http/namespaces/projects.py +13 -22
- mindsdb/api/http/namespaces/sql.py +33 -25
- mindsdb/api/http/namespaces/tab.py +27 -37
- mindsdb/api/http/namespaces/views.py +1 -1
- mindsdb/api/http/start.py +14 -8
- mindsdb/api/mcp/__init__.py +2 -1
- mindsdb/api/mysql/mysql_proxy/executor/mysql_executor.py +15 -20
- mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +26 -50
- mindsdb/api/mysql/mysql_proxy/utilities/__init__.py +0 -1
- mindsdb/api/postgres/postgres_proxy/executor/executor.py +6 -13
- mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_packets.py +40 -28
- mindsdb/integrations/handlers/byom_handler/byom_handler.py +168 -185
- mindsdb/integrations/handlers/file_handler/file_handler.py +7 -0
- mindsdb/integrations/handlers/lightwood_handler/functions.py +45 -79
- mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +13 -1
- mindsdb/integrations/handlers/shopify_handler/shopify_handler.py +25 -12
- mindsdb/integrations/handlers/snowflake_handler/snowflake_handler.py +2 -1
- mindsdb/integrations/handlers/statsforecast_handler/requirements.txt +1 -0
- mindsdb/integrations/handlers/statsforecast_handler/requirements_extra.txt +1 -0
- mindsdb/integrations/handlers/web_handler/urlcrawl_helpers.py +4 -4
- mindsdb/integrations/libs/api_handler.py +10 -10
- mindsdb/integrations/libs/base.py +4 -4
- mindsdb/integrations/libs/llm/utils.py +2 -2
- mindsdb/integrations/libs/ml_handler_process/create_engine_process.py +4 -7
- mindsdb/integrations/libs/ml_handler_process/func_call_process.py +2 -7
- mindsdb/integrations/libs/ml_handler_process/learn_process.py +37 -47
- mindsdb/integrations/libs/ml_handler_process/update_engine_process.py +4 -7
- mindsdb/integrations/libs/ml_handler_process/update_process.py +2 -7
- mindsdb/integrations/libs/process_cache.py +132 -140
- mindsdb/integrations/libs/response.py +18 -12
- mindsdb/integrations/libs/vectordatabase_handler.py +26 -0
- mindsdb/integrations/utilities/files/file_reader.py +6 -7
- mindsdb/integrations/utilities/rag/config_loader.py +37 -26
- mindsdb/integrations/utilities/rag/rerankers/base_reranker.py +59 -9
- mindsdb/integrations/utilities/rag/rerankers/reranker_compressor.py +4 -4
- mindsdb/integrations/utilities/rag/retrievers/sql_retriever.py +55 -133
- mindsdb/integrations/utilities/rag/settings.py +58 -133
- mindsdb/integrations/utilities/rag/splitters/file_splitter.py +5 -15
- mindsdb/interfaces/agents/agents_controller.py +2 -1
- mindsdb/interfaces/agents/constants.py +0 -2
- mindsdb/interfaces/agents/litellm_server.py +34 -58
- mindsdb/interfaces/agents/mcp_client_agent.py +10 -10
- mindsdb/interfaces/agents/mindsdb_database_agent.py +5 -5
- mindsdb/interfaces/agents/run_mcp_agent.py +12 -21
- mindsdb/interfaces/chatbot/chatbot_task.py +20 -23
- mindsdb/interfaces/chatbot/polling.py +30 -18
- mindsdb/interfaces/data_catalog/data_catalog_loader.py +10 -10
- mindsdb/interfaces/database/integrations.py +19 -2
- mindsdb/interfaces/file/file_controller.py +6 -6
- mindsdb/interfaces/functions/controller.py +1 -1
- mindsdb/interfaces/functions/to_markdown.py +2 -2
- mindsdb/interfaces/jobs/jobs_controller.py +5 -5
- mindsdb/interfaces/jobs/scheduler.py +3 -8
- mindsdb/interfaces/knowledge_base/controller.py +50 -23
- mindsdb/interfaces/knowledge_base/preprocessing/json_chunker.py +40 -61
- mindsdb/interfaces/model/model_controller.py +170 -166
- mindsdb/interfaces/query_context/context_controller.py +14 -2
- mindsdb/interfaces/skills/custom/text2sql/mindsdb_sql_toolkit.py +6 -4
- mindsdb/interfaces/skills/retrieval_tool.py +43 -50
- mindsdb/interfaces/skills/skill_tool.py +2 -2
- mindsdb/interfaces/skills/sql_agent.py +25 -19
- mindsdb/interfaces/storage/fs.py +114 -169
- mindsdb/interfaces/storage/json.py +19 -18
- mindsdb/interfaces/tabs/tabs_controller.py +49 -72
- mindsdb/interfaces/tasks/task_monitor.py +3 -9
- mindsdb/interfaces/tasks/task_thread.py +7 -9
- mindsdb/interfaces/triggers/trigger_task.py +7 -13
- mindsdb/interfaces/triggers/triggers_controller.py +47 -50
- mindsdb/migrations/migrate.py +16 -16
- mindsdb/utilities/api_status.py +58 -0
- mindsdb/utilities/config.py +49 -0
- mindsdb/utilities/exception.py +40 -1
- mindsdb/utilities/fs.py +0 -1
- mindsdb/utilities/hooks/profiling.py +17 -14
- mindsdb/utilities/langfuse.py +40 -45
- mindsdb/utilities/log.py +272 -0
- mindsdb/utilities/ml_task_queue/consumer.py +52 -58
- mindsdb/utilities/ml_task_queue/producer.py +26 -30
- mindsdb/utilities/render/sqlalchemy_render.py +7 -6
- mindsdb/utilities/utils.py +2 -2
- {mindsdb-25.9.2.0a1.dist-info → mindsdb-25.9.3rc1.dist-info}/METADATA +269 -264
- {mindsdb-25.9.2.0a1.dist-info → mindsdb-25.9.3rc1.dist-info}/RECORD +115 -115
- mindsdb/api/mysql/mysql_proxy/utilities/exceptions.py +0 -14
- {mindsdb-25.9.2.0a1.dist-info → mindsdb-25.9.3rc1.dist-info}/WHEEL +0 -0
- {mindsdb-25.9.2.0a1.dist-info → mindsdb-25.9.3rc1.dist-info}/licenses/LICENSE +0 -0
- {mindsdb-25.9.2.0a1.dist-info → mindsdb-25.9.3rc1.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import json
|
|
3
|
-
import traceback
|
|
4
3
|
from http import HTTPStatus
|
|
5
4
|
from typing import Dict, Iterable, List
|
|
6
5
|
|
|
@@ -307,10 +306,10 @@ def _completion_event_generator(agent_name: str, messages: List[Dict], project_n
|
|
|
307
306
|
|
|
308
307
|
logger.info("Completion stream finished")
|
|
309
308
|
|
|
310
|
-
except Exception
|
|
311
|
-
|
|
312
|
-
logger.
|
|
313
|
-
yield json_serialize({"error":
|
|
309
|
+
except Exception:
|
|
310
|
+
error_message = "Error in completion event generator"
|
|
311
|
+
logger.exception(error_message)
|
|
312
|
+
yield json_serialize({"error": error_message})
|
|
314
313
|
|
|
315
314
|
finally:
|
|
316
315
|
yield json_serialize({"type": "end"})
|
|
@@ -337,12 +336,12 @@ class AgentCompletionsStream(Resource):
|
|
|
337
336
|
try:
|
|
338
337
|
existing_agent = session.agents_controller.get_agent(agent_name, project_name=project_name)
|
|
339
338
|
if existing_agent is None:
|
|
340
|
-
logger.
|
|
339
|
+
logger.warning(f"Agent {agent_name} not found in project {project_name}")
|
|
341
340
|
return http_error(
|
|
342
341
|
HTTPStatus.NOT_FOUND, "Agent not found", f"Agent with name {agent_name} does not exist"
|
|
343
342
|
)
|
|
344
343
|
except ValueError as e:
|
|
345
|
-
logger.
|
|
344
|
+
logger.warning(f"Project {project_name} not found: {e}")
|
|
346
345
|
return http_error(
|
|
347
346
|
HTTPStatus.NOT_FOUND, "Project not found", f"Project with name {project_name} does not exist"
|
|
348
347
|
)
|
|
@@ -352,10 +351,9 @@ class AgentCompletionsStream(Resource):
|
|
|
352
351
|
logger.info(f"Starting streaming response for agent {agent_name}")
|
|
353
352
|
return Response(gen, mimetype="text/event-stream")
|
|
354
353
|
except Exception as e:
|
|
355
|
-
logger.
|
|
356
|
-
logger.error(traceback.format_exc())
|
|
354
|
+
logger.exception(f"Error during streaming for agent {agent_name}:")
|
|
357
355
|
return http_error(
|
|
358
|
-
HTTPStatus.INTERNAL_SERVER_ERROR, "Streaming error", f"An error occurred during streaming: {
|
|
356
|
+
HTTPStatus.INTERNAL_SERVER_ERROR, "Streaming error", f"An error occurred during streaming: {e}"
|
|
359
357
|
)
|
|
360
358
|
|
|
361
359
|
|
|
@@ -416,8 +414,8 @@ class AgentCompletions(Resource):
|
|
|
416
414
|
last_context = completion.iloc[-1]["context"]
|
|
417
415
|
if last_context:
|
|
418
416
|
context = json.loads(last_context)
|
|
419
|
-
except (json.JSONDecodeError, IndexError)
|
|
420
|
-
logger.
|
|
417
|
+
except (json.JSONDecodeError, IndexError):
|
|
418
|
+
logger.warning("Error decoding context:", exc_info=True)
|
|
421
419
|
pass # Keeping context as an empty list in case of error
|
|
422
420
|
|
|
423
421
|
response["message"]["context"] = context
|
|
@@ -36,6 +36,7 @@ def analyze_df(df: DataFrame) -> dict:
|
|
|
36
36
|
df.columns = cols
|
|
37
37
|
|
|
38
38
|
from dataprep_ml.insights import analyze_dataset
|
|
39
|
+
|
|
39
40
|
analysis = analyze_dataset(df)
|
|
40
41
|
return analysis.to_dict()
|
|
41
42
|
|
|
@@ -43,7 +44,7 @@ def analyze_df(df: DataFrame) -> dict:
|
|
|
43
44
|
@ns_conf.route("/query")
|
|
44
45
|
class QueryAnalysis(Resource):
|
|
45
46
|
@ns_conf.doc("post_query_to_analyze")
|
|
46
|
-
@api_endpoint_metrics(
|
|
47
|
+
@api_endpoint_metrics("POST", "/analysis/query")
|
|
47
48
|
def post(self):
|
|
48
49
|
data = request.json
|
|
49
50
|
query = data.get("query")
|
|
@@ -67,10 +68,8 @@ class QueryAnalysis(Resource):
|
|
|
67
68
|
try:
|
|
68
69
|
result = mysql_proxy.process_query(query)
|
|
69
70
|
except Exception as e:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
logger.error(traceback.format_exc())
|
|
73
|
-
return http_error(500, "Error", str(e))
|
|
71
|
+
logger.exception("Error during query analysis:")
|
|
72
|
+
return http_error(500, "Error", f"Unexpected error duting query analysis: {e}")
|
|
74
73
|
|
|
75
74
|
if result.type == SQL_RESPONSE_TYPE.ERROR:
|
|
76
75
|
return http_error(500, f"Error {result.error_code}", result.error_message)
|
|
@@ -83,14 +82,12 @@ class QueryAnalysis(Resource):
|
|
|
83
82
|
analysis = analyze_df(df)
|
|
84
83
|
except ImportError:
|
|
85
84
|
return {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
"analysis": {},
|
|
86
|
+
"timestamp": time.time(),
|
|
87
|
+
"error": 'To use this feature, please install the "dataprep_ml" package.',
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
query_tables = [
|
|
92
|
-
table.to_string() for table in get_query_tables(ast)
|
|
93
|
-
]
|
|
90
|
+
query_tables = [table.to_string() for table in get_query_tables(ast)]
|
|
94
91
|
|
|
95
92
|
return {
|
|
96
93
|
"analysis": analysis,
|
|
@@ -104,7 +101,7 @@ class QueryAnalysis(Resource):
|
|
|
104
101
|
@ns_conf.route("/data")
|
|
105
102
|
class DataAnalysis(Resource):
|
|
106
103
|
@ns_conf.doc("post_data_to_analyze")
|
|
107
|
-
@api_endpoint_metrics(
|
|
104
|
+
@api_endpoint_metrics("POST", "/analysis/data")
|
|
108
105
|
def post(self):
|
|
109
106
|
payload = request.json
|
|
110
107
|
column_names = payload.get("column_names")
|
|
@@ -116,15 +113,11 @@ class DataAnalysis(Resource):
|
|
|
116
113
|
return {"analysis": analysis, "timestamp": time.time()}
|
|
117
114
|
except ImportError:
|
|
118
115
|
return {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
"analysis": {},
|
|
117
|
+
"timestamp": timestamp,
|
|
118
|
+
"error": 'To use this feature, please install the "dataprep_ml" package.',
|
|
122
119
|
}
|
|
123
120
|
except Exception as e:
|
|
124
121
|
# Don't want analysis exceptions to show up on UI.
|
|
125
122
|
# TODO: Fix analysis so it doesn't throw exceptions at all.
|
|
126
|
-
return {
|
|
127
|
-
'analysis': {},
|
|
128
|
-
'timestamp': timestamp,
|
|
129
|
-
'error': str(e)
|
|
130
|
-
}
|
|
123
|
+
return {"analysis": {}, "timestamp": timestamp, "error": str(e)}
|
|
@@ -117,7 +117,7 @@ class Auth(Resource):
|
|
|
117
117
|
if resp.status_code != 200:
|
|
118
118
|
logger.warning(f"Wrong response from cloud server: {resp.status_code}")
|
|
119
119
|
except Exception as e:
|
|
120
|
-
logger.warning(f"Cant't send request to cloud server: {e}")
|
|
120
|
+
logger.warning(f"Cant't send request to cloud server: {e}", exc_info=True)
|
|
121
121
|
|
|
122
122
|
if request.path.endswith("/auth/callback/cloud_home"):
|
|
123
123
|
return redirect(f"https://{auth_server}")
|
|
@@ -11,6 +11,7 @@ from flask import current_app as ca
|
|
|
11
11
|
from mindsdb.api.http.namespaces.configs.config import ns_conf
|
|
12
12
|
from mindsdb.api.http.utils import http_error
|
|
13
13
|
from mindsdb.metrics.metrics import api_endpoint_metrics
|
|
14
|
+
from mindsdb.utilities.api_status import get_api_status
|
|
14
15
|
from mindsdb.utilities import log
|
|
15
16
|
from mindsdb.utilities.functions import decrypt, encrypt
|
|
16
17
|
from mindsdb.utilities.config import Config
|
|
@@ -32,6 +33,13 @@ class GetConfig(Resource):
|
|
|
32
33
|
value = config.get(key)
|
|
33
34
|
if value is not None:
|
|
34
35
|
resp[key] = value
|
|
36
|
+
|
|
37
|
+
api_status = get_api_status()
|
|
38
|
+
api_configs = copy.deepcopy(config["api"])
|
|
39
|
+
for api_name, api_config in api_configs.items():
|
|
40
|
+
api_config["running"] = api_status.get(api_name, False)
|
|
41
|
+
resp["api"] = api_configs
|
|
42
|
+
|
|
35
43
|
return resp
|
|
36
44
|
|
|
37
45
|
@ns_conf.doc("put_config")
|
|
@@ -163,9 +171,7 @@ class Integration(Resource):
|
|
|
163
171
|
)
|
|
164
172
|
|
|
165
173
|
try:
|
|
166
|
-
engine = params
|
|
167
|
-
if engine is not None:
|
|
168
|
-
del params["type"]
|
|
174
|
+
engine = params.pop("type", None)
|
|
169
175
|
params.pop("publish", False)
|
|
170
176
|
storage = params.pop("storage", None)
|
|
171
177
|
ca.integration_controller.add(name, engine, params)
|
|
@@ -178,10 +184,10 @@ class Integration(Resource):
|
|
|
178
184
|
handler.handler_storage.import_files(export)
|
|
179
185
|
|
|
180
186
|
except Exception as e:
|
|
181
|
-
logger.error
|
|
187
|
+
logger.exception("An error occurred during the creation of the integration:")
|
|
182
188
|
if temp_dir is not None:
|
|
183
189
|
shutil.rmtree(temp_dir)
|
|
184
|
-
return http_error(HTTPStatus.INTERNAL_SERVER_ERROR, "Error", f"Error during config update: {
|
|
190
|
+
return http_error(HTTPStatus.INTERNAL_SERVER_ERROR, "Error", f"Error during config update: {e}")
|
|
185
191
|
|
|
186
192
|
if temp_dir is not None:
|
|
187
193
|
shutil.rmtree(temp_dir)
|
|
@@ -198,8 +204,8 @@ class Integration(Resource):
|
|
|
198
204
|
try:
|
|
199
205
|
ca.integration_controller.delete(name)
|
|
200
206
|
except Exception as e:
|
|
201
|
-
logger.error
|
|
202
|
-
return http_error(HTTPStatus.INTERNAL_SERVER_ERROR, "Error", f"Error during integration delete: {
|
|
207
|
+
logger.exception("An error occurred while deleting the integration")
|
|
208
|
+
return http_error(HTTPStatus.INTERNAL_SERVER_ERROR, "Error", f"Error during integration delete: {e}")
|
|
203
209
|
return "", 200
|
|
204
210
|
|
|
205
211
|
@ns_conf.doc("modify_integration")
|
|
@@ -223,8 +229,6 @@ class Integration(Resource):
|
|
|
223
229
|
ca.integration_controller.modify(name, params)
|
|
224
230
|
|
|
225
231
|
except Exception as e:
|
|
226
|
-
logger.error
|
|
227
|
-
return http_error(
|
|
228
|
-
HTTPStatus.INTERNAL_SERVER_ERROR, "Error", f"Error during integration modification: {str(e)}"
|
|
229
|
-
)
|
|
232
|
+
logger.exception("An error occurred while modifying the integration")
|
|
233
|
+
return http_error(HTTPStatus.INTERNAL_SERVER_ERROR, "Error", f"Error during integration modification: {e}")
|
|
230
234
|
return "", 200
|