Skip to content

Commit 6866491

Browse files
authored
Merge pull request #4 from oracle/dev/1.0.0.dev8
1.0.0 beta release
2 parents b7f7a48 + f5c989d commit 6866491

Some content is hidden

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

41 files changed

+827
-181
lines changed

README.md

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,73 @@ python3 -m pip install select_ai
1515

1616
## Samples
1717

18-
Examples can be found in the samples directory
18+
Examples can be found in the [/samples][samples] directory
1919

20-
## Contributing
20+
### Basic Example
21+
22+
```python
23+
import select_ai
24+
25+
user = "<your_select_ai_user>"
26+
password = "<your_select_ai_password>"
27+
dsn = "<your_select_ai_db_connect_string>"
28+
29+
select_ai.connect(user=user, password=password, dsn=dsn)
30+
profile = select_ai.Profile(profile_name="oci_ai_profile")
31+
# run_sql returns a pandas dataframe
32+
df = profile.run_sql(prompt="How many promotions?")
33+
print(df.columns)
34+
print(df)
35+
```
36+
37+
### Async Example
38+
39+
```python
40+
41+
import asyncio
42+
43+
import select_ai
2144

45+
user = "<your_select_ai_user>"
46+
password = "<your_select_ai_password>"
47+
dsn = "<your_select_ai_db_connect_string>"
2248

23-
This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)
49+
# This example shows how to asynchronously run sql
50+
async def main():
51+
await select_ai.async_connect(user=user, password=password, dsn=dsn)
52+
async_profile = await select_ai.AsyncProfile(
53+
profile_name="async_oci_ai_profile",
54+
)
55+
# run_sql returns a pandas df
56+
df = await async_profile.run_sql("How many promotions?")
57+
print(df)
58+
59+
asyncio.run(main())
60+
61+
```
62+
## Help
63+
64+
Questions can be asked in [GitHub Discussions][ghdiscussions].
65+
66+
Problem reports can be raised in [GitHub Issues][ghissues].
67+
68+
## Contributing
69+
70+
This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide][contributing]
2471

2572
## Security
2673

27-
Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process
74+
Please consult the [security guide][security] for our responsible security vulnerability disclosure process
2875

2976
## License
3077

3178
Copyright (c) 2025 Oracle and/or its affiliates.
3279

3380
Released under the Universal Permissive License v1.0 as shown at
3481
<https://oss.oracle.com/licenses/upl/>.
82+
83+
[contributing]: https://github.com/oracle/python-select-ai/blob/main/CONTRIBUTING.md
84+
[ghdiscussions]: https://github.com/oracle/python-select-ai/discussions
85+
[ghissues]: https://github.com/oracle/python-select-ai/issues
86+
[samples]: https://github.com/oracle/python-select-ai/tree/main/samples
87+
[security]: https://github.com/oracle/python-select-ai/blob/main/SECURITY.md

doc/source/user_guide/async_profile.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Async Profile creation
2020

2121
.. literalinclude:: ../../../samples/async/profile_create.py
2222
:language: python
23+
:lines: 14-
2324

2425
output::
2526

@@ -60,6 +61,7 @@ Async explain SQL
6061

6162
.. literalinclude:: ../../../samples/async/profile_explain_sql.py
6263
:language: python
64+
:lines: 12-
6365

6466
output::
6567

@@ -89,6 +91,7 @@ Async run SQL
8991

9092
.. literalinclude:: ../../../samples/async/profile_run_sql.py
9193
:language: python
94+
:lines: 14-
9295

9396
output::
9497

@@ -103,6 +106,7 @@ Async show SQL
103106

104107
.. literalinclude:: ../../../samples/async/profile_show_sql.py
105108
:language: python
109+
:lines: 14-
106110

107111
output::
108112

@@ -117,6 +121,7 @@ Async concurrent SQL
117121

118122
.. literalinclude:: ../../../samples/async/profile_sql_concurrent_tasks.py
119123
:language: python
124+
:lines: 15-
120125

121126
output::
122127

@@ -152,6 +157,7 @@ Async chat
152157

153158
.. literalinclude:: ../../../samples/async/profile_chat.py
154159
:language: python
160+
:lines: 14-
155161

156162
output::
157163

@@ -177,6 +183,7 @@ Async pipeline
177183

178184
.. literalinclude:: ../../../samples/async/profile_pipeline.py
179185
:language: python
186+
:lines: 14-
180187

181188
output::
182189

@@ -209,6 +216,7 @@ List profiles asynchronously
209216

210217
.. literalinclude:: ../../../samples/async/profiles_list.py
211218
:language: python
219+
:lines: 14-
212220

213221
output::
214222

doc/source/user_guide/conversation.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Create conversion
3636

3737
.. literalinclude:: ../../../samples/conversation_create.py
3838
:language: python
39+
:lines: 15-
3940

4041
output::
4142

@@ -48,6 +49,7 @@ Chat session
4849

4950
.. literalinclude:: ../../../samples/conversation_chat_session.py
5051
:language: python
52+
:lines: 14-
5153

5254
output::
5355

@@ -71,6 +73,7 @@ List conversations
7173

7274
.. literalinclude:: ../../../samples/conversations_list.py
7375
:language: python
76+
:lines: 14-
7477

7578
output::
7679

@@ -87,6 +90,7 @@ Delete conversation
8790

8891
.. literalinclude:: ../../../samples/conversation_delete.py
8992
:language: python
93+
:lines: 14-
9094

9195
output::
9296

@@ -109,6 +113,7 @@ Async chat session
109113

110114
.. literalinclude:: ../../../samples/async/conversation_chat_session.py
111115
:language: python
116+
:lines: 13-
112117

113118
output::
114119

@@ -132,6 +137,7 @@ Async list conversations
132137

133138
.. literalinclude:: ../../../samples/async/conversations_list.py
134139
:language: python
140+
:lines: 14-
135141

136142
output::
137143

doc/source/user_guide/credential.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,25 @@ Create credential
3939
In this example, we create a credential object to authenticate to OCI Gen AI
4040
service provider:
4141

42+
Sync API
43+
++++++++
44+
4245
.. literalinclude:: ../../../samples/create_ai_credential.py
4346
:language: python
47+
:lines: 14-
48+
49+
output::
50+
51+
Created credential: my_oci_ai_profile_key
52+
53+
.. latex:clearpage::
54+
55+
Async API
56+
+++++++++
57+
58+
.. literalinclude:: ../../../samples/async/create_ai_credential.py
59+
:language: python
60+
:lines: 14-
4461

4562
output::
4663

doc/source/user_guide/profile.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Create Profile
3939

4040
.. literalinclude:: ../../../samples/profile_create.py
4141
:language: python
42+
:lines: 14-
4243

4344
output::
4445

@@ -79,6 +80,7 @@ Narrate
7980

8081
.. literalinclude:: ../../../samples/profile_narrate.py
8182
:language: python
83+
:lines: 14-
8284

8385
output::
8486

@@ -93,6 +95,7 @@ Show SQL
9395

9496
.. literalinclude:: ../../../samples/profile_show_sql.py
9597
:language: python
98+
:lines: 14-
9699

97100
output::
98101

@@ -108,6 +111,7 @@ Run SQL
108111

109112
.. literalinclude:: ../../../samples/profile_run_sql.py
110113
:language: python
114+
:lines: 14-
111115

112116
output::
113117

@@ -123,7 +127,8 @@ Chat
123127
**************************
124128

125129
.. literalinclude:: ../../../samples/profile_chat.py
126-
:language: python
130+
:language: python
131+
:lines: 14-
127132

128133
output::
129134

@@ -139,7 +144,9 @@ List profiles
139144
**************************
140145

141146
.. literalinclude:: ../../../samples/profiles_list.py
142-
:language: python
147+
:language: python
148+
:lines: 14-
149+
143150

144151
output::
145152

doc/source/user_guide/provider.rst

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,28 @@ Enable AI service provider
103103
export SELECT_AI_DB_CONNECT_STRING=<db_connect_string>
104104
export TNS_ADMIN=<path/to/dir_containing_tnsnames.ora>
105105
106+
Sync API
107+
++++++++
108+
106109
This method grants execute privilege on the packages
107110
``DBMS_CLOUD``, ``DBMS_CLOUD_AI`` and ``DBMS_CLOUD_PIPELINE``. It
108-
also enables the user to invoke the AI(LLM) endpoint hosted at a
109-
certain domain
111+
also enables the database user to invoke the AI(LLM) endpoint
110112

111113
.. literalinclude:: ../../../samples/enable_ai_provider.py
112114
:language: python
115+
:lines: 15-
116+
117+
output::
118+
119+
Enabled AI provider for user: <select_ai_db_user>
120+
121+
.. latex:clearpage::
122+
123+
Async API
124+
+++++++++
125+
.. literalinclude:: ../../../samples/async/enable_ai_provider.py
126+
:language: python
127+
:lines: 14-
113128

114129
output::
115130

@@ -121,8 +136,25 @@ output::
121136
Disable AI service provider
122137
***************************
123138

139+
Sync API
140+
++++++++
141+
124142
.. literalinclude:: ../../../samples/disable_ai_provider.py
125143
:language: python
144+
:lines: 14-
145+
146+
output::
147+
148+
Disabled AI provider for user: <select_ai_db_user>
149+
150+
.. latex:clearpage::
151+
152+
Async API
153+
+++++++++
154+
155+
.. literalinclude:: ../../../samples/async/disable_ai_provider.py
156+
:language: python
157+
:lines: 14-
126158

127159
output::
128160

0 commit comments

Comments
 (0)