Skip to content

Commit e78be15

Browse files
rashimahawarMaxrovr
authored andcommitted
Added - Support for GenAI Agents Tools API
1 parent 8a3ec60 commit e78be15

34 files changed

+3939
-211
lines changed

examples/generative_ai_agent/agent.tf

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ resource "oci_generative_ai_agent_agent" "test_agent" {
99
display_name = var.agent_display_name
1010
description = var.agent_description
1111
welcome_message = var.agent_welcome_message
12-
#defined_tags not tested - cannot test in home region
12+
llm_config {
13+
routing_llm_customization {
14+
#Optional
15+
instruction = var.agent_llm_config_routing_llm_customization_instruction
16+
}
17+
}
18+
#defined_tags not tested - cannot test in home region
1319
freeform_tags = var.test_freeform_tags
14-
knowledge_base_ids = [
15-
oci_generative_ai_agent_knowledge_base.test_service_managed_knowledge_base.id
16-
]
1720
}
1821

1922
data "oci_generative_ai_agent_agent" "test_agent" {

examples/generative_ai_agent/agent_endpoint.tf

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,61 @@
11
resource "oci_generative_ai_agent_agent_endpoint" "test_agent_endpoint" {
22
#Required
33
compartment_id = var.compartment_ocid
4-
agent_id = data.oci_generative_ai_agent_agent.test_agent.id
4+
agent_id = var.test_agent_id
55

66
#Optional
77
display_name = var.test_agent_endpoint_display_name
88
description = var.test_agent_endpoint_description
9-
#defined_tags not tested - cannot test in home region
9+
#defined_tags not tested - cannot test in home region
1010
freeform_tags = var.test_freeform_tags
1111
should_enable_citation = var.should_enable_citation
1212
should_enable_session = var.should_enable_session
1313
should_enable_trace = var.should_enable_trace
14+
should_enable_multi_language = var.agent_endpoint_should_enable_multi_language
1415
content_moderation_config {
1516
should_enable_on_input = var.should_enable_on_input
1617
should_enable_on_output = var.should_enable_on_output
1718
}
19+
guardrail_config {
20+
21+
#Optional
22+
content_moderation_config {
23+
24+
#Optional
25+
input_guardrail_mode = var.agent_endpoint_guardrail_config_content_moderation_config_input_guardrail_mode
26+
output_guardrail_mode = var.agent_endpoint_guardrail_config_content_moderation_config_output_guardrail_mode
27+
}
28+
personally_identifiable_information_config {
29+
30+
#Optional
31+
input_guardrail_mode = var.agent_endpoint_guardrail_config_personally_identifiable_information_config_input_guardrail_mode
32+
output_guardrail_mode = var.agent_endpoint_guardrail_config_personally_identifiable_information_config_output_guardrail_mode
33+
}
34+
prompt_injection_config {
35+
36+
#Optional
37+
input_guardrail_mode = var.agent_endpoint_guardrail_config_prompt_injection_config_input_guardrail_mode
38+
}
39+
}
40+
human_input_config {
41+
#Required
42+
should_enable_human_input = var.agent_endpoint_human_input_config_should_enable_human_input
43+
}
44+
output_config {
45+
#Required
46+
output_location {
47+
#Required
48+
bucket = var.agent_endpoint_output_config_output_location_bucket
49+
namespace = var.agent_endpoint_output_config_output_location_namespace
50+
output_location_type = var.agent_endpoint_output_config_output_location_output_location_type
51+
52+
#Optional
53+
prefix = var.agent_endpoint_output_config_output_location_prefix
54+
}
55+
56+
#Optional
57+
retention_period_in_minutes = var.agent_endpoint_output_config_retention_period_in_minutes
58+
}
1859
session_config {
1960
idle_timeout_in_seconds = var.idle_timeout_in_seconds
2061
}
Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
resource "oci_generative_ai_agent_data_source" "test_data_source" {
22
#Required
33
compartment_id = var.compartment_ocid
4-
knowledge_base_id = oci_generative_ai_agent_knowledge_base.test_service_managed_knowledge_base.id
4+
knowledge_base_id = var.test_knowledge_base_id
55
data_source_config {
6-
data_source_config_type = "OCI_OBJECT_STORAGE"
6+
data_source_config_type = "OCI_OBJECT_STORAGE"
77
object_storage_prefixes {
8-
bucket = data.oci_objectstorage_bucket.bucket.name
9-
namespace = data.oci_objectstorage_namespace.ns.namespace
10-
prefix = var.test_data_source_prefix
8+
bucket = var.test_bucket
9+
namespace = var.test_namespace
10+
prefix = var.test_prefix
1111
}
1212
}
1313

1414
#Optional
1515
display_name = var.test_data_source_display_name
1616
description = var.test_data_source_description
17-
#defined_tags not tested - cannot test in home region
17+
#defined_tags not tested - cannot test in home region
1818
freeform_tags = var.test_freeform_tags
1919
}
2020

@@ -27,13 +27,3 @@ data "oci_generative_ai_agent_data_sources" "test_data_sources" {
2727
#Required
2828
compartment_id = var.compartment_ocid
2929
}
30-
31-
data "oci_objectstorage_namespace" "ns" {
32-
#Optional
33-
compartment_id = var.compartment_ocid
34-
}
35-
36-
data "oci_objectstorage_bucket" "bucket" {
37-
name = "oci-docs"
38-
namespace = data.oci_objectstorage_namespace.ns.namespace
39-
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
resource "oci_generative_ai_agent_tool" "rag_test_tool" {
2+
agent_id = var.test_agent_id
3+
compartment_id = var.compartment_ocid
4+
display_name = var.test_agent_tool_display_name
5+
description = var.test_agent_tool_description
6+
freeform_tags = {
7+
Department = "Finance"
8+
}
9+
tool_config {
10+
knowledge_base_configs {
11+
knowledge_base_id = var.test_knowledge_base_id
12+
}
13+
tool_config_type = "RAG_TOOL_CONFIG"
14+
generation_llm_customization {
15+
instruction = "instruction"
16+
}
17+
}
18+
}
19+
20+
21+
resource "oci_generative_ai_agent_tool" "sql_test_tool" {
22+
agent_id = var.test_agent_id
23+
compartment_id = var.compartment_ocid
24+
display_name = var.test_agent_tool_display_name
25+
description = var.test_agent_tool_description
26+
tool_config {
27+
database_schema {
28+
content = "CREATE TABLE example ();"
29+
input_location_type = "INLINE"
30+
}
31+
dialect = "SQL_LITE"
32+
model_size = "SMALL"
33+
should_enable_self_correction = false
34+
should_enable_sql_execution = false
35+
tool_config_type = "SQL_TOOL_CONFIG"
36+
}
37+
}
38+
39+
resource "oci_generative_ai_agent_tool" "fc_test_tool" {
40+
agent_id = var.test_agent_id
41+
compartment_id = var.compartment_ocid
42+
display_name = var.test_agent_tool_display_name
43+
description = var.test_agent_tool_description
44+
freeform_tags = {
45+
Department = "Finance"
46+
}
47+
tool_config {
48+
function {
49+
description = "description"
50+
name = "name"
51+
parameters = {
52+
"parameters" = "parameters"
53+
}
54+
}
55+
tool_config_type = "FUNCTION_CALLING_TOOL_CONFIG"
56+
}
57+
}

examples/generative_ai_agent/variables.tf

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ variable "test_agent_endpoint_description" {
5353
default = "test agent endpoint"
5454
}
5555

56+
variable "test_agent_tool_display_name" {
57+
default = "test_agent_tool"
58+
}
59+
60+
variable "test_agent_tool_description" {
61+
default = "test agent tool"
62+
}
63+
5664
variable "test_knowledge_base_display_name" {
5765
default = "test_knowledge_base"
5866
}
@@ -85,4 +93,74 @@ variable "test_freeform_tags" {
8593
default = {
8694
"bar-key" = "value"
8795
}
96+
}
97+
98+
variable "should_enable_multi_modality"{
99+
default = "true"
100+
}
101+
102+
variable "test_agent_id" {}
103+
104+
variable "test_knowledge_base_id" {}
105+
106+
variable "test_bucket" {}
107+
108+
variable "test_namespace" {}
109+
110+
variable "test_prefix" {}
111+
112+
variable "agent_endpoint_guardrail_config_content_moderation_config_input_guardrail_mode" {
113+
default = "DISABLE"
114+
}
115+
116+
variable "agent_endpoint_guardrail_config_content_moderation_config_output_guardrail_mode" {
117+
default = "DISABLE"
118+
}
119+
120+
variable "agent_endpoint_guardrail_config_personally_identifiable_information_config_input_guardrail_mode" {
121+
default = "DISABLE"
122+
}
123+
124+
variable "agent_endpoint_guardrail_config_personally_identifiable_information_config_output_guardrail_mode" {
125+
default = "DISABLE"
126+
}
127+
128+
variable "agent_endpoint_guardrail_config_prompt_injection_config_input_guardrail_mode" {
129+
default = "DISABLE"
130+
}
131+
132+
variable "agent_endpoint_human_input_config_should_enable_human_input" {
133+
default = false
134+
}
135+
136+
variable "agent_endpoint_metadata" {
137+
default = "metadata"
138+
}
139+
140+
variable "agent_endpoint_output_config_output_location_bucket" {
141+
default = "bucket"
142+
}
143+
144+
variable "agent_endpoint_output_config_output_location_namespace" {
145+
default = "namespace"
146+
}
147+
148+
variable "agent_endpoint_output_config_output_location_output_location_type" {
149+
default = "OBJECT_STORAGE_PREFIX"
150+
}
151+
152+
variable "agent_endpoint_output_config_output_location_prefix" {
153+
default = "prefix"
154+
}
155+
156+
variable "agent_endpoint_output_config_retention_period_in_minutes" {
157+
default = 10
158+
}
159+
160+
variable "agent_endpoint_should_enable_multi_language" {
161+
default = false
162+
}
163+
164+
variable "agent_llm_config_routing_llm_customization_instruction" {
165+
default = "instruction"
88166
}

0 commit comments

Comments
 (0)