// 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{ServingMode: generativeaiinference.OnDemandServingMode{ModelId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-modelId-Value")},
		ChatRequest: generativeaiinference.CohereChatRequest{Documents: []interface{}{"EXAMPLE-documents-Value"},
			MaxInputTokens:   common.Int(519),
			PreambleOverride: common.String("EXAMPLE-preambleOverride-Value"),
			PresencePenalty:  common.Float64(0.8043424),
			Seed:             common.Int(305),
			StreamOptions:    &generativeaiinference.StreamOptions{IsIncludeUsage: common.Bool(false)},
			ToolResults: []generativeaiinference.CohereToolResult{generativeaiinference.CohereToolResult{Call: &generativeaiinference.CohereToolCall{Name: common.String("EXAMPLE-name-Value"),
				Parameters: &parameters},
				Outputs: []interface{}{"EXAMPLE-outputs-Value"}}},
			IsEcho:           common.Bool(true),
			IsStream:         common.Bool(false),
			Message:          common.String("EXAMPLE-message-Value"),
			PromptTruncation: generativeaiinference.CohereChatRequestPromptTruncationOff,
			Tools: []generativeaiinference.CohereTool{generativeaiinference.CohereTool{ParameterDefinitions: map[string]generativeaiinference.CohereParameterDefinition{"EXAMPLE_KEY_W0Y40": generativeaiinference.CohereParameterDefinition{Description: common.String("EXAMPLE-description-Value"),
				IsRequired: common.Bool(false),
				Type:       common.String("EXAMPLE-type-Value")}},
				Description: common.String("EXAMPLE-description-Value"),
				Name:        common.String("EXAMPLE-name-Value")}},
			TopP:                common.Float64(0.45686334),
			ChatHistory:         []generativeaiinference.CohereMessage{generativeaiinference.CohereSystemMessage{Message: common.String("EXAMPLE-message-Value")}},
			FrequencyPenalty:    common.Float64(0.40616524),
			IsRawPrompting:      common.Bool(false),
			IsSearchQueriesOnly: common.Bool(false),
			MaxTokens:           common.Int(346),
			Temperature:         common.Float64(0.6024618),
			CitationQuality:     generativeaiinference.CohereChatRequestCitationQualityAccurate,
			IsForceSingleStep:   common.Bool(false),
			ResponseFormat:      generativeaiinference.CohereResponseJsonFormat{Schema: &schema},
			SafetyMode:          generativeaiinference.CohereChatRequestSafetyModeContextual,
			StopSequences:       []string{"EXAMPLE--Value"},
			TopK:                common.Int(335)},
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")},
		OpcRequestId:  common.String("AF3TIJYGONJZU1OGWPHN<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)
}