oracle-vecdb 1.0.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.
Files changed (98) hide show
  1. oracle_vecdb-1.0.0/CHANGELOG.rst +54 -0
  2. oracle_vecdb-1.0.0/LICENSE.txt +35 -0
  3. oracle_vecdb-1.0.0/MANIFEST.in +2 -0
  4. oracle_vecdb-1.0.0/PKG-INFO +282 -0
  5. oracle_vecdb-1.0.0/README.md +235 -0
  6. oracle_vecdb-1.0.0/examples/test_client.py +71 -0
  7. oracle_vecdb-1.0.0/pyproject.toml +99 -0
  8. oracle_vecdb-1.0.0/setup.cfg +4 -0
  9. oracle_vecdb-1.0.0/src/oracle_vecdb/__init__.py +12 -0
  10. oracle_vecdb-1.0.0/src/oracle_vecdb/client.py +2433 -0
  11. oracle_vecdb-1.0.0/src/oracle_vecdb/configuration.py +848 -0
  12. oracle_vecdb-1.0.0/src/oracle_vecdb/data_types/__init__.py +56 -0
  13. oracle_vecdb-1.0.0/src/oracle_vecdb/data_types/responses.py +475 -0
  14. oracle_vecdb-1.0.0/src/oracle_vecdb/error_messages.py +71 -0
  15. oracle_vecdb-1.0.0/src/oracle_vecdb/ords.py +785 -0
  16. oracle_vecdb-1.0.0/src/oracle_vecdb/ords_response_handlers.py +106 -0
  17. oracle_vecdb-1.0.0/src/oracle_vecdb/service_protocol.py +138 -0
  18. oracle_vecdb-1.0.0/src/oracle_vecdb/services/__init__.py +6 -0
  19. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/__init__.py +51 -0
  20. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/api/__init__.py +29 -0
  21. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/api/vector_database_inference_operations_api.py +581 -0
  22. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/api/vector_database_models_api.py +1161 -0
  23. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/api/vector_database_summary_api.py +276 -0
  24. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/api/vector_database_vector_indexes_api.py +2008 -0
  25. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/api/vector_database_vector_operations_api.py +2012 -0
  26. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/api/vector_database_vector_search_api.py +335 -0
  27. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/api/vector_database_vector_tables_api.py +1472 -0
  28. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/api_client.py +823 -0
  29. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/api_response.py +27 -0
  30. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/configuration.py +689 -0
  31. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/exceptions.py +230 -0
  32. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/__init__.py +34 -0
  33. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/create_index_request.py +126 -0
  34. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/create_index_request_index_params.py +92 -0
  35. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/create_vector_table_request.py +169 -0
  36. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/create_vector_table_request_embed_params.py +110 -0
  37. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/create_vector_table_request_table_params.py +109 -0
  38. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/delete_vectors200_response.py +90 -0
  39. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/delete_vectors_request.py +108 -0
  40. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/describe_index200_response.py +90 -0
  41. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/drop_model200_response.py +95 -0
  42. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/drop_vector_table200_response.py +88 -0
  43. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/link_relation.py +91 -0
  44. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/list_vectors_request.py +125 -0
  45. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/load_model_request.py +129 -0
  46. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/load_model_request_model_params.py +102 -0
  47. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/load_vectors_request.py +122 -0
  48. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/model_attribute_item.py +111 -0
  49. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/model_item.py +123 -0
  50. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/model_item_with_links.py +138 -0
  51. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/models_collection.py +145 -0
  52. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/ords_error_response.py +111 -0
  53. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/query_vectors200_response.py +107 -0
  54. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/query_vectors_request.py +151 -0
  55. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/rebuild_index_request.py +118 -0
  56. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/summary_item.py +100 -0
  57. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/update_vector_table_annotation_request.py +112 -0
  58. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/upsert_vectors201_response.py +90 -0
  59. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/upsert_vectors_request.py +125 -0
  60. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/upsert_vectors_request_vectors_inner.py +110 -0
  61. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_job_collection.py +146 -0
  62. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_job_item.py +129 -0
  63. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_job_log_item.py +135 -0
  64. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_search_item.py +98 -0
  65. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_table_base_no_links_embed_params.py +110 -0
  66. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_table_base_no_links_indexes.py +123 -0
  67. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_table_collection.py +140 -0
  68. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_table_item.py +269 -0
  69. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_table_no_links.py +255 -0
  70. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_table_no_links_all_of_table_params.py +108 -0
  71. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_table_no_links_index_params_advanced_params.py +120 -0
  72. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_vector_vector_collection.py +115 -0
  73. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vec_db_vector_vector_item.py +101 -0
  74. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_debug_flags.py +411 -0
  75. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_embed_input_item.py +88 -0
  76. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_embed_item.py +100 -0
  77. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_embed_request.py +131 -0
  78. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_embed_response.py +106 -0
  79. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_index_params.py +174 -0
  80. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_index_params_metadata_index_params.py +116 -0
  81. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_index_params_vector_index_params.py +246 -0
  82. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_index_params_vector_index_params_distribute_params.py +111 -0
  83. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_rerank_item.py +95 -0
  84. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_rerank_request.py +138 -0
  85. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/models/vector_rerank_request_model_params.py +106 -0
  86. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/py.typed +0 -0
  87. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/rest.py +269 -0
  88. oracle_vecdb-1.0.0/src/oracle_vecdb/services/ords/runtime_compat.py +436 -0
  89. oracle_vecdb-1.0.0/src/oracle_vecdb/types.py +55 -0
  90. oracle_vecdb-1.0.0/src/oracle_vecdb/validation.py +88 -0
  91. oracle_vecdb-1.0.0/src/oracle_vecdb/vecdb_errors.py +173 -0
  92. oracle_vecdb-1.0.0/src/oracle_vecdb/vecdb_exception.py +543 -0
  93. oracle_vecdb-1.0.0/src/oracle_vecdb/version.py +4 -0
  94. oracle_vecdb-1.0.0/src/oracle_vecdb.egg-info/PKG-INFO +282 -0
  95. oracle_vecdb-1.0.0/src/oracle_vecdb.egg-info/SOURCES.txt +96 -0
  96. oracle_vecdb-1.0.0/src/oracle_vecdb.egg-info/dependency_links.txt +1 -0
  97. oracle_vecdb-1.0.0/src/oracle_vecdb.egg-info/requires.txt +26 -0
  98. oracle_vecdb-1.0.0/src/oracle_vecdb.egg-info/top_level.txt +1 -0
@@ -0,0 +1,54 @@
1
+ Changelog
2
+ =========
3
+
4
+ All notable changes to this project will be documented in this file.
5
+
6
+ The format is based on the `Keep a Changelog <https://keepachangelog.com/en/1.1.0/>`__,
7
+ and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`__.
8
+
9
+ 1.0.0 - 2026-07-15
10
+ ------------------
11
+
12
+ Added
13
+ ~~~~~
14
+
15
+ - Initial public release of oracle_vecdb
16
+ - Support for vector table management, indexing, search, and inference operations in Oracle AI Database (26ai+). Refer this for detailed documentation -
17
+ https://docs.oracle.com/en/cloud/paas/autonomous-vector-database/vcapi/overview.html
18
+
19
+
20
+ 1.0.0b2 - 2026-04-30
21
+ ------------------
22
+
23
+ Added
24
+ ~~~~~
25
+
26
+ - Added support for automatic batching during large dataset upsert.
27
+ - Added support for case-insensitive input keys, allowing user data to use any capitalization for ID, DENSE_VECTOR, and METADATA.
28
+ - Updated the host URL validation pattern to work in ExaCC environments for pool mappings.
29
+ - Added "rest_url" as the preferred parameter and deprecated "host", with support for disabling "host" later via a feature toggle.
30
+
31
+ Changed
32
+ ~~~~~~~
33
+
34
+ - Renamed `agent.md` to `AGENTS.md` and streamlined it around verified public SDK workflows.
35
+
36
+ Fixed
37
+ ~~~~~
38
+
39
+ - Fixed the ``rerank`` API reference to mention results from ``query`` instead of ``query_vectors()``.
40
+
41
+ 1.0.0b1 - 2026-03-24
42
+ ------------------
43
+
44
+ Added
45
+ ~~~~~
46
+
47
+ - Limited Availability release.
48
+ - Support for vector table management, indexing, search, and inference operations in Oracle AI Database (26ai+).
49
+
50
+
51
+ Compatibility
52
+ ----------
53
+ Requires - Oracle AI Database 23.26.3 and later with ORDS 26.2.2 and later
54
+ Supported languages: Python 3.10+
@@ -0,0 +1,35 @@
1
+ Copyright (c) 2026 Oracle and/or its affiliates.
2
+
3
+ The Universal Permissive License (UPL), Version 1.0
4
+
5
+ Subject to the condition set forth below, permission is hereby granted to any
6
+ person obtaining a copy of this software, associated documentation and/or data
7
+ (collectively the "Software"), free of charge and under any and all copyright
8
+ rights in the Software, and any and all patent rights owned or freely
9
+ licensable by each licensor hereunder covering either (i) the unmodified
10
+ Software as contributed to or provided by such licensor, or (ii) the Larger
11
+ Works (as defined below), to deal in both
12
+
13
+ (a) the Software, and
14
+ (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15
+ one is included with the Software (each a "Larger Work" to which the Software
16
+ is contributed by such licensors),
17
+
18
+ without restriction, including without limitation the rights to copy, create
19
+ derivative works of, display, perform, and distribute the Software and make,
20
+ use, sell, offer for sale, import, export, have made, and have sold the
21
+ Software and the Larger Work(s), and to sublicense the foregoing rights on
22
+ either these or other terms.
23
+
24
+ This license is subject to the following condition:
25
+ The above copyright notice and either this complete permission notice or at
26
+ a minimum a reference to the UPL must be included in all copies or
27
+ substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include LICENSE.txt README.md CHANGELOG.rst pyproject.toml
2
+ recursive-include examples *.py
@@ -0,0 +1,282 @@
1
+ Metadata-Version: 2.4
2
+ Name: oracle-vecdb
3
+ Version: 1.0.0
4
+ Summary: Oracle VecDB Python SDK
5
+ Author: Oracle
6
+ License-Expression: UPL-1.0
7
+ Project-URL: Repository, https://github.com/oracle/vecdb-python-sdk
8
+ Project-URL: Homepage, https://docs.oracle.com/en-us/iaas/tools/vecdb/latest/index.html
9
+ Keywords: Oracle,vecdb,vector,database,ords,sdk
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Database :: Database Engines/Servers
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Requires-Python: <3.15,>=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE.txt
23
+ Requires-Dist: urllib3<3.0.0,>=2.1.0
24
+ Requires-Dist: python-dateutil>=2.8.2
25
+ Requires-Dist: pydantic>=2
26
+ Requires-Dist: typing-extensions>=4.7.1
27
+ Provides-Extra: dev
28
+ Requires-Dist: black; extra == "dev"
29
+ Requires-Dist: flake8; extra == "dev"
30
+ Requires-Dist: mypy; extra == "dev"
31
+ Requires-Dist: bandit; extra == "dev"
32
+ Requires-Dist: types-python-dateutil; extra == "dev"
33
+ Requires-Dist: build; extra == "dev"
34
+ Requires-Dist: tox; extra == "dev"
35
+ Requires-Dist: oci-cli; extra == "dev"
36
+ Provides-Extra: test
37
+ Requires-Dist: pytest; extra == "test"
38
+ Requires-Dist: pytest-cov; extra == "test"
39
+ Requires-Dist: pytest-mock; extra == "test"
40
+ Requires-Dist: pytest-xdist; extra == "test"
41
+ Requires-Dist: lxml; extra == "test"
42
+ Provides-Extra: doc
43
+ Requires-Dist: sphinx; extra == "doc"
44
+ Requires-Dist: sphinx_autodoc_typehints; extra == "doc"
45
+ Requires-Dist: sphinx-rtd-theme; extra == "doc"
46
+ Dynamic: license-file
47
+
48
+ # Oracle VecDB Python SDK &nbsp;โšก๏ธ
49
+
50
+ <p align="center">
51
+ <img src="https://img.shields.io/pypi/v/oracle-vecdb?color=%23f80000&label=PyPI&logo=python" alt="PyPI">
52
+ <img src="https://img.shields.io/pypi/pyversions/oracle-vecdb.svg?logo=python&label=Python" alt="Python Versions">
53
+ <img src="https://img.shields.io/badge/status-active-success?style=flat" alt="Status">
54
+ </p>
55
+
56
+ ## ๐Ÿš€ About
57
+
58
+ Oracle VecDB Python SDK is the Python client for the Oracle AI Database (26ai+). It covers both Autonomous AI Vector Database deployments and customer-managed Oracle AI Database instances where ORDS is enabled, offering simple APIs for vector table management, indexing, search, and inference operations.
59
+
60
+
61
+ ## โœจ Highlights
62
+
63
+ - ๐Ÿ” Typed client with simple auth + configuration
64
+ - ๐Ÿ“ฆ Manage vector tables, vector indexes, and metadata programmatically
65
+ - ๐Ÿง  Run embeddings & inference flows via Oracle AI Database models
66
+ - ๐Ÿ”„ Integrate vector search, filtering, and RAG-style pipelines quickly
67
+
68
+
69
+ ## ๐Ÿ“ฆ Installation
70
+
71
+ ```bash
72
+ pip install oracle-vecdb
73
+ ```
74
+
75
+ **Requires:** Python 3.10+
76
+
77
+
78
+ ## ๐Ÿš€ Quickstart
79
+
80
+ ```python
81
+ from oracle_vecdb import OracleVecDB, Configuration
82
+
83
+ config = Configuration(
84
+ rest_url="https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/",
85
+ # choose one auth method
86
+ access_token="<bearer-token>",
87
+ # or username="<user>", password="<pass>",
88
+ )
89
+
90
+ vecdb = OracleVecDB(config)
91
+
92
+ vecdb.create_vector_table(
93
+ name="demo",
94
+ table_params={"auto_generate_id": True},
95
+ embed_params={
96
+ "model": "all_MiniLM_L12_v2", # must be preloaded via Vector Database Console or load_model()
97
+ "embed_metadata_jsonpath": "content", # JSON field in metadata to extract text from for embedding
98
+ },
99
+ )
100
+
101
+ vecdb.upsert_vectors(
102
+ table_name="demo",
103
+ vectors=[
104
+ {
105
+ "metadata": {
106
+ "title": "Comedy movie review",
107
+ "content": "A lighthearted comedy with fast-paced jokes.", # text to embed
108
+ "genre": "comedy",
109
+ }
110
+ },
111
+ {
112
+ "metadata": {
113
+ "title": "Drama movie review",
114
+ "content": "An emotional family drama with strong performances.",
115
+ "genre": "drama",
116
+ }
117
+ },
118
+ ],
119
+ )
120
+
121
+ results = vecdb.query(
122
+ table_name="demo",
123
+ query_by={"text": "family drama"}, # uses integrated embeddings for the query text
124
+ filters={"genre": {"$eq": "drama"}},
125
+ top_k=1,
126
+ )
127
+
128
+ for index in range(len(results)):
129
+ item = results[index]
130
+ row = item if isinstance(item, dict) else item.model_dump()
131
+ print(row["id"], row["distance"], row["metadata"])
132
+ ```
133
+
134
+ ### ๐Ÿ“ฅ Ingestion Options
135
+
136
+ #### Bring your own vectors
137
+
138
+ ```python
139
+ vecdb.create_vector_table(name="demo")
140
+ # Large inline datasets >32MB are automatically split into bounded requests.
141
+ # Batching preserves order but does not deduplicate IDs or guarantee avoidance
142
+ # of service rate limits.
143
+ response = vecdb.upsert_vectors(
144
+ table_name="demo",
145
+ vectors=[
146
+ {"id": "1", "dense_vector": [0.1, 0.1], "metadata": {"genre": "comedy"}},
147
+ {"id": "2", "dense_vector": [0.2, 0.2], "metadata": {"genre": "drama"}},
148
+ ],
149
+ )
150
+ print(response.upserted_count)
151
+ ```
152
+
153
+ For huge dataset, prefer asynchronous bulk loading from object
154
+ storage instead of sending a large inline JSON request. This avoids keeping
155
+ the complete dataset in the request body and is better suited to production
156
+ ingestion workloads:
157
+
158
+ ```python
159
+ load_job = vecdb.load_vectors(
160
+ table_name="demo",
161
+ url="https://objectstorage.<region>.oraclecloud.com/<namespace>/<bucket>/vectors.csv",
162
+ params={"credential": "<oci-credential-name>"},
163
+ )
164
+
165
+ status = vecdb.describe_vector_load_job(load_job.job_name)
166
+ print(status.state)
167
+ ```
168
+
169
+ The CSV should contain `id`, `dense_vector`, and `metadata` columns. Use an
170
+ OCI credential configured for the database when the object is not publicly
171
+ readable. Do not place signed URLs or credentials directly in application
172
+ logs. `upsert_vectors` remains useful for small inline batches and is
173
+ automatically split below the service JSON limit, but it does not replace
174
+ bulk loading for large files.
175
+
176
+ ```python
177
+ results = vecdb.query(
178
+ table_name="demo",
179
+ query_by={"vector": [0.15, 0.1]},
180
+ filters={"genre": {"$eq": "drama"}},
181
+ top_k=1,
182
+ )
183
+
184
+ for index in range(len(results)):
185
+ item = results[index]
186
+ row = item if isinstance(item, dict) else item.model_dump()
187
+ print(row["metadata"]["genre"])
188
+
189
+ # Collection endpoints support ORDS pagination. Existing calls without these
190
+ # arguments retain the server's default page size.
191
+ tables_page = vecdb.list_vector_tables(limit=25, offset=25)
192
+ models_page = vecdb.list_models(limit=25, offset=0)
193
+ ```
194
+
195
+ ### ๐Ÿ”ง Indexing & tuning
196
+
197
+ Delay index creation until `create_index()`
198
+
199
+ ```python
200
+ vecdb.create_vector_table(
201
+ name="demo_byuser",
202
+ index_params={
203
+ "vector_index_params": {
204
+ "auto_index": False,
205
+ }
206
+ },
207
+ )
208
+
209
+ vecdb.create_index(
210
+ table_name="demo_byuser",
211
+ )
212
+ ```
213
+
214
+ Create HNSW index instead of default IVF
215
+
216
+ ```python
217
+ vecdb.create_vector_table(
218
+ name="demo_hnsw",
219
+ index_params={
220
+ "vector_index_params": {
221
+ "auto_index": True,
222
+ "organization": "INMEMORY GRAPH", # HNSW-style index organization
223
+ "distance_metric": "COSINE",
224
+ "advanced_params": {
225
+ "neighbors": 32, # higher = better recall, more memory
226
+ "efConstruction": 200, # higher = better recall, slower index build
227
+ },
228
+ },
229
+ },
230
+ )
231
+ ```
232
+
233
+ Query-time HNSW tuning
234
+
235
+ ```python
236
+ results = vecdb.query(
237
+ table_name="demo",
238
+ query_by={"text": "family drama"},
239
+ filters={"genre": {"$eq": "drama"}},
240
+ top_k=1,
241
+ advanced_options={
242
+ "idx_parameters": {
243
+ "efsearch": 64, # number of candidates explored (higher = better recall, higher latency)
244
+ }
245
+ },
246
+ )
247
+ ```
248
+
249
+
250
+ ## ๐Ÿงช Sample notebooks & apps
251
+
252
+ - [Sample notebooks](https://github.com/oracle-devrel/oracle-ai-developer-hub/tree/main/notebooks/vecdb) โ€“ Guided notebooks for setup, table/index workflows, vector search, and inference via the SDK.
253
+ - [Sample applications](https://github.com/oracle-devrel/oracle-ai-developer-hub/tree/main/apps/vecdb) โ€“ Oracle AI Developer Hub apps showcasing ingestion, embeddings, search, filtering, and FastAPI + React/Vite integration using this SDK.
254
+
255
+ ## ๐Ÿ“š Documentation & Resources
256
+
257
+ Most SDK methods return typed response models. Import stable SDK response types
258
+ from `oracle_vecdb.data_types`, and use `.model_dump()` or `.to_dict()` when
259
+ you need a plain dictionary representation.
260
+
261
+ - [Autonomous AI Vector Database docs](https://docs.oracle.com/en/cloud/paas/autonomous-vector-database)
262
+ - [Autonomous AI Vector Database setup guide](https://docs.oracle.com/en/cloud/paas/autonomous-vector-database/vecdb/get-started-using-autonomous-ai-vector-database.html)
263
+ - [Customer-managed Oracle AI Database (26ai+) requirements](https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/26.2/) โ€“ DB 23.26.3+ with ORDS 26.2.2+, plus TLS/ORDS notes for handling self-signed certificates
264
+ - [Quickstart guide](./docs/source/quickstart.rst)
265
+ - [Installation notes](./docs/source/installation.rst)
266
+ - [API reference](https://docs.oracle.com/en/cloud/paas/autonomous-vector-database/vcapi/index.html)
267
+ - [Changelog](./CHANGELOG.rst)
268
+ - [Examples](./examples/test_client.py)
269
+
270
+
271
+
272
+ ## ๐Ÿค Contributing
273
+
274
+ This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)
275
+
276
+ ## ๐Ÿ” Security
277
+
278
+ Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process
279
+
280
+ ## ๐Ÿ“„ License
281
+
282
+ See [LICENSE.txt](./LICENSE.txt), [THIRD_PARTY_LICENSE.txt](./THIRD_PARTY_LICENSE.txt), and [NOTICE.txt](./NOTICE.txt).
@@ -0,0 +1,235 @@
1
+ # Oracle VecDB Python SDK &nbsp;โšก๏ธ
2
+
3
+ <p align="center">
4
+ <img src="https://img.shields.io/pypi/v/oracle-vecdb?color=%23f80000&label=PyPI&logo=python" alt="PyPI">
5
+ <img src="https://img.shields.io/pypi/pyversions/oracle-vecdb.svg?logo=python&label=Python" alt="Python Versions">
6
+ <img src="https://img.shields.io/badge/status-active-success?style=flat" alt="Status">
7
+ </p>
8
+
9
+ ## ๐Ÿš€ About
10
+
11
+ Oracle VecDB Python SDK is the Python client for the Oracle AI Database (26ai+). It covers both Autonomous AI Vector Database deployments and customer-managed Oracle AI Database instances where ORDS is enabled, offering simple APIs for vector table management, indexing, search, and inference operations.
12
+
13
+
14
+ ## โœจ Highlights
15
+
16
+ - ๐Ÿ” Typed client with simple auth + configuration
17
+ - ๐Ÿ“ฆ Manage vector tables, vector indexes, and metadata programmatically
18
+ - ๐Ÿง  Run embeddings & inference flows via Oracle AI Database models
19
+ - ๐Ÿ”„ Integrate vector search, filtering, and RAG-style pipelines quickly
20
+
21
+
22
+ ## ๐Ÿ“ฆ Installation
23
+
24
+ ```bash
25
+ pip install oracle-vecdb
26
+ ```
27
+
28
+ **Requires:** Python 3.10+
29
+
30
+
31
+ ## ๐Ÿš€ Quickstart
32
+
33
+ ```python
34
+ from oracle_vecdb import OracleVecDB, Configuration
35
+
36
+ config = Configuration(
37
+ rest_url="https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/",
38
+ # choose one auth method
39
+ access_token="<bearer-token>",
40
+ # or username="<user>", password="<pass>",
41
+ )
42
+
43
+ vecdb = OracleVecDB(config)
44
+
45
+ vecdb.create_vector_table(
46
+ name="demo",
47
+ table_params={"auto_generate_id": True},
48
+ embed_params={
49
+ "model": "all_MiniLM_L12_v2", # must be preloaded via Vector Database Console or load_model()
50
+ "embed_metadata_jsonpath": "content", # JSON field in metadata to extract text from for embedding
51
+ },
52
+ )
53
+
54
+ vecdb.upsert_vectors(
55
+ table_name="demo",
56
+ vectors=[
57
+ {
58
+ "metadata": {
59
+ "title": "Comedy movie review",
60
+ "content": "A lighthearted comedy with fast-paced jokes.", # text to embed
61
+ "genre": "comedy",
62
+ }
63
+ },
64
+ {
65
+ "metadata": {
66
+ "title": "Drama movie review",
67
+ "content": "An emotional family drama with strong performances.",
68
+ "genre": "drama",
69
+ }
70
+ },
71
+ ],
72
+ )
73
+
74
+ results = vecdb.query(
75
+ table_name="demo",
76
+ query_by={"text": "family drama"}, # uses integrated embeddings for the query text
77
+ filters={"genre": {"$eq": "drama"}},
78
+ top_k=1,
79
+ )
80
+
81
+ for index in range(len(results)):
82
+ item = results[index]
83
+ row = item if isinstance(item, dict) else item.model_dump()
84
+ print(row["id"], row["distance"], row["metadata"])
85
+ ```
86
+
87
+ ### ๐Ÿ“ฅ Ingestion Options
88
+
89
+ #### Bring your own vectors
90
+
91
+ ```python
92
+ vecdb.create_vector_table(name="demo")
93
+ # Large inline datasets >32MB are automatically split into bounded requests.
94
+ # Batching preserves order but does not deduplicate IDs or guarantee avoidance
95
+ # of service rate limits.
96
+ response = vecdb.upsert_vectors(
97
+ table_name="demo",
98
+ vectors=[
99
+ {"id": "1", "dense_vector": [0.1, 0.1], "metadata": {"genre": "comedy"}},
100
+ {"id": "2", "dense_vector": [0.2, 0.2], "metadata": {"genre": "drama"}},
101
+ ],
102
+ )
103
+ print(response.upserted_count)
104
+ ```
105
+
106
+ For huge dataset, prefer asynchronous bulk loading from object
107
+ storage instead of sending a large inline JSON request. This avoids keeping
108
+ the complete dataset in the request body and is better suited to production
109
+ ingestion workloads:
110
+
111
+ ```python
112
+ load_job = vecdb.load_vectors(
113
+ table_name="demo",
114
+ url="https://objectstorage.<region>.oraclecloud.com/<namespace>/<bucket>/vectors.csv",
115
+ params={"credential": "<oci-credential-name>"},
116
+ )
117
+
118
+ status = vecdb.describe_vector_load_job(load_job.job_name)
119
+ print(status.state)
120
+ ```
121
+
122
+ The CSV should contain `id`, `dense_vector`, and `metadata` columns. Use an
123
+ OCI credential configured for the database when the object is not publicly
124
+ readable. Do not place signed URLs or credentials directly in application
125
+ logs. `upsert_vectors` remains useful for small inline batches and is
126
+ automatically split below the service JSON limit, but it does not replace
127
+ bulk loading for large files.
128
+
129
+ ```python
130
+ results = vecdb.query(
131
+ table_name="demo",
132
+ query_by={"vector": [0.15, 0.1]},
133
+ filters={"genre": {"$eq": "drama"}},
134
+ top_k=1,
135
+ )
136
+
137
+ for index in range(len(results)):
138
+ item = results[index]
139
+ row = item if isinstance(item, dict) else item.model_dump()
140
+ print(row["metadata"]["genre"])
141
+
142
+ # Collection endpoints support ORDS pagination. Existing calls without these
143
+ # arguments retain the server's default page size.
144
+ tables_page = vecdb.list_vector_tables(limit=25, offset=25)
145
+ models_page = vecdb.list_models(limit=25, offset=0)
146
+ ```
147
+
148
+ ### ๐Ÿ”ง Indexing & tuning
149
+
150
+ Delay index creation until `create_index()`
151
+
152
+ ```python
153
+ vecdb.create_vector_table(
154
+ name="demo_byuser",
155
+ index_params={
156
+ "vector_index_params": {
157
+ "auto_index": False,
158
+ }
159
+ },
160
+ )
161
+
162
+ vecdb.create_index(
163
+ table_name="demo_byuser",
164
+ )
165
+ ```
166
+
167
+ Create HNSW index instead of default IVF
168
+
169
+ ```python
170
+ vecdb.create_vector_table(
171
+ name="demo_hnsw",
172
+ index_params={
173
+ "vector_index_params": {
174
+ "auto_index": True,
175
+ "organization": "INMEMORY GRAPH", # HNSW-style index organization
176
+ "distance_metric": "COSINE",
177
+ "advanced_params": {
178
+ "neighbors": 32, # higher = better recall, more memory
179
+ "efConstruction": 200, # higher = better recall, slower index build
180
+ },
181
+ },
182
+ },
183
+ )
184
+ ```
185
+
186
+ Query-time HNSW tuning
187
+
188
+ ```python
189
+ results = vecdb.query(
190
+ table_name="demo",
191
+ query_by={"text": "family drama"},
192
+ filters={"genre": {"$eq": "drama"}},
193
+ top_k=1,
194
+ advanced_options={
195
+ "idx_parameters": {
196
+ "efsearch": 64, # number of candidates explored (higher = better recall, higher latency)
197
+ }
198
+ },
199
+ )
200
+ ```
201
+
202
+
203
+ ## ๐Ÿงช Sample notebooks & apps
204
+
205
+ - [Sample notebooks](https://github.com/oracle-devrel/oracle-ai-developer-hub/tree/main/notebooks/vecdb) โ€“ Guided notebooks for setup, table/index workflows, vector search, and inference via the SDK.
206
+ - [Sample applications](https://github.com/oracle-devrel/oracle-ai-developer-hub/tree/main/apps/vecdb) โ€“ Oracle AI Developer Hub apps showcasing ingestion, embeddings, search, filtering, and FastAPI + React/Vite integration using this SDK.
207
+
208
+ ## ๐Ÿ“š Documentation & Resources
209
+
210
+ Most SDK methods return typed response models. Import stable SDK response types
211
+ from `oracle_vecdb.data_types`, and use `.model_dump()` or `.to_dict()` when
212
+ you need a plain dictionary representation.
213
+
214
+ - [Autonomous AI Vector Database docs](https://docs.oracle.com/en/cloud/paas/autonomous-vector-database)
215
+ - [Autonomous AI Vector Database setup guide](https://docs.oracle.com/en/cloud/paas/autonomous-vector-database/vecdb/get-started-using-autonomous-ai-vector-database.html)
216
+ - [Customer-managed Oracle AI Database (26ai+) requirements](https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/26.2/) โ€“ DB 23.26.3+ with ORDS 26.2.2+, plus TLS/ORDS notes for handling self-signed certificates
217
+ - [Quickstart guide](./docs/source/quickstart.rst)
218
+ - [Installation notes](./docs/source/installation.rst)
219
+ - [API reference](https://docs.oracle.com/en/cloud/paas/autonomous-vector-database/vcapi/index.html)
220
+ - [Changelog](./CHANGELOG.rst)
221
+ - [Examples](./examples/test_client.py)
222
+
223
+
224
+
225
+ ## ๐Ÿค Contributing
226
+
227
+ This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)
228
+
229
+ ## ๐Ÿ” Security
230
+
231
+ Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process
232
+
233
+ ## ๐Ÿ“„ License
234
+
235
+ See [LICENSE.txt](./LICENSE.txt), [THIRD_PARTY_LICENSE.txt](./THIRD_PARTY_LICENSE.txt), and [NOTICE.txt](./NOTICE.txt).
@@ -0,0 +1,71 @@
1
+ ##
2
+ ## Copyright (c) 2026 Oracle and/or its affiliates.
3
+ ## Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
4
+ ##
5
+
6
+ import os
7
+ from oracle_vecdb import OracleVecDB, Configuration
8
+
9
+
10
+ def main():
11
+ # Use a valid HTTPS ORDS VecDB endpoint. Example pattern:
12
+ # https://<host>:<port>/ords/<schema>/_/db-api/stable/vecdb/
13
+ config = Configuration(
14
+ rest_url="https://example.com/ords/foo/_/db-api/stable/vecdb/",
15
+ username="username",
16
+ password=os.getenv("DB_PASSWORD"),
17
+ )
18
+
19
+ vecdb = OracleVecDB(config)
20
+
21
+ try:
22
+ vecdb.create_vector_table(name="TEST_DB")
23
+ vecdb.upsert_vectors(
24
+ table_name="TEST_DB",
25
+ vectors=[
26
+ {
27
+ "id": "A",
28
+ "dense_vector": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
29
+ "metadata": {"genre": "comedy", "year": 2020},
30
+ },
31
+ {
32
+ "id": "B",
33
+ "dense_vector": [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2],
34
+ "metadata": {"genre": "documentary", "year": 2019},
35
+ },
36
+ {
37
+ "id": "C",
38
+ "dense_vector": [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
39
+ "metadata": {"genre": "comedy", "year": 2019},
40
+ },
41
+ {
42
+ "id": "D",
43
+ "dense_vector": [0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4],
44
+ "metadata": {"genre": "drama"},
45
+ },
46
+ ],
47
+ )
48
+ result = vecdb.query(
49
+ table_name="TEST_DB",
50
+ query_by={
51
+ "vector": [
52
+ -0.00337490835,
53
+ 0.0575999133,
54
+ -0.0147442026,
55
+ -0.0645009279,
56
+ 0.0645009279,
57
+ 0.0645009279,
58
+ 0.0645009279,
59
+ 0.0645009279,
60
+ ]
61
+ },
62
+ top_k=2,
63
+ )
64
+
65
+ print(result)
66
+ except Exception as exc:
67
+ print("An error occurred:", exc)
68
+
69
+
70
+ if __name__ == "__main__":
71
+ main()