# 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_inference_client = oci.generative_ai_inference.AsyncGenerativeAiInferenceClient(
    config)


# Send the request to service, some parameters are not required, see API
# doc for more info
chat_response = generative_ai_inference_client.chat(
    chat_details=oci.generative_ai_inference.models.ChatDetails(
        compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
        serving_mode=oci.generative_ai_inference.models.OnDemandServingMode(
            serving_type="ON_DEMAND",
            model_id="ocid1.test.oc1..<unique_ID>EXAMPLE-modelId-Value"),
        chat_request=oci.generative_ai_inference.models.CohereChatRequestV2(
            api_format="COHEREV2",
            messages=[
                oci.generative_ai_inference.models.CohereUserMessageV2(
                    role="USER",
                    content=[
                        oci.generative_ai_inference.models.CohereImageContentV2(
                            type="IMAGE_URL",
                            image_url=oci.generative_ai_inference.models.CohereImageUrlV2(
                                url="EXAMPLE-url-Value",
                                detail="AUTO"))])],
            documents=["EXAMPLE-documents-Value"],
            citation_options=oci.generative_ai_inference.models.CitationOptionsV2(
                mode="ACCURATE"),
            tools_choice="REQUIRED",
            tools=[
                oci.generative_ai_inference.models.CohereToolV2(
                    type="FUNCTION",
                    function=oci.generative_ai_inference.models.Function(
                        name="EXAMPLE-name-Value",
                        parameters="EXAMPLE-parameters-Value",
                        description="EXAMPLE-description-Value"))],
            is_strict_tools_enabled=True,
            is_log_probs_enabled=False,
            thinking=oci.generative_ai_inference.models.CohereThinkingV2(
                type="ENABLED",
                token_budget=779),
            response_format=oci.generative_ai_inference.models.CohereResponseJsonFormat(
                type="JSON_OBJECT",
                schema="EXAMPLE-schema-Value"),
            is_search_queries_only=False,
            stream_options=oci.generative_ai_inference.models.StreamOptions(
                is_include_usage=False),
            is_stream=False,
            max_tokens=594,
            temperature=0.83250326,
            top_k=145,
            top_p=0.47860694,
            frequency_penalty=0.25524896,
            presence_penalty=0.66092473,
            seed=2,
            stop_sequences=["EXAMPLE--Value"],
            priority=917,
            is_raw_prompting=True,
            safety_mode="OFF")),
    opc_retry_token="EXAMPLE-opcRetryToken-Value",
    opc_request_id="01F8ZU5VSK2GAJPZXNSY<unique_ID>")

# Get the data from response
print(chat_response.data)