# 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).
import 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.config.from_file()
# Initialize service client with default config file
generative_ai_agent_client = oci.generative_ai_agent.GenerativeAiAgentClient(
config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_knowledge_base_response = generative_ai_agent_client.create_knowledge_base(
create_knowledge_base_details=oci.generative_ai_agent.models.CreateKnowledgeBaseDetails(
index_config=oci.generative_ai_agent.models.OciOpenSearchIndexConfig(
index_config_type="OCI_OPEN_SEARCH_INDEX_CONFIG",
cluster_id="ocid1.test.oc1..<unique_ID>EXAMPLE-clusterId-Value",
secret_detail=oci.generative_ai_agent.models.BasicAuthSecret(
type="BASIC_AUTH_SECRET",
vault_secret_id="ocid1.test.oc1..<unique_ID>EXAMPLE-vaultSecretId-Value"),
indexes=[
oci.generative_ai_agent.models.Index(
name="EXAMPLE-name-Value",
schema=oci.generative_ai_agent.models.IndexSchema(
body_key="EXAMPLE-bodyKey-Value",
url_key="EXAMPLE-urlKey-Value",
title_key="EXAMPLE-titleKey-Value",
embedding_body_key="EXAMPLE-embeddingBodyKey-Value"))]),
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
display_name="EXAMPLE-displayName-Value",
description="EXAMPLE-description-Value",
freeform_tags={
'EXAMPLE_KEY_uaLSF': 'EXAMPLE_VALUE_YqoCJlCz0X7N1IQ7kCuM'},
defined_tags={
'EXAMPLE_KEY_3P2R8': {
'EXAMPLE_KEY_p0cgL': 'EXAMPLE--Value'}}),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="EAW54L8COJFPKEWWPNAP<unique_ID>")
# Get the data from response
print(create_knowledge_base_response.data)