// 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).

package main

import (
	"context"
	"fmt"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
	"github.com/oracle/oci-go-sdk/v65/generativeaiinference"
)

func ExampleChat() {
	// 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.
	client, err := generativeaiinference.NewGenerativeAiInferenceClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).
	var schema interface{}
	schema = "EXAMPLE-schema-Value"
	var parameters interface{}
	parameters = "EXAMPLE-parameters-Value"
	req := generativeaiinference.ChatRequest{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		ChatDetails: generativeaiinference.ChatDetails{CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
			ServingMode: generativeaiinference.OnDemandServingMode{ModelId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-modelId-Value")},
			ChatRequest: generativeaiinference.CohereChatRequestV2{ResponseFormat: generativeaiinference.CohereResponseJsonFormat{Schema: &schema},
				FrequencyPenalty:    common.Float64(0.25524896),
				IsRawPrompting:      common.Bool(true),
				IsSearchQueriesOnly: common.Bool(false),
				IsStream:            common.Bool(false),
				Seed:                common.Int(2),
				IsLogProbsEnabled:   common.Bool(false),
				Messages: []generativeaiinference.CohereMessageV2{generativeaiinference.CohereUserMessageV2{Content: []generativeaiinference.CohereContentV2{generativeaiinference.CohereImageContentV2{ImageUrl: &generativeaiinference.CohereImageUrlV2{Detail: generativeaiinference.CohereImageUrlV2DetailAuto,
					Url: common.String("EXAMPLE-url-Value")}}}}},
				PresencePenalty: common.Float64(0.66092473),
				SafetyMode:      generativeaiinference.CohereChatRequestV2SafetyModeOff,
				Temperature:     common.Float64(0.83250326),
				Thinking: &generativeaiinference.CohereThinkingV2{TokenBudget: common.Int(779),
					Type: generativeaiinference.CohereThinkingV2TypeEnabled},
				TopP:                 common.Float64(0.47860694),
				Priority:             common.Int(917),
				CitationOptions:      &generativeaiinference.CitationOptionsV2{Mode: generativeaiinference.CitationOptionsV2ModeAccurate},
				IsStrictToolsEnabled: common.Bool(true),
				MaxTokens:            common.Int(594),
				ToolsChoice:          generativeaiinference.CohereChatRequestV2ToolsChoiceRequired,
				Documents:            []interface{}{"EXAMPLE-documents-Value"},
				StopSequences:        []string{"EXAMPLE--Value"},
				StreamOptions:        &generativeaiinference.StreamOptions{IsIncludeUsage: common.Bool(false)},
				Tools: []generativeaiinference.CohereToolV2{generativeaiinference.CohereToolV2{Function: &generativeaiinference.Function{Description: common.String("EXAMPLE-description-Value"),
					Name:       common.String("EXAMPLE-name-Value"),
					Parameters: &parameters},
					Type: generativeaiinference.CohereToolV2TypeFunction}},
				TopK: common.Int(145)}},
		OpcRequestId: common.String("01F8ZU5VSK2GAJPZXNSY<unique_ID>")}

	// Send the request using the service client
	resp, err := client.Chat(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}