Skip to content

Commit a88185a

Browse files
committed
Updated samples for summary and feedback
1 parent 9dc5e51 commit a88185a

24 files changed

+399
-73
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ pytest.env
1717
.venv3.11/
1818
.venv3.9/
1919
sample_connect.py
20+
async_pipeline_test.py
21+
parquet.py

doc/requirements.txt

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

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
# -- Options for HTML output -------------------------------------------------
5353
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
5454

55-
html_theme = "sphinx_rtd_theme"
55+
html_theme = "python_docs_theme"
5656
html_static_path = ["_static"]
5757

5858
pygments_style = "sphinx"

doc/source/user_guide/actions.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ Following list of actions can be performed using ``select_ai``
3434
* - showsql
3535
- ``select_ai.Action.SHOWSQL``
3636
- Displays the generated SQL statement without executing it.
37+
* - summarize
38+
- ``select_ai.Action.SUMMARIZE``
39+
- Generate summary of your large texts
40+
* - feedback
41+
- ``select_ai.Action.FEEDBACK``
42+
- Provide feedback to improve accuracy of the generated SQL
43+
* - translate
44+
- ``select_ai.Action.TRANSLATE``
45+
- Translate text from one language to another

doc/source/user_guide/agent.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ output::
125125
List Tools
126126
++++++++++
127127

128-
.. literalinclude:: ../../../samples/agent/tool_list.py
128+
.. literalinclude:: ../../../samples/agent/tools_list.py
129129
:language: python
130130
:lines: 14-
131131

@@ -168,6 +168,7 @@ previous step
168168

169169
.. literalinclude:: ../../../samples/agent/task_create.py
170170
:language: python
171+
:lines: 14-
171172

172173
output::
173174

@@ -188,6 +189,7 @@ List Tasks
188189

189190
.. literalinclude:: ../../../samples/agent/tasks_list.py
190191
:language: python
192+
:lines: 14-
191193

192194
output::
193195

@@ -219,6 +221,7 @@ Create Agent
219221

220222
.. literalinclude:: ../../../samples/agent/agent_create.py
221223
:language: python
224+
:lines: 14-
222225

223226
output::
224227

@@ -254,10 +257,23 @@ Run Team
254257

255258
.. literalinclude:: ../../../samples/agent/team_create.py
256259
:language: python
260+
:lines: 14-
257261

258262
output::
259263

260-
To list the movies, you can use the SQL query: SELECT m.* FROM "SPARK_DB_USER"."MOVIE" m.
264+
The database contains 100 movies with various titles, genres, and release dates. The list includes a wide range of genres such as Action, Comedy, Drama, Thriller, Romance, Adventure, Mystery, Sci-Fi, Historical, Biography, War, Sports, Music, Documentary, Animated, Fantasy, Horror, Western, Family, and more. The release dates are primarily in January and February of 2019. Here is a summary of the movies:
265+
266+
1. Action Movie (Action, 2019-01-01)
267+
2. Comedy Film (Comedy, 2019-01-02)
268+
3. Drama Series (Drama, 2019-01-03)
269+
4. Thriller Night (Thriller, 2019-01-04)
270+
5. Romance Story (Romance, 2019-01-05)
271+
6. Adventure Time (Adventure, 2019-01-06)
272+
7. Mystery Solver (Mystery, 2019-01-07)
273+
8. Sci-Fi World (Sci-Fi, 2019-01-08)
274+
9. Historical Epic (Historical, 2019-01-09)
275+
10. Biographical (Biography, 2019-01-10)
276+
... (list continues up to 100 movies)
261277

262278
.. latex:clearpage::
263279

doc/source/user_guide/async_profile.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,50 @@ output::
177177

178178
.. latex:clearpage::
179179
180+
**************************
181+
Summarize
182+
**************************
183+
184+
.. literalinclude:: ../../../samples/async/profile_summarize_content.py
185+
:language: python
186+
:lines: 14-
187+
188+
output::
189+
190+
A gas cloud in the Sagittarius B2 galaxy contains a large amount of alcohol,
191+
while some stars are cool enough to touch without being burned. The exoplanet
192+
55 Cancri e has a unique form of "hot ice" where water remains solid despite
193+
high temperatures due to high pressure. Ancient stars in the Milky Way's halo
194+
are older than the Sun, providing insights into the early universe and its composition,
195+
offering clues about the universe's formation and evolution.
196+
197+
.. latex:clearpage::
198+
199+
200+
.. literalinclude:: ../../../samples/async/profile_summarize_uri.py
201+
:language: python
202+
:lines: 14-
203+
204+
output::
205+
206+
Astronomy is a natural science that studies celestial objects and phenomena,
207+
using mathematics, physics, and chemistry to explain their origin and evolution.
208+
The field has a long history, with early civilizations making methodical
209+
observations of the night sky, and has since split into observational and
210+
theoretical branches. Observational astronomy focuses on acquiring data
211+
from observations, while theoretical astronomy develops computer or
212+
analytical models to describe astronomical objects and phenomena. The study
213+
of astronomy has led to numerous discoveries, including the existence of
214+
galaxies, the expansion of the universe, and the detection of gravitational
215+
waves. Astronomers use various methods, such as radio, infrared, optical,
216+
ultraviolet, X-ray, and gamma-ray astronomy, to study objects and events in
217+
the universe. The field has also led to the development of new technologies and
218+
has inspired new areas of research, such as astrobiology and the search for
219+
extraterrestrial life. Overall, astronomy is a dynamic and constantly evolving
220+
field that seeks to understand the universe and its many mysteries.
221+
222+
.. latex:clearpage::
223+
180224
*********************
181225
Async pipeline
182226
*********************

doc/source/user_guide/profile.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,50 @@ output::
139139

140140
.. latex:clearpage::
141141
142+
**************************
143+
Summarize
144+
**************************
145+
146+
.. literalinclude:: ../../../samples/profile_summarize_content.py
147+
:language: python
148+
:lines: 14-
149+
150+
output::
151+
152+
A gas cloud in the Sagittarius B2 galaxy contains a large amount of alcohol,
153+
while some stars are cool enough to touch without being burned. The exoplanet
154+
55 Cancri e has a unique form of "hot ice" where water remains solid despite
155+
high temperatures due to high pressure. Ancient stars in the Milky Way's halo
156+
are older than the Sun, providing insights into the early universe and its composition,
157+
offering clues about the universe's formation and evolution.
158+
159+
.. latex:clearpage::
160+
161+
162+
.. literalinclude:: ../../../samples/profile_summarize_uri.py
163+
:language: python
164+
:lines: 14-
165+
166+
output::
167+
168+
Astronomy is a natural science that studies celestial objects and phenomena,
169+
using mathematics, physics, and chemistry to explain their origin and evolution.
170+
The field has a long history, with early civilizations making methodical
171+
observations of the night sky, and has since split into observational and
172+
theoretical branches. Observational astronomy focuses on acquiring data
173+
from observations, while theoretical astronomy develops computer or
174+
analytical models to describe astronomical objects and phenomena. The study
175+
of astronomy has led to numerous discoveries, including the existence of
176+
galaxies, the expansion of the universe, and the detection of gravitational
177+
waves. Astronomers use various methods, such as radio, infrared, optical,
178+
ultraviolet, X-ray, and gamma-ray astronomy, to study objects and events in
179+
the universe. The field has also led to the development of new technologies and
180+
has inspired new areas of research, such as astrobiology and the search for
181+
extraterrestrial life. Overall, astronomy is a dynamic and constantly evolving
182+
field that seeks to understand the universe and its many mysteries.
183+
184+
.. latex:clearpage::
185+
142186
**************************
143187
List profiles
144188
**************************

samples/agent/task_create.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,19 @@
2121
user = os.getenv("SELECT_AI_USER")
2222
password = os.getenv("SELECT_AI_PASSWORD")
2323
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
24-
2524
select_ai.connect(user=user, password=password, dsn=dsn)
2625

27-
attributes = TaskAttributes(
28-
instruction="Help the user with their request about movies. "
29-
"User question: {query}. "
30-
"You can use SQL tool to search the data from database",
31-
tools=["MOVIE_SQL_TOOL"],
32-
enable_human_tool=False,
33-
)
34-
3526
task = Task(
3627
task_name="ANALYZE_MOVIE_TASK",
3728
description="Movie task involving a human",
38-
attributes=attributes,
29+
attributes=TaskAttributes(
30+
instruction="Help the user with their request about movies. "
31+
"User question: {query}. "
32+
"You can use SQL tool to search the data from database",
33+
tools=["MOVIE_SQL_TOOL"],
34+
enable_human_tool=False,
35+
),
3936
)
40-
4137
task.create(replace=True)
42-
4338
print(task.task_name)
4439
print(pformat(task.attributes))
File renamed without changes.

samples/async/profile_feedback.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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/profile_feedback.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+
await async_profile.add_positive_feedback(
28+
prompt_spec=("How many promotions ?", select_ai.Action.RUNSQL)
29+
)
30+
31+
32+
asyncio.run(main())

0 commit comments

Comments
 (0)