// 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 document interface{}
	document = "EXAMPLE-document-Value"
	var parameters interface{}
	parameters = "EXAMPLE-parameters-Value"
	req := generativeaiinference.ChatRequest{ChatDetails: generativeaiinference.ChatDetails{ChatRequest: generativeaiinference.CohereChatRequestV2{CitationOptions: &generativeaiinference.CitationOptionsV2{Mode: generativeaiinference.CitationOptionsV2ModeFast},
		Documents:           []interface{}{"EXAMPLE-documents-Value"},
		IsLogProbsEnabled:   common.Bool(false),
		IsRawPrompting:      common.Bool(true),
		Priority:            common.Int(404),
		StreamOptions:       &generativeaiinference.StreamOptions{IsIncludeUsage: common.Bool(false)},
		ToolsChoice:         generativeaiinference.CohereChatRequestV2ToolsChoiceRequired,
		IsSearchQueriesOnly: common.Bool(false),
		MaxTokens:           common.Int(887),
		Messages: []generativeaiinference.CohereMessageV2{generativeaiinference.CohereToolMessageV2{Content: []generativeaiinference.CohereContentV2{generativeaiinference.CohereDocumentContentV2{Document: &document}},
			ToolCallId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-toolCallId-Value")}},
		PresencePenalty:      common.Float64(0.7918264),
		ResponseFormat:       generativeaiinference.CohereResponseTextFormat{},
		StopSequences:        []string{"EXAMPLE--Value"},
		Temperature:          common.Float64(0.13406122),
		SafetyMode:           generativeaiinference.CohereChatRequestV2SafetyModeOff,
		Seed:                 common.Int(937),
		TopK:                 common.Int(36),
		FrequencyPenalty:     common.Float64(0.90215766),
		IsStream:             common.Bool(true),
		IsStrictToolsEnabled: common.Bool(true),
		Thinking: &generativeaiinference.CohereThinkingV2{TokenBudget: common.Int(203),
			Type: generativeaiinference.CohereThinkingV2TypeDisabled},
		Tools: []generativeaiinference.CohereToolV2{generativeaiinference.CohereToolV2{Function: &generativeaiinference.Function{Name: common.String("EXAMPLE-name-Value"),
			Parameters:  &parameters,
			Description: common.String("EXAMPLE-description-Value")},
			Type: generativeaiinference.CohereToolV2TypeFunction}},
		TopP: common.Float64(0.30801296)},
		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")}},
		OpcRequestId:  common.String("NOYUHSDU8YXMQ1XEONMW<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)
}