Skip to content

Commit e6f11f4

Browse files
author
Christopher Jones
authored
Don't swallow connection errors. Add doc link section (#29)
Signed-off-by: Christopher Jones <christopher.jones@oracle.com>
1 parent 8d7da8a commit e6f11f4

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

libs/oracledb/README.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ This package contains the LangChain integrations with [Oracle AI Vector Search](
88
python -m pip install -U langchain-oracledb
99
```
1010

11+
## Documentation
12+
13+
- [Oracle AI Vector Search: Vector Store](https://python.langchain.com/docs/integrations/vectorstores/oracle/)
14+
- [Oracle AI Vector Search: Generate Summary](https://python.langchain.com/docs/integrations/tools/oracleai/)
15+
- [Oracle AI Vector Search: Document Processing](https://python.langchain.com/docs/integrations/document_loaders/oracleai/)
16+
- [Oracle AI Vector Search: Generate Embeddings](https://python.langchain.com/docs/integrations/text_embedding/oracleai/)
17+
1118
## Examples
1219

1320
The following examples showcase basic usage of the components provided by `langchain-oracledb`.
@@ -16,23 +23,20 @@ Please refer to our complete demo guide [Oracle AI Vector Search End-to-End Demo
1623

1724
### Connect to Oracle Database
1825

19-
Some examples below require a connection with Oracle Database through `python-oracledb`. The following sample code will show how to connect to Oracle Database. By default, `python-oracledb` runs in a ‘Thin’ mode which connects directly to Oracle Database. This mode does not need Oracle Client libraries. However, some additional functionality is available when python-oracledb uses them. Python-oracledb is said to be in ‘Thick’ mode when Oracle Client libraries are used. Both modes have comprehensive functionality supporting the Python Database API v2.0 Specification. See the following [guide](https://python-oracledb.readthedocs.io/en/latest/user_guide/appendix_a.html#featuresummary) that talks about features supported in each mode. You might want to switch to thick-mode if you are unable to use thin-mode.
26+
Some examples below require a connection with Oracle Database through [`python-oracledb`](https://pypi.org/project/oracledb/). The following sample code will show how to connect to Oracle Database. By default, `python-oracledb` runs in a ‘Thin’ mode which connects directly to Oracle Database. This mode does not need Oracle Client libraries. However, some additional functionality is available when python-oracledb uses them. Python-oracledb is said to be in ‘Thick’ mode when Oracle Client libraries are used. Both modes have comprehensive functionality supporting the Python Database API v2.0 Specification. See the following [guide](https://python-oracledb.readthedocs.io/en/latest/user_guide/appendix_a.html#featuresummary) that talks about features supported in each mode. You might want to switch to Thick mode if you are unable to use Thin mode. For python-oracledb installation help, see [Installing python-oracledb](https://python-oracledb.readthedocs.io/en/latest/user_guide/installation.html).
27+
28+
Check your database connectivity:
2029

2130
```python
22-
import sys
2331
import oracledb
2432

25-
# please update with your username, password, hostname and service_name
33+
# Please update with your username, password, hostname, port and service_name
2634
username = "<username>"
2735
password = "<password>"
28-
dsn = "<hostname>/<service_name>"
29-
30-
try:
31-
conn = oracledb.connect(user=username, password=password, dsn=dsn)
32-
print("Connection successful!")
33-
except Exception as e:
34-
print("Connection failed!")
35-
sys.exit(1)
36+
dsn = "<hostname>:<port>/<service_name>"
37+
38+
connection = oracledb.connect(user=username, password=password, dsn=dsn)
39+
print("Connection successful!")
3640
```
3741

3842
### Vector Stores
@@ -196,10 +200,10 @@ embedder_params = {
196200
197201
# using huggingface
198202
embedder_params = {
199-
"provider": "huggingface",
200-
"credential_name": "HF_CRED",
201-
"url": "https://api-inference.huggingface.co/pipeline/feature-extraction/",
202-
"model": "sentence-transformers/all-MiniLM-L6-v2",
203+
"provider": "huggingface",
204+
"credential_name": "HF_CRED",
205+
"url": "https://api-inference.huggingface.co/pipeline/feature-extraction/",
206+
"model": "sentence-transformers/all-MiniLM-L6-v2",
203207
"wait_for_model": "true"
204208
}
205209
"""
@@ -215,9 +219,9 @@ embed = embedder.embed_query("Hello World!")
215219
print(f"Embedding generated by OracleEmbeddings: {embed}")
216220
```
217221

218-
### Utilities
222+
### Utilities
219223

220-
#### OracleSummary
224+
#### OracleSummary
221225

222226
Generate summary for your documents using `OracleSummary`. More information can be found in [Oracle AI Vector Search: Generate Summary](https://python.langchain.com/docs/integrations/tools/oracleai/) documentation.
223227

0 commit comments

Comments
 (0)