select-ai 1.0.0.dev7__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.dev7 → select_ai-1.0.0.dev8}/pyproject.toml +3 -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.dev8/samples/async/enable_ai_provider.py +33 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/profile_explain_sql.py +1 -2
- 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.dev7 → select_ai-1.0.0.dev8}/samples/async/profile_run_sql.py +1 -1
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/profile_show_sql.py +1 -1
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/profile_sql_concurrent_tasks.py +2 -2
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/conversation_chat_session.py +1 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/conversation_create.py +1 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/create_ai_credential.py +1 -0
- select_ai-1.0.0.dev8/samples/delete_ai_credential.py +25 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/profile_explain_sql.py +1 -1
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/profile_narrate.py +1 -1
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/profile_run_sql.py +1 -1
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/profile_show_sql.py +1 -1
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/__init__.py +10 -5
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/async_profile.py +30 -7
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/base_profile.py +7 -3
- {select_ai-1.0.0.dev7 → 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.dev7 → select_ai-1.0.0.dev8}/src/select_ai/db.py +2 -2
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/profile.py +30 -7
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/provider.py +104 -2
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/synthetic_data.py +5 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/vector_index.py +10 -4
- {select_ai-1.0.0.dev7 → 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.dev7 → select_ai-1.0.0.dev8}/src/select_ai.egg-info/SOURCES.txt +8 -1
- select_ai-1.0.0.dev7/PKG-INFO +0 -25
- select_ai-1.0.0.dev7/README.md +0 -14
- select_ai-1.0.0.dev7/src/select_ai/admin.py +0 -116
- select_ai-1.0.0.dev7/src/select_ai.egg-info/PKG-INFO +0 -25
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/LICENSE.txt +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/MANIFEST.in +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/conversation_chat_session.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/conversations_list.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/profile_chat.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/profile_create.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/profile_pipeline.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/profiles_list.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/vector_index_create.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/vector_index_delete.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/vector_index_list.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/async/vector_index_rag.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/conversation_delete.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/conversations_list.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/disable_ai_provider.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/enable_ai_provider.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/profile_chat.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/profile_create.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/profile_delete.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/profile_gen_multi_table_synthetic_data.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/profile_gen_single_table_synthetic_data.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/profiles_list.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/vector_index_create.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/vector_index_delete.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/vector_index_list.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/samples/vector_index_rag.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/setup.cfg +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/_abc.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/_enums.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/action.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/errors.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai/sql.py +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai.egg-info/dependency_links.txt +0 -0
- {select_ai-1.0.0.dev7 → select_ai-1.0.0.dev8}/src/select_ai.egg-info/requires.txt +0 -0
- {select_ai-1.0.0.dev7 → 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",
|
|
@@ -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())
|
|
@@ -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/enable_ai_provider.py
|
|
10
|
+
#
|
|
11
|
+
# Async API to enable 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_enable_provider(
|
|
28
|
+
users=select_ai_user, provider_endpoint="*.openai.azure.com"
|
|
29
|
+
)
|
|
30
|
+
print("Enabled AI provider for user: ", select_ai_user)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
asyncio.run(main())
|
|
@@ -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())
|
|
@@ -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
|
|
|
@@ -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
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
# delete_ai_credential.py
|
|
10
|
+
#
|
|
11
|
+
# Delete AI credential
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
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
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
22
|
+
select_ai.delete_credential(
|
|
23
|
+
credential_name="my_oci_ai_profile_key", force=True
|
|
24
|
+
)
|
|
25
|
+
print("Deleted credential: my_oci_ai_profile_key")
|
|
@@ -22,7 +22,7 @@ dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
|
22
22
|
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
23
23
|
profile = select_ai.Profile(profile_name="oci_ai_profile")
|
|
24
24
|
df = profile.run_sql(
|
|
25
|
-
prompt="How many promotions are there in the
|
|
25
|
+
prompt="How many promotions are there in the database?"
|
|
26
26
|
)
|
|
27
27
|
print(df.columns)
|
|
28
28
|
print(df)
|
|
@@ -22,6 +22,6 @@ dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
|
22
22
|
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
23
23
|
profile = select_ai.Profile(profile_name="oci_ai_profile")
|
|
24
24
|
sql = profile.show_sql(
|
|
25
|
-
prompt="How many promotions are there in the
|
|
25
|
+
prompt="How many promotions are there in the database?"
|
|
26
26
|
)
|
|
27
27
|
print(sql)
|
|
@@ -6,11 +6,6 @@
|
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
8
|
from .action import Action
|
|
9
|
-
from .admin import (
|
|
10
|
-
create_credential,
|
|
11
|
-
disable_provider,
|
|
12
|
-
enable_provider,
|
|
13
|
-
)
|
|
14
9
|
from .async_profile import AsyncProfile
|
|
15
10
|
from .base_profile import BaseProfile, ProfileAttributes
|
|
16
11
|
from .conversation import (
|
|
@@ -18,6 +13,12 @@ from .conversation import (
|
|
|
18
13
|
Conversation,
|
|
19
14
|
ConversationAttributes,
|
|
20
15
|
)
|
|
16
|
+
from .credential import (
|
|
17
|
+
async_create_credential,
|
|
18
|
+
async_delete_credential,
|
|
19
|
+
create_credential,
|
|
20
|
+
delete_credential,
|
|
21
|
+
)
|
|
21
22
|
from .db import (
|
|
22
23
|
async_connect,
|
|
23
24
|
async_cursor,
|
|
@@ -39,6 +40,10 @@ from .provider import (
|
|
|
39
40
|
OCIGenAIProvider,
|
|
40
41
|
OpenAIProvider,
|
|
41
42
|
Provider,
|
|
43
|
+
async_disable_provider,
|
|
44
|
+
async_enable_provider,
|
|
45
|
+
disable_provider,
|
|
46
|
+
enable_provider,
|
|
42
47
|
)
|
|
43
48
|
from .synthetic_data import (
|
|
44
49
|
SyntheticDataAttributes,
|