// 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"
	var document interface{}
	document = "EXAMPLE-document-Value"
	req := generativeaiinference.ChatRequest{OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		ChatDetails: generativeaiinference.ChatDetails{ChatRequest: generativeaiinference.CohereChatRequestV2{IsStrictToolsEnabled: common.Bool(false),
			MaxTokens:           common.Int(416),
			Priority:            common.Int(937),
			ResponseFormat:      generativeaiinference.CohereResponseJsonFormat{Schema: &schema},
			SafetyMode:          generativeaiinference.CohereChatRequestV2SafetyModeOff,
			StopSequences:       []string{"EXAMPLE--Value"},
			IsSearchQueriesOnly: common.Bool(true),
			PresencePenalty:     common.Float64(0.90215766),
			StreamOptions:       &generativeaiinference.StreamOptions{IsIncludeUsage: common.Bool(false)},
			Thinking: &generativeaiinference.CohereThinkingV2{TokenBudget: common.Int(443),
				Type: generativeaiinference.CohereThinkingV2TypeEnabled},
			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}},
			TopP:              common.Float64(0.77279377),
			CitationOptions:   &generativeaiinference.CitationOptionsV2{Mode: generativeaiinference.CitationOptionsV2ModeFast},
			Seed:              common.Int(420),
			Temperature:       common.Float64(0.5781878),
			TopK:              common.Int(340),
			Documents:         []interface{}{"EXAMPLE-documents-Value"},
			IsLogProbsEnabled: common.Bool(true),
			IsStream:          common.Bool(true),
			Messages:          []generativeaiinference.CohereMessageV2{generativeaiinference.CohereSystemMessageV2{Content: []generativeaiinference.CohereContentV2{generativeaiinference.CohereDocumentContentV2{Document: &document}}}},
			ToolsChoice:       generativeaiinference.CohereChatRequestV2ToolsChoiceNone,
			FrequencyPenalty:  common.Float64(0.30801296),
			IsRawPrompting:    common.Bool(true)},
			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("8NOYUHSDU8YXMQ1XEONM<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)
}