select-ai 1.1.0rc1__tar.gz → 1.2.0rc1__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.1.0rc1/src/select_ai.egg-info → select_ai-1.2.0rc1}/PKG-INFO +1 -1
- select_ai-1.2.0rc1/samples/agent/agent_create.py +27 -0
- select_ai-1.2.0rc1/samples/agent/movie_analyst.py +63 -0
- select_ai-1.2.0rc1/samples/agent/task_create.py +31 -0
- select_ai-1.2.0rc1/samples/agent/tasks_list.py +13 -0
- select_ai-1.2.0rc1/samples/agent/team_create.py +33 -0
- select_ai-1.2.0rc1/samples/agent/tool_create.py +55 -0
- select_ai-1.2.0rc1/samples/agent/tool_create_human.py +35 -0
- select_ai-1.2.0rc1/samples/agent/tool_delete.py +25 -0
- select_ai-1.2.0rc1/samples/agent/tool_list.py +26 -0
- select_ai-1.2.0rc1/samples/agent/websearch_agent.py +101 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/vector_index_get_attributes.py +1 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/vector_index_update_attributes.py +5 -3
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/enable_ai_provider.py +1 -1
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/vector_index_update_attributes.py +5 -3
- select_ai-1.2.0rc1/src/select_ai/agent/__init__.py +24 -0
- select_ai-1.2.0rc1/src/select_ai/agent/core.py +235 -0
- select_ai-1.2.0rc1/src/select_ai/agent/sql.py +80 -0
- select_ai-1.2.0rc1/src/select_ai/agent/task.py +247 -0
- select_ai-1.2.0rc1/src/select_ai/agent/team.py +280 -0
- select_ai-1.2.0rc1/src/select_ai/agent/tool.py +620 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/async_profile.py +1 -1
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/base_profile.py +1 -1
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/errors.py +40 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/profile.py +2 -2
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/sql.py +10 -4
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/vector_index.py +84 -36
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/version.py +1 -1
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1/src/select_ai.egg-info}/PKG-INFO +1 -1
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai.egg-info/SOURCES.txt +17 -1
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/LICENSE.txt +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/MANIFEST.in +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/README.md +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/pyproject.toml +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/conversation_chat_session.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/conversations_list.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/create_ai_credential.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/delete_ai_credential.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/disable_ai_provider.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/enable_ai_provider.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/profile_chat.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/profile_create.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/profile_explain_sql.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/profile_gen_multi_table_synthetic_data.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/profile_gen_single_table_synthetic_data.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/profile_pipeline.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/profile_run_sql.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/profile_show_sql.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/profile_sql_concurrent_tasks.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/profiles_list.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/vector_index_create.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/vector_index_delete.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/vector_index_list.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/async/vector_index_rag.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/conversation_chat_session.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/conversation_create.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/conversation_delete.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/conversations_list.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/create_ai_credential.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/delete_ai_credential.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/disable_ai_provider.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/profile_chat.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/profile_create.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/profile_delete.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/profile_explain_sql.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/profile_gen_multi_table_synthetic_data.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/profile_gen_single_table_synthetic_data.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/profile_narrate.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/profile_run_sql.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/profile_show_sql.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/profiles_list.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/vector_index_create.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/vector_index_delete.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/vector_index_get_attributes.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/vector_index_list.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/samples/vector_index_rag.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/setup.cfg +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/__init__.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/_abc.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/_enums.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/_validations.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/action.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/conversation.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/credential.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/db.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/provider.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai/synthetic_data.py +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai.egg-info/dependency_links.txt +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai.egg-info/requires.txt +0 -0
- {select_ai-1.1.0rc1 → select_ai-1.2.0rc1}/src/select_ai.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import select_ai
|
|
4
|
+
from select_ai.agent import (
|
|
5
|
+
Agent,
|
|
6
|
+
AgentAttributes,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
user = os.getenv("SELECT_AI_USER")
|
|
10
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
11
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
12
|
+
|
|
13
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
14
|
+
|
|
15
|
+
# Agent
|
|
16
|
+
agent_attributes = AgentAttributes(
|
|
17
|
+
profile_name="LLAMA_4_MAVERICK",
|
|
18
|
+
role="You are an AI Movie Analyst. "
|
|
19
|
+
"Your can help answer a variety of questions related to movies. ",
|
|
20
|
+
enable_human_tool=False,
|
|
21
|
+
)
|
|
22
|
+
agent = Agent(
|
|
23
|
+
agent_name="MOVIE_ANALYST",
|
|
24
|
+
attributes=agent_attributes,
|
|
25
|
+
)
|
|
26
|
+
agent.create(enabled=True, replace=True)
|
|
27
|
+
print("Created Agent:", agent)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import uuid
|
|
3
|
+
|
|
4
|
+
import select_ai
|
|
5
|
+
from select_ai.agent import (
|
|
6
|
+
Agent,
|
|
7
|
+
AgentAttributes,
|
|
8
|
+
Task,
|
|
9
|
+
TaskAttributes,
|
|
10
|
+
Team,
|
|
11
|
+
TeamAttributes,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
user = os.getenv("SELECT_AI_USER")
|
|
15
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
16
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
17
|
+
|
|
18
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
19
|
+
|
|
20
|
+
# 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
|
+
)
|
|
27
|
+
agent = Agent(
|
|
28
|
+
agent_name="MOVIE_ANALYST",
|
|
29
|
+
attributes=agent_attributes,
|
|
30
|
+
)
|
|
31
|
+
agent.create(enabled=True, replace=True)
|
|
32
|
+
print("Create Agent", agent)
|
|
33
|
+
|
|
34
|
+
# 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
|
+
)
|
|
40
|
+
task = Task(
|
|
41
|
+
task_name="ANALYZE_MOVIE_TASK",
|
|
42
|
+
description="Movie task involving a human",
|
|
43
|
+
attributes=task_attributes,
|
|
44
|
+
)
|
|
45
|
+
task.create(replace=True)
|
|
46
|
+
print("Created Task", task)
|
|
47
|
+
|
|
48
|
+
# Team
|
|
49
|
+
team_attributes = TeamAttributes(
|
|
50
|
+
agents=[{"name": "MOVIE_ANALYST", "task": "ANALYZE_MOVIE_TASK"}],
|
|
51
|
+
process="sequential",
|
|
52
|
+
)
|
|
53
|
+
team = Team(
|
|
54
|
+
team_name="MOVIE_AGENT_TEAM",
|
|
55
|
+
attributes=team_attributes,
|
|
56
|
+
)
|
|
57
|
+
team.create(enabled=True, replace=True)
|
|
58
|
+
print(
|
|
59
|
+
team.run(
|
|
60
|
+
prompt="In the movie Titanic, was there enough space for Jack ? ",
|
|
61
|
+
params={"conversation_id": str(uuid.uuid4())},
|
|
62
|
+
)
|
|
63
|
+
)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pprint import pformat
|
|
3
|
+
|
|
4
|
+
import select_ai
|
|
5
|
+
import select_ai.agent
|
|
6
|
+
from select_ai.agent import Task, TaskAttributes
|
|
7
|
+
|
|
8
|
+
user = os.getenv("SELECT_AI_USER")
|
|
9
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
10
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
11
|
+
|
|
12
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
13
|
+
|
|
14
|
+
attributes = TaskAttributes(
|
|
15
|
+
instruction="Help the user with their request about movies. "
|
|
16
|
+
"User question: {query}. "
|
|
17
|
+
"You can use SQL tool to search the data from database",
|
|
18
|
+
tools=["MOVIE_SQL_TOOL"],
|
|
19
|
+
enable_human_tool=False,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
task = Task(
|
|
23
|
+
task_name="ANALYZE_MOVIE_TASK",
|
|
24
|
+
description="Movie task involving a human",
|
|
25
|
+
attributes=attributes,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
task.create(replace=True)
|
|
29
|
+
|
|
30
|
+
print(task.task_name)
|
|
31
|
+
print(pformat(task.attributes))
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import select_ai
|
|
4
|
+
import select_ai.agent
|
|
5
|
+
|
|
6
|
+
user = os.getenv("SELECT_AI_USER")
|
|
7
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
8
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
9
|
+
|
|
10
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
11
|
+
|
|
12
|
+
for task in select_ai.agent.Task.list():
|
|
13
|
+
print(task)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import uuid
|
|
3
|
+
|
|
4
|
+
import select_ai
|
|
5
|
+
from select_ai.agent import (
|
|
6
|
+
Team,
|
|
7
|
+
TeamAttributes,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
conversation_id = str(uuid.uuid4())
|
|
11
|
+
|
|
12
|
+
user = os.getenv("SELECT_AI_USER")
|
|
13
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
14
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
15
|
+
|
|
16
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
17
|
+
|
|
18
|
+
# Team
|
|
19
|
+
team = Team(
|
|
20
|
+
team_name="MOVIE_AGENT_TEAM",
|
|
21
|
+
attributes=TeamAttributes(
|
|
22
|
+
agents=[{"name": "MOVIE_ANALYST", "task": "ANALYZE_MOVIE_TASK"}],
|
|
23
|
+
process="sequential",
|
|
24
|
+
),
|
|
25
|
+
)
|
|
26
|
+
team.create(enabled=True, replace=True)
|
|
27
|
+
|
|
28
|
+
print(
|
|
29
|
+
team.run(
|
|
30
|
+
prompt="Could you list the movies in the database?",
|
|
31
|
+
params={"conversation_id": conversation_id},
|
|
32
|
+
)
|
|
33
|
+
)
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
# tool_create.py
|
|
10
|
+
#
|
|
11
|
+
# Create a tool for
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
from pprint import pformat
|
|
16
|
+
|
|
17
|
+
import select_ai
|
|
18
|
+
import select_ai.agent
|
|
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
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
25
|
+
|
|
26
|
+
profile_attributes = select_ai.ProfileAttributes(
|
|
27
|
+
credential_name="my_oci_ai_profile_key",
|
|
28
|
+
object_list=[
|
|
29
|
+
{"owner": user, "name": "MOVIE"},
|
|
30
|
+
{"owner": user, "name": "ACTOR"},
|
|
31
|
+
{"owner": user, "name": "DIRECTOR"},
|
|
32
|
+
],
|
|
33
|
+
provider=select_ai.OCIGenAIProvider(
|
|
34
|
+
region="us-chicago-1",
|
|
35
|
+
oci_apiformat="GENERIC",
|
|
36
|
+
model="meta.llama-4-maverick-17b-128e-instruct-fp8",
|
|
37
|
+
),
|
|
38
|
+
)
|
|
39
|
+
profile = select_ai.Profile(
|
|
40
|
+
profile_name="LLAMA_4_MAVERICK",
|
|
41
|
+
attributes=profile_attributes,
|
|
42
|
+
description="MY OCI AI Profile",
|
|
43
|
+
replace=True,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Use the OCI AI Profile to perform natural
|
|
47
|
+
# language SQL translation
|
|
48
|
+
sql_tool = select_ai.agent.Tool.create_sql_tool(
|
|
49
|
+
tool_name="MOVIE_SQL_TOOL",
|
|
50
|
+
description="My Select AI MOVIE SQL agent tool",
|
|
51
|
+
profile_name="LLAMA_4_MAVERICK",
|
|
52
|
+
replace=True,
|
|
53
|
+
)
|
|
54
|
+
print(sql_tool.tool_name)
|
|
55
|
+
print(pformat(sql_tool.attributes))
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
# tool_create_human.py
|
|
10
|
+
#
|
|
11
|
+
# Create a vector index for Retrieval Augmented Generation (RAG)
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
|
|
16
|
+
import select_ai
|
|
17
|
+
import select_ai.agent
|
|
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
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
24
|
+
|
|
25
|
+
attributes = select_ai.agent.ToolAttributes(
|
|
26
|
+
tool_params=select_ai.agent.HumanToolParams()
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
human_tool = select_ai.agent.Tool(
|
|
30
|
+
attributes=attributes,
|
|
31
|
+
tool_name="Human",
|
|
32
|
+
description="My Select AI agent human tool",
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
human_tool.create()
|
|
@@ -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
|
+
# tool_delete.py
|
|
10
|
+
#
|
|
11
|
+
# Delete an AI tool
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
|
|
16
|
+
import select_ai.agent
|
|
17
|
+
|
|
18
|
+
user = os.getenv("SELECT_AI_USER")
|
|
19
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
20
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
21
|
+
|
|
22
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
23
|
+
|
|
24
|
+
tool = select_ai.agent.Tool("LLM_CHAT_TOOL")
|
|
25
|
+
tool.delete(force=True)
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
# tool_list.py
|
|
10
|
+
#
|
|
11
|
+
# List all the Agent Tools
|
|
12
|
+
# -----------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
|
|
16
|
+
import select_ai
|
|
17
|
+
import select_ai.agent
|
|
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
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
24
|
+
|
|
25
|
+
for tool in select_ai.agent.Tool.list():
|
|
26
|
+
print(tool)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import select_ai
|
|
4
|
+
from select_ai.agent import (
|
|
5
|
+
Agent,
|
|
6
|
+
AgentAttributes,
|
|
7
|
+
Task,
|
|
8
|
+
TaskAttributes,
|
|
9
|
+
Team,
|
|
10
|
+
TeamAttributes,
|
|
11
|
+
Tool,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
OPEN_AI_CREDENTIAL_NAME = "OPENAI_CRED"
|
|
15
|
+
OPEN_AI_PROFILE_NAME = "OPENAI_PROFILE"
|
|
16
|
+
SELECT_AI_AGENT_NAME = "WEB_SEARCH_AGENT"
|
|
17
|
+
SELECT_AI_TASK_NAME = "WEB_SEARCH_TASK"
|
|
18
|
+
SELECT_AI_TOOL_NAME = "WEB_SEARCH_TOOL"
|
|
19
|
+
SELECT_AI_TEAM_NAME = "WEB_SEARCH_TEAM"
|
|
20
|
+
|
|
21
|
+
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",
|
|
23
|
+
"c2e3ff20-f56d-40e7-987c-cc72740c75a5": "What is the main topic at this URL https://www.oracle.com/artificial-intelligence/database-machine-learning",
|
|
24
|
+
"25e23a25-07b9-4ed7-be11-f7e5e445d286": "What is the main topic at this URL https://openai.com",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# connect
|
|
28
|
+
user = os.getenv("SELECT_AI_USER")
|
|
29
|
+
password = os.getenv("SELECT_AI_PASSWORD")
|
|
30
|
+
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
|
|
31
|
+
select_ai.connect(user=user, password=password, dsn=dsn)
|
|
32
|
+
|
|
33
|
+
# Create Open AI credential
|
|
34
|
+
select_ai.create_credential(
|
|
35
|
+
credential={
|
|
36
|
+
"credential_name": OPEN_AI_CREDENTIAL_NAME,
|
|
37
|
+
"username": "OPENAI",
|
|
38
|
+
"password": os.getenv("OPEN_AI_API_KEY"),
|
|
39
|
+
},
|
|
40
|
+
replace=True,
|
|
41
|
+
)
|
|
42
|
+
print("Created credential: ", OPEN_AI_CREDENTIAL_NAME)
|
|
43
|
+
|
|
44
|
+
# # Create Open AI Profile
|
|
45
|
+
profile = select_ai.Profile(
|
|
46
|
+
profile_name=OPEN_AI_PROFILE_NAME,
|
|
47
|
+
attributes=select_ai.ProfileAttributes(
|
|
48
|
+
credential_name=OPEN_AI_CREDENTIAL_NAME,
|
|
49
|
+
provider=select_ai.OpenAIProvider(model="gpt-4.1"),
|
|
50
|
+
),
|
|
51
|
+
description="My Open AI Profile",
|
|
52
|
+
replace=True,
|
|
53
|
+
)
|
|
54
|
+
print("Created profile: ", OPEN_AI_PROFILE_NAME)
|
|
55
|
+
|
|
56
|
+
# Create an AI Agent team
|
|
57
|
+
team = Team(
|
|
58
|
+
team_name=SELECT_AI_TEAM_NAME,
|
|
59
|
+
attributes=TeamAttributes(
|
|
60
|
+
agents=[{"name": SELECT_AI_AGENT_NAME, "task": SELECT_AI_TASK_NAME}]
|
|
61
|
+
),
|
|
62
|
+
)
|
|
63
|
+
team.create(replace=True)
|
|
64
|
+
|
|
65
|
+
# Agent
|
|
66
|
+
agent = Agent(
|
|
67
|
+
agent_name=SELECT_AI_AGENT_NAME,
|
|
68
|
+
attributes=AgentAttributes(
|
|
69
|
+
profile_name=OPEN_AI_PROFILE_NAME,
|
|
70
|
+
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.",
|
|
72
|
+
),
|
|
73
|
+
)
|
|
74
|
+
agent.create(replace=True)
|
|
75
|
+
|
|
76
|
+
# Task
|
|
77
|
+
task = Task(
|
|
78
|
+
task_name=SELECT_AI_TASK_NAME,
|
|
79
|
+
attributes=TaskAttributes(
|
|
80
|
+
instruction="Answer the user question about the provided URL:{query}",
|
|
81
|
+
enable_human_tool=False,
|
|
82
|
+
tools=[SELECT_AI_TOOL_NAME],
|
|
83
|
+
),
|
|
84
|
+
)
|
|
85
|
+
task.create(replace=True)
|
|
86
|
+
|
|
87
|
+
# Tool
|
|
88
|
+
web_search_tool = Tool.create_websearch_tool(
|
|
89
|
+
tool_name=SELECT_AI_TOOL_NAME,
|
|
90
|
+
credential_name=OPEN_AI_CREDENTIAL_NAME,
|
|
91
|
+
description="Web Search Tool using OpenAI",
|
|
92
|
+
replace=True,
|
|
93
|
+
)
|
|
94
|
+
print("Created tool: ", SELECT_AI_TOOL_NAME)
|
|
95
|
+
|
|
96
|
+
# Run the Agent Team
|
|
97
|
+
for conversation_id, prompt in USER_QUERIES.items():
|
|
98
|
+
response = team.run(
|
|
99
|
+
prompt=prompt, params={"conversation_id": conversation_id}
|
|
100
|
+
)
|
|
101
|
+
print(response)
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
8
|
# -----------------------------------------------------------------------------
|
|
9
|
-
# async/
|
|
9
|
+
# async/vector_index_update_attributes.py
|
|
10
10
|
#
|
|
11
|
-
#
|
|
11
|
+
# Update Vector index attributes
|
|
12
12
|
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
import asyncio
|
|
@@ -34,7 +34,9 @@ async def main():
|
|
|
34
34
|
await async_vector_index.set_attributes(attributes=updated_attributes)
|
|
35
35
|
|
|
36
36
|
# Use vector_index.set_attribute to update a single attribute
|
|
37
|
-
await async_vector_index.set_attribute(
|
|
37
|
+
await async_vector_index.set_attribute(
|
|
38
|
+
attribute_name="similarity_threshold", attribute_value=0.5
|
|
39
|
+
)
|
|
38
40
|
attributes = await async_vector_index.get_attributes()
|
|
39
41
|
print(attributes)
|
|
40
42
|
|
|
@@ -23,6 +23,6 @@ select_ai_user = os.getenv("SELECT_AI_USER")
|
|
|
23
23
|
|
|
24
24
|
select_ai.connect(user=admin_user, password=password, dsn=dsn)
|
|
25
25
|
select_ai.enable_provider(
|
|
26
|
-
users=select_ai_user, provider_endpoint="
|
|
26
|
+
users=select_ai_user, provider_endpoint="api.OPENAI.com"
|
|
27
27
|
)
|
|
28
28
|
print("Enabled AI provider for user: ", select_ai_user)
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
|
|
8
8
|
# -----------------------------------------------------------------------------
|
|
9
|
-
#
|
|
9
|
+
# vector_index_update_attributes.py
|
|
10
10
|
#
|
|
11
|
-
#
|
|
11
|
+
# Update attributes for a vector index
|
|
12
12
|
# -----------------------------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
import os
|
|
@@ -30,5 +30,7 @@ updated_attributes = select_ai.OracleVectorIndexAttributes(
|
|
|
30
30
|
vector_index.set_attributes(attributes=updated_attributes)
|
|
31
31
|
|
|
32
32
|
# Use vector_index.set_attribute to update a single attribute
|
|
33
|
-
vector_index.set_attribute(
|
|
33
|
+
vector_index.set_attribute(
|
|
34
|
+
attribute_name="similarity_threshold", attribute_value=0.5
|
|
35
|
+
)
|
|
34
36
|
print(vector_index.get_attributes())
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
from .core import Agent, AgentAttributes
|
|
10
|
+
from .task import Task, TaskAttributes
|
|
11
|
+
from .team import Team, TeamAttributes
|
|
12
|
+
from .tool import (
|
|
13
|
+
EmailNotificationToolParams,
|
|
14
|
+
HTTPToolParams,
|
|
15
|
+
HumanToolParams,
|
|
16
|
+
RAGToolParams,
|
|
17
|
+
SlackNotificationToolParams,
|
|
18
|
+
SQLToolParams,
|
|
19
|
+
Tool,
|
|
20
|
+
ToolAttributes,
|
|
21
|
+
ToolParams,
|
|
22
|
+
ToolType,
|
|
23
|
+
WebSearchToolParams,
|
|
24
|
+
)
|