// 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 logitBias interface{}
	logitBias = "EXAMPLE-logitBias-Value"
	var parameters interface{}
	parameters = "EXAMPLE-parameters-Value"
	var metadata interface{}
	metadata = "EXAMPLE-metadata-Value"
	req := generativeaiinference.ChatRequest{ChatDetails: generativeaiinference.ChatDetails{ChatRequest: generativeaiinference.GenericChatRequest{IsStream: common.Bool(true),
		Messages: []generativeaiinference.Message{generativeaiinference.AssistantMessage{Content: []generativeaiinference.ChatContent{generativeaiinference.VideoContent{VideoUrl: &generativeaiinference.VideoUrl{Detail: generativeaiinference.VideoUrlDetailLow,
			Url: common.String("EXAMPLE-url-Value")}}},
			Name:    common.String("EXAMPLE-name-Value"),
			Refusal: common.String("EXAMPLE-refusal-Value"),
			ToolCalls: []generativeaiinference.ToolCall{generativeaiinference.FunctionCall{Arguments: common.String("EXAMPLE-arguments-Value"),
				Id:   common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value"),
				Name: common.String("EXAMPLE-name-Value")}},
			Annotations: []generativeaiinference.Annotation{generativeaiinference.Annotation{UrlCitation: &generativeaiinference.UrlCitation{Url: common.String("EXAMPLE-url-Value"),
				EndIndex:   common.Int(175),
				StartIndex: common.Int(249),
				Title:      common.String("EXAMPLE-title-Value")},
				Type: common.String("EXAMPLE-type-Value")}}}},
		ReasoningEffort:     generativeaiinference.GenericChatRequestReasoningEffortLow,
		ResponseFormat:      generativeaiinference.JsonObjectResponseFormat{},
		Seed:                common.Int(467),
		FrequencyPenalty:    common.Float64(1.5041656),
		IsParallelToolCalls: common.Bool(true),
		LogitBias:           &logitBias,
		MaxTokens:           common.Int(661),
		ToolChoice:          generativeaiinference.ToolChoiceFunction{Name: common.String("EXAMPLE-name-Value")},
		Tools: []generativeaiinference.ToolDefinition{generativeaiinference.FunctionDefinition{Description: common.String("EXAMPLE-description-Value"),
			Name:       common.String("EXAMPLE-name-Value"),
			Parameters: &parameters}},
		WebSearchOptions: &generativeaiinference.WebSearchOptions{SearchContextSize: generativeaiinference.WebSearchOptionsSearchContextSizeMedium,
			UserLocation: &generativeaiinference.ApproximateLocation{City: common.String("EXAMPLE-city-Value"),
				Country:  common.String("P8"),
				Region:   common.String("EXAMPLE-region-Value"),
				Timezone: common.String("EXAMPLE-timezone-Value")}},
		LogProbs:            common.Int(592),
		MaxCompletionTokens: common.Int(125),
		Metadata:            &metadata,
		Prediction:          generativeaiinference.StaticContent{Content: []generativeaiinference.TextContent{generativeaiinference.TextContent{Text: common.String("EXAMPLE-text-Value")}}},
		PresencePenalty:     common.Float64(1.6071491),
		Stop:                []string{"EXAMPLE--Value"},
		StreamOptions:       &generativeaiinference.StreamOptions{IsIncludeUsage: common.Bool(false)},
		Temperature:         common.Float64(1.6857262),
		IsEcho:              common.Bool(false),
		NumGenerations:      common.Int(1),
		TopK:                common.Int(0),
		TopP:                common.Float64(0.52461445),
		Verbosity:           generativeaiinference.GenericChatRequestVerbosityLow},
		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("9CA4Z7RFAJ8RJGUQISTI<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)
}