MindsDB 25.7.4.0__py3-none-any.whl → 25.8.3.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 (65) hide show
  1. mindsdb/__about__.py +1 -1
  2. mindsdb/__main__.py +13 -1
  3. mindsdb/api/a2a/agent.py +6 -16
  4. mindsdb/api/a2a/common/types.py +3 -4
  5. mindsdb/api/a2a/task_manager.py +24 -35
  6. mindsdb/api/a2a/utils.py +63 -0
  7. mindsdb/api/executor/command_executor.py +9 -15
  8. mindsdb/api/executor/sql_query/steps/fetch_dataframe.py +21 -24
  9. mindsdb/api/executor/sql_query/steps/fetch_dataframe_partition.py +9 -3
  10. mindsdb/api/executor/sql_query/steps/subselect_step.py +11 -8
  11. mindsdb/api/executor/utilities/mysql_to_duckdb_functions.py +264 -0
  12. mindsdb/api/executor/utilities/sql.py +30 -0
  13. mindsdb/api/http/initialize.py +2 -1
  14. mindsdb/api/http/namespaces/agents.py +6 -7
  15. mindsdb/api/http/namespaces/views.py +56 -72
  16. mindsdb/integrations/handlers/db2_handler/db2_handler.py +19 -23
  17. mindsdb/integrations/handlers/gong_handler/__about__.py +2 -0
  18. mindsdb/integrations/handlers/gong_handler/__init__.py +30 -0
  19. mindsdb/integrations/handlers/gong_handler/connection_args.py +37 -0
  20. mindsdb/integrations/handlers/gong_handler/gong_handler.py +164 -0
  21. mindsdb/integrations/handlers/gong_handler/gong_tables.py +508 -0
  22. mindsdb/integrations/handlers/gong_handler/icon.svg +25 -0
  23. mindsdb/integrations/handlers/gong_handler/test_gong_handler.py +125 -0
  24. mindsdb/integrations/handlers/huggingface_handler/__init__.py +8 -12
  25. mindsdb/integrations/handlers/huggingface_handler/finetune.py +203 -223
  26. mindsdb/integrations/handlers/huggingface_handler/huggingface_handler.py +360 -383
  27. mindsdb/integrations/handlers/huggingface_handler/requirements.txt +7 -7
  28. mindsdb/integrations/handlers/huggingface_handler/requirements_cpu.txt +7 -7
  29. mindsdb/integrations/handlers/huggingface_handler/settings.py +25 -25
  30. mindsdb/integrations/handlers/langchain_handler/langchain_handler.py +1 -2
  31. mindsdb/integrations/handlers/openai_handler/constants.py +11 -30
  32. mindsdb/integrations/handlers/openai_handler/helpers.py +27 -34
  33. mindsdb/integrations/handlers/openai_handler/openai_handler.py +14 -12
  34. mindsdb/integrations/handlers/salesforce_handler/constants.py +9 -2
  35. mindsdb/integrations/libs/llm/config.py +0 -14
  36. mindsdb/integrations/libs/llm/utils.py +0 -15
  37. mindsdb/integrations/utilities/files/file_reader.py +5 -19
  38. mindsdb/integrations/utilities/rag/rerankers/base_reranker.py +1 -1
  39. mindsdb/interfaces/agents/agents_controller.py +83 -45
  40. mindsdb/interfaces/agents/constants.py +16 -3
  41. mindsdb/interfaces/agents/langchain_agent.py +84 -21
  42. mindsdb/interfaces/database/projects.py +111 -7
  43. mindsdb/interfaces/knowledge_base/controller.py +7 -1
  44. mindsdb/interfaces/knowledge_base/preprocessing/document_preprocessor.py +6 -10
  45. mindsdb/interfaces/knowledge_base/preprocessing/text_splitter.py +73 -0
  46. mindsdb/interfaces/query_context/context_controller.py +14 -15
  47. mindsdb/interfaces/skills/custom/text2sql/mindsdb_sql_toolkit.py +7 -1
  48. mindsdb/interfaces/skills/skill_tool.py +7 -1
  49. mindsdb/interfaces/skills/sql_agent.py +6 -2
  50. mindsdb/utilities/config.py +2 -0
  51. mindsdb/utilities/fs.py +60 -17
  52. {mindsdb-25.7.4.0.dist-info → mindsdb-25.8.3.0.dist-info}/METADATA +277 -262
  53. {mindsdb-25.7.4.0.dist-info → mindsdb-25.8.3.0.dist-info}/RECORD +57 -56
  54. mindsdb/integrations/handlers/anyscale_endpoints_handler/__about__.py +0 -9
  55. mindsdb/integrations/handlers/anyscale_endpoints_handler/__init__.py +0 -20
  56. mindsdb/integrations/handlers/anyscale_endpoints_handler/anyscale_endpoints_handler.py +0 -290
  57. mindsdb/integrations/handlers/anyscale_endpoints_handler/creation_args.py +0 -14
  58. mindsdb/integrations/handlers/anyscale_endpoints_handler/icon.svg +0 -4
  59. mindsdb/integrations/handlers/anyscale_endpoints_handler/requirements.txt +0 -2
  60. mindsdb/integrations/handlers/anyscale_endpoints_handler/settings.py +0 -51
  61. mindsdb/integrations/handlers/anyscale_endpoints_handler/tests/test_anyscale_endpoints_handler.py +0 -212
  62. /mindsdb/integrations/handlers/{anyscale_endpoints_handler/tests/__init__.py → gong_handler/requirements.txt} +0 -0
  63. {mindsdb-25.7.4.0.dist-info → mindsdb-25.8.3.0.dist-info}/WHEEL +0 -0
  64. {mindsdb-25.7.4.0.dist-info → mindsdb-25.8.3.0.dist-info}/licenses/LICENSE +0 -0
  65. {mindsdb-25.7.4.0.dist-info → mindsdb-25.8.3.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,37 @@
1
+ from collections import OrderedDict
2
+
3
+ from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE as ARG_TYPE
4
+
5
+
6
+ connection_args = OrderedDict(
7
+ api_key={
8
+ "type": ARG_TYPE.PWD,
9
+ "description": "Gong API key for authentication.",
10
+ "secret": True,
11
+ "required": False,
12
+ "label": "API Key",
13
+ },
14
+ # Basic Authentication with Access Key + Secret Key (Option 2)
15
+ access_key={
16
+ "type": ARG_TYPE.STR,
17
+ "description": "Gong Access Key for basic authentication (if not using OAuth).",
18
+ "secret": True,
19
+ "required": False,
20
+ "label": "Access Key",
21
+ },
22
+ secret_key={
23
+ "type": ARG_TYPE.PWD,
24
+ "description": "Gong Secret Key for basic authentication (if not using OAuth).",
25
+ "secret": True,
26
+ "required": False,
27
+ "label": "Secret Key",
28
+ },
29
+ base_url={
30
+ "type": ARG_TYPE.STR,
31
+ "description": "Gong API base URL (optional, defaults to production).",
32
+ "required": False,
33
+ "label": "Base URL",
34
+ },
35
+ )
36
+
37
+ connection_args_example = OrderedDict(api_key="your_gong_api_key_here", base_url="https://api.gong.io")
@@ -0,0 +1,164 @@
1
+ import requests
2
+ from typing import Any, Dict
3
+
4
+ from mindsdb_sql_parser import parse_sql
5
+
6
+ from mindsdb.integrations.handlers.gong_handler.gong_tables import (
7
+ GongCallsTable,
8
+ GongUsersTable,
9
+ GongAnalyticsTable,
10
+ GongTranscriptsTable,
11
+ )
12
+ from mindsdb.integrations.libs.api_handler import APIHandler
13
+ from mindsdb.integrations.libs.response import (
14
+ HandlerResponse as Response,
15
+ HandlerStatusResponse as StatusResponse,
16
+ RESPONSE_TYPE,
17
+ )
18
+ from mindsdb.utilities import log
19
+
20
+
21
+ logger = log.getLogger(__name__)
22
+
23
+
24
+ class GongHandler(APIHandler):
25
+ """
26
+ This handler handles the connection and execution of SQL statements on Gong.
27
+ """
28
+
29
+ name = "gong"
30
+
31
+ def __init__(self, name: str, connection_data: Dict, **kwargs: Any) -> None:
32
+ """
33
+ Initializes the handler.
34
+
35
+ Args:
36
+ name (Text): The name of the handler instance.
37
+ connection_data (Dict): The connection data required to connect to the Gong API.
38
+ kwargs: Arbitrary keyword arguments.
39
+ """
40
+ super().__init__(name)
41
+ self.connection_data = connection_data
42
+ self.kwargs = kwargs
43
+
44
+ self.connection = None
45
+ self.is_connected = False
46
+ self.base_url = connection_data.get("base_url", "https://api.gong.io")
47
+
48
+ # Support both bearer token and access key + secret key
49
+ self.bearer_token = connection_data.get("api_key")
50
+ self.access_key = connection_data.get("access_key")
51
+ self.secret_key = connection_data.get("secret_key")
52
+
53
+ # Register core tables
54
+ self._register_table("calls", GongCallsTable(self))
55
+ self._register_table("users", GongUsersTable(self))
56
+ self._register_table("analytics", GongAnalyticsTable(self))
57
+ self._register_table("transcripts", GongTranscriptsTable(self))
58
+
59
+ def connect(self) -> requests.Session:
60
+ """
61
+ Establishes a connection to the Gong API.
62
+
63
+ Raises:
64
+ ValueError: If the required connection parameters are not provided.
65
+ Exception: If a connection error occurs.
66
+
67
+ Returns:
68
+ requests.Session: A session object for making API requests.
69
+ """
70
+ if self.is_connected is True:
71
+ return self.connection
72
+
73
+ if self.access_key and self.secret_key:
74
+ auth_method = "basic"
75
+ elif self.bearer_token:
76
+ auth_method = "bearer"
77
+ else:
78
+ raise ValueError("Either bearer_token or (access_key + secret_key) is required to connect to Gong API.")
79
+
80
+ try:
81
+ self.connection = requests.Session()
82
+
83
+ if auth_method == "basic":
84
+ # Basic authentication with access key + secret key
85
+ self.connection.auth = (self.access_key, self.secret_key)
86
+ self.connection.headers.update({"Content-Type": "application/json", "Accept": "application/json"})
87
+ else:
88
+ # Bearer token authentication
89
+ self.connection.headers.update(
90
+ {
91
+ "Authorization": f"Bearer {self.bearer_token}",
92
+ "Content-Type": "application/json",
93
+ "Accept": "application/json",
94
+ }
95
+ )
96
+
97
+ test_response = self.connection.get(f"{self.base_url}/v2/users")
98
+ test_response.raise_for_status()
99
+
100
+ self.is_connected = True
101
+ return self.connection
102
+
103
+ except Exception as e:
104
+ self.is_connected = False
105
+ logger.error(f"Error connecting to Gong API: {e}")
106
+ raise
107
+
108
+ def check_connection(self) -> StatusResponse:
109
+ """
110
+ Checks the status of the connection to the Gong API.
111
+
112
+ Returns:
113
+ StatusResponse: An object containing the success status and an error message if an error occurs.
114
+ """
115
+ response = StatusResponse(False)
116
+
117
+ try:
118
+ self.connect()
119
+ # Test the connection by making a simple API call
120
+ test_response = self.connection.get(f"{self.base_url}/v2/users")
121
+ test_response.raise_for_status()
122
+ response.success = True
123
+ except Exception as e:
124
+ logger.error(f"Connection check to Gong failed: {e}")
125
+ response.error_message = str(e)
126
+
127
+ self.is_connected = response.success
128
+ return response
129
+
130
+ def native_query(self, query: str) -> Response:
131
+ """
132
+ Executes a native query on Gong and returns the result.
133
+
134
+ Args:
135
+ query (Text): The SQL query to be executed.
136
+
137
+ Returns:
138
+ Response: A response object containing the result of the query or an error message.
139
+ """
140
+ try:
141
+ ast = parse_sql(query)
142
+ return self.query(ast)
143
+ except Exception as e:
144
+ logger.error(f"Error running query: {query} on Gong: {e}")
145
+ return Response(RESPONSE_TYPE.ERROR, error_code=0, error_message=str(e))
146
+
147
+ def call_gong_api(self, endpoint: str, params: Dict = None) -> Dict:
148
+ """
149
+ Makes a call to the Gong API.
150
+
151
+ Args:
152
+ endpoint (str): The API endpoint to call.
153
+ params (Dict): Query parameters for the API call.
154
+
155
+ Returns:
156
+ Dict: The API response.
157
+ """
158
+ if not self.is_connected:
159
+ self.connect()
160
+
161
+ url = f"{self.base_url}{endpoint}"
162
+ response = self.connection.get(url, params=params)
163
+ response.raise_for_status()
164
+ return response.json()