Skip to content

Commit a6446c2

Browse files
committed
- Added support for Select AI Summarize and feedback
- Unified set_attributes and set_attribute implementation across all AI objects - Added AI agent, tool, task and team methods
1 parent 4a8fb87 commit a6446c2

22 files changed

+812
-169
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
2828
- name: Install select_ai with core dependencies
2929
run: |
30-
python -m pip install --upgrade pip
30+
python -m pip install --upgrade pip setuptools
3131
pip install pytest anyio
3232
pip install -e .
3333

samples/agent/agent_create.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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+
# agent_create.py
10+
#
11+
# Create an agent to answer any movie related questions
12+
# -----------------------------------------------------------------------------
13+
114
import os
215

316
import select_ai
@@ -9,10 +22,7 @@
922
user = os.getenv("SELECT_AI_USER")
1023
password = os.getenv("SELECT_AI_PASSWORD")
1124
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
12-
1325
select_ai.connect(user=user, password=password, dsn=dsn)
14-
15-
# Agent
1626
agent_attributes = AgentAttributes(
1727
profile_name="LLAMA_4_MAVERICK",
1828
role="You are an AI Movie Analyst. "

samples/agent/movie_analyst.py

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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+
# movie_analyst.py
10+
#
11+
# Demonstrates movie analyst AI agent
12+
# -----------------------------------------------------------------------------
13+
114
import os
215
import uuid
316

@@ -18,41 +31,38 @@
1831
select_ai.connect(user=user, password=password, dsn=dsn)
1932

2033
# Agent
21-
agent_attributes = AgentAttributes(
22-
profile_name="oci_ai_profile",
23-
role="You are an AI Movie Analyst. "
24-
"Your can help answer a variety of questions related to movies. ",
25-
enable_human_tool=False,
26-
)
2734
agent = Agent(
2835
agent_name="MOVIE_ANALYST",
29-
attributes=agent_attributes,
36+
attributes=AgentAttributes(
37+
profile_name="oci_ai_profile",
38+
role="You are an AI Movie Analyst. "
39+
"Your can help answer a variety of questions related to movies. ",
40+
enable_human_tool=False,
41+
),
3042
)
3143
agent.create(enabled=True, replace=True)
3244
print("Create Agent", agent)
3345

3446
# Task
35-
task_attributes = TaskAttributes(
36-
instruction="Help the user with their request about movies. "
37-
"User question: {query}",
38-
enable_human_tool=False,
39-
)
4047
task = Task(
4148
task_name="ANALYZE_MOVIE_TASK",
4249
description="Movie task involving a human",
43-
attributes=task_attributes,
50+
attributes=TaskAttributes(
51+
instruction="Help the user with their request about movies. "
52+
"User question: {query}",
53+
enable_human_tool=False,
54+
),
4455
)
4556
task.create(replace=True)
4657
print("Created Task", task)
4758

4859
# Team
49-
team_attributes = TeamAttributes(
50-
agents=[{"name": "MOVIE_ANALYST", "task": "ANALYZE_MOVIE_TASK"}],
51-
process="sequential",
52-
)
5360
team = Team(
5461
team_name="MOVIE_AGENT_TEAM",
55-
attributes=team_attributes,
62+
attributes=TeamAttributes(
63+
agents=[{"name": "MOVIE_ANALYST", "task": "ANALYZE_MOVIE_TASK"}],
64+
process="sequential",
65+
),
5666
)
5767
team.create(enabled=True, replace=True)
5868
print(

samples/agent/task_create.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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+
# task_create.py
10+
#
11+
# Create an AI agent task which uses SQL tool to perform NL2SQL
12+
# -----------------------------------------------------------------------------
13+
114
import os
215
from pprint import pformat
316

samples/agent/tasks_list.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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+
# tasks_list.py
10+
#
11+
# List all tasks saved in the database
12+
# -----------------------------------------------------------------------------
13+
114
import os
215

316
import select_ai

samples/agent/team_create.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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+
# team_create.py
10+
#
11+
# Create a team for movie analyst and run it
12+
# -----------------------------------------------------------------------------
13+
114
import os
215
import uuid
316

samples/agent/tool_create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# -----------------------------------------------------------------------------
99
# tool_create.py
1010
#
11-
# Create a tool for
11+
# Create an in-built SQL tool
1212
# -----------------------------------------------------------------------------
1313

1414
import os

samples/agent/tool_create_human.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

samples/agent/websearch_agent.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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+
# movie_analyst.py
10+
#
11+
# Demonstrates web search AI agent
12+
# -----------------------------------------------------------------------------
13+
114
import os
215

316
import select_ai
@@ -19,7 +32,8 @@
1932
SELECT_AI_TEAM_NAME = "WEB_SEARCH_TEAM"
2033

2134
USER_QUERIES = {
22-
"d917b055-e8a1-463a-a489-d4328a7b2210": "What are the key features for the product highlighted at this URL https://www.oracle.com/artificial-intelligence/database-machine-learning",
35+
"d917b055-e8a1-463a-a489-d4328a7b2210": "What are the key features for the product highlighted at "
36+
"this URL https://www.oracle.com/artificial-intelligence/database-machine-learning",
2337
"c2e3ff20-f56d-40e7-987c-cc72740c75a5": "What is the main topic at this URL https://www.oracle.com/artificial-intelligence/database-machine-learning",
2438
"25e23a25-07b9-4ed7-be11-f7e5e445d286": "What is the main topic at this URL https://openai.com",
2539
}
@@ -68,7 +82,8 @@
6882
attributes=AgentAttributes(
6983
profile_name=OPEN_AI_PROFILE_NAME,
7084
enable_human_tool=False,
71-
role="You are a specialized web search agent that can access web page contents and respond to questions based on its content.",
85+
role="You are a specialized web search agent that can access web page "
86+
"contents and respond to questions based on its content.",
7287
),
7388
)
7489
agent.create(replace=True)

src/select_ai/action.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ class Action(StrEnum):
1919
NARRATE = "narrate"
2020
CHAT = "chat"
2121
SHOWPROMPT = "showprompt"
22+
FEEDBACK = "feedback"
23+
SUMMARIZE = "summarize"

0 commit comments

Comments
 (0)