|
| 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 | + |
1 | 14 | import os |
2 | 15 | import uuid |
3 | 16 |
|
|
18 | 31 | select_ai.connect(user=user, password=password, dsn=dsn) |
19 | 32 |
|
20 | 33 | # 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 | 34 | agent = Agent( |
28 | 35 | 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 | + ), |
30 | 42 | ) |
31 | 43 | agent.create(enabled=True, replace=True) |
32 | 44 | print("Create Agent", agent) |
33 | 45 |
|
34 | 46 | # 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 | 47 | task = Task( |
41 | 48 | task_name="ANALYZE_MOVIE_TASK", |
42 | 49 | 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 | + ), |
44 | 55 | ) |
45 | 56 | task.create(replace=True) |
46 | 57 | print("Created Task", task) |
47 | 58 |
|
48 | 59 | # Team |
49 | | -team_attributes = TeamAttributes( |
50 | | - agents=[{"name": "MOVIE_ANALYST", "task": "ANALYZE_MOVIE_TASK"}], |
51 | | - process="sequential", |
52 | | -) |
53 | 60 | team = Team( |
54 | 61 | 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 | + ), |
56 | 66 | ) |
57 | 67 | team.create(enabled=True, replace=True) |
58 | 68 | print( |
|
0 commit comments