// 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 parameters interface{}
	parameters = "EXAMPLE-parameters-Value"
	var schema interface{}
	schema = "EXAMPLE-schema-Value"
	req := generativeaiinference.ChatRequest{ChatDetails: generativeaiinference.ChatDetails{ChatRequest: generativeaiinference.CohereChatRequestV2{Documents: []interface{}{"EXAMPLE-documents-Value"},
		IsRawPrompting:       common.Bool(true),
		IsSearchQueriesOnly:  common.Bool(true),
		IsStrictToolsEnabled: common.Bool(false),
		CitationOptions:      &generativeaiinference.CitationOptionsV2{Mode: generativeaiinference.CitationOptionsV2ModeOff},
		IsStream:             common.Bool(false),
		MaxTokens:            common.Int(676),
		PresencePenalty:      common.Float64(0.3435359),
		Priority:             common.Int(313),
		StreamOptions:        &generativeaiinference.StreamOptions{IsIncludeUsage: common.Bool(true)},
		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}},
		FrequencyPenalty: common.Float64(0.9440276),
		Messages: []generativeaiinference.CohereMessageV2{generativeaiinference.CohereSystemMessageV2{Content: []generativeaiinference.CohereContentV2{generativeaiinference.CohereImageContentV2{ImageUrl: &generativeaiinference.CohereImageUrlV2{Detail: generativeaiinference.CohereImageUrlV2DetailAuto,
			Url: common.String("EXAMPLE-url-Value")}}}}},
		StopSequences: []string{"EXAMPLE--Value"},
		Thinking: &generativeaiinference.CohereThinkingV2{Type: generativeaiinference.CohereThinkingV2TypeEnabled,
			TokenBudget: common.Int(407)},
		TopK:              common.Int(79),
		IsLogProbsEnabled: common.Bool(true),
		ResponseFormat:    generativeaiinference.CohereResponseJsonFormat{Schema: &schema},
		SafetyMode:        generativeaiinference.CohereChatRequestV2SafetyModeOff,
		Seed:              common.Int(478),
		Temperature:       common.Float64(0.8016353),
		ToolsChoice:       generativeaiinference.CohereChatRequestV2ToolsChoiceNone,
		TopP:              common.Float64(0.153871)},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		ServingMode:   generativeaiinference.DedicatedServingMode{EndpointId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-endpointId-Value")}},
		OpcRequestId:  common.String("V8SNRFQ3CEC5XR0VQ9K7<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}

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