select-ai 1.0.0.dev6__tar.gz → 1.0.0.dev8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of select-ai might be problematic. Click here for more details.
- select_ai-1.0.0.dev8/PKG-INFO +115 -0
- select_ai-1.0.0.dev8/README.md +88 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/pyproject.toml +3 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/conversation_chat_session.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/conversations_list.py +2 -2
- select_ai-1.0.0.dev8/samples/async/create_ai_credential.py +44 -0
- select_ai-1.0.0.dev8/samples/async/delete_ai_credential.py +32 -0
- select_ai-1.0.0.dev8/samples/async/disable_ai_provider.py +33 -0
- {select_ai-1.0.0.dev6/samples → select_ai-1.0.0.dev8/samples/async}/enable_ai_provider.py +9 -10
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/profile_chat.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/profile_create.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/profile_explain_sql.py +3 -4
- select_ai-1.0.0.dev8/samples/async/profile_gen_multi_table_synthetic_data.py +48 -0
- select_ai-1.0.0.dev8/samples/async/profile_gen_single_table_synthetic_data.py +41 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/profile_pipeline.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/profile_run_sql.py +3 -3
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/profile_show_sql.py +3 -3
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/profile_sql_concurrent_tasks.py +4 -4
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/profiles_list.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/vector_index_create.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/vector_index_delete.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/vector_index_list.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/async/vector_index_rag.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/conversation_chat_session.py +3 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/conversation_create.py +3 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/conversation_delete.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/conversations_list.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/create_ai_credential.py +3 -2
- select_ai-1.0.0.dev8/samples/delete_ai_credential.py +25 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/disable_ai_provider.py +2 -2
- select_ai-1.0.0.dev8/samples/enable_ai_provider.py +28 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/profile_chat.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/profile_create.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/profile_delete.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/profile_explain_sql.py +3 -3
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/profile_gen_multi_table_synthetic_data.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/profile_gen_single_table_synthetic_data.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/profile_narrate.py +3 -3
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/profile_run_sql.py +3 -3
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/profile_show_sql.py +3 -3
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/profiles_list.py +3 -3
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/vector_index_create.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/vector_index_delete.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/vector_index_list.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/samples/vector_index_rag.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/__init__.py +10 -5
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/async_profile.py +32 -9
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/base_profile.py +7 -3
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/conversation.py +16 -4
- select_ai-1.0.0.dev8/src/select_ai/credential.py +135 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/db.py +2 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/profile.py +32 -9
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/provider.py +104 -2
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/synthetic_data.py +5 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/vector_index.py +15 -8
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/version.py +1 -1
- select_ai-1.0.0.dev8/src/select_ai.egg-info/PKG-INFO +115 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai.egg-info/SOURCES.txt +8 -1
- select_ai-1.0.0.dev6/PKG-INFO +0 -25
- select_ai-1.0.0.dev6/README.md +0 -14
- select_ai-1.0.0.dev6/src/select_ai/admin.py +0 -116
- select_ai-1.0.0.dev6/src/select_ai.egg-info/PKG-INFO +0 -25
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/LICENSE.txt +0 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/MANIFEST.in +0 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/setup.cfg +0 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/_abc.py +0 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/_enums.py +0 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/action.py +0 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/errors.py +0 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai/sql.py +0 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai.egg-info/dependency_links.txt +0 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai.egg-info/requires.txt +0 -0
- {select_ai-1.0.0.dev6 → select_ai-1.0.0.dev8}/src/select_ai.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: select_ai
|
|
3
|
+
Version: 1.0.0.dev8
|
|
4
|
+
Summary: Select AI for Python
|
|
5
|
+
Author-email: Abhishek Singh <abhishek.o.singh@oracle.com>
|
|
6
|
+
Maintainer-email: Abhishek Singh <abhishek.o.singh@oracle.com>
|
|
7
|
+
License-Expression: UPL-1.0
|
|
8
|
+
Keywords: oracle,select-ai,adbs,autonomous database serverless
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
20
|
+
Classifier: Topic :: Database
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE.txt
|
|
24
|
+
Requires-Dist: oracledb
|
|
25
|
+
Requires-Dist: pandas==2.2.3
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# Select AI for Python
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Select AI for Python enables you to ask questions of your database data using natural language (text-to-SQL), get generative AI responses using your trusted content (retrieval augmented generation), generate synthetic data using large language models, and other features – all from Python. With the general availability of Select AI Python, Python developers have access to the functionality of Select AI on Oracle Autonomous Database.
|
|
32
|
+
|
|
33
|
+
Select AI for Python enables you to leverage the broader Python ecosystem in combination with generative AI and database functionality - bridging the gap between the DBMS_CLOUD_AI PL/SQL package and Python's rich ecosystem. It provides intuitive objects and methods for AI model interaction.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
Run
|
|
39
|
+
```bash
|
|
40
|
+
python3 -m pip install select_ai
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Samples
|
|
44
|
+
|
|
45
|
+
Examples can be found in the [/samples][samples] directory
|
|
46
|
+
|
|
47
|
+
### Basic Example
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
import select_ai
|
|
51
|
+
|
|
52
|
+
user = "<your_select_ai_user>"
|
|
53
|
+
password = "<your_select_ai_password>"
|
|
54
|
+
dsn = "<your_select_ai_db_connect_string>"
|
|
55
|
+
|
|
56
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
57
|
+
profile = select_ai.Profile(profile_name="oci_ai_profile")
|
|
58
|
+
df = profile.run_sql(
|
|
59
|
+
prompt="How many promotions are there in the sh database?"
|
|
60
|
+
)
|
|
61
|
+
print(df.columns)
|
|
62
|
+
print(df)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Async Example
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
|
|
69
|
+
import asyncio
|
|
70
|
+
|
|
71
|
+
import select_ai
|
|
72
|
+
|
|
73
|
+
user = "<your_select_ai_user>"
|
|
74
|
+
password = "<your_select_ai_password>"
|
|
75
|
+
dsn = "<your_select_ai_db_connect_string>"
|
|
76
|
+
|
|
77
|
+
# This example shows how to asynchronously run sql
|
|
78
|
+
async def main():
|
|
79
|
+
await select_ai.async_connect(user=user, password=password, dsn=dsn)
|
|
80
|
+
async_profile = await select_ai.AsyncProfile(
|
|
81
|
+
profile_name="async_oci_ai_profile",
|
|
82
|
+
)
|
|
83
|
+
# run_sql returns a pandas df
|
|
84
|
+
df = await async_profile.run_sql("How many promotions?")
|
|
85
|
+
print(df)
|
|
86
|
+
|
|
87
|
+
asyncio.run(main())
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
## Help
|
|
91
|
+
|
|
92
|
+
Questions can be asked in [GitHub Discussions][ghdiscussions].
|
|
93
|
+
|
|
94
|
+
Problem reports can be raised in [GitHub Issues][ghissues].
|
|
95
|
+
|
|
96
|
+
## Contributing
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)
|
|
100
|
+
|
|
101
|
+
## Security
|
|
102
|
+
|
|
103
|
+
Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
Copyright (c) 2025 Oracle and/or its affiliates.
|
|
108
|
+
|
|
109
|
+
Released under the Universal Permissive License v1.0 as shown at
|
|
110
|
+
<https://oss.oracle.com/licenses/upl/>.
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
[ghdiscussions]: https://github.com/oracle/python-select-ai/discussions
|
|
114
|
+
[ghissues]: https://github.com/oracle/python-select-ai/issues
|
|
115
|
+
[samples]: https://github.com/oracle/python-select-ai/tree/main/samples
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Select AI for Python
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Select AI for Python enables you to ask questions of your database data using natural language (text-to-SQL), get generative AI responses using your trusted content (retrieval augmented generation), generate synthetic data using large language models, and other features – all from Python. With the general availability of Select AI Python, Python developers have access to the functionality of Select AI on Oracle Autonomous Database.
|
|
5
|
+
|
|
6
|
+
Select AI for Python enables you to leverage the broader Python ecosystem in combination with generative AI and database functionality - bridging the gap between the DBMS_CLOUD_AI PL/SQL package and Python's rich ecosystem. It provides intuitive objects and methods for AI model interaction.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Run
|
|
12
|
+
```bash
|
|
13
|
+
python3 -m pip install select_ai
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Samples
|
|
17
|
+
|
|
18
|
+
Examples can be found in the [/samples][samples] directory
|
|
19
|
+
|
|
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
|
+
df = profile.run_sql(
|
|
32
|
+
prompt="How many promotions are there in the sh database?"
|
|
33
|
+
)
|
|
34
|
+
print(df.columns)
|
|
35
|
+
print(df)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Async Example
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
|
|
42
|
+
import asyncio
|
|
43
|
+
|
|
44
|
+
import select_ai
|
|
45
|
+
|
|
46
|
+
user = "<your_select_ai_user>"
|
|
47
|
+
password = "<your_select_ai_password>"
|
|
48
|
+
dsn = "<your_select_ai_db_connect_string>"
|
|
49
|
+
|
|
50
|
+
# This example shows how to asynchronously run sql
|
|
51
|
+
async def main():
|
|
52
|
+
await select_ai.async_connect(user=user, password=password, dsn=dsn)
|
|
53
|
+
async_profile = await select_ai.AsyncProfile(
|
|
54
|
+
profile_name="async_oci_ai_profile",
|
|
55
|
+
)
|
|
56
|
+
# run_sql returns a pandas df
|
|
57
|
+
df = await async_profile.run_sql("How many promotions?")
|
|
58
|
+
print(df)
|
|
59
|
+
|
|
60
|
+
asyncio.run(main())
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
## Help
|
|
64
|
+
|
|
65
|
+
Questions can be asked in [GitHub Discussions][ghdiscussions].
|
|
66
|
+
|
|
67
|
+
Problem reports can be raised in [GitHub Issues][ghissues].
|
|
68
|
+
|
|
69
|
+
## Contributing
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)
|
|
73
|
+
|
|
74
|
+
## Security
|
|
75
|
+
|
|
76
|
+
Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
Copyright (c) 2025 Oracle and/or its affiliates.
|
|
81
|
+
|
|
82
|
+
Released under the Universal Permissive License v1.0 as shown at
|
|
83
|
+
<https://oss.oracle.com/licenses/upl/>.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
[ghdiscussions]: https://github.com/oracle/python-select-ai/discussions
|
|
87
|
+
[ghissues]: https://github.com/oracle/python-select-ai/issues
|
|
88
|
+
[samples]: https://github.com/oracle/python-select-ai/tree/main/samples
|
|
@@ -5,7 +5,8 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "select_ai"
|
|
7
7
|
dynamic = ["version"]
|
|
8
|
-
description = "
|
|
8
|
+
description = "Select AI for Python"
|
|
9
|
+
readme = {file = "README.md", content-type = "text/markdown"}
|
|
9
10
|
requires-python = ">=3.9"
|
|
10
11
|
authors = [
|
|
11
12
|
{name="Abhishek Singh", email="abhishek.o.singh@oracle.com"}
|
|
@@ -22,7 +23,7 @@ keywords = [
|
|
|
22
23
|
license = " UPL-1.0"
|
|
23
24
|
license-files = ["LICENSE.txt"]
|
|
24
25
|
classifiers = [
|
|
25
|
-
"Development Status ::
|
|
26
|
+
"Development Status :: 4 - Beta",
|
|
26
27
|
"Intended Audience :: Developers",
|
|
27
28
|
"Natural Language :: English",
|
|
28
29
|
"Operating System :: OS Independent",
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
# Licensed under the Universal Permissive License v 1.0 as shown at
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
|
-
#
|
|
7
|
+
# -----------------------------------------------------------------------------
|
|
8
8
|
# async/conversation_chat_session.py
|
|
9
9
|
#
|
|
10
10
|
# Demonstrates context aware conversation using AI Profile
|
|
11
|
-
#
|
|
11
|
+
# -----------------------------------------------------------------------------
|
|
12
12
|
|
|
13
13
|
import asyncio
|
|
14
14
|
import os
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
9
|
# async/conversations_list.py
|
|
10
10
|
#
|
|
11
11
|
# List all conversations saved in the database
|
|
12
|
-
#
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
import asyncio
|
|
15
15
|
import os
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2025, Oracle and/or its affiliates.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Universal Permissive License v 1.0 as shown at
|
|
5
|
+
# http://oss.oracle.com/licenses/upl.
|
|
6
|
+
# -----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
|
+
# async/create_ai_credential.py
|
|
10
|
+
#
|
|
11
|
+
# Async API to create credential
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
import asyncio
|
|
15
|
+
import os
|
|
16
|
+
|
|
17
|
+
import oci
|
|
18
|
+
import select_ai
|
|
19
|
+
|
|
20
|
+
user = os.getenv("SELECT_AI_USER")
|
|
21
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
22
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
async def main():
|
|
26
|
+
await select_ai.async_connect(user=user, password=password, dsn=dsn)
|
|
27
|
+
default_config = oci.config.from_file()
|
|
28
|
+
oci.config.validate_config(default_config)
|
|
29
|
+
with open(default_config["key_file"]) as fp:
|
|
30
|
+
key_contents = fp.read()
|
|
31
|
+
credential = {
|
|
32
|
+
"credential_name": "my_oci_ai_profile_key",
|
|
33
|
+
"user_ocid": default_config["user"],
|
|
34
|
+
"tenancy_ocid": default_config["tenancy"],
|
|
35
|
+
"private_key": key_contents,
|
|
36
|
+
"fingerprint": default_config["fingerprint"],
|
|
37
|
+
}
|
|
38
|
+
await select_ai.async_create_credential(
|
|
39
|
+
credential=credential, replace=True
|
|
40
|
+
)
|
|
41
|
+
print("Created credential: ", credential["credential_name"])
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2025, Oracle and/or its affiliates.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Universal Permissive License v 1.0 as shown at
|
|
5
|
+
# http://oss.oracle.com/licenses/upl.
|
|
6
|
+
# -----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
|
+
# async/delete_ai_credential
|
|
10
|
+
#
|
|
11
|
+
# Async API to delete credential
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
import asyncio
|
|
15
|
+
import os
|
|
16
|
+
|
|
17
|
+
import select_ai
|
|
18
|
+
|
|
19
|
+
user = os.getenv("SELECT_AI_USER")
|
|
20
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
21
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
async def main():
|
|
25
|
+
await select_ai.async_connect(user=user, password=password, dsn=dsn)
|
|
26
|
+
await select_ai.async_delete_credential(
|
|
27
|
+
credential_name="my_oci_ai_profile_key", force=True
|
|
28
|
+
)
|
|
29
|
+
print("Deleted credential: my_oci_ai_profile_key")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2025, Oracle and/or its affiliates.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Universal Permissive License v 1.0 as shown at
|
|
5
|
+
# http://oss.oracle.com/licenses/upl.
|
|
6
|
+
# -----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
|
+
# async/disable_ai_provider.py
|
|
10
|
+
#
|
|
11
|
+
# Async API to disable AI provider for database users
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
import asyncio
|
|
15
|
+
import os
|
|
16
|
+
|
|
17
|
+
import select_ai
|
|
18
|
+
|
|
19
|
+
admin_user = os.getenv("SELECT_AI_ADMIN_USER")
|
|
20
|
+
password = os.getenv("SELECT_AI_ADMIN_PASSWORD")
|
|
21
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
22
|
+
select_ai_user = os.getenv("SELECT_AI_USER")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
async def main():
|
|
26
|
+
await select_ai.async_connect(user=admin_user, password=password, dsn=dsn)
|
|
27
|
+
await select_ai.async_disable_provider(
|
|
28
|
+
users=select_ai_user, provider_endpoint="*.openai.azure.com"
|
|
29
|
+
)
|
|
30
|
+
print("Disabled AI provider for user: ", select_ai_user)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
asyncio.run(main())
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
9
|
-
# enable_ai_provider.py
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
|
+
# async/enable_ai_provider.py
|
|
10
10
|
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# ------------------------------------------------------------------------------
|
|
11
|
+
# Async API to enable AI provider for database users
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
14
13
|
|
|
14
|
+
import asyncio
|
|
15
15
|
import os
|
|
16
16
|
|
|
17
17
|
import select_ai
|
|
@@ -22,13 +22,12 @@ dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
|
22
22
|
select_ai_user = os.getenv("SELECT_AI_USER")
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def main():
|
|
26
|
-
select_ai.
|
|
27
|
-
select_ai.
|
|
25
|
+
async def main():
|
|
26
|
+
await select_ai.async_connect(user=admin_user, password=password, dsn=dsn)
|
|
27
|
+
await select_ai.async_enable_provider(
|
|
28
28
|
users=select_ai_user, provider_endpoint="*.openai.azure.com"
|
|
29
29
|
)
|
|
30
30
|
print("Enabled AI provider for user: ", select_ai_user)
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
main()
|
|
33
|
+
asyncio.run(main())
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
9
|
# async/profile_chat.py
|
|
10
10
|
#
|
|
11
11
|
# Chat using an AI Profile
|
|
12
|
-
#
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
import asyncio
|
|
15
15
|
import os
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
9
|
# async/profile_create.py
|
|
10
10
|
#
|
|
11
11
|
# Create an OCI Gen AI profile
|
|
12
|
-
#
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
import asyncio
|
|
15
15
|
import os
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
9
|
# async/profile_explain_sql.py
|
|
10
|
-
#
|
|
10
|
+
# -----------------------------------------------------------------------------
|
|
11
11
|
|
|
12
12
|
import asyncio
|
|
13
13
|
import os
|
|
@@ -19,13 +19,12 @@ password = os.getenv("SELECT_AI_PASSWORD")
|
|
|
19
19
|
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
# This example shows how to asynchronously ask the LLM to explain SQL
|
|
23
22
|
async def main():
|
|
24
23
|
await select_ai.async_connect(user=user, password=password, dsn=dsn)
|
|
25
24
|
async_profile = await select_ai.AsyncProfile(
|
|
26
25
|
profile_name="async_oci_ai_profile",
|
|
27
26
|
)
|
|
28
|
-
response = await async_profile.explain_sql("How many promotions")
|
|
27
|
+
response = await async_profile.explain_sql("How many promotions ?")
|
|
29
28
|
print(response)
|
|
30
29
|
|
|
31
30
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2025, Oracle and/or its affiliates.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Universal Permissive License v 1.0 as shown at
|
|
5
|
+
# http://oss.oracle.com/licenses/upl.
|
|
6
|
+
# -----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
|
+
# async/profile_gen_multi_table_synthetic_data.py
|
|
10
|
+
# -----------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
import asyncio
|
|
13
|
+
import os
|
|
14
|
+
|
|
15
|
+
import select_ai
|
|
16
|
+
|
|
17
|
+
user = os.getenv("SELECT_AI_USER")
|
|
18
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
19
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
async def main():
|
|
23
|
+
await select_ai.async_connect(user=user, password=password, dsn=dsn)
|
|
24
|
+
async_profile = await select_ai.AsyncProfile(
|
|
25
|
+
profile_name="async_oci_ai_profile",
|
|
26
|
+
)
|
|
27
|
+
synthetic_data_params = select_ai.SyntheticDataParams(
|
|
28
|
+
sample_rows=100, table_statistics=True, priority="HIGH"
|
|
29
|
+
)
|
|
30
|
+
object_list = [
|
|
31
|
+
{
|
|
32
|
+
"owner": user,
|
|
33
|
+
"name": "MOVIE",
|
|
34
|
+
"record_count": 100,
|
|
35
|
+
"user_prompt": "the release date for the movies should be in 2019",
|
|
36
|
+
},
|
|
37
|
+
{"owner": user, "name": "ACTOR", "record_count": 10},
|
|
38
|
+
{"owner": user, "name": "DIRECTOR", "record_count": 5},
|
|
39
|
+
]
|
|
40
|
+
synthetic_data_attributes = select_ai.SyntheticDataAttributes(
|
|
41
|
+
object_list=object_list, params=synthetic_data_params
|
|
42
|
+
)
|
|
43
|
+
await async_profile.generate_synthetic_data(
|
|
44
|
+
synthetic_data_attributes=synthetic_data_attributes
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) 2025, Oracle and/or its affiliates.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Universal Permissive License v 1.0 as shown at
|
|
5
|
+
# http://oss.oracle.com/licenses/upl.
|
|
6
|
+
# -----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
|
+
# async/profile_gen_single_table_synthetic_data.py
|
|
10
|
+
# -----------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
import asyncio
|
|
13
|
+
import os
|
|
14
|
+
|
|
15
|
+
import select_ai
|
|
16
|
+
|
|
17
|
+
user = os.getenv("SELECT_AI_USER")
|
|
18
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
19
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
async def main():
|
|
23
|
+
await select_ai.async_connect(user=user, password=password, dsn=dsn)
|
|
24
|
+
async_profile = await select_ai.AsyncProfile(
|
|
25
|
+
profile_name="async_oci_ai_profile",
|
|
26
|
+
)
|
|
27
|
+
synthetic_data_params = select_ai.SyntheticDataParams(
|
|
28
|
+
sample_rows=100, table_statistics=True, priority="HIGH"
|
|
29
|
+
)
|
|
30
|
+
synthetic_data_attributes = select_ai.SyntheticDataAttributes(
|
|
31
|
+
object_name="MOVIE",
|
|
32
|
+
user_prompt="the release date for the movies should be in 2019",
|
|
33
|
+
params=synthetic_data_params,
|
|
34
|
+
record_count=100,
|
|
35
|
+
)
|
|
36
|
+
await async_profile.generate_synthetic_data(
|
|
37
|
+
synthetic_data_attributes=synthetic_data_attributes
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
asyncio.run(main())
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
9
|
# async/profile_pipeline.py
|
|
10
10
|
#
|
|
11
11
|
# Demonstrates sending multiple prompts using a single Database round-trip
|
|
12
|
-
#
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
import asyncio
|
|
15
15
|
import os
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
9
|
# async/profile_run_sql.py
|
|
10
10
|
#
|
|
11
11
|
# Return a pandas.Dataframe built using the resultset of the generated SQL
|
|
12
|
-
#
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
import asyncio
|
|
15
15
|
import os
|
|
@@ -28,7 +28,7 @@ async def main():
|
|
|
28
28
|
profile_name="async_oci_ai_profile",
|
|
29
29
|
)
|
|
30
30
|
# run_sql returns a pandas df
|
|
31
|
-
df = await async_profile.run_sql("How many promotions")
|
|
31
|
+
df = await async_profile.run_sql("How many promotions?")
|
|
32
32
|
print(df)
|
|
33
33
|
|
|
34
34
|
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
9
|
# async/profile_show_sql.py
|
|
10
10
|
#
|
|
11
11
|
# Show the generated SQL without executing it
|
|
12
|
-
#
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
import asyncio
|
|
15
15
|
import os
|
|
@@ -26,7 +26,7 @@ async def main():
|
|
|
26
26
|
async_profile = await select_ai.AsyncProfile(
|
|
27
27
|
profile_name="async_oci_ai_profile",
|
|
28
28
|
)
|
|
29
|
-
response = await async_profile.show_sql("How many promotions")
|
|
29
|
+
response = await async_profile.show_sql("How many promotions?")
|
|
30
30
|
print(response)
|
|
31
31
|
|
|
32
32
|
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
9
|
# async/profile_sql_concurrent_tasks.py
|
|
10
10
|
#
|
|
11
11
|
# Demonstrates sending multiple prompts concurrently using asyncio
|
|
12
|
-
#
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
import asyncio
|
|
@@ -29,8 +29,8 @@ async def main():
|
|
|
29
29
|
)
|
|
30
30
|
sql_tasks = [
|
|
31
31
|
async_profile.show_sql(prompt="How many customers?"),
|
|
32
|
-
async_profile.run_sql(prompt="How many promotions"),
|
|
33
|
-
async_profile.explain_sql(prompt="How many promotions"),
|
|
32
|
+
async_profile.run_sql(prompt="How many promotions?"),
|
|
33
|
+
async_profile.explain_sql(prompt="How many promotions?"),
|
|
34
34
|
]
|
|
35
35
|
|
|
36
36
|
# Collect results from multiple asynchronous tasks
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
9
|
# async/profile_list.py
|
|
10
10
|
#
|
|
11
11
|
# List all the profile names matching a certain pattern
|
|
12
|
-
#
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
import asyncio
|
|
15
15
|
import os
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
# http://oss.oracle.com/licenses/upl.
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
9
|
# async/vector_index_create.py
|
|
10
10
|
#
|
|
11
11
|
# Create a vector index for Retrieval Augmented Generation (RAG)
|
|
12
|
-
#
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
import asyncio
|