MindsDB 25.7.4.0__py3-none-any.whl → 25.8.2.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 (57) hide show
  1. mindsdb/__about__.py +1 -1
  2. mindsdb/__main__.py +11 -1
  3. mindsdb/api/executor/command_executor.py +9 -15
  4. mindsdb/api/executor/sql_query/steps/fetch_dataframe.py +21 -24
  5. mindsdb/api/executor/sql_query/steps/fetch_dataframe_partition.py +9 -3
  6. mindsdb/api/executor/sql_query/steps/subselect_step.py +11 -8
  7. mindsdb/api/executor/utilities/mysql_to_duckdb_functions.py +264 -0
  8. mindsdb/api/executor/utilities/sql.py +30 -0
  9. mindsdb/api/http/initialize.py +2 -1
  10. mindsdb/api/http/namespaces/views.py +56 -72
  11. mindsdb/integrations/handlers/db2_handler/db2_handler.py +19 -23
  12. mindsdb/integrations/handlers/gong_handler/__about__.py +2 -0
  13. mindsdb/integrations/handlers/gong_handler/__init__.py +30 -0
  14. mindsdb/integrations/handlers/gong_handler/connection_args.py +37 -0
  15. mindsdb/integrations/handlers/gong_handler/gong_handler.py +164 -0
  16. mindsdb/integrations/handlers/gong_handler/gong_tables.py +508 -0
  17. mindsdb/integrations/handlers/gong_handler/icon.svg +25 -0
  18. mindsdb/integrations/handlers/gong_handler/test_gong_handler.py +125 -0
  19. mindsdb/integrations/handlers/huggingface_handler/__init__.py +8 -12
  20. mindsdb/integrations/handlers/huggingface_handler/finetune.py +203 -223
  21. mindsdb/integrations/handlers/huggingface_handler/huggingface_handler.py +360 -383
  22. mindsdb/integrations/handlers/huggingface_handler/requirements.txt +7 -7
  23. mindsdb/integrations/handlers/huggingface_handler/requirements_cpu.txt +7 -7
  24. mindsdb/integrations/handlers/huggingface_handler/settings.py +25 -25
  25. mindsdb/integrations/handlers/langchain_handler/langchain_handler.py +1 -2
  26. mindsdb/integrations/handlers/openai_handler/constants.py +11 -30
  27. mindsdb/integrations/handlers/openai_handler/helpers.py +27 -34
  28. mindsdb/integrations/handlers/openai_handler/openai_handler.py +14 -12
  29. mindsdb/integrations/handlers/salesforce_handler/constants.py +9 -2
  30. mindsdb/integrations/libs/llm/config.py +0 -14
  31. mindsdb/integrations/libs/llm/utils.py +0 -15
  32. mindsdb/integrations/utilities/files/file_reader.py +5 -19
  33. mindsdb/integrations/utilities/rag/rerankers/base_reranker.py +1 -1
  34. mindsdb/interfaces/agents/agents_controller.py +83 -45
  35. mindsdb/interfaces/agents/constants.py +0 -1
  36. mindsdb/interfaces/agents/langchain_agent.py +1 -3
  37. mindsdb/interfaces/database/projects.py +111 -7
  38. mindsdb/interfaces/knowledge_base/controller.py +7 -1
  39. mindsdb/interfaces/knowledge_base/preprocessing/document_preprocessor.py +6 -10
  40. mindsdb/interfaces/knowledge_base/preprocessing/text_splitter.py +73 -0
  41. mindsdb/interfaces/query_context/context_controller.py +14 -15
  42. mindsdb/utilities/config.py +2 -0
  43. mindsdb/utilities/fs.py +54 -17
  44. {mindsdb-25.7.4.0.dist-info → mindsdb-25.8.2.0.dist-info}/METADATA +278 -263
  45. {mindsdb-25.7.4.0.dist-info → mindsdb-25.8.2.0.dist-info}/RECORD +49 -48
  46. mindsdb/integrations/handlers/anyscale_endpoints_handler/__about__.py +0 -9
  47. mindsdb/integrations/handlers/anyscale_endpoints_handler/__init__.py +0 -20
  48. mindsdb/integrations/handlers/anyscale_endpoints_handler/anyscale_endpoints_handler.py +0 -290
  49. mindsdb/integrations/handlers/anyscale_endpoints_handler/creation_args.py +0 -14
  50. mindsdb/integrations/handlers/anyscale_endpoints_handler/icon.svg +0 -4
  51. mindsdb/integrations/handlers/anyscale_endpoints_handler/requirements.txt +0 -2
  52. mindsdb/integrations/handlers/anyscale_endpoints_handler/settings.py +0 -51
  53. mindsdb/integrations/handlers/anyscale_endpoints_handler/tests/test_anyscale_endpoints_handler.py +0 -212
  54. /mindsdb/integrations/handlers/{anyscale_endpoints_handler/tests/__init__.py → gong_handler/requirements.txt} +0 -0
  55. {mindsdb-25.7.4.0.dist-info → mindsdb-25.8.2.0.dist-info}/WHEEL +0 -0
  56. {mindsdb-25.7.4.0.dist-info → mindsdb-25.8.2.0.dist-info}/licenses/LICENSE +0 -0
  57. {mindsdb-25.7.4.0.dist-info → mindsdb-25.8.2.0.dist-info}/top_level.txt +0 -0
@@ -1,51 +0,0 @@
1
- from typing import Text, List
2
- from pydantic_settings import BaseSettings
3
-
4
-
5
- class AnyscaleHandlerConfig(BaseSettings):
6
- """
7
- Configuration for the Anyscale handler.
8
-
9
- Attributes
10
- ----------
11
-
12
- ANYSCALE_API_BASE : Text
13
- Base URL for the Anyscale API.
14
-
15
- MIN_FT_VAL_LEN : int
16
- Minimum number of validation chats required for fine-tuning.
17
-
18
- MIN_FT_DATASET_LEN : int
19
- Minimum number of training and validation chats required for fine-tuning.
20
-
21
- DEFAULT_MODEL : Text
22
- Default model to use for models.
23
-
24
- DEFAULT_MODE : Text
25
- Default mode to use for models. Can be 'default', 'conversational', or 'conversational-full'.
26
-
27
- SUPPORTED_MODES : List
28
- List of supported modes. Can be 'default', 'conversational', or 'conversational-full'.
29
-
30
- RATE_LIMIT : int
31
- Number of requests per minute.
32
-
33
- MAX_BATCH_SIZE : int
34
- Maximum batch size for requests.
35
-
36
- DEFAULT_MAX_TOKENS : int
37
- Default maximum tokens for requests.
38
- """
39
-
40
- ANYSCALE_API_BASE: Text = 'https://api.endpoints.anyscale.com/v1'
41
- MIN_FT_VAL_LEN: int = 20
42
- MIN_FT_DATASET_LEN: int = MIN_FT_VAL_LEN * 2
43
- DEFAULT_MODEL: Text = 'meta-llama/Llama-2-7b-chat-hf'
44
- DEFAULT_MODE: Text = 'default'
45
- SUPPORTED_MODES: List = ['default', 'conversational', 'conversational-full']
46
- RATE_LIMIT: int = 25
47
- MAX_BATCH_SIZE: int = 20
48
- DEFAULT_MAX_TOKENS: int = 100
49
-
50
-
51
- anyscale_handler_config = AnyscaleHandlerConfig()
@@ -1,212 +0,0 @@
1
- import os
2
- import pytest
3
- import pandas as pd
4
- from unittest.mock import patch
5
-
6
- from tests.unit.ml_handlers.base_ml_test import BaseMLAPITest
7
-
8
-
9
- @pytest.mark.skipif(os.environ.get('MDB_TEST_ANYSCALE_ENDPOINTS_API_KEY') is None, reason='Missing API key!')
10
- class TestAnyscaleEndpoints(BaseMLAPITest):
11
- """
12
- Integration tests for Anyscale Endpoints AI engine.
13
- """
14
-
15
- def setup_method(self):
16
- """
17
- Setup test environment by creating a project and a Anyscale Endpoints engine.
18
- """
19
-
20
- super().setup_method()
21
- self.run_sql("CREATE DATABASE proj")
22
- self.run_sql(
23
- f"""
24
- CREATE ML_ENGINE anyscale_endpoints_engine
25
- FROM anyscale_endpoints
26
- USING
27
- anyscale_endpoints_api_key = '{self.get_api_key('MDB_TEST_ANYSCALE_ENDPOINTS_API_KEY')}';
28
- """
29
- )
30
-
31
- def test_create_model_raises_exception_with_invalid_model_parameter(self):
32
- """
33
- Test for invalid parameter during model creation.
34
- """
35
-
36
- self.run_sql(
37
- """
38
- CREATE MODEL proj.test_anyscale_invalid_parameter_model
39
- PREDICT answer
40
- USING
41
- engine='anyscale_endpoints_engine',
42
- model_name='this-model-does-not-exist',
43
- prompt_template='dummy_prompt_template';
44
- """
45
- )
46
- with pytest.raises(Exception):
47
- self.wait_predictor("proj", "test_anyscale_invalid_parameter_model")
48
-
49
- # TODO: Uncomment this once the handler is updated to handle unknown arguments.
50
- # def test_create_model_raises_exception_with_unknown_model_argument(self):
51
- # """
52
- # Test for unknown argument during model creation.
53
- # """
54
-
55
- # self.run_sql(
56
- # """
57
- # CREATE MODEL proj.test_anyscale_unknown_argument_model
58
- # PREDICT answer
59
- # USING
60
- # engine='anyscale_endpoints_engine',
61
- # prompt_template='dummy_prompt_template',
62
- # evidently_wrong_argument='wrong value';
63
- # """
64
- # )
65
- # with pytest.raises(Exception):
66
- # self.wait_predictor("proj", "test_anyscale_unknown_argument_model")
67
-
68
- def test_create_model_raises_exception_with_invalid_operation_mode(self):
69
- """
70
- Test for invalid operation mode during model creation.
71
- """
72
-
73
- self.run_sql(
74
- """
75
- CREATE MODEL proj.test_anyscale_invalid_operation_mode
76
- PREDICT answer
77
- USING
78
- engine='anyscale_endpoints_engine',
79
- prompt_template='dummy_prompt_template',
80
- mode='invalid_mode';
81
- """
82
- )
83
- with pytest.raises(Exception):
84
- self.wait_predictor("proj", "test_anyscale_invalid_operation_mode")
85
-
86
- def test_select_runs_no_errors_on_completion_sentiment_analysis_single(self):
87
- """
88
- Test for a valid response to a sentiment analysis task (completion).
89
- """
90
-
91
- self.run_sql(
92
- """
93
- CREATE MODEL proj.test_anyscale_single_sa
94
- PREDICT sentiment
95
- USING
96
- engine='anyscale_endpoints_engine',
97
- model_name = 'mistralai/Mistral-7B-Instruct-v0.1',
98
- prompt_template = 'Classify the sentiment of the following text as one of `positive`, `neutral` or `negative`: {{text}}';
99
- """
100
- )
101
- self.wait_predictor("proj", "test_anyscale_single_sa")
102
-
103
- result_df = self.run_sql(
104
- """
105
- SELECT sentiment
106
- FROM proj.test_anyscale_single_sa
107
- WHERE text = 'I love machine learning!';
108
- """
109
- )
110
-
111
- assert "positive" in result_df["sentiment"].iloc[0].lower()
112
-
113
- @patch("mindsdb.integrations.handlers.postgres_handler.Handler")
114
- def test_select_runs_no_errors_on_completion_sentiment_analysis_bulk(self, mock_postgres_handler):
115
- """
116
- Test for valid reponses to bulk questions in a sentiment analysis task (completion).
117
- """
118
-
119
- df = pd.DataFrame.from_dict({"text": [
120
- "I love machine learning!",
121
- "I hate slow internet connections!"
122
- ]})
123
- self.set_handler(mock_postgres_handler, name="pg", tables={"df": df})
124
-
125
- self.run_sql(
126
- """
127
- CREATE MODEL proj.test_anyscale_bulk_sa
128
- PREDICT sentiment
129
- USING
130
- engine='anyscale_endpoints_engine',
131
- model_name = 'mistralai/Mistral-7B-Instruct-v0.1',
132
- prompt_template = 'Classify the sentiment of the following text as one of `positive`, `neutral` or `negative`: {{text}}';
133
- """
134
- )
135
- self.wait_predictor("proj", "test_anyscale_bulk_sa")
136
-
137
- result_df = self.run_sql(
138
- """
139
- SELECT p.sentiment
140
- FROM pg.df as t
141
- JOIN proj.test_anyscale_bulk_sa as p;
142
- """
143
- )
144
-
145
- assert "positive" in result_df["sentiment"].iloc[0].lower()
146
- assert "negative" in result_df["sentiment"].iloc[1].lower()
147
-
148
- def test_select_runs_no_errors_on_chat_completion_question_answering_single(self):
149
- """
150
- Test for a valid response to a question answering task (chat completion).
151
- """
152
-
153
- self.run_sql(
154
- """
155
- CREATE MODEL proj.test_anyscale_single_qa
156
- PREDICT answer
157
- USING
158
- engine='anyscale_endpoints_engine',
159
- model_name = 'mistralai/Mistral-7B-Instruct-v0.1',
160
- question_column='question';
161
- """
162
- )
163
- self.wait_predictor("proj", "test_anyscale_single_qa")
164
-
165
- result_df = self.run_sql(
166
- """
167
- SELECT answer
168
- FROM proj.test_anyscale_single_qa
169
- WHERE question = 'What is the capital of Sweden?';
170
- """
171
- )
172
-
173
- assert "stockholm" in result_df["answer"].iloc[0].lower()
174
-
175
- @patch("mindsdb.integrations.handlers.postgres_handler.Handler")
176
- def test_select_runs_no_errors_on_chat_completion_question_answering_bulk(self, mock_postgres_handler):
177
- """
178
- Test for valid reponses to bulk questions in a question answering task (chat completion).
179
- """
180
-
181
- df = pd.DataFrame.from_dict({"question": [
182
- "What is the capital of Sweden?",
183
- "What is the second planet in the solar system?"
184
- ]})
185
- self.set_handler(mock_postgres_handler, name="pg", tables={"df": df})
186
-
187
- self.run_sql(
188
- """
189
- CREATE MODEL proj.test_anyscale_bulk_qa
190
- PREDICT answer
191
- USING
192
- engine='anyscale_endpoints_engine',
193
- model_name = 'mistralai/Mistral-7B-Instruct-v0.1',
194
- question_column='question';
195
- """
196
- )
197
- self.wait_predictor("proj", "test_anyscale_bulk_qa")
198
-
199
- result_df = self.run_sql(
200
- """
201
- SELECT p.answer
202
- FROM pg.df as t
203
- JOIN proj.test_anyscale_bulk_qa as p;
204
- """
205
- )
206
-
207
- assert "stockholm" in result_df["answer"].iloc[0].lower()
208
- assert "venus" in result_df["answer"].iloc[1].lower()
209
-
210
-
211
- if __name__ == '__main__':
212
- pytest.main([__file__])