Skip to content

Commit 7b141e4

Browse files
Sync Core Integrations API reference (oracle) on Docusaurus (#11122)
Co-authored-by: davidsbatista <7937824+davidsbatista@users.noreply.github.com>
1 parent 07e8c9b commit 7b141e4

11 files changed

Lines changed: 3586 additions & 0 deletions

File tree

Lines changed: 326 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,326 @@
1+
---
2+
title: "Oracle AI Vector Search"
3+
id: integrations-oracle
4+
description: "Oracle AI Vector Search integration for Haystack"
5+
slug: "/integrations-oracle"
6+
---
7+
8+
9+
## haystack_integrations.components.retrievers.oracle.embedding_retriever
10+
11+
### OracleEmbeddingRetriever
12+
13+
Retrieves documents from an OracleDocumentStore using vector similarity.
14+
15+
Use inside a Haystack pipeline after a text embedder::
16+
17+
```
18+
pipeline.add_component("embedder", SentenceTransformersTextEmbedder())
19+
pipeline.add_component("retriever", OracleEmbeddingRetriever(
20+
document_store=store, top_k=5
21+
))
22+
pipeline.connect("embedder.embedding", "retriever.query_embedding")
23+
```
24+
25+
#### run
26+
27+
```python
28+
run(
29+
query_embedding: list[float],
30+
filters: dict[str, Any] | None = None,
31+
top_k: int | None = None,
32+
) -> dict[str, list[Document]]
33+
```
34+
35+
Retrieve documents by vector similarity.
36+
37+
Args:
38+
query_embedding: Dense float vector from an embedder component.
39+
filters: Runtime filters, merged with constructor filters according to filter_policy.
40+
top_k: Override the constructor top_k for this call.
41+
42+
Returns:
43+
`{"documents": [Document, ...]}`
44+
45+
#### run_async
46+
47+
```python
48+
run_async(
49+
query_embedding: list[float],
50+
filters: dict[str, Any] | None = None,
51+
top_k: int | None = None,
52+
) -> dict[str, list[Document]]
53+
```
54+
55+
Async variant of :meth:`run`.
56+
57+
#### to_dict
58+
59+
```python
60+
to_dict() -> dict[str, Any]
61+
```
62+
63+
Serializes the component to a dictionary.
64+
65+
**Returns:**
66+
67+
- <code>dict\[str, Any\]</code> – Dictionary with serialized data.
68+
69+
#### from_dict
70+
71+
```python
72+
from_dict(data: dict[str, Any]) -> OracleEmbeddingRetriever
73+
```
74+
75+
Deserializes the component from a dictionary.
76+
77+
**Parameters:**
78+
79+
- **data** (<code>dict\[str, Any\]</code>) – Dictionary to deserialize from.
80+
81+
**Returns:**
82+
83+
- <code>OracleEmbeddingRetriever</code> – Deserialized component.
84+
85+
## haystack_integrations.document_stores.oracle.document_store
86+
87+
### OracleConnectionConfig
88+
89+
Connection parameters for Oracle Database.
90+
91+
Supports both thin (direct TCP) and thick (wallet / ADB-S) modes.
92+
Thin mode requires no Oracle Instant Client; thick mode is activated
93+
automatically when *wallet_location* is provided.
94+
95+
#### to_dict
96+
97+
```python
98+
to_dict() -> dict[str, Any]
99+
```
100+
101+
Serializes the component to a dictionary.
102+
103+
**Returns:**
104+
105+
- <code>dict\[str, Any\]</code> – Dictionary with serialized data.
106+
107+
#### from_dict
108+
109+
```python
110+
from_dict(data: dict[str, Any]) -> OracleConnectionConfig
111+
```
112+
113+
Deserializes the component from a dictionary.
114+
115+
**Parameters:**
116+
117+
- **data** (<code>dict\[str, Any\]</code>) – Dictionary to deserialize from.
118+
119+
**Returns:**
120+
121+
- <code>OracleConnectionConfig</code> – Deserialized component.
122+
123+
### OracleDocumentStore
124+
125+
Haystack DocumentStore backed by Oracle AI Vector Search.
126+
127+
Requires Oracle Database 23ai or later (for VECTOR data type and
128+
IF NOT EXISTS DDL support).
129+
130+
Usage::
131+
132+
```
133+
from haystack.utils import Secret
134+
from haystack_integrations.document_stores.oracle import (
135+
OracleDocumentStore, OracleConnectionConfig,
136+
)
137+
138+
store = OracleDocumentStore(
139+
connection_config=OracleConnectionConfig(
140+
user=Secret.from_env_var("ORACLE_USER"),
141+
password=Secret.from_env_var("ORACLE_PASSWORD"),
142+
dsn=Secret.from_env_var("ORACLE_DSN"),
143+
),
144+
embedding_dim=1536,
145+
)
146+
```
147+
148+
#### create_hnsw_index
149+
150+
```python
151+
create_hnsw_index() -> None
152+
```
153+
154+
Create an HNSW vector index on the embedding column.
155+
156+
Safe to call multiple times — uses IF NOT EXISTS.
157+
158+
#### create_hnsw_index_async
159+
160+
```python
161+
create_hnsw_index_async() -> None
162+
```
163+
164+
Async variant of create_hnsw_index.
165+
166+
#### write_documents
167+
168+
```python
169+
write_documents(
170+
documents: list[Document], policy: DuplicatePolicy = DuplicatePolicy.NONE
171+
) -> int
172+
```
173+
174+
Writes documents to the document store.
175+
176+
**Parameters:**
177+
178+
- **documents** (<code>list\[Document\]</code>) – A list of Documents to write to the document store.
179+
- **policy** (<code>DuplicatePolicy</code>) – The duplicate policy to use when writing documents.
180+
181+
**Returns:**
182+
183+
- <code>int</code> – The number of documents written to the document store.
184+
185+
**Raises:**
186+
187+
- <code>DuplicateDocumentError</code> – If a document with the same id already exists in the document store
188+
and the policy is set to `DuplicatePolicy.FAIL` or `DuplicatePolicy.NONE`.
189+
190+
#### write_documents_async
191+
192+
```python
193+
write_documents_async(
194+
documents: list[Document], policy: DuplicatePolicy = DuplicatePolicy.NONE
195+
) -> int
196+
```
197+
198+
Asynchronously writes documents to the document store.
199+
200+
**Parameters:**
201+
202+
- **documents** (<code>list\[Document\]</code>) – A list of Documents to write to the document store.
203+
- **policy** (<code>DuplicatePolicy</code>) – The duplicate policy to use when writing documents.
204+
205+
**Returns:**
206+
207+
- <code>int</code> – The number of documents written to the document store.
208+
209+
**Raises:**
210+
211+
- <code>DuplicateDocumentError</code> – If a document with the same id already exists in the document store
212+
and the policy is set to `DuplicatePolicy.FAIL` or `DuplicatePolicy.NONE`.
213+
214+
#### filter_documents
215+
216+
```python
217+
filter_documents(filters: dict[str, Any] | None = None) -> list[Document]
218+
```
219+
220+
Returns the documents that match the filters provided.
221+
222+
For a detailed specification of the filters,
223+
refer to the [documentation](https://docs.haystack.deepset.ai/docs/metadata-filtering)
224+
225+
**Parameters:**
226+
227+
- **filters** (<code>dict\[str, Any\] | None</code>) – The filters to apply to the document list.
228+
229+
**Returns:**
230+
231+
- <code>list\[Document\]</code> – A list of Documents that match the given filters.
232+
233+
#### filter_documents_async
234+
235+
```python
236+
filter_documents_async(filters: dict[str, Any] | None = None) -> list[Document]
237+
```
238+
239+
Asynchronously returns the documents that match the filters provided.
240+
241+
For a detailed specification of the filters,
242+
refer to the [documentation](https://docs.haystack.deepset.ai/docs/metadata-filtering)
243+
244+
**Parameters:**
245+
246+
- **filters** (<code>dict\[str, Any\] | None</code>) – The filters to apply to the document list.
247+
248+
**Returns:**
249+
250+
- <code>list\[Document\]</code> – A list of Documents that match the given filters.
251+
252+
#### delete_documents
253+
254+
```python
255+
delete_documents(document_ids: list[str]) -> None
256+
```
257+
258+
Deletes documents that match the provided `document_ids` from the document store.
259+
260+
**Parameters:**
261+
262+
- **document_ids** (<code>list\[str\]</code>) – the document ids to delete
263+
264+
#### delete_documents_async
265+
266+
```python
267+
delete_documents_async(document_ids: list[str]) -> None
268+
```
269+
270+
Asynchronously deletes documents that match the provided `document_ids` from the document store.
271+
272+
**Parameters:**
273+
274+
- **document_ids** (<code>list\[str\]</code>) – the document ids to delete
275+
276+
#### count_documents
277+
278+
```python
279+
count_documents() -> int
280+
```
281+
282+
Returns how many documents are present in the document store.
283+
284+
**Returns:**
285+
286+
- <code>int</code> – Number of documents in the document store.
287+
288+
#### count_documents_async
289+
290+
```python
291+
count_documents_async() -> int
292+
```
293+
294+
Asynchronously returns how many documents are present in the document store.
295+
296+
**Returns:**
297+
298+
- <code>int</code> – Number of documents in the document store.
299+
300+
#### to_dict
301+
302+
```python
303+
to_dict() -> dict[str, Any]
304+
```
305+
306+
Serializes the component to a dictionary.
307+
308+
**Returns:**
309+
310+
- <code>dict\[str, Any\]</code> – Dictionary with serialized data.
311+
312+
#### from_dict
313+
314+
```python
315+
from_dict(data: dict[str, Any]) -> OracleDocumentStore
316+
```
317+
318+
Deserializes the component from a dictionary.
319+
320+
**Parameters:**
321+
322+
- **data** (<code>dict\[str, Any\]</code>) – Dictionary to deserialize from.
323+
324+
**Returns:**
325+
326+
- <code>OracleDocumentStore</code> – Deserialized component.

0 commit comments

Comments
 (0)