Files
log10go/models/components/chatcompletiontool.go
2024-05-24 18:29:28 -07:00

53 lines
1.2 KiB
Go

// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package components
import (
"encoding/json"
"fmt"
)
// ChatCompletionToolType - The type of the tool. Currently, only `function` is supported.
type ChatCompletionToolType string
const (
ChatCompletionToolTypeFunction ChatCompletionToolType = "function"
)
func (e ChatCompletionToolType) ToPointer() *ChatCompletionToolType {
return &e
}
func (e *ChatCompletionToolType) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "function":
*e = ChatCompletionToolType(v)
return nil
default:
return fmt.Errorf("invalid value for ChatCompletionToolType: %v", v)
}
}
type ChatCompletionTool struct {
// The type of the tool. Currently, only `function` is supported.
Type ChatCompletionToolType `json:"type"`
Function FunctionObject `json:"function"`
}
func (o *ChatCompletionTool) GetType() ChatCompletionToolType {
if o == nil {
return ChatCompletionToolType("")
}
return o.Type
}
func (o *ChatCompletionTool) GetFunction() FunctionObject {
if o == nil {
return FunctionObject{}
}
return o.Function
}