singlestoredb 1.13.0__tar.gz → 1.14.0__tar.gz

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 singlestoredb might be problematic. Click here for more details.

Files changed (163) hide show
  1. {singlestoredb-1.13.0/singlestoredb.egg-info → singlestoredb-1.14.0}/PKG-INFO +2 -2
  2. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/setup.cfg +3 -2
  3. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/__init__.py +9 -1
  4. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/ai/__init__.py +1 -0
  5. singlestoredb-1.14.0/singlestoredb/ai/chat.py +26 -0
  6. singlestoredb-1.14.0/singlestoredb/ai/embeddings.py +27 -0
  7. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/connection.py +9 -0
  8. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/__init__.py +4 -0
  9. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/ext/asgi.py +188 -94
  10. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/utils.py +171 -92
  11. singlestoredb-1.14.0/singlestoredb/management/inference_api.py +101 -0
  12. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/organization.py +17 -0
  13. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_management.py +5 -5
  14. singlestoredb-1.14.0/singlestoredb/tests/test_vectorstore.py +51 -0
  15. singlestoredb-1.14.0/singlestoredb/vectorstore.py +192 -0
  16. {singlestoredb-1.13.0 → singlestoredb-1.14.0/singlestoredb.egg-info}/PKG-INFO +2 -2
  17. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb.egg-info/SOURCES.txt +4 -0
  18. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb.egg-info/requires.txt +1 -0
  19. singlestoredb-1.13.0/singlestoredb/ai/embeddings.py +0 -24
  20. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/LICENSE +0 -0
  21. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/README.md +0 -0
  22. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/accel.c +0 -0
  23. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/setup.py +0 -0
  24. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/alchemy/__init__.py +0 -0
  25. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/apps/__init__.py +0 -0
  26. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/apps/_cloud_functions.py +0 -0
  27. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/apps/_config.py +0 -0
  28. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/apps/_connection_info.py +0 -0
  29. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/apps/_dashboards.py +0 -0
  30. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/apps/_process.py +0 -0
  31. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/apps/_python_udfs.py +0 -0
  32. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/apps/_stdout_supress.py +0 -0
  33. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/apps/_uvicorn_util.py +0 -0
  34. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/auth.py +0 -0
  35. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/config.py +0 -0
  36. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/converters.py +0 -0
  37. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/exceptions.py +0 -0
  38. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/decorator.py +0 -0
  39. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/dtypes.py +0 -0
  40. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/ext/__init__.py +0 -0
  41. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/ext/arrow.py +0 -0
  42. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/ext/json.py +0 -0
  43. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/ext/mmap.py +0 -0
  44. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/ext/rowdat_1.py +0 -0
  45. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/ext/utils.py +0 -0
  46. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/signature.py +0 -0
  47. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/functions/typing.py +0 -0
  48. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/__init__.py +0 -0
  49. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/graphql.py +0 -0
  50. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/handler.py +0 -0
  51. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/handlers/__init__.py +0 -0
  52. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/handlers/export.py +0 -0
  53. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/handlers/files.py +0 -0
  54. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/handlers/job.py +0 -0
  55. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/handlers/models.py +0 -0
  56. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/handlers/stage.py +0 -0
  57. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/handlers/utils.py +0 -0
  58. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/handlers/workspace.py +0 -0
  59. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/registry.py +0 -0
  60. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/fusion/result.py +0 -0
  61. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/http/__init__.py +0 -0
  62. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/http/connection.py +0 -0
  63. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/magics/__init__.py +0 -0
  64. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/magics/run_personal.py +0 -0
  65. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/magics/run_shared.py +0 -0
  66. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/__init__.py +0 -0
  67. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/billing_usage.py +0 -0
  68. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/cluster.py +0 -0
  69. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/export.py +0 -0
  70. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/files.py +0 -0
  71. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/job.py +0 -0
  72. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/manager.py +0 -0
  73. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/region.py +0 -0
  74. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/utils.py +0 -0
  75. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/management/workspace.py +0 -0
  76. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/__init__.py +0 -0
  77. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/_auth.py +0 -0
  78. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/charset.py +0 -0
  79. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/connection.py +0 -0
  80. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/constants/CLIENT.py +0 -0
  81. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/constants/COMMAND.py +0 -0
  82. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/constants/CR.py +0 -0
  83. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/constants/ER.py +0 -0
  84. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/constants/EXTENDED_TYPE.py +0 -0
  85. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/constants/FIELD_TYPE.py +0 -0
  86. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/constants/FLAG.py +0 -0
  87. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/constants/SERVER_STATUS.py +0 -0
  88. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/constants/VECTOR_TYPE.py +0 -0
  89. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/constants/__init__.py +0 -0
  90. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/converters.py +0 -0
  91. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/cursors.py +0 -0
  92. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/err.py +0 -0
  93. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/optionfile.py +0 -0
  94. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/protocol.py +0 -0
  95. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/__init__.py +0 -0
  96. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/base.py +0 -0
  97. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/conftest.py +0 -0
  98. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_DictCursor.py +0 -0
  99. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_SSCursor.py +0 -0
  100. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_basic.py +0 -0
  101. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_connection.py +0 -0
  102. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_converters.py +0 -0
  103. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_cursor.py +0 -0
  104. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_err.py +0 -0
  105. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_issues.py +0 -0
  106. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_load_local.py +0 -0
  107. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_nextset.py +0 -0
  108. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/test_optionfile.py +0 -0
  109. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/thirdparty/__init__.py +0 -0
  110. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/__init__.py +0 -0
  111. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/capabilities.py +0 -0
  112. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/dbapi20.py +0 -0
  113. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py +0 -0
  114. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py +0 -0
  115. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py +0 -0
  116. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/mysql/times.py +0 -0
  117. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/notebook/__init__.py +0 -0
  118. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/notebook/_objects.py +0 -0
  119. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/notebook/_portal.py +0 -0
  120. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/py.typed +0 -0
  121. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/pytest.py +0 -0
  122. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/server/__init__.py +0 -0
  123. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/server/docker.py +0 -0
  124. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/server/free_tier.py +0 -0
  125. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/__init__.py +0 -0
  126. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/empty.sql +0 -0
  127. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/ext_funcs/__init__.py +0 -0
  128. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/local_infile.csv +0 -0
  129. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test.ipynb +0 -0
  130. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test.sql +0 -0
  131. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test2.ipynb +0 -0
  132. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test2.sql +0 -0
  133. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_basics.py +0 -0
  134. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_config.py +0 -0
  135. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_connection.py +0 -0
  136. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_dbapi.py +0 -0
  137. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_exceptions.py +0 -0
  138. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_ext_func.py +0 -0
  139. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_ext_func_data.py +0 -0
  140. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_fusion.py +0 -0
  141. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_http.py +0 -0
  142. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_plugin.py +0 -0
  143. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_results.py +0 -0
  144. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_types.py +0 -0
  145. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_udf.py +0 -0
  146. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_udf_returns.py +0 -0
  147. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/test_xdict.py +0 -0
  148. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/tests/utils.py +0 -0
  149. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/types.py +0 -0
  150. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/utils/__init__.py +0 -0
  151. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/utils/config.py +0 -0
  152. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/utils/convert_rows.py +0 -0
  153. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/utils/debug.py +0 -0
  154. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/utils/dtypes.py +0 -0
  155. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/utils/events.py +0 -0
  156. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/utils/mogrify.py +0 -0
  157. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/utils/results.py +0 -0
  158. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb/utils/xdict.py +0 -0
  159. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb.egg-info/dependency_links.txt +0 -0
  160. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb.egg-info/entry_points.txt +0 -0
  161. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/singlestoredb.egg-info/top_level.txt +0 -0
  162. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/sqlx/__init__.py +0 -0
  163. {singlestoredb-1.13.0 → singlestoredb-1.14.0}/sqlx/magic.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: singlestoredb
3
- Version: 1.13.0
3
+ Version: 1.14.0
4
4
  Summary: Interface to the SingleStoreDB database and workspace management APIs
5
5
  Home-page: https://github.com/singlestore-labs/singlestoredb-python
6
6
  Author: SingleStore
@@ -11,7 +11,7 @@ Classifier: License :: OSI Approved :: Apache Software License
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3 :: Only
13
13
  Classifier: Topic :: Database
14
- Requires-Python: >=3.8
14
+ Requires-Python: >=3.9
15
15
  Description-Content-Type: text/markdown
16
16
  Provides-Extra: dataframe
17
17
  Provides-Extra: dbt
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = singlestoredb
3
- version = 1.13.0
3
+ version = 1.14.0
4
4
  description = Interface to the SingleStoreDB database and workspace management APIs
5
5
  long_description = file: README.md
6
6
  long_description_content_type = text/markdown
@@ -24,11 +24,12 @@ install_requires =
24
24
  parsimonious
25
25
  requests
26
26
  setuptools
27
+ singlestore-vectorstore>=0.1.2
27
28
  sqlparams
28
29
  wheel
29
30
  tomli>=1.1.0;python_version < '3.11'
30
31
  typing-extensions<=4.13.2;python_version < '3.11'
31
- python_requires = >=3.8
32
+ python_requires = >=3.9
32
33
  include_package_data = True
33
34
  tests_require =
34
35
  coverage
@@ -13,7 +13,7 @@ Examples
13
13
 
14
14
  """
15
15
 
16
- __version__ = '1.13.0'
16
+ __version__ = '1.14.0'
17
17
 
18
18
  from typing import Any
19
19
 
@@ -31,6 +31,14 @@ from .types import (
31
31
  Date, Time, Timestamp, DateFromTicks, TimeFromTicks, TimestampFromTicks,
32
32
  Binary, STRING, BINARY, NUMBER, DATETIME, ROWID,
33
33
  )
34
+ from .vectorstore import (
35
+ vector_db, IndexInterface, IndexList, IndexModel, MatchTypedDict,
36
+ Metric, IndexStatsTypedDict, NamespaceStatsTypedDict, Vector,
37
+ VectorDictMetadataValue, VectorMetadataTypedDict, VectorTuple,
38
+ VectorTupleWithMetadata, DeletionProtection, AndFilter, EqFilter,
39
+ ExactMatchFilter, FilterTypedDict, GteFilter, GtFilter, InFilter,
40
+ LteFilter, LtFilter, NeFilter, NinFilter, OrFilter, SimpleFilter,
41
+ )
34
42
 
35
43
 
36
44
  #
@@ -1 +1,2 @@
1
+ from .chat import SingleStoreChatOpenAI # noqa: F401
1
2
  from .embeddings import SingleStoreEmbeddings # noqa: F401
@@ -0,0 +1,26 @@
1
+ import os
2
+ from typing import Any
3
+
4
+ from singlestoredb.fusion.handlers.utils import get_workspace_manager
5
+
6
+ try:
7
+ from langchain_openai import ChatOpenAI
8
+ except ImportError:
9
+ raise ImportError(
10
+ 'Could not import langchain_openai python package. '
11
+ 'Please install it with `pip install langchain_openai`.',
12
+ )
13
+
14
+
15
+ class SingleStoreChatOpenAI(ChatOpenAI):
16
+ def __init__(self, model_name: str, **kwargs: Any):
17
+ inference_api_manger = (
18
+ get_workspace_manager().organizations.current.inference_apis
19
+ )
20
+ info = inference_api_manger.get(model_name=model_name)
21
+ super().__init__(
22
+ base_url=info.connection_url,
23
+ api_key=os.environ.get('SINGLESTOREDB_USER_TOKEN'),
24
+ model=model_name,
25
+ **kwargs,
26
+ )
@@ -0,0 +1,27 @@
1
+ import os
2
+ from typing import Any
3
+
4
+ from singlestoredb.fusion.handlers.utils import get_workspace_manager
5
+
6
+ try:
7
+ from langchain_openai import OpenAIEmbeddings
8
+ except ImportError:
9
+ raise ImportError(
10
+ 'Could not import langchain_openai python package. '
11
+ 'Please install it with `pip install langchain_openai`.',
12
+ )
13
+
14
+
15
+ class SingleStoreEmbeddings(OpenAIEmbeddings):
16
+
17
+ def __init__(self, model_name: str, **kwargs: Any):
18
+ inference_api_manger = (
19
+ get_workspace_manager().organizations.current.inference_apis
20
+ )
21
+ info = inference_api_manger.get(model_name=model_name)
22
+ super().__init__(
23
+ base_url=info.connection_url,
24
+ api_key=os.environ.get('SINGLESTOREDB_USER_TOKEN'),
25
+ model=model_name,
26
+ **kwargs,
27
+ )
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  """SingleStoreDB connections and cursors."""
3
3
  import abc
4
+ import functools
4
5
  import inspect
5
6
  import io
6
7
  import queue
@@ -1288,6 +1289,14 @@ class Connection(metaclass=abc.ABCMeta):
1288
1289
  """Access server properties managed by the SHOW statement."""
1289
1290
  return ShowAccessor(self)
1290
1291
 
1292
+ @functools.cached_property
1293
+ def vector_db(self) -> Any:
1294
+ """
1295
+ Get vectorstore API accessor
1296
+ """
1297
+ from vectorstore import VectorDB
1298
+ return VectorDB(connection=self)
1299
+
1291
1300
 
1292
1301
  #
1293
1302
  # NOTE: When adding parameters to this function, you should always
@@ -1,6 +1,10 @@
1
1
  from .decorator import udf # noqa: F401
2
2
  from .typing import Masked # noqa: F401
3
3
  from .typing import Table # noqa: F401
4
+ from .utils import pack_vector # noqa: F401
5
+ from .utils import pack_vectors # noqa: F401
6
+ from .utils import unpack_vector # noqa: F401
7
+ from .utils import unpack_vectors # noqa: F401
4
8
  from .utils import VectorTypes
5
9
 
6
10
 
@@ -246,6 +246,192 @@ def get_masked_params(func: Callable[..., Any]) -> List[bool]:
246
246
  return [typing.get_origin(x.annotation) is Masked for x in params.values()]
247
247
 
248
248
 
249
+ def build_tuple(x: Any) -> Any:
250
+ """Convert object to tuple."""
251
+ return tuple(x) if isinstance(x, Masked) else (x, None)
252
+
253
+
254
+ def build_udf_endpoint(
255
+ func: Callable[..., Any],
256
+ returns_data_format: str,
257
+ ) -> Callable[..., Any]:
258
+ """
259
+ Build a UDF endpoint for scalar / list types (row-based).
260
+
261
+ Parameters
262
+ ----------
263
+ func : Callable
264
+ The function to call as the endpoint
265
+ returns_data_format : str
266
+ The format of the return values
267
+
268
+ Returns
269
+ -------
270
+ Callable
271
+ The function endpoint
272
+
273
+ """
274
+ if returns_data_format in ['scalar', 'list']:
275
+
276
+ async def do_func(
277
+ row_ids: Sequence[int],
278
+ rows: Sequence[Sequence[Any]],
279
+ ) -> Tuple[Sequence[int], List[Tuple[Any, ...]]]:
280
+ '''Call function on given rows of data.'''
281
+ return row_ids, [as_tuple(x) for x in zip(func_map(func, rows))]
282
+
283
+ return do_func
284
+
285
+ return build_vector_udf_endpoint(func, returns_data_format)
286
+
287
+
288
+ def build_vector_udf_endpoint(
289
+ func: Callable[..., Any],
290
+ returns_data_format: str,
291
+ ) -> Callable[..., Any]:
292
+ """
293
+ Build a UDF endpoint for vector formats (column-based).
294
+
295
+ Parameters
296
+ ----------
297
+ func : Callable
298
+ The function to call as the endpoint
299
+ returns_data_format : str
300
+ The format of the return values
301
+
302
+ Returns
303
+ -------
304
+ Callable
305
+ The function endpoint
306
+
307
+ """
308
+ masks = get_masked_params(func)
309
+ array_cls = get_array_class(returns_data_format)
310
+
311
+ async def do_func(
312
+ row_ids: Sequence[int],
313
+ cols: Sequence[Tuple[Sequence[Any], Optional[Sequence[bool]]]],
314
+ ) -> Tuple[
315
+ Sequence[int],
316
+ List[Tuple[Sequence[Any], Optional[Sequence[bool]]]],
317
+ ]:
318
+ '''Call function on given columns of data.'''
319
+ row_ids = array_cls(row_ids)
320
+
321
+ # Call the function with `cols` as the function parameters
322
+ if cols and cols[0]:
323
+ out = func(*[x if m else x[0] for x, m in zip(cols, masks)])
324
+ else:
325
+ out = func()
326
+
327
+ # Single masked value
328
+ if isinstance(out, Masked):
329
+ return row_ids, [tuple(out)]
330
+
331
+ # Multiple return values
332
+ if isinstance(out, tuple):
333
+ return row_ids, [build_tuple(x) for x in out]
334
+
335
+ # Single return value
336
+ return row_ids, [(out, None)]
337
+
338
+ return do_func
339
+
340
+
341
+ def build_tvf_endpoint(
342
+ func: Callable[..., Any],
343
+ returns_data_format: str,
344
+ ) -> Callable[..., Any]:
345
+ """
346
+ Build a TVF endpoint for scalar / list types (row-based).
347
+
348
+ Parameters
349
+ ----------
350
+ func : Callable
351
+ The function to call as the endpoint
352
+ returns_data_format : str
353
+ The format of the return values
354
+
355
+ Returns
356
+ -------
357
+ Callable
358
+ The function endpoint
359
+
360
+ """
361
+ if returns_data_format in ['scalar', 'list']:
362
+
363
+ async def do_func(
364
+ row_ids: Sequence[int],
365
+ rows: Sequence[Sequence[Any]],
366
+ ) -> Tuple[Sequence[int], List[Tuple[Any, ...]]]:
367
+ '''Call function on given rows of data.'''
368
+ out_ids: List[int] = []
369
+ out = []
370
+ # Call function on each row of data
371
+ for i, res in zip(row_ids, func_map(func, rows)):
372
+ out.extend(as_list_of_tuples(res))
373
+ out_ids.extend([row_ids[i]] * (len(out)-len(out_ids)))
374
+ return out_ids, out
375
+
376
+ return do_func
377
+
378
+ return build_vector_tvf_endpoint(func, returns_data_format)
379
+
380
+
381
+ def build_vector_tvf_endpoint(
382
+ func: Callable[..., Any],
383
+ returns_data_format: str,
384
+ ) -> Callable[..., Any]:
385
+ """
386
+ Build a TVF endpoint for vector formats (column-based).
387
+
388
+ Parameters
389
+ ----------
390
+ func : Callable
391
+ The function to call as the endpoint
392
+ returns_data_format : str
393
+ The format of the return values
394
+
395
+ Returns
396
+ -------
397
+ Callable
398
+ The function endpoint
399
+
400
+ """
401
+ masks = get_masked_params(func)
402
+ array_cls = get_array_class(returns_data_format)
403
+
404
+ async def do_func(
405
+ row_ids: Sequence[int],
406
+ cols: Sequence[Tuple[Sequence[Any], Optional[Sequence[bool]]]],
407
+ ) -> Tuple[
408
+ Sequence[int],
409
+ List[Tuple[Sequence[Any], Optional[Sequence[bool]]]],
410
+ ]:
411
+ '''Call function on given columns of data.'''
412
+ # NOTE: There is no way to determine which row ID belongs to
413
+ # each result row, so we just have to use the same
414
+ # row ID for all rows in the result.
415
+
416
+ # Call function on each column of data
417
+ if cols and cols[0]:
418
+ res = get_dataframe_columns(
419
+ func(*[x if m else x[0] for x, m in zip(cols, masks)]),
420
+ )
421
+ else:
422
+ res = get_dataframe_columns(func())
423
+
424
+ # Generate row IDs
425
+ if isinstance(res[0], Masked):
426
+ row_ids = array_cls([row_ids[0]] * len(res[0][0]))
427
+ else:
428
+ row_ids = array_cls([row_ids[0]] * len(res[0]))
429
+
430
+ return row_ids, [build_tuple(x) for x in res]
431
+
432
+ return do_func
433
+
434
+
249
435
  def make_func(
250
436
  name: str,
251
437
  func: Callable[..., Any],
@@ -273,102 +459,10 @@ def make_func(
273
459
  args_data_format = sig.get('args_data_format', 'scalar')
274
460
  returns_data_format = sig.get('returns_data_format', 'scalar')
275
461
 
276
- masks = get_masked_params(func)
277
-
278
462
  if function_type == 'tvf':
279
- # Scalar / list types (row-based)
280
- if returns_data_format in ['scalar', 'list']:
281
- async def do_func(
282
- row_ids: Sequence[int],
283
- rows: Sequence[Sequence[Any]],
284
- ) -> Tuple[Sequence[int], List[Tuple[Any, ...]]]:
285
- '''Call function on given rows of data.'''
286
- out_ids: List[int] = []
287
- out = []
288
- # Call function on each row of data
289
- for i, res in zip(row_ids, func_map(func, rows)):
290
- out.extend(as_list_of_tuples(res))
291
- out_ids.extend([row_ids[i]] * (len(out)-len(out_ids)))
292
- return out_ids, out
293
-
294
- # Vector formats (column-based)
295
- else:
296
- array_cls = get_array_class(returns_data_format)
297
-
298
- async def do_func( # type: ignore
299
- row_ids: Sequence[int],
300
- cols: Sequence[Tuple[Sequence[Any], Optional[Sequence[bool]]]],
301
- ) -> Tuple[
302
- Sequence[int],
303
- List[Tuple[Sequence[Any], Optional[Sequence[bool]]]],
304
- ]:
305
- '''Call function on given cols of data.'''
306
- # NOTE: There is no way to determine which row ID belongs to
307
- # each result row, so we just have to use the same
308
- # row ID for all rows in the result.
309
-
310
- def build_tuple(x: Any) -> Any:
311
- return tuple(x) if isinstance(x, Masked) else (x, None)
312
-
313
- # Call function on each column of data
314
- if cols and cols[0]:
315
- res = get_dataframe_columns(
316
- func(*[x if m else x[0] for x, m in zip(cols, masks)]),
317
- )
318
- else:
319
- res = get_dataframe_columns(func())
320
-
321
- # Generate row IDs
322
- if isinstance(res[0], Masked):
323
- row_ids = array_cls([row_ids[0]] * len(res[0][0]))
324
- else:
325
- row_ids = array_cls([row_ids[0]] * len(res[0]))
326
-
327
- return row_ids, [build_tuple(x) for x in res]
328
-
463
+ do_func = build_tvf_endpoint(func, returns_data_format)
329
464
  else:
330
- # Scalar / list types (row-based)
331
- if returns_data_format in ['scalar', 'list']:
332
- async def do_func(
333
- row_ids: Sequence[int],
334
- rows: Sequence[Sequence[Any]],
335
- ) -> Tuple[Sequence[int], List[Tuple[Any, ...]]]:
336
- '''Call function on given rows of data.'''
337
- return row_ids, [as_tuple(x) for x in zip(func_map(func, rows))]
338
-
339
- # Vector formats (column-based)
340
- else:
341
- array_cls = get_array_class(returns_data_format)
342
-
343
- async def do_func( # type: ignore
344
- row_ids: Sequence[int],
345
- cols: Sequence[Tuple[Sequence[Any], Optional[Sequence[bool]]]],
346
- ) -> Tuple[
347
- Sequence[int],
348
- List[Tuple[Sequence[Any], Optional[Sequence[bool]]]],
349
- ]:
350
- '''Call function on given cols of data.'''
351
- row_ids = array_cls(row_ids)
352
-
353
- def build_tuple(x: Any) -> Any:
354
- return tuple(x) if isinstance(x, Masked) else (x, None)
355
-
356
- # Call the function with `cols` as the function parameters
357
- if cols and cols[0]:
358
- out = func(*[x if m else x[0] for x, m in zip(cols, masks)])
359
- else:
360
- out = func()
361
-
362
- # Single masked value
363
- if isinstance(out, Masked):
364
- return row_ids, [tuple(out)]
365
-
366
- # Multiple return values
367
- if isinstance(out, tuple):
368
- return row_ids, [build_tuple(x) for x in out]
369
-
370
- # Single return value
371
- return row_ids, [(out, None)]
465
+ do_func = build_udf_endpoint(func, returns_data_format)
372
466
 
373
467
  do_func.__name__ = name
374
468
  do_func.__doc__ = func.__doc__