# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
require 'oci'
# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config
# Initialize service client with default config file
generative_ai_agent_client =
OCI::GenerativeAiAgent::GenerativeAiAgentClient.new(config: config)
# Send the request to service, some parameters are not required, see API doc for more info
create_tool_response =
generative_ai_agent_client.create_tool(
OCI::GenerativeAiAgent::Models::CreateToolDetails.new(
description: 'EXAMPLE-description-Value',
agent_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-agentId-Value',
compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
tool_config:
OCI::GenerativeAiAgent::Models::RagToolConfig.new(
tool_config_type: 'RAG_TOOL_CONFIG',
knowledge_base_configs: [
OCI::GenerativeAiAgent::Models::KnowledgeBaseConfig.new(
knowledge_base_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-knowledgeBaseId-Value'
)
],
generation_llm_customization:
OCI::GenerativeAiAgent::Models::LlmCustomization.new(
llm_selection:
OCI::GenerativeAiAgent::Models::CustomGenAiEndpointLlmSelection
.new(
llm_selection_type: 'CUSTOM_GEN_AI_ENDPOINT',
endpoint_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-endpointId-Value'
),
llm_hyper_parameters: { 'EXAMPLE_KEY_ct1c4' => 'EXAMPLE--Value' },
instruction: 'EXAMPLE-instruction-Value'
),
runtime_version: 'EXAMPLE-runtimeVersion-Value',
embedding_llm_customization:
OCI::GenerativeAiAgent::Models::LlmCustomization.new(
llm_selection:
OCI::GenerativeAiAgent::Models::CustomGenAiEndpointLlmSelection
.new(
llm_selection_type: 'CUSTOM_GEN_AI_ENDPOINT',
endpoint_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-endpointId-Value'
),
llm_hyper_parameters: { 'EXAMPLE_KEY_ZhZjv' => 'EXAMPLE--Value' },
instruction: 'EXAMPLE-instruction-Value'
),
reranking_llm_customization:
OCI::GenerativeAiAgent::Models::LlmCustomization.new(
llm_selection:
OCI::GenerativeAiAgent::Models::CustomGenAiEndpointLlmSelection
.new(
llm_selection_type: 'CUSTOM_GEN_AI_ENDPOINT',
endpoint_id:
'ocid1.test.oc1..<unique_ID>EXAMPLE-endpointId-Value'
),
llm_hyper_parameters: { 'EXAMPLE_KEY_ZR1Di' => 'EXAMPLE--Value' },
instruction: 'EXAMPLE-instruction-Value'
),
reasoning_llm_customization:
OCI::GenerativeAiAgent::Models::LlmCustomization.new(
llm_selection:
OCI::GenerativeAiAgent::Models::CustomGenAiModelLlmSelection
.new(
llm_selection_type: 'CUSTOM_GEN_AI_MODEL',
model_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-modelId-Value'
),
llm_hyper_parameters: { 'EXAMPLE_KEY_D94nK' => 'EXAMPLE--Value' },
instruction: 'EXAMPLE-instruction-Value'
)
),
display_name: 'EXAMPLE-displayName-Value',
metadata: { 'EXAMPLE_KEY_1nV66' => 'EXAMPLE_VALUE_ewqi0AimLLDZ8yrtfE8Y' },
freeform_tags: {
'EXAMPLE_KEY_p0fi4' => 'EXAMPLE_VALUE_Jv9W71keZkEqTYl78dSn'
},
defined_tags: {
'EXAMPLE_KEY_GkDf8' => { 'EXAMPLE_KEY_gXfT9' => 'EXAMPLE--Value' }
}
)
)
# Get the data from response
puts "#{create_tool_response.data}"