// 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).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.GenerativeaiagentService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Generativeaiagent
{
public class CreateAgentEndpointExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createAgentEndpointDetails = new Oci.GenerativeaiagentService.Models.CreateAgentEndpointDetails
{
DisplayName = "EXAMPLE-displayName-Value",
Description = "EXAMPLE-description-Value",
AgentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-agentId-Value",
ContentModerationConfig = new Oci.GenerativeaiagentService.Models.ContentModerationConfig
{
ShouldEnableOnInput = false,
ShouldEnableOnOutput = true
},
GuardrailConfig = new Oci.GenerativeaiagentService.Models.GuardrailConfig
{
ContentModerationConfig = new Oci.GenerativeaiagentService.Models.ContentModerationGuardrailConfig
{
InputGuardrailMode = Oci.GenerativeaiagentService.Models.GuardrailMode.Block,
OutputGuardrailMode = Oci.GenerativeaiagentService.Models.GuardrailMode.Disable
},
PromptInjectionConfig = new Oci.GenerativeaiagentService.Models.PromptInjectionGuardrailConfig
{
InputGuardrailMode = Oci.GenerativeaiagentService.Models.GuardrailMode.Inform
},
PersonallyIdentifiableInformationConfig = new Oci.GenerativeaiagentService.Models.PersonallyIdentifiableInformationGuardrailConfig
{
InputGuardrailMode = Oci.GenerativeaiagentService.Models.GuardrailMode.Inform,
OutputGuardrailMode = Oci.GenerativeaiagentService.Models.GuardrailMode.Disable
}
},
Metadata = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_fVoLs",
"EXAMPLE_VALUE_aDKk5Qv9YdOi2TmMLXSv"
}
},
HumanInputConfig = new Oci.GenerativeaiagentService.Models.HumanInputConfig
{
ShouldEnableHumanInput = true
},
OutputConfig = new Oci.GenerativeaiagentService.Models.OutputConfig
{
OutputLocation = new Oci.GenerativeaiagentService.Models.ObjectStoragePrefixOutputLocation
{
NamespaceName = "EXAMPLE-namespaceName-Value",
BucketName = "EXAMPLE-bucketName-Value",
Prefix = "EXAMPLE-prefix-Value"
},
RetentionPeriodInMinutes = 336
},
ShouldEnableTrace = false,
ShouldEnableCitation = true,
ShouldEnableSession = false,
ShouldEnableMultiLanguage = true,
SessionConfig = new Oci.GenerativeaiagentService.Models.SessionConfig
{
IdleTimeoutInSeconds = 679
},
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_biaB0",
"EXAMPLE_VALUE_JQk4qFl5Qz15IACgYgna"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_HnrFg",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_C7WcX",
"EXAMPLE--Value"
}
}
}
}
};
var createAgentEndpointRequest = new Oci.GenerativeaiagentService.Requests.CreateAgentEndpointRequest
{
CreateAgentEndpointDetails = createAgentEndpointDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "AQQ7YGBES6QTU8UA2MQH<unique_ID>"
};
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new GenerativeAiAgentClient(provider, new ClientConfiguration()))
{
var response = await client.CreateAgentEndpoint(createAgentEndpointRequest);
// Retrieve value from the response.
var id = response.AgentEndpoint.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateAgentEndpoint Failed with {e.Message}");
throw e;
}
}
}
}