|
| 1 | +# Agent Guide: vecdb-python-sdk |
| 2 | + |
| 3 | +## Purpose |
| 4 | + |
| 5 | +- This repository owns the Oracle VecDB Python SDK, its public Python API, |
| 6 | + examples, package metadata, tests, and changelog. |
| 7 | + |
| 8 | +## Workspace Setup |
| 9 | + |
| 10 | +- Python 3.10+ is the user-facing requirement from `README.md` and |
| 11 | + `pyproject.toml`. |
| 12 | +- Keep real hosts, tokens, usernames, passwords, and production table names out |
| 13 | + of committed examples, tests, issues, and reviews. |
| 14 | +- Prefer `Configuration.access_token` when bearer tokens are available; use |
| 15 | + username/password only when the target environment requires it. |
| 16 | +- Use host placeholders that preserve the documented ORDS VecDB URL shape: |
| 17 | + `https://<host>/ords/<schema>/_/db-api/stable/vecdb/`. |
| 18 | + |
| 19 | +## API Surface (OracleVecDB) |
| 20 | + |
| 21 | +- Table management (`create_vector_table`, `describe_vector_table`, |
| 22 | + `drop_vector_table`, `list_vector_tables`, `update_vector_table_annotation`). |
| 23 | +- Index lifecycle (`create_index`, `describe_index`, `describe_index_job`, |
| 24 | + `list_index_jobs`, `get_index_job_log`, `rebuild_index`, `drop_index`). |
| 25 | +- Inference (`generate_embedding`, `rerank`). |
| 26 | +- Model orchestration (`load_model`, `list_models`, `describe_model`, |
| 27 | + `drop_model`). |
| 28 | +- Vector operations (`upsert_vectors`, `list_vectors`, `delete_vectors`, |
| 29 | + `load_vectors`, `describe_vector_load_job`, `get_vector_load_job_log`, |
| 30 | + `list_vector_load_jobs`). |
| 31 | +- Search (`query`). |
| 32 | +- Summary (`describe_vector_database`). |
| 33 | + |
| 34 | +## Capability Workflows |
| 35 | + |
| 36 | +- Authentication and configuration: construct `Configuration` with a VecDB ORDS |
| 37 | + host and either `access_token` or `username`/`password`, then pass it to |
| 38 | + `OracleVecDB`. |
| 39 | +- Model management: use `list_models` and `describe_model` before binding a |
| 40 | + model to table or rerank workflows. Use `load_model` and `drop_model` only |
| 41 | + when the task explicitly includes model lifecycle work. |
| 42 | +- Vector tables: use `describe_vector_database` and `list_vector_tables` for |
| 43 | + discovery, `create_vector_table` for storage, `describe_vector_table` for |
| 44 | + schema/index checks, `update_vector_table_annotation` for metadata updates, |
| 45 | + and `drop_vector_table` for cleanup when the workflow owns the table. |
| 46 | +- Ingestion: use `upsert_vectors` for inline batches, `delete_vectors` for |
| 47 | + removing known records, `list_vectors` for inspection, and `load_vectors` |
| 48 | + for object-storage bulk ingestion. Monitor bulk jobs with |
| 49 | + `list_vector_load_jobs`, `describe_vector_load_job`, and |
| 50 | + `get_vector_load_job_log`. |
| 51 | +- Embeddings and reranking: use hosted VecDB model flows through |
| 52 | + `generate_embedding`, integrated table embedding configuration, `query`, and |
| 53 | + `rerank`. |
| 54 | +- Search: use `query` with `query_by`, `top_k`, and verified `filters`. Query |
| 55 | + examples may search by text, vector, or record ID only when that shape is |
| 56 | + verified from README, docs, source, tests, or explicit checked instruction. |
| 57 | +- Index lifecycle: use `create_index`, `list_index_jobs`, |
| 58 | + `describe_index_job`, `get_index_job_log`, `rebuild_index`, |
| 59 | + `describe_index`, and `drop_index` for index build, monitoring, tuning, and |
| 60 | + cleanup workflows. |
| 61 | + |
| 62 | +## Query Filters |
| 63 | + |
| 64 | +The public `query` method accepts a filter dictionary and forwards it through |
| 65 | +the SDK request model. The REST documentation lists these filter operators: |
| 66 | + |
| 67 | +```python |
| 68 | +filters = { |
| 69 | + "$and": [ |
| 70 | + {"ACCOUNT_CATEGORY": {"$eq": "Savings"}}, |
| 71 | + {"ELIGIBILITY": {"$eq": "Student"}}, |
| 72 | + {"MONTHLY_FEE": {"$lte": 5}}, |
| 73 | + ] |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +Use only filter operators documented in `docs/source/rest_api.rst` or verified |
| 78 | +by SDK tests. Do not copy filter syntax from another vector database product. |
| 79 | + |
| 80 | +## Quick Start |
| 81 | + |
| 82 | +- Use the `README.md` Quickstart as the source of truth for runnable |
| 83 | + quick-start examples. |
| 84 | +- Use the README Quickstart for integrated embedding flows and the README |
| 85 | + "Bring your own vectors" section for BYOV examples. |
| 86 | +- If a quick-start flow changes, update `README.md` first and keep this section |
| 87 | + as a pointer rather than duplicating runnable snippets. |
| 88 | +- Verify any adapted quick-start code against the public SDK surface in this |
| 89 | + repo before publishing it. |
| 90 | + |
| 91 | +## Workflow Pointers |
| 92 | + |
| 93 | +- For SDK consumer examples, start with `README.md` and `docs/source/`. |
| 94 | +- For public method availability, inspect `OracleVecDB` in |
| 95 | + `src/oracle_vecdb/client.py` and existing tests. |
| 96 | +- For request or response details, prefer typed SDK models and tests over |
| 97 | + copied REST payloads. |
| 98 | +- For examples that create resources, include cleanup when it is part of the |
| 99 | + demonstrated workflow and does not obscure the main point. |
| 100 | + |
| 101 | +## Troubleshooting |
| 102 | + |
| 103 | +- 401 or 403: check credentials, token freshness, endpoint privileges, and |
| 104 | + schema access without exposing secret values. |
| 105 | +- 404: verify the ORDS URL shape, schema segment, table name, model name, index |
| 106 | + name, and job name. |
| 107 | +- 409 or job conflicts: inspect existing load or index jobs before retrying. |
| 108 | +- Embedding or rerank failures: verify model availability and the public SDK |
| 109 | + request shape before suggesting code changes. |
| 110 | +- Large payloads: prefer `load_vectors` over massive inline upserts when the |
| 111 | + input is already staged in object storage. |
| 112 | +- Slow or unexpected search results: inspect table, index, filter, and query |
| 113 | + configuration using public SDK methods before recommending service tuning. |
0 commit comments