// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. package components import ( "encoding/json" "fmt" ) // ChatCompletionNamedToolChoiceType - The type of the tool. Currently, only `function` is supported. type ChatCompletionNamedToolChoiceType string const ( ChatCompletionNamedToolChoiceTypeFunction ChatCompletionNamedToolChoiceType = "function" ) func (e ChatCompletionNamedToolChoiceType) ToPointer() *ChatCompletionNamedToolChoiceType { return &e } func (e *ChatCompletionNamedToolChoiceType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err } switch v { case "function": *e = ChatCompletionNamedToolChoiceType(v) return nil default: return fmt.Errorf("invalid value for ChatCompletionNamedToolChoiceType: %v", v) } } type ChatCompletionNamedToolChoiceFunction struct { // The name of the function to call. Name string `json:"name"` } func (o *ChatCompletionNamedToolChoiceFunction) GetName() string { if o == nil { return "" } return o.Name } // ChatCompletionNamedToolChoice - Specifies a tool the model should use. Use to force the model to call a specific function. type ChatCompletionNamedToolChoice struct { // The type of the tool. Currently, only `function` is supported. Type ChatCompletionNamedToolChoiceType `json:"type"` Function ChatCompletionNamedToolChoiceFunction `json:"function"` } func (o *ChatCompletionNamedToolChoice) GetType() ChatCompletionNamedToolChoiceType { if o == nil { return ChatCompletionNamedToolChoiceType("") } return o.Type } func (o *ChatCompletionNamedToolChoice) GetFunction() ChatCompletionNamedToolChoiceFunction { if o == nil { return ChatCompletionNamedToolChoiceFunction{} } return o.Function }