MindsDB 25.1.2.1__py3-none-any.whl → 25.1.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.
- {MindsDB-25.1.2.1.dist-info → MindsDB-25.1.3.0.dist-info}/METADATA +251 -250
- {MindsDB-25.1.2.1.dist-info → MindsDB-25.1.3.0.dist-info}/RECORD +33 -27
- mindsdb/__about__.py +1 -1
- mindsdb/__main__.py +5 -3
- mindsdb/api/executor/sql_query/result_set.py +36 -21
- mindsdb/api/executor/sql_query/steps/apply_predictor_step.py +1 -1
- mindsdb/api/executor/sql_query/steps/join_step.py +4 -4
- mindsdb/api/executor/utilities/sql.py +2 -10
- mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +7 -0
- mindsdb/integrations/handlers/file_handler/file_handler.py +1 -1
- mindsdb/integrations/handlers/langchain_embedding_handler/fastapi_embeddings.py +82 -0
- mindsdb/integrations/handlers/langchain_embedding_handler/langchain_embedding_handler.py +8 -1
- mindsdb/integrations/handlers/pgvector_handler/pgvector_handler.py +48 -16
- mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +3 -3
- mindsdb/integrations/utilities/rag/loaders/vector_store_loader/pgvector.py +76 -27
- mindsdb/integrations/utilities/rag/loaders/vector_store_loader/vector_store_loader.py +18 -1
- mindsdb/integrations/utilities/rag/retrievers/sql_retriever.py +6 -2
- mindsdb/integrations/utilities/rag/settings.py +2 -0
- mindsdb/integrations/utilities/sql_utils.py +1 -1
- mindsdb/interfaces/knowledge_base/controller.py +33 -14
- mindsdb/interfaces/skills/retrieval_tool.py +10 -3
- mindsdb/utilities/cache.py +7 -4
- mindsdb/utilities/context.py +9 -0
- mindsdb/utilities/log.py +20 -2
- mindsdb/utilities/otel/__init__.py +206 -0
- mindsdb/utilities/otel/logger.py +25 -0
- mindsdb/utilities/otel/meter.py +19 -0
- mindsdb/utilities/otel/metric_handlers/__init__.py +25 -0
- mindsdb/utilities/otel/tracer.py +16 -0
- mindsdb/utilities/utils.py +34 -0
- mindsdb/utilities/otel.py +0 -72
- {MindsDB-25.1.2.1.dist-info → MindsDB-25.1.3.0.dist-info}/LICENSE +0 -0
- {MindsDB-25.1.2.1.dist-info → MindsDB-25.1.3.0.dist-info}/WHEEL +0 -0
- {MindsDB-25.1.2.1.dist-info → MindsDB-25.1.3.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
mindsdb/__about__.py,sha256=
|
|
1
|
+
mindsdb/__about__.py,sha256=LNDd_zVIOeNxjsjc42uW7ErlnlNW4gUsg3uFkfEluNc,444
|
|
2
2
|
mindsdb/__init__.py,sha256=fZopLiAYa9MzMZ0d48JgHc_LddfFKDzh7n_8icsjrVs,54
|
|
3
|
-
mindsdb/__main__.py,sha256=
|
|
3
|
+
mindsdb/__main__.py,sha256=VQ3RetGs34NhFRT9d76o5S3UpKxdr-G3c0138kz3f8Y,21435
|
|
4
4
|
mindsdb/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
mindsdb/api/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
mindsdb/api/common/check_auth.py,sha256=cQEZqsnCbrRtUf8j4H6uPF98cDPu79t8TdtwBi5g30w,1345
|
|
@@ -34,15 +34,15 @@ mindsdb/api/executor/planner/steps.py,sha256=kB7FtJiUjiuDYk8a3qw_-EK4VKqcRZSr-ud
|
|
|
34
34
|
mindsdb/api/executor/planner/ts_utils.py,sha256=_vujPqWH-Y3gVffv6ND1H2b_j99CBvIgQBxZUvZ7Sic,3871
|
|
35
35
|
mindsdb/api/executor/planner/utils.py,sha256=pCec75lLc5V84LYMheprYxT7RGeJPKiNZrqA_bYmco0,3838
|
|
36
36
|
mindsdb/api/executor/sql_query/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
|
-
mindsdb/api/executor/sql_query/result_set.py,sha256=
|
|
37
|
+
mindsdb/api/executor/sql_query/result_set.py,sha256=tYU0q47RGCxwCIloPn_gxz0O3cBe6ShPQWreWT2rKUE,9629
|
|
38
38
|
mindsdb/api/executor/sql_query/sql_query.py,sha256=6S_PTYYsi9T4I6EvL8X5VvD8sbogSKsuxCQt9gYgGgc,11064
|
|
39
39
|
mindsdb/api/executor/sql_query/steps/__init__.py,sha256=73K_wevliekB1qX5g6RW_TN6wKqXneBVkk52m3Ualvk,728
|
|
40
|
-
mindsdb/api/executor/sql_query/steps/apply_predictor_step.py,sha256=
|
|
40
|
+
mindsdb/api/executor/sql_query/steps/apply_predictor_step.py,sha256=Qm_kVTg0fwXWIy26Atmie_bGNa0wQQ7mVengN6Zly2A,16305
|
|
41
41
|
mindsdb/api/executor/sql_query/steps/base.py,sha256=xs3wOJ0fkqMRDNR5jDVaz23zeaD8wSF0L-JVC2WW7_E,557
|
|
42
42
|
mindsdb/api/executor/sql_query/steps/delete_step.py,sha256=YsHVlszYDV2-kxCcMnaGUyf-m7clrFzw0h0o4ZCvZAU,1324
|
|
43
43
|
mindsdb/api/executor/sql_query/steps/fetch_dataframe.py,sha256=3ciEmtczfTHDFhRwi1sgAwqt5Scl_QQxYeIrVlbfvv0,3643
|
|
44
44
|
mindsdb/api/executor/sql_query/steps/insert_step.py,sha256=xjVSFzopHVW85sq5p5WVp4hcwkS3qdN8Ygc50jMjFJ0,3738
|
|
45
|
-
mindsdb/api/executor/sql_query/steps/join_step.py,sha256=
|
|
45
|
+
mindsdb/api/executor/sql_query/steps/join_step.py,sha256=8wW7AmIMhMinpMovSgl-2CGujV3mDX5kTFLxuI1KZfQ,4261
|
|
46
46
|
mindsdb/api/executor/sql_query/steps/map_reduce_step.py,sha256=44X1vwnPbXYQ4cQa-PS8mCQH7VgnW0v_NpG5B_wcNb4,5447
|
|
47
47
|
mindsdb/api/executor/sql_query/steps/multiple_step.py,sha256=jAwY8rGUOdecQNP5JSjjHmPpNLMVPX4adAU-PoHJBuY,656
|
|
48
48
|
mindsdb/api/executor/sql_query/steps/prepare_steps.py,sha256=QATZ17UHZe5h41jqJP0yicXMsr1B7ak4p7CLHogFbAA,1538
|
|
@@ -53,7 +53,7 @@ mindsdb/api/executor/sql_query/steps/union_step.py,sha256=BTVFZz28sGPgbwDOb7pUQx
|
|
|
53
53
|
mindsdb/api/executor/sql_query/steps/update_step.py,sha256=0MeUNsgVsK4pm2VrwM2ZrRua2JFvUHGhvzwzXRc8I1o,4563
|
|
54
54
|
mindsdb/api/executor/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
55
|
mindsdb/api/executor/utilities/functions.py,sha256=xUrrh2zgsP0cYNUAUDGWUXyam693NTL9nlByUAwx7nw,995
|
|
56
|
-
mindsdb/api/executor/utilities/sql.py,sha256=
|
|
56
|
+
mindsdb/api/executor/utilities/sql.py,sha256=vULbEMKN3ZB5RULqC_VPRhuROQ0_CotHYqA32Z2gKAg,6280
|
|
57
57
|
mindsdb/api/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
58
|
mindsdb/api/http/gui.py,sha256=V1_SYzBvEbRfpwSaNdxdlU2ylS-OhJ8IK6p6pcHNJXo,3087
|
|
59
59
|
mindsdb/api/http/gunicorn_wrapper.py,sha256=U11cza-mn71RcLcJZOYwo2Aee3fRIhAYQxby_FF6_Yc,534
|
|
@@ -148,7 +148,7 @@ mindsdb/api/mongo/utilities/mongodb_query.py,sha256=t6GIriKEGXH0mpaux71kCuVwYVaD
|
|
|
148
148
|
mindsdb/api/mysql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
149
149
|
mindsdb/api/mysql/start.py,sha256=gxW_29ozucMWxuBlGZHmT4f5WS24YogR4UL93Q0MMAk,377
|
|
150
150
|
mindsdb/api/mysql/mysql_proxy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
151
|
-
mindsdb/api/mysql/mysql_proxy/mysql_proxy.py,sha256
|
|
151
|
+
mindsdb/api/mysql/mysql_proxy/mysql_proxy.py,sha256=-xRKCBiGoP32IsYK6aEJss_uVn_c9wJF8SZlfPYi6XU,35283
|
|
152
152
|
mindsdb/api/mysql/mysql_proxy/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
153
153
|
mindsdb/api/mysql/mysql_proxy/classes/client_capabilities.py,sha256=cUdIojE7yC8dGdaJtULSzZjkzlkJoP1CrKomwpFn0nI,3358
|
|
154
154
|
mindsdb/api/mysql/mysql_proxy/classes/server_capabilities.py,sha256=oW1oARAZRSIv20Pkfy6nCTB0w69a6-ajVdo9APHohKg,586
|
|
@@ -607,7 +607,7 @@ mindsdb/integrations/handlers/faunadb_handler/tests/__init__.py,sha256=47DEQpj8H
|
|
|
607
607
|
mindsdb/integrations/handlers/faunadb_handler/tests/test_faunadb_handler.py,sha256=JrgVIq6jucZjUCr8FpbC9ByJ3WdZGppZKHdovvFbNiw,1151
|
|
608
608
|
mindsdb/integrations/handlers/file_handler/__about__.py,sha256=UavP5jJ_xWIaJ0oRsEANLulczZ0craaUb3XLfCSBmEc,331
|
|
609
609
|
mindsdb/integrations/handlers/file_handler/__init__.py,sha256=46Hnm3ijRsYw95BkkBxHJK8k4h_2Te0j1W0r3-ptVCg,329
|
|
610
|
-
mindsdb/integrations/handlers/file_handler/file_handler.py,sha256=
|
|
610
|
+
mindsdb/integrations/handlers/file_handler/file_handler.py,sha256=eL4wugROFNBK7qcOvELrcx7cCBtkibZ-StQZCSBIn14,18363
|
|
611
611
|
mindsdb/integrations/handlers/file_handler/icon.svg,sha256=hsXEvUzrO7WQMOPC83LYQt-FW0wey9TCj5EwiIJwKwk,565
|
|
612
612
|
mindsdb/integrations/handlers/file_handler/requirements.txt,sha256=0a-9n_mDJfSsmbTIL94YxHTIFm2oybXwTap6-oSNg_U,119
|
|
613
613
|
mindsdb/integrations/handlers/file_handler/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -855,8 +855,9 @@ mindsdb/integrations/handlers/lancedb_handler/tests/__init__.py,sha256=47DEQpj8H
|
|
|
855
855
|
mindsdb/integrations/handlers/lancedb_handler/tests/test_lancedb_handler.py,sha256=dHFnAMplZCfXk0DwpDM1gKIsG42vEypx9-51nRoCQZc,3351
|
|
856
856
|
mindsdb/integrations/handlers/langchain_embedding_handler/__about__.py,sha256=CqrMPm5gho1vYeXuFNSisjwl32JpHR3IoKv3xw_7fx8,388
|
|
857
857
|
mindsdb/integrations/handlers/langchain_embedding_handler/__init__.py,sha256=7PKWnAB9pBcfxF2SjM3wLmyEq787zj0ZPvSaZD8zoR8,627
|
|
858
|
+
mindsdb/integrations/handlers/langchain_embedding_handler/fastapi_embeddings.py,sha256=h8feiZrRboFcaBGkv5VYdJRHdVeBUCZ6hz0hC_bNqf0,2479
|
|
858
859
|
mindsdb/integrations/handlers/langchain_embedding_handler/icon.svg,sha256=dMV03a2BDQvZTwxDAxRmd-GzmCCVXyYvJqTwdZb5Hbw,73222
|
|
859
|
-
mindsdb/integrations/handlers/langchain_embedding_handler/langchain_embedding_handler.py,sha256=
|
|
860
|
+
mindsdb/integrations/handlers/langchain_embedding_handler/langchain_embedding_handler.py,sha256=GrXTyvb-nLSsfI6V2yblQWSgRgkbTXiWtmfWJYYordw,8277
|
|
860
861
|
mindsdb/integrations/handlers/langchain_embedding_handler/requirements.txt,sha256=C_GVvAYnKB13ILpKZcGHSuNg8km5qIB4gbEUaD4Ifz0,24
|
|
861
862
|
mindsdb/integrations/handlers/langchain_embedding_handler/vllm_embeddings.py,sha256=gxrwh_0d2FiOqAo4xmr-7KGLTFuSuBxLH0gfvmHPVIg,3734
|
|
862
863
|
mindsdb/integrations/handlers/langchain_handler/__about__.py,sha256=rBZQP0fyIkObedPPwbyNl9tB0ygJN6qj0aPwPYI_fqc,345
|
|
@@ -1170,7 +1171,7 @@ mindsdb/integrations/handlers/pgvector_handler/__about__.py,sha256=f7NEmnT5v8Bhc
|
|
|
1170
1171
|
mindsdb/integrations/handlers/pgvector_handler/__init__.py,sha256=291L7daFcaNnMUEcIjs7-U-jgOTJzEvIm2FoO43S_6Q,659
|
|
1171
1172
|
mindsdb/integrations/handlers/pgvector_handler/connection_args.py,sha256=etSu8X9uvYcdG0UZP7N8NdKCywmpcMf19ZPtthZArMg,1688
|
|
1172
1173
|
mindsdb/integrations/handlers/pgvector_handler/icon.svg,sha256=BPrdgXF1gRp2IBmklyYNRpdGtbi1F6Ca78V_L4ji_LE,13760
|
|
1173
|
-
mindsdb/integrations/handlers/pgvector_handler/pgvector_handler.py,sha256=
|
|
1174
|
+
mindsdb/integrations/handlers/pgvector_handler/pgvector_handler.py,sha256=9t0XTkE2c9eKiGhFh0wh0spYn8wSMLo5U2o8_0C85Qg,19292
|
|
1174
1175
|
mindsdb/integrations/handlers/pgvector_handler/requirements.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1175
1176
|
mindsdb/integrations/handlers/phoenix_handler/__about__.py,sha256=PGGn5y0Y7tn2FnY2Ru1N7yjr6KZb8IhfUoKFc7GZO9I,359
|
|
1176
1177
|
mindsdb/integrations/handlers/phoenix_handler/__init__.py,sha256=dguuDcpGTUdL7KHbLPv3OLY9fmvJrQj5I_CsfmuQdKk,606
|
|
@@ -1227,7 +1228,7 @@ mindsdb/integrations/handlers/postgres_handler/__about__.py,sha256=5W3AHCv0BuvCa
|
|
|
1227
1228
|
mindsdb/integrations/handlers/postgres_handler/__init__.py,sha256=tszm8ZCcNkHKoPDIB99A4A40dvj-Yk8PY8p35irS0tQ,606
|
|
1228
1229
|
mindsdb/integrations/handlers/postgres_handler/connection_args.py,sha256=Td7_Pj2HJYVi3-yzBe-BpFfl1zAZvtDZaYh77PfdhE8,1911
|
|
1229
1230
|
mindsdb/integrations/handlers/postgres_handler/icon.svg,sha256=pDl9ZZL9cGcrcGVglWMX1L1IncVv5di1b1tly1dfia4,13757
|
|
1230
|
-
mindsdb/integrations/handlers/postgres_handler/postgres_handler.py,sha256=
|
|
1231
|
+
mindsdb/integrations/handlers/postgres_handler/postgres_handler.py,sha256=F75dO09OZgIpv3G5owb5e--ceissM3VjMJIQdp7pRYU,13586
|
|
1231
1232
|
mindsdb/integrations/handlers/postgres_handler/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1232
1233
|
mindsdb/integrations/handlers/postgres_handler/tests/test_postgres_handler.py,sha256=IwUYXO3aVCsIunHl5cPsf1nndZj3W-wkp5naH_vPb9Q,5825
|
|
1233
1234
|
mindsdb/integrations/handlers/pycaret_handler/__about__.py,sha256=Cbt3qxt8SiIhU2_cgCwQxNjrB-alortHg4VqGFY0VlQ,340
|
|
@@ -1704,7 +1705,7 @@ mindsdb/integrations/utilities/date_utils.py,sha256=TqCyde_jbknQnrJqYIkNwEHUg-ds
|
|
|
1704
1705
|
mindsdb/integrations/utilities/handler_utils.py,sha256=UEgEckWFDZXLcu5AbBFrqPJuFFXgejDmDRkr6622CPc,2272
|
|
1705
1706
|
mindsdb/integrations/utilities/install.py,sha256=wbg0pcIn8C8PEfjA45DmwueEZ5nX27t2YsLe1xXhC7s,5018
|
|
1706
1707
|
mindsdb/integrations/utilities/query_traversal.py,sha256=oUSsBCwDcMBr-vaUYH5I8koMPDpJDXe0ByxPD0EIG0g,9292
|
|
1707
|
-
mindsdb/integrations/utilities/sql_utils.py,sha256=
|
|
1708
|
+
mindsdb/integrations/utilities/sql_utils.py,sha256=WHlXN3Zjn8kS-sh_jqv1Q6abM-8YocS4WCWzpcIqlhY,6713
|
|
1708
1709
|
mindsdb/integrations/utilities/test_utils.py,sha256=eplCMcVjOsrXRhIhAUhgOPIt2zNiyUV67BYnJ2lvPiE,691
|
|
1709
1710
|
mindsdb/integrations/utilities/time_series_utils.py,sha256=qWVqZaXW7gdVM3jJ6WWYt1VP4WoFmaKt7jhNU6OpMvE,8312
|
|
1710
1711
|
mindsdb/integrations/utilities/utils.py,sha256=TuIgAbuZVkCRUSgLmqJ2STZ1CxVgBGrEnajW68SsKg0,972
|
|
@@ -1735,7 +1736,7 @@ mindsdb/integrations/utilities/handlers/validation_utilities/parameter_validatio
|
|
|
1735
1736
|
mindsdb/integrations/utilities/rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1736
1737
|
mindsdb/integrations/utilities/rag/config_loader.py,sha256=3m_hdTugNxbTevU79AMNzK-tjObpj5JBvpGMBZB0Iuw,3573
|
|
1737
1738
|
mindsdb/integrations/utilities/rag/rag_pipeline_builder.py,sha256=0RhyafFoQPl1aniRYcOu57aljfqKqj_p0cNb_bfOrc8,3742
|
|
1738
|
-
mindsdb/integrations/utilities/rag/settings.py,sha256=
|
|
1739
|
+
mindsdb/integrations/utilities/rag/settings.py,sha256=kz6oJpvEnl51ikQULj7PGB_tKZJR2n4fk8krAHEpC58,23397
|
|
1739
1740
|
mindsdb/integrations/utilities/rag/utils.py,sha256=AAMW1gybfAntUkAPb9AYUeWZUMtZAwWaYiLJcTHNB4A,1620
|
|
1740
1741
|
mindsdb/integrations/utilities/rag/vector_store.py,sha256=EwCdCf0dXwJXKOYfqTUPWEDOPLumWl2EKQiiXzgy8XA,3782
|
|
1741
1742
|
mindsdb/integrations/utilities/rag/chains/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -1744,8 +1745,8 @@ mindsdb/integrations/utilities/rag/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW
|
|
|
1744
1745
|
mindsdb/integrations/utilities/rag/loaders/file_loader.py,sha256=CZWcr1F2LHmiKxrQwqPModAlHCgJ4F9OLuVpaf14DR8,1868
|
|
1745
1746
|
mindsdb/integrations/utilities/rag/loaders/vector_store_loader/MDBVectorStore.py,sha256=TgLU4hFPc-eKJPuN8Gn9UnwqXWF_EhCUGTZNMEP-_vQ,1476
|
|
1746
1747
|
mindsdb/integrations/utilities/rag/loaders/vector_store_loader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1747
|
-
mindsdb/integrations/utilities/rag/loaders/vector_store_loader/pgvector.py,sha256=
|
|
1748
|
-
mindsdb/integrations/utilities/rag/loaders/vector_store_loader/vector_store_loader.py,sha256=
|
|
1748
|
+
mindsdb/integrations/utilities/rag/loaders/vector_store_loader/pgvector.py,sha256=1ZG2zu6wmn1xdsQT9lyCeFZjJmLTOyr7iAB8M9ZgtYM,5014
|
|
1749
|
+
mindsdb/integrations/utilities/rag/loaders/vector_store_loader/vector_store_loader.py,sha256=TaJkfrsajapchnP5ED0WMCP85ptbvN2d8y3UMdjMjDc,3188
|
|
1749
1750
|
mindsdb/integrations/utilities/rag/pipelines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1750
1751
|
mindsdb/integrations/utilities/rag/pipelines/rag.py,sha256=BFCj361hjfYd7UsxeLsZo0jADdYmNIoviHyeCaR50po,12343
|
|
1751
1752
|
mindsdb/integrations/utilities/rag/rerankers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -1756,7 +1757,7 @@ mindsdb/integrations/utilities/rag/retrievers/base.py,sha256=fomZCUibDLKg-g4_uoT
|
|
|
1756
1757
|
mindsdb/integrations/utilities/rag/retrievers/multi_hop_retriever.py,sha256=wC2M3Vsgzs5Nu6uEuD4YQZZU9W8eW_bc7RrrqvN38mk,3319
|
|
1757
1758
|
mindsdb/integrations/utilities/rag/retrievers/multi_vector_retriever.py,sha256=D9QzIRZWQ6LrT892twdgJj287_BlVEmXRQLYQegQuVA,4383
|
|
1758
1759
|
mindsdb/integrations/utilities/rag/retrievers/retriever_factory.py,sha256=knmGLJNEG8x4KFhUYQiCIpghR5yEEeu_tonSUMUqXAQ,2205
|
|
1759
|
-
mindsdb/integrations/utilities/rag/retrievers/sql_retriever.py,sha256=
|
|
1760
|
+
mindsdb/integrations/utilities/rag/retrievers/sql_retriever.py,sha256=QVMeyLaTk4Vx9FSiBtoHwp2V0Mothciw5_NeXXSecJ8,8805
|
|
1760
1761
|
mindsdb/integrations/utilities/rag/splitters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1761
1762
|
mindsdb/integrations/utilities/rag/splitters/file_splitter.py,sha256=O14E_27omTti4jsxhgTiwHtlR2LdCa9D2DiEgc7yKmc,5260
|
|
1762
1763
|
mindsdb/interfaces/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
@@ -1791,7 +1792,7 @@ mindsdb/interfaces/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
1791
1792
|
mindsdb/interfaces/jobs/jobs_controller.py,sha256=xBleXIpGLZ_Sg3j5e7BeTRV-Hp6ELMuFuQwtVZyQ72s,18247
|
|
1792
1793
|
mindsdb/interfaces/jobs/scheduler.py,sha256=m_C-QiTExljq0ilpe4vQiQv56AIWsrtfcdo0krMYQes,3664
|
|
1793
1794
|
mindsdb/interfaces/knowledge_base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1794
|
-
mindsdb/interfaces/knowledge_base/controller.py,sha256=
|
|
1795
|
+
mindsdb/interfaces/knowledge_base/controller.py,sha256=D2A__yrbocaEhOxhYjTTGzmyEo7eOrk-CYGPWVyg66w,35421
|
|
1795
1796
|
mindsdb/interfaces/knowledge_base/preprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1796
1797
|
mindsdb/interfaces/knowledge_base/preprocessing/constants.py,sha256=0sLB2GOQhh3d46WNcVPF0iTmJc01CIXJoPT99XktuMo,295
|
|
1797
1798
|
mindsdb/interfaces/knowledge_base/preprocessing/document_loader.py,sha256=Ry0KG8F6kNPAnaoKRqsGX1Oq_ukt6ZmI8fYgj_0RnvU,6342
|
|
@@ -1804,7 +1805,7 @@ mindsdb/interfaces/query_context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
|
1804
1805
|
mindsdb/interfaces/query_context/context_controller.py,sha256=YAmdcSFEzd3aOr4nRF7TX6UfAXH9kMK1qk7bpVtvhpY,9486
|
|
1805
1806
|
mindsdb/interfaces/query_context/last_query.py,sha256=LbZwvPtDYJFVBRonJr6RgGZyCbCNGcJJdhS22pW_YE0,9331
|
|
1806
1807
|
mindsdb/interfaces/skills/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
1807
|
-
mindsdb/interfaces/skills/retrieval_tool.py,sha256=
|
|
1808
|
+
mindsdb/interfaces/skills/retrieval_tool.py,sha256=zuEEPky--GdKHa1rqd4VhM2wgtlGas5G72eFbooj-Hg,4480
|
|
1808
1809
|
mindsdb/interfaces/skills/skill_tool.py,sha256=8nnemMDUuq93UxJFR9gT3RPHcp2gsx98NvxQ23fx0k0,10092
|
|
1809
1810
|
mindsdb/interfaces/skills/skills_controller.py,sha256=6UagDyYf-xDjnanIJzoOcPAIuBi7g9O6DKE0YaKW61g,5783
|
|
1810
1811
|
mindsdb/interfaces/skills/sql_agent.py,sha256=lP433_P6YrlwDdKeX8ACeRzA20KfcdT47oIGxHDg-rQ,9901
|
|
@@ -1888,22 +1889,22 @@ mindsdb/migrations/versions/2024-11-29_f6dc924079fa_predictor_training_metadata.
|
|
|
1888
1889
|
mindsdb/migrations/versions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1889
1890
|
mindsdb/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1890
1891
|
mindsdb/utilities/auth.py,sha256=6ycLJgXySghgFdzK6emxdStElzt5aOPafjDCRR_g_q0,2336
|
|
1891
|
-
mindsdb/utilities/cache.py,sha256=
|
|
1892
|
+
mindsdb/utilities/cache.py,sha256=6VV5BJ0EWPYK2h80KEM1ETMhw_OCgDKyU6Pejvj1s3E,7431
|
|
1892
1893
|
mindsdb/utilities/config.py,sha256=ezGcUAy2D9NiRd1mpLbZ2JyN5JSwAp7HR9Gm9MyZJ6I,20688
|
|
1893
|
-
mindsdb/utilities/context.py,sha256=
|
|
1894
|
+
mindsdb/utilities/context.py,sha256=2M6ErZR722EIZIij96f4XlEO0P5n1omA6uBe2soM7Ak,1778
|
|
1894
1895
|
mindsdb/utilities/context_executor.py,sha256=6ByyeulMePEfRrGxR9vlKYF87R8z1wHFwc1GdfhlGCk,1946
|
|
1895
1896
|
mindsdb/utilities/exception.py,sha256=q-9cwMLmQvuPpwdjRG0xNZ23z9cxHSfyT2295Rk6waA,1034
|
|
1896
1897
|
mindsdb/utilities/fs.py,sha256=1ezB-EkY-qhIBBC_qRUAn79D0CbxCyVDfEdrY2pp1JA,4657
|
|
1897
1898
|
mindsdb/utilities/functions.py,sha256=CQ87uYz7elOeklHbl7vQdK6QPKpTLGWHAOEKW-lKq5Q,6398
|
|
1898
1899
|
mindsdb/utilities/json_encoder.py,sha256=-nWynBlL7AwRyrM8gkiXPvPzk97EBJawryCA-ZO_7-A,1094
|
|
1899
|
-
mindsdb/utilities/log.py,sha256=
|
|
1900
|
+
mindsdb/utilities/log.py,sha256=cqWnFDM3qBbsMKTpIXKjA7q1jTZDMkrk4YhjVmzko58,3908
|
|
1900
1901
|
mindsdb/utilities/log_controller.py,sha256=B70FF1P1-kkpujpSAkxhu9FCZARKXfvov-SBl3oiobA,1039
|
|
1901
|
-
mindsdb/utilities/otel.py,sha256=0ybLBt8kFqWj_4TXEsHumywlQ2zYUcRX3jb8OIsOanY,3140
|
|
1902
1902
|
mindsdb/utilities/ps.py,sha256=vsY7119OJGYd_n1FXT_FuMTfUL3dVr3WiTRyASaGD00,2339
|
|
1903
1903
|
mindsdb/utilities/security.py,sha256=Mdj3c9Y2BFiEmwKY7J-yrbYdQ6oMgWENPE1XIu4tidk,1506
|
|
1904
1904
|
mindsdb/utilities/sentry.py,sha256=PMI55LbYvCi8NLmI3QgCNL1M8bymVr8J4JBTywAl1WE,2420
|
|
1905
1905
|
mindsdb/utilities/starters.py,sha256=PknV9T2RdnEN7ekgt0ru_PYYT20NlFEPz3LrH8kws2w,818
|
|
1906
1906
|
mindsdb/utilities/telemetry.py,sha256=E1RAdG3g4BwUuD5rx6MpFVP1J1gEd6O4AzHTND6ql1A,1377
|
|
1907
|
+
mindsdb/utilities/utils.py,sha256=RZcPZtM5o1PPYOQmooHSTDn2yP909LGKm9whjVzTr28,1089
|
|
1907
1908
|
mindsdb/utilities/wizards.py,sha256=vlWb50BSmBomj4jMGVc-DABx88GGAaWWqZf8RxA6O-0,1708
|
|
1908
1909
|
mindsdb/utilities/hooks/__init__.py,sha256=HDPLuCxND4GUj5biGVfYeCmMZipMIyTG5WCOU3k654E,796
|
|
1909
1910
|
mindsdb/utilities/hooks/profiling.py,sha256=rku6YqVRv1cL0V62aZEw3dzrv5WQcFkoOut_93YHr2Q,2262
|
|
@@ -1914,12 +1915,17 @@ mindsdb/utilities/ml_task_queue/consumer.py,sha256=cRRlgqOEFSQBKFEowLti2NbgX3cti
|
|
|
1914
1915
|
mindsdb/utilities/ml_task_queue/producer.py,sha256=x0s1_xcqtUaT5Og0TdErgWmN1Jp236byzvd2N2HMO34,2764
|
|
1915
1916
|
mindsdb/utilities/ml_task_queue/task.py,sha256=h6PimSa_AXFo_xvEJGvhDhxiCI54VN2VebVQn0QpAsQ,3166
|
|
1916
1917
|
mindsdb/utilities/ml_task_queue/utils.py,sha256=2bmO5cbgqsXuMkolcaK54_VYjoGKIpg60B2t4XRNboU,3239
|
|
1918
|
+
mindsdb/utilities/otel/__init__.py,sha256=l6OLKIeTmRPxtCRsrV27w7vFSfqQAj22BBMT7T-f1Ys,7744
|
|
1919
|
+
mindsdb/utilities/otel/logger.py,sha256=o-bWPUinZS0yz2G89oxVD4qXgi0oo5gXHJI4aT7sejY,892
|
|
1920
|
+
mindsdb/utilities/otel/meter.py,sha256=oJDoBaU76kF6nenJxZIS08IIz-7GFM3enSKQoeJ6oqI,597
|
|
1921
|
+
mindsdb/utilities/otel/tracer.py,sha256=BBdVTwxpF0gP6uDbwJSj49OjIJOF-giyVRd0yR9p8Tc,679
|
|
1922
|
+
mindsdb/utilities/otel/metric_handlers/__init__.py,sha256=3jGsLt5KkdhqaAUUw8ALxERjlPFq9JclOIedXlS-baY,711
|
|
1917
1923
|
mindsdb/utilities/profiler/__init__.py,sha256=d4VXl80uSm1IotR-WwbBInPmLmACiK0AzxXGBA40I-0,251
|
|
1918
1924
|
mindsdb/utilities/profiler/profiler.py,sha256=KCUtOupkbM_nCoof9MtiuhUzDGezx4a4NsBX6vGWbPA,3936
|
|
1919
1925
|
mindsdb/utilities/render/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1920
1926
|
mindsdb/utilities/render/sqlalchemy_render.py,sha256=ot4I-2OV81f7P5XohbFjIb7PluQ5uHPREY7ci8TjBoI,28072
|
|
1921
|
-
MindsDB-25.1.
|
|
1922
|
-
MindsDB-25.1.
|
|
1923
|
-
MindsDB-25.1.
|
|
1924
|
-
MindsDB-25.1.
|
|
1925
|
-
MindsDB-25.1.
|
|
1927
|
+
MindsDB-25.1.3.0.dist-info/LICENSE,sha256=ziqdjujs6WDn-9g3t0SISjHCBc2pLRht3gnRbQoXmIs,5804
|
|
1928
|
+
MindsDB-25.1.3.0.dist-info/METADATA,sha256=BW3YuhlOGTFimRoPTAGEyYw1jSifP1Ng5ELgLP4Qfd4,43110
|
|
1929
|
+
MindsDB-25.1.3.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
1930
|
+
MindsDB-25.1.3.0.dist-info/top_level.txt,sha256=10wPR96JDf3hM8aMP7Fz0lDlmClEP480zgXISJKr5jE,8
|
|
1931
|
+
MindsDB-25.1.3.0.dist-info/RECORD,,
|
mindsdb/__about__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
__title__ = 'MindsDB'
|
|
2
2
|
__package_name__ = 'mindsdb'
|
|
3
|
-
__version__ = '25.1.
|
|
3
|
+
__version__ = '25.1.3.0'
|
|
4
4
|
__description__ = "MindsDB's AI SQL Server enables developers to build AI tools that need access to real-time data to perform their tasks"
|
|
5
5
|
__email__ = "jorge@mindsdb.com"
|
|
6
6
|
__author__ = 'MindsDB Inc'
|
mindsdb/__main__.py
CHANGED
|
@@ -303,12 +303,14 @@ if __name__ == '__main__':
|
|
|
303
303
|
except Exception as e:
|
|
304
304
|
logger.error(f"Error! Something went wrong during DB migrations: {e}")
|
|
305
305
|
|
|
306
|
-
|
|
306
|
+
apis = os.getenv('MINDSDB_APIS') or config.cmd_args.api
|
|
307
|
+
|
|
308
|
+
if apis is None: # If "--api" option is not specified, start the default APIs
|
|
307
309
|
api_arr = [TrunkProcessEnum.HTTP, TrunkProcessEnum.MYSQL]
|
|
308
|
-
elif
|
|
310
|
+
elif apis == "": # If "--api=" (blank) is specified, don't start any APIs
|
|
309
311
|
api_arr = []
|
|
310
312
|
else: # The user has provided a list of APIs to start
|
|
311
|
-
api_arr = [TrunkProcessEnum(name) for name in
|
|
313
|
+
api_arr = [TrunkProcessEnum(name) for name in apis.split(',')]
|
|
312
314
|
|
|
313
315
|
if config.cmd_args.install_handlers is not None:
|
|
314
316
|
handlers_list = [s.strip() for s in config.cmd_args.install_handlers.split(",")]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
from typing import List
|
|
2
1
|
import copy
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
3
4
|
import numpy as np
|
|
4
5
|
import pandas as pd
|
|
5
6
|
|
|
@@ -35,6 +36,19 @@ class Column:
|
|
|
35
36
|
return f'{self.__class__.__name__}({self.__dict__})'
|
|
36
37
|
|
|
37
38
|
|
|
39
|
+
def rename_df_columns(df: pd.DataFrame, names: Optional[List] = None) -> None:
|
|
40
|
+
"""Inplace rename of dataframe columns
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
df (pd.DataFrame): dataframe
|
|
44
|
+
names (Optional[List]): columns names to set
|
|
45
|
+
"""
|
|
46
|
+
if names is not None:
|
|
47
|
+
df.columns = names
|
|
48
|
+
else:
|
|
49
|
+
df.columns = list(range(len(df.columns)))
|
|
50
|
+
|
|
51
|
+
|
|
38
52
|
class ResultSet:
|
|
39
53
|
def __init__(self, columns=None, values: List[List] = None, df: pd.DataFrame = None):
|
|
40
54
|
'''
|
|
@@ -73,20 +87,19 @@ class ResultSet:
|
|
|
73
87
|
# --- converters ---
|
|
74
88
|
|
|
75
89
|
def from_df(self, df, database=None, table_name=None, table_alias=None):
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
for i, col in enumerate(df.columns):
|
|
80
|
-
self._columns.append(Column(
|
|
81
|
-
name=col,
|
|
90
|
+
self._columns = [
|
|
91
|
+
Column(
|
|
92
|
+
name=column_name,
|
|
82
93
|
table_name=table_name,
|
|
83
94
|
table_alias=table_alias,
|
|
84
95
|
database=database,
|
|
85
|
-
type=
|
|
86
|
-
)
|
|
96
|
+
type=column_dtype
|
|
97
|
+
) for column_name, column_dtype
|
|
98
|
+
in zip(df.columns, df.dtypes)
|
|
99
|
+
]
|
|
87
100
|
|
|
88
|
-
|
|
89
|
-
self._df = df
|
|
101
|
+
rename_df_columns(df)
|
|
102
|
+
self._df = df
|
|
90
103
|
|
|
91
104
|
return self
|
|
92
105
|
|
|
@@ -97,9 +110,6 @@ class ResultSet:
|
|
|
97
110
|
if col.alias is not None:
|
|
98
111
|
alias_idx[col.alias] = col
|
|
99
112
|
|
|
100
|
-
# resp_dict = df.to_dict(orient='split')
|
|
101
|
-
# self._records = resp_dict['data']
|
|
102
|
-
|
|
103
113
|
for col in df.columns:
|
|
104
114
|
if col in col_names or strict:
|
|
105
115
|
column = col_names[col]
|
|
@@ -109,13 +119,16 @@ class ResultSet:
|
|
|
109
119
|
column = Column(col)
|
|
110
120
|
self._columns.append(column)
|
|
111
121
|
|
|
112
|
-
|
|
122
|
+
rename_df_columns(df)
|
|
123
|
+
self._df = df
|
|
113
124
|
|
|
114
125
|
return self
|
|
115
126
|
|
|
116
127
|
def to_df(self):
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
columns_names = self.get_column_names()
|
|
129
|
+
df = self.get_raw_df()
|
|
130
|
+
rename_df_columns(df, columns_names)
|
|
131
|
+
return df
|
|
119
132
|
|
|
120
133
|
def to_df_cols(self, prefix=''):
|
|
121
134
|
# returns dataframe and dict of columns
|
|
@@ -128,7 +141,9 @@ class ResultSet:
|
|
|
128
141
|
columns.append(name)
|
|
129
142
|
col_names[name] = col
|
|
130
143
|
|
|
131
|
-
|
|
144
|
+
df = self.get_raw_df()
|
|
145
|
+
rename_df_columns(df, columns)
|
|
146
|
+
return df, col_names
|
|
132
147
|
|
|
133
148
|
# --- tables ---
|
|
134
149
|
|
|
@@ -174,7 +189,7 @@ class ResultSet:
|
|
|
174
189
|
self._columns.pop(idx)
|
|
175
190
|
|
|
176
191
|
self._df.drop(idx, axis=1, inplace=True)
|
|
177
|
-
|
|
192
|
+
rename_df_columns(self._df)
|
|
178
193
|
|
|
179
194
|
@property
|
|
180
195
|
def columns(self):
|
|
@@ -226,7 +241,7 @@ class ResultSet:
|
|
|
226
241
|
if len(df.columns) != len(self._columns):
|
|
227
242
|
raise WrongArgumentError(f'Record length mismatch columns length: {len(df.columns)} != {len(self.columns)}')
|
|
228
243
|
|
|
229
|
-
|
|
244
|
+
rename_df_columns(df)
|
|
230
245
|
|
|
231
246
|
if self._df is None:
|
|
232
247
|
self._df = df
|
|
@@ -269,7 +284,7 @@ class ResultSet:
|
|
|
269
284
|
def get_column_values(self, col_idx):
|
|
270
285
|
# get by column index
|
|
271
286
|
df = self.get_raw_df()
|
|
272
|
-
return list(df[col_idx])
|
|
287
|
+
return list(df[df.columns[col_idx]])
|
|
273
288
|
|
|
274
289
|
def set_column_values(self, col_name, values):
|
|
275
290
|
# values is one value or list of values
|
|
@@ -213,7 +213,7 @@ class ApplyPredictorStepCall(ApplyPredictorBaseCall):
|
|
|
213
213
|
columns = list(table_df.columns)
|
|
214
214
|
for col_idx, name in cols_to_rename.items():
|
|
215
215
|
columns[col_idx] = name
|
|
216
|
-
table_df =
|
|
216
|
+
table_df.columns = columns
|
|
217
217
|
|
|
218
218
|
version = None
|
|
219
219
|
if len(step.predictor.parts) > 1 and step.predictor.parts[-1].isdigit():
|
|
@@ -90,15 +90,15 @@ class JoinStepCall(BaseStepCall):
|
|
|
90
90
|
table_b, names_b = right_data.to_df_cols(prefix='B')
|
|
91
91
|
|
|
92
92
|
query = f"""
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
SELECT * FROM table_a {join_type} table_b
|
|
94
|
+
ON {join_condition}
|
|
95
|
+
"""
|
|
96
96
|
resp_df, _description = query_df_with_type_infer_fallback(query, {
|
|
97
97
|
'table_a': table_a,
|
|
98
98
|
'table_b': table_b
|
|
99
99
|
})
|
|
100
100
|
|
|
101
|
-
resp_df
|
|
101
|
+
resp_df.replace({np.nan: None}, inplace=True)
|
|
102
102
|
|
|
103
103
|
names_a.update(names_b)
|
|
104
104
|
data = ResultSet().from_df_cols(resp_df, col_names=names_a)
|
|
@@ -182,14 +182,6 @@ def query_df(df, query, session=None):
|
|
|
182
182
|
df = df.astype({'CONNECTION_DATA': 'string'})
|
|
183
183
|
|
|
184
184
|
result_df, description = query_df_with_type_infer_fallback(query_str, {'df': df}, user_functions=user_functions)
|
|
185
|
-
result_df
|
|
186
|
-
|
|
187
|
-
new_column_names = {}
|
|
188
|
-
real_column_names = [x[0] for x in description]
|
|
189
|
-
for i, duck_column_name in enumerate(result_df.columns):
|
|
190
|
-
new_column_names[duck_column_name] = real_column_names[i]
|
|
191
|
-
result_df = result_df.rename(
|
|
192
|
-
new_column_names,
|
|
193
|
-
axis='columns'
|
|
194
|
-
)
|
|
185
|
+
result_df.replace({np.nan: None}, inplace=True)
|
|
186
|
+
result_df.columns = [x[0] for x in description]
|
|
195
187
|
return result_df
|
|
@@ -83,6 +83,7 @@ from mindsdb.api.mysql.mysql_proxy.utilities.lightwood_dtype import dtype
|
|
|
83
83
|
from mindsdb.utilities import log
|
|
84
84
|
from mindsdb.utilities.config import Config
|
|
85
85
|
from mindsdb.utilities.context import context as ctx
|
|
86
|
+
from mindsdb.utilities.otel.metric_handlers import get_query_request_counter
|
|
86
87
|
from mindsdb.utilities.wizards import make_ssl_cert
|
|
87
88
|
|
|
88
89
|
logger = log.getLogger(__name__)
|
|
@@ -562,6 +563,12 @@ class MysqlProxy(SocketServer.BaseRequestHandler):
|
|
|
562
563
|
data=executor.data,
|
|
563
564
|
status=executor.server_status,
|
|
564
565
|
)
|
|
566
|
+
|
|
567
|
+
# Increment the counter and include metadata in attributes
|
|
568
|
+
metadata = ctx.metadata(query=sql)
|
|
569
|
+
query_request_counter = get_query_request_counter()
|
|
570
|
+
query_request_counter.add(1, metadata)
|
|
571
|
+
|
|
565
572
|
return resp
|
|
566
573
|
|
|
567
574
|
def answer_stmt_prepare(self, sql):
|
|
@@ -276,7 +276,7 @@ class FileHandler(DatabaseHandler):
|
|
|
276
276
|
|
|
277
277
|
header = df.columns.values.tolist()
|
|
278
278
|
|
|
279
|
-
df
|
|
279
|
+
df.columns = [key.strip() for key in header]
|
|
280
280
|
df = df.applymap(clean_cell)
|
|
281
281
|
|
|
282
282
|
header = [x.strip() for x in header]
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from typing import Any, List
|
|
2
|
+
from langchain_core.embeddings import Embeddings
|
|
3
|
+
import requests
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FastAPIEmbeddings(Embeddings):
|
|
7
|
+
"""An embedding extension that interfaces with FAST API. Useful for custom serving solutions."""
|
|
8
|
+
|
|
9
|
+
def __init__(
|
|
10
|
+
self,
|
|
11
|
+
api_base: str,
|
|
12
|
+
model: str,
|
|
13
|
+
batch_size: int = 32,
|
|
14
|
+
**kwargs: Any,
|
|
15
|
+
):
|
|
16
|
+
"""Initialize the embeddings class.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
api_base: Base URL for the VLLM server
|
|
20
|
+
model: Model name/path to use for embeddings
|
|
21
|
+
batch_size: Batch size for generating embeddings
|
|
22
|
+
"""
|
|
23
|
+
super().__init__()
|
|
24
|
+
self.api_base = api_base
|
|
25
|
+
self.model = model
|
|
26
|
+
self.batch_size = batch_size
|
|
27
|
+
|
|
28
|
+
# initialize requests here with the api_base
|
|
29
|
+
|
|
30
|
+
def _get_embeddings(self, texts: List[str]) -> List[str]:
|
|
31
|
+
"""Get embeddings for a batch of text chunks.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
List of embeddings as strings. For sparse vectors, returns strings in format
|
|
35
|
+
"{key:value,...}/size" where size is the dimension of the vector space.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
headers = {"accept": "application/json", "Content-Type": "application/json"}
|
|
39
|
+
|
|
40
|
+
data = {
|
|
41
|
+
"input": texts,
|
|
42
|
+
"model": self.model
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
response = requests.post(self.api_base, headers=headers, json=data)
|
|
46
|
+
|
|
47
|
+
response.raise_for_status()
|
|
48
|
+
|
|
49
|
+
embeddings = []
|
|
50
|
+
for response_dict in response.json()["data"]:
|
|
51
|
+
embedding = response_dict["embedding"]
|
|
52
|
+
embeddings.append(embedding)
|
|
53
|
+
|
|
54
|
+
return embeddings
|
|
55
|
+
|
|
56
|
+
def embed_documents(self, texts: List[str]) -> List[str]:
|
|
57
|
+
"""Embed a list of documents using vLLM.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
texts: List of documents to embed
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
List of embeddings as strings, one for each document.
|
|
64
|
+
For sparse embeddings, returns strings in format "{key:value,...}/size"
|
|
65
|
+
For dense embeddings, returns JSON strings of float lists
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
return self._get_embeddings(texts)
|
|
69
|
+
|
|
70
|
+
def embed_query(self, text: str) -> str:
|
|
71
|
+
"""Embed a single query text using vLLM.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
text: Query text to embed
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
Query embedding as a string.
|
|
78
|
+
For sparse embeddings, returns string in format "{key:value,...}/size"
|
|
79
|
+
For dense embeddings, returns JSON string of float list
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
return self._get_embeddings([text])[0]
|
|
@@ -10,6 +10,7 @@ from mindsdb.integrations.libs.base import BaseMLEngine
|
|
|
10
10
|
from mindsdb.utilities import log
|
|
11
11
|
from langchain_core.embeddings import Embeddings
|
|
12
12
|
from mindsdb.integrations.handlers.langchain_embedding_handler.vllm_embeddings import VLLMEmbeddings
|
|
13
|
+
from mindsdb.integrations.handlers.langchain_embedding_handler.fastapi_embeddings import FastAPIEmbeddings
|
|
13
14
|
|
|
14
15
|
logger = log.getLogger(__name__)
|
|
15
16
|
|
|
@@ -20,7 +21,10 @@ logger = log.getLogger(__name__)
|
|
|
20
21
|
# This is used for the user to select the embedding model
|
|
21
22
|
EMBEDDING_MODELS = {
|
|
22
23
|
'VLLM': 'VLLMEmbeddings',
|
|
23
|
-
'vllm': 'VLLMEmbeddings'
|
|
24
|
+
'vllm': 'VLLMEmbeddings',
|
|
25
|
+
'FastAPI': 'FastAPIEmbeddings',
|
|
26
|
+
'fastapi': 'FastAPIEmbeddings'
|
|
27
|
+
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
try:
|
|
@@ -55,6 +59,9 @@ def get_langchain_class(class_name: str) -> Embeddings:
|
|
|
55
59
|
if class_name == "VLLMEmbeddings":
|
|
56
60
|
return VLLMEmbeddings
|
|
57
61
|
|
|
62
|
+
if class_name == "FastAPIEmbeddings":
|
|
63
|
+
return FastAPIEmbeddings
|
|
64
|
+
|
|
58
65
|
# Then try langchain_community.embeddings
|
|
59
66
|
try:
|
|
60
67
|
module = importlib.import_module("langchain_community.embeddings")
|
|
@@ -37,6 +37,11 @@ class PgVectorHandler(VectorStoreHandler, PostgresHandler):
|
|
|
37
37
|
super().__init__(name=name, **kwargs)
|
|
38
38
|
self._is_shared_db = False
|
|
39
39
|
self._is_vector_registered = False
|
|
40
|
+
# we get these from the connection args on PostgresHandler parent
|
|
41
|
+
self._is_sparse = self.connection_args.get('is_sparse', False)
|
|
42
|
+
self._vector_size = self.connection_args.get('vector_size', None)
|
|
43
|
+
if self._is_sparse and not self._vector_size:
|
|
44
|
+
raise ValueError("vector_size is required when is_sparse=True")
|
|
40
45
|
self.connect()
|
|
41
46
|
|
|
42
47
|
def _make_connection_args(self):
|
|
@@ -190,13 +195,30 @@ class PgVectorHandler(VectorStoreHandler, PostgresHandler):
|
|
|
190
195
|
if filter_conditions:
|
|
191
196
|
|
|
192
197
|
if embedding_search:
|
|
193
|
-
# if search vector, return similar rows, apply other filters after if any
|
|
194
198
|
search_vector = filter_conditions["embeddings"]["value"][0]
|
|
195
199
|
filter_conditions.pop("embeddings")
|
|
196
|
-
|
|
200
|
+
|
|
201
|
+
if self._is_sparse:
|
|
202
|
+
# Convert dict to sparse vector if needed
|
|
203
|
+
if isinstance(search_vector, dict):
|
|
204
|
+
from pgvector.utils import SparseVector
|
|
205
|
+
embedding = SparseVector(search_vector, self._vector_size)
|
|
206
|
+
search_vector = embedding.to_text()
|
|
207
|
+
# Use inner product for sparse vectors
|
|
208
|
+
distance_op = "<#>"
|
|
209
|
+
else:
|
|
210
|
+
# Convert list to vector string if needed
|
|
211
|
+
if isinstance(search_vector, list):
|
|
212
|
+
search_vector = f"[{','.join(str(x) for x in search_vector)}]"
|
|
213
|
+
# Use cosine similarity for dense vectors
|
|
214
|
+
distance_op = "<=>"
|
|
215
|
+
|
|
216
|
+
return f"SELECT {targets} FROM {table_name} ORDER BY embeddings {distance_op} '{search_vector}' ASC {after_from_clause}"
|
|
217
|
+
|
|
197
218
|
else:
|
|
198
|
-
# if filter conditions, return
|
|
219
|
+
# if filter conditions, return rows that satisfy the conditions
|
|
199
220
|
return f"SELECT {targets} FROM {table_name} {after_from_clause}"
|
|
221
|
+
|
|
200
222
|
else:
|
|
201
223
|
# if no filter conditions, return all rows
|
|
202
224
|
return f"SELECT {targets} FROM {table_name} {after_from_clause}"
|
|
@@ -283,7 +305,7 @@ class PgVectorHandler(VectorStoreHandler, PostgresHandler):
|
|
|
283
305
|
# See https://docs.pgvecto.rs/use-case/hybrid-search.html#advanced-search-merge-the-results-of-full-text-search-and-vector-search.
|
|
284
306
|
#
|
|
285
307
|
# We can break down the below query as follows:
|
|
286
|
-
#
|
|
308
|
+
#
|
|
287
309
|
# Start with a CTE (Common Table Expression) called semantic_search (https://www.postgresql.org/docs/current/queries-with.html).
|
|
288
310
|
# This expression calculates rank by the defined distance function, which measures the distance between the
|
|
289
311
|
# embeddings column and the given embeddings vector. Results are ordered by this rank.
|
|
@@ -339,17 +361,28 @@ class PgVectorHandler(VectorStoreHandler, PostgresHandler):
|
|
|
339
361
|
full_search_query = f'{semantic_search_cte}{full_text_search_cte}{hybrid_select}'
|
|
340
362
|
return self.raw_query(full_search_query)
|
|
341
363
|
|
|
342
|
-
def create_table(self, table_name: str
|
|
343
|
-
"""
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
364
|
+
def create_table(self, table_name: str):
|
|
365
|
+
"""Create a table with a vector column."""
|
|
366
|
+
with self.connection.cursor() as cur:
|
|
367
|
+
# For sparse vectors, use sparsevec type
|
|
368
|
+
vector_column_type = 'sparsevec' if self._is_sparse else 'vector'
|
|
369
|
+
|
|
370
|
+
# Vector size is required for sparse vectors, optional for dense
|
|
371
|
+
if self._is_sparse and not self._vector_size:
|
|
372
|
+
raise ValueError("vector_size is required for sparse vectors")
|
|
373
|
+
|
|
374
|
+
# Add vector size specification only if provided
|
|
375
|
+
size_spec = f"({self._vector_size})" if self._vector_size is not None else "()"
|
|
376
|
+
|
|
377
|
+
cur.execute(f"""
|
|
378
|
+
CREATE TABLE IF NOT EXISTS {table_name} (
|
|
379
|
+
id SERIAL PRIMARY KEY,
|
|
380
|
+
embeddings {vector_column_type}{size_spec},
|
|
381
|
+
content TEXT,
|
|
382
|
+
metadata JSONB
|
|
383
|
+
)
|
|
384
|
+
""")
|
|
385
|
+
self.connection.commit()
|
|
353
386
|
|
|
354
387
|
def insert(
|
|
355
388
|
self, table_name: str, data: pd.DataFrame
|
|
@@ -447,4 +480,3 @@ class PgVectorHandler(VectorStoreHandler, PostgresHandler):
|
|
|
447
480
|
"""
|
|
448
481
|
table_name = self._check_table(table_name)
|
|
449
482
|
self.raw_query(f"DROP TABLE IF EXISTS {table_name}")
|
|
450
|
-
|