Skip to content

Commit 470d560

Browse files
committed
Merge branch 'v1.0.0.dev6' into 'main'
V1.0.0.dev6 See merge request adbs/python-select-ai!8
2 parents f90e9f5 + 22960c5 commit 470d560

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+921
-504
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# select-ai
22

3-
Python API for Select AI
3+
Select AI for Python
44

55
## Install
66

doc/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
sphinx
22
sphinx-rtd-theme
3+
sphinx_toolbox

doc/source/conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
import os
99
import sys
1010

11+
import sphinx_prompt
12+
13+
sys.modules["sphinx-prompt"] = sphinx_prompt
14+
1115
sys.path.insert(0, os.path.join("..", "..", "src", "select_ai"))
1216

1317
autodocs_default_options = {
@@ -16,14 +20,14 @@
1620
"undoc-members": True,
1721
}
1822

19-
project = "Python API for Select AI"
23+
project = "Select AI for Python"
2024
copyright = "2025, Oracle and/or its affiliates. All rights reserved."
2125
author = "Oracle"
2226

2327
# -- General configuration ---------------------------------------------------
2428
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2529

26-
extensions = ["sphinx.ext.autodoc"]
30+
extensions = ["sphinx.ext.autodoc", "sphinx_toolbox.latex"]
2731

2832
# The suffix of source filenames.
2933
source_suffix = ".rst"

doc/source/license.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
:orphan:
2+
3+
.. _license:
4+
5+
6+
.. include:: <isonum.txt>
7+
8+
.. centered:: **LICENSE AGREEMENT FOR python-select-ai**
9+
10+
Copyright (c) 2025, Oracle and/or its affiliates.
11+
12+
The Universal Permissive License (UPL), Version 1.0
13+
14+
Subject to the condition set forth below, permission is hereby granted to any
15+
person obtaining a copy of this software, associated documentation and/or data
16+
(collectively the "Software"), free of charge and under any and all copyright
17+
rights in the Software, and any and all patent rights owned or freely
18+
licensable by each licensor hereunder covering either (i) the unmodified
19+
Software as contributed to or provided by such licensor, or (ii) the Larger
20+
Works (as defined below), to deal in both
21+
22+
(a) the Software, and
23+
24+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
25+
one is included with the Software (each a "Larger Work" to which the Software
26+
is contributed by such licensors),
27+
28+
without restriction, including without limitation the rights to copy, create
29+
derivative works of, display, perform, and distribute the Software and make,
30+
use, sell, offer for sale, import, export, have made, and have sold the
31+
Software and the Larger Work(s), and to sublicense the foregoing rights on
32+
either these or other terms.
33+
34+
This license is subject to the following condition:
35+
The above copyright notice and either this complete permission notice or at
36+
a minimum a reference to the UPL must be included in all copies or
37+
substantial portions of the Software.
38+
39+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45+
SOFTWARE.
46+
47+
END OF TERMS AND CONDITIONS

doc/source/user_guide/async_profile.rst

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ used with ``await``.
1212
.. autoclass:: select_ai.AsyncProfile
1313
:members:
1414

15+
.. latex:clearpage::
16+
1517
***********************
1618
Async Profile creation
1719
***********************
1820

19-
.. literalinclude:: ../../../samples/async_samples/profile_create.py
21+
.. literalinclude:: ../../../samples/async/profile_create.py
2022
:language: python
2123

2224
output::
2325

24-
Profile attributes are: ProfileAttributes(annotations=None, case_sensitive_values=None, comments=None, constraints=None, conversation=None, credential_name='my_oci_ai_profile_key', enable_sources=None, enable_source_offsets=None, enforce_object_list=None, max_tokens=1024, object_list=[{'owner': 'SH'}], object_list_mode=None, provider=OCIGenAIProvider(embedding_model=None, model=None, provider_name='oci', provider_endpoint=None, region='us-chicago-1', oci_apiformat='GENERIC', oci_compartment_id=None, oci_endpoint_id=None, oci_runtimetype=None), seed=None, stop_tokens=None, streaming=None, temperature=None, vector_index_name=None)
25-
Profile attributes as Python dict: {'annotations': None,
26+
Created async profile async_oci_ai_profile
27+
Profile attributes: {'annotations': None,
2628
'case_sensitive_values': None,
2729
'comments': None,
2830
'constraints': None,
@@ -31,8 +33,8 @@ output::
3133
'enable_source_offsets': None,
3234
'enable_sources': None,
3335
'enforce_object_list': None,
34-
'max_tokens': 1024,
35-
'object_list': [{'owner': 'SH'}],
36+
'max_tokens': '1024',
37+
'object_list': '[{"owner":"SH"}]',
3638
'object_list_mode': None,
3739
'provider': OCIGenAIProvider(embedding_model=None,
3840
model=None,
@@ -50,11 +52,13 @@ output::
5052
'vector_index_name': None}
5153

5254

55+
.. latex:clearpage::
56+
5357
***********************
5458
Async explain SQL
5559
***********************
5660

57-
.. literalinclude:: ../../../samples/async_samples/profile_explain_sql.py
61+
.. literalinclude:: ../../../samples/async/profile_explain_sql.py
5862
:language: python
5963

6064
output::
@@ -77,36 +81,41 @@ output::
7781

7882
This query will return the total number of promotions in the `"PROMOTIONS"` table.
7983

84+
.. latex:clearpage::
8085
8186
***********************
8287
Async run SQL
8388
***********************
8489

85-
.. literalinclude:: ../../../samples/async_samples/profile_run_sql.py
90+
.. literalinclude:: ../../../samples/async/profile_run_sql.py
8691
:language: python
8792

8893
output::
8994

9095
PROMOTION_COUNT
9196
0 503
9297

98+
.. latex:clearpage::
99+
93100
***********************
94101
Async show SQL
95102
***********************
96103

97-
.. literalinclude:: ../../../samples/async_samples/profile_show_sql.py
104+
.. literalinclude:: ../../../samples/async/profile_show_sql.py
98105
:language: python
99106

100107
output::
101108

102109
SELECT COUNT("p"."PROMO_ID") AS "PROMOTION_COUNT" FROM "SH"."PROMOTIONS" "p"
103110

104111

112+
.. latex:clearpage::
113+
105114
***********************
106115
Async concurrent SQL
107116
***********************
108117

109-
.. literalinclude:: ../../../samples/async_samples/profile_sql_concurrent_tasks.py
118+
.. literalinclude:: ../../../samples/async/profile_sql_concurrent_tasks.py
110119
:language: python
111120

112121
output::
@@ -135,11 +144,13 @@ output::
135144
PROMOTION_COUNT
136145
0 503
137146

147+
.. latex:clearpage::
148+
138149
**********
139150
Async chat
140151
**********
141152

142-
.. literalinclude:: ../../../samples/async_samples/profile_chat.py
153+
.. literalinclude:: ../../../samples/async/profile_chat.py
143154
:language: python
144155

145156
output::
@@ -158,11 +169,13 @@ output::
158169
...
159170
...
160171

172+
.. latex:clearpage::
173+
161174
*********************
162175
Async pipeline
163176
*********************
164177

165-
.. literalinclude:: ../../../samples/async_samples/profile_pipeline.py
178+
.. literalinclude:: ../../../samples/async/profile_pipeline.py
166179
:language: python
167180

168181
output::
@@ -188,13 +201,16 @@ output::
188201

189202
Result 3 for prompt 'Explain the query: SELECT * FROM sh.products' is: ORA-20000: Invalid action - INVALID ACTION
190203

204+
.. latex:clearpage::
205+
191206
****************************
192207
List profiles asynchronously
193208
****************************
194209

195-
.. literalinclude:: ../../../samples/async_samples/profiles_list.py
210+
.. literalinclude:: ../../../samples/async/profiles_list.py
196211
:language: python
197212

198213
output::
199214

215+
OCI_VECTOR_AI_PROFILE
200216
OCI_AI_PROFILE

doc/source/user_guide/conversation.rst

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.. _conversation:
22

3-
Conversations in Select AI represent an interactive exchange between the user and the system, enabling users to query or interact with the database through a series of natural language prompts.
3+
Conversations in Select AI represent an interactive exchange between the user
4+
and the system, enabling users to query or interact with the database through
5+
a series of natural language prompts.
46

57
*****************************
68
``Conversation Object model``
@@ -9,13 +11,16 @@ Conversations in Select AI represent an interactive exchange between the user an
911
.. figure:: /image/conversation.png
1012
:alt: Select AI Conversation
1113

14+
.. latex:clearpage::
15+
1216
**************************
1317
``ConversationAttributes``
1418
**************************
1519

1620
.. autoclass:: select_ai.ConversationAttributes
1721
:members:
1822

23+
.. latex:clearpage::
1924
2025
********************
2126
``Conversation`` API
@@ -24,6 +29,8 @@ Conversations in Select AI represent an interactive exchange between the user an
2429
.. autoclass:: select_ai.Conversation
2530
:members:
2631

32+
.. latex:clearpage::
33+
2734
Create conversion
2835
++++++++++++++++++
2936

@@ -32,7 +39,9 @@ Create conversion
3239

3340
output::
3441

35-
Created conversation with conversation id: 380A1601-182D-F329-E063-D81A000A2C93
42+
Created conversation with conversation id: 3AB2ED3E-7E52-8000-E063-BE1A000A15B6
43+
44+
.. latex:clearpage::
3645
3746
Chat session
3847
+++++++++++++
@@ -55,6 +64,8 @@ output::
5564
...
5665
...
5766

67+
.. latex:clearpage::
68+
5869
List conversations
5970
++++++++++++++++++
6071

@@ -69,6 +80,7 @@ output::
6980
37DF777F-F3DA-F084-E063-D81A000A53BE
7081
ConversationAttributes(title='History of Science', description="LLM's understanding of history of science", retention_days=7)
7182

83+
.. latex:clearpage::
7284
7385
Delete conversation
7486
+++++++++++++++++++
@@ -81,6 +93,7 @@ output::
8193
Deleted conversation with conversation id: 37DDC22E-11C8-3D49-E063-D81A000A85FE
8294

8395

96+
.. latex:clearpage::
8497
8598
*************************
8699
``AsyncConversation`` API
@@ -89,11 +102,12 @@ output::
89102
.. autoclass:: select_ai.AsyncConversation
90103
:members:
91104

105+
.. latex:clearpage::
92106
93107
Async chat session
94108
++++++++++++++++++
95109

96-
.. literalinclude:: ../../../samples/async_samples/conversation_chat_session.py
110+
.. literalinclude:: ../../../samples/async/conversation_chat_session.py
97111
:language: python
98112

99113
output::
@@ -111,10 +125,12 @@ output::
111125
...
112126
...
113127

128+
.. latex:clearpage::
129+
114130
Async list conversations
115131
++++++++++++++++++++++++
116132

117-
.. literalinclude:: ../../../samples/async_samples/conversations_list.py
133+
.. literalinclude:: ../../../samples/async/conversations_list.py
118134
:language: python
119135

120136
output::

doc/source/user_guide/credential.rst

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
11
.. _credential:
22

3-
Credential stores the API key from your AI provider for use by Oracle Database.
3+
Credential object securely stores API key from your AI provider for use by Oracle Database.
4+
The following table shows AI Provider and corresponding credential object format
5+
6+
.. list-table:: AI Provider and expected credential format
7+
:header-rows: 1
8+
:widths: 30 70
9+
:align: left
10+
11+
* - AI Provider
12+
- Credential format
13+
* - Anthropic
14+
- .. code-block:: python
15+
16+
{"username": "anthropic", "password": "sk-xxx"}
17+
* - HuggingFace
18+
- .. code-block:: python
19+
20+
{"username": "hf", "password": "hf_xxx"}
21+
* - OCI Gen AI
22+
- .. code-block:: python
23+
24+
{"user_ocid": "", "tenancy_ocid": "", "private_key": "", "fingerprint": ""}
25+
* - OpenAI
26+
- .. code-block:: python
27+
28+
{"username": "openai", "password": "sk-xxx"}
29+
30+
31+
32+
33+
.. latex:clearpage::
434
535
**************************
636
Create credential

doc/source/user_guide/installation.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ To use ``select_ai`` you need:
4848
.. code-block:: python
4949
5050
import select_ai
51-
import getpass
5251
53-
username = ""
54-
dsn = ""
55-
password = getpass.getpass(f"Enter password for {username}@{dsn}")
52+
user = "<your_db_user>"
53+
password = "<your_db_password>"
54+
dsn = "<your_db_dsn>"
5655
select_ai.connect(user=user, password=password, dsn=dsn)
5756
print("Connected to the Database")
5857
@@ -67,3 +66,5 @@ To use ``select_ai`` you need:
6766
.. code-block:: shell
6867
6968
Connected to the Database
69+
70+
.. latex:clearpage::

0 commit comments

Comments
 (0)