Skip to content

Commit 62e7514

Browse files
committed
Added Sphinx docs and autodocs
1 parent 93f3e71 commit 62e7514

28 files changed

+336
-146
lines changed

doc/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx
2+
sphinx-rtd-theme

doc/source/conf.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
# -- Project information -----------------------------------------------------
77
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
88
import os
9+
import sys
10+
11+
sys.path.insert(0, os.path.join("..", "..", "src", "select_ai"))
12+
13+
autodocs_default_options = {
14+
"members": True,
15+
"inherited-members": True,
16+
"undoc-members": True,
17+
}
918

1019
project = "Python API for Select AI"
1120
copyright = "2025, Oracle and/or its affiliates. All rights reserved."
@@ -14,7 +23,7 @@
1423
# -- General configuration ---------------------------------------------------
1524
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1625

17-
extensions = []
26+
extensions = ["sphinx.ext.autodoc"]
1827

1928
# The suffix of source filenames.
2029
source_suffix = ".rst"
@@ -39,5 +48,7 @@
3948
# -- Options for HTML output -------------------------------------------------
4049
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
4150

42-
html_theme = "alabaster"
51+
html_theme = "sphinx_rtd_theme"
4352
html_static_path = ["_static"]
53+
54+
pygments_style = "sphinx"

doc/source/index.rst

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,60 @@ select_ai documentation
1111
and Python's rich ecosystem.
1212

1313

14-
User Guide
15-
==========
14+
Getting Started
15+
===============
1616

1717
.. toctree::
1818
:numbered:
1919
:maxdepth: 3
2020

2121
user_guide/introduction.rst
2222
user_guide/installation.rst
23+
user_guide/connection.rst
24+
25+
Actions
26+
=======
27+
28+
.. toctree::
29+
:numbered:
30+
:maxdepth: 3
31+
32+
user_guide/actions.rst
33+
34+
Provider
35+
========
36+
37+
.. toctree::
38+
:numbered:
39+
:maxdepth: 3
40+
41+
user_guide/provider.rst
42+
43+
44+
Provider Attributes
45+
===================
46+
47+
.. toctree::
48+
:numbered:
49+
:maxdepth: 3
50+
51+
user_guide/provider_attributes.rst
52+
53+
Profile
54+
=======
55+
56+
.. toctree::
57+
:numbered:
58+
:maxdepth: 3
59+
60+
user_guide/profile.rst
61+
62+
63+
Async Profile
64+
=============
65+
66+
.. toctree::
67+
:numbered:
68+
:maxdepth: 3
69+
70+
user_guide/async_profile.rst

doc/source/user_guide/actions.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. _actions:
2+
3+
********************
4+
Supported AI Actions
5+
********************
6+
7+
.. literalinclude:: ../../../src/select_ai/action.py
8+
:language: python
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. _async_profile:
2+
3+
********************
4+
``AsyncProfile`` API
5+
********************
6+
7+
.. autoclass:: select_ai.AsyncProfile
8+
:members:
9+
10+
********************
11+
Async SQL generation
12+
********************
13+
14+
.. literalinclude:: ../../../examples/async_examples/1_sql.py
15+
:language: python
16+
17+
**********
18+
Async Chat
19+
**********
20+
21+
.. literalinclude:: ../../../examples/async_examples/2_chat.py
22+
:language: python
23+
24+
*********************
25+
Async Prompt Pipeline
26+
*********************
27+
28+
.. literalinclude:: ../../../examples/async_examples/3_pipeline.py
29+
:language: python
30+
31+
*********************
32+
Async Conversation
33+
*********************
34+
35+
.. literalinclude:: ../../../examples/async_examples/4_conversation.py
36+
:language: python
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.. _conn:
2+
3+
*****************************
4+
Connecting to Oracle Database
5+
*****************************
6+
7+
``select_ai`` uses the Python thin driver i.e. ``python-oracledb``
8+
to connect to the database and execute PL/SQL subprograms.
9+
10+
.. _sync_conn:
11+
12+
Synchronous connection
13+
======================
14+
15+
To connect to an Oracle Database synchronously, use
16+
``select_ai.connect()`` method as shown below
17+
18+
.. code-block:: python
19+
20+
import select_ai
21+
user = "<your_db_user>"
22+
password = "<your_db_password>"
23+
dsn = "<your_db_dsn>"
24+
select_ai.connect(user=user, password=password, dsn=dsn)
25+
26+
.. _async_conn:
27+
28+
Asynchronous connection
29+
=======================
30+
31+
Asynchronous applications should use ``select_ai.async_connect()`` along
32+
with ``await`` keyword:
33+
34+
.. code-block:: python
35+
36+
import select_ai
37+
user = "<your_db_user>"
38+
password = "<your_db_password>"
39+
dsn = "<your_db_dsn>"
40+
await select_ai.async_connect(user=user, password=password, dsn=dsn)
41+
42+
43+
.. note::
44+
45+
For m-TLS (wallet) based connection, additional parameters like
46+
``wallet_location``, ``wallet_password``, ``https_proxy``,
47+
``https_proxy_port`` can be passed to the ``connect`` and ``async_connect``
48+
methods

doc/source/user_guide/installation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ To use ``select_ai`` you need:
4242
4343
python3 -m pip install select_ai --upgrade --user --proxy=http://proxy.example.com:80
4444
45+
4546
4. Create a file ``select_ai_connection_test.py`` such as:
4647

4748
.. code-block:: python

doc/source/user_guide/introduction.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,4 @@ AI service providers, generate, run, explain SQL and chat with LLMs.
1111
``select_ai`` supports both synchronous and concurrent(asynchronous)
1212
programming styles
1313

14-
It uses the Python thin driver for Oracle database i.e. ``python-oracledb``
15-
to connect to the database and execute PL/SQL subprograms.
16-
1714
Currently supported Python versions are 3.9, 3.10, 3.11, 3.12 and 3.13.

doc/source/user_guide/profile.rst

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
.. _profile:
2+
3+
********************
4+
``Profile`` API
5+
********************
6+
7+
.. autoclass:: select_ai.Profile
8+
:members:
9+
10+
**************************
11+
Enable AI Service provider
12+
**************************
13+
14+
.. literalinclude:: ../../../examples/1_enable_ai_provider.py
15+
:language: python
16+
17+
18+
**************************
19+
Create credential
20+
**************************
21+
22+
.. literalinclude:: ../../../examples/2_create_ai_credential.py
23+
:language: python
24+
25+
26+
**************************
27+
Show SQL
28+
**************************
29+
30+
.. literalinclude:: ../../../examples/3_show_sql.py
31+
:language: python
32+
33+
**************************
34+
Run SQL
35+
**************************
36+
37+
.. literalinclude:: ../../../examples/4_run_sql.py
38+
:language: python
39+
40+
**************************
41+
Chat
42+
**************************
43+
44+
.. literalinclude:: ../../../examples/5_chat.py
45+
:language: python
46+
47+
**************************
48+
List Profiles
49+
**************************
50+
51+
.. literalinclude:: ../../../examples/6_list_ai_profiles.py
52+
:language: python
53+
54+
**************************
55+
Create Vector Index
56+
**************************
57+
58+
.. literalinclude:: ../../../examples/7_vector_index.py
59+
:language: python
60+
61+
**************************
62+
Generate Synthetic Data
63+
**************************
64+
65+
.. literalinclude:: ../../../examples/8_generate_synthetic_data.py
66+
:language: python
67+
68+
**************************
69+
Conversation
70+
**************************
71+
72+
.. literalinclude:: ../../../examples/9_conversation.py
73+
:language: python
74+
75+
***************************
76+
Disable AI service provider
77+
***************************
78+
79+
.. literalinclude:: ../../../examples/10_disable_ai_provider.py
80+
:language: python

doc/source/user_guide/provider.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. _provider:
2+
3+
**********************
4+
Supported AI Providers
5+
**********************
6+
7+
TODO

0 commit comments

Comments
 (0)