mirror of
https://github.com/LukeHagar/log10go.git
synced 2025-12-06 20:47:44 +00:00
53 lines
1.2 KiB
Go
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
|
|
}
|