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

85 lines
2.1 KiB
Go

// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package components
import (
"encoding/json"
"fmt"
)
// ChatCompletionMessageToolCallType - The type of the tool. Currently, only `function` is supported.
type ChatCompletionMessageToolCallType string
const (
ChatCompletionMessageToolCallTypeFunction ChatCompletionMessageToolCallType = "function"
)
func (e ChatCompletionMessageToolCallType) ToPointer() *ChatCompletionMessageToolCallType {
return &e
}
func (e *ChatCompletionMessageToolCallType) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "function":
*e = ChatCompletionMessageToolCallType(v)
return nil
default:
return fmt.Errorf("invalid value for ChatCompletionMessageToolCallType: %v", v)
}
}
// Function - The function that the model called.
type Function struct {
// The name of the function to call.
Name string `json:"name"`
// The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
Arguments string `json:"arguments"`
}
func (o *Function) GetName() string {
if o == nil {
return ""
}
return o.Name
}
func (o *Function) GetArguments() string {
if o == nil {
return ""
}
return o.Arguments
}
type ChatCompletionMessageToolCall struct {
// The ID of the tool call.
ID string `json:"id"`
// The type of the tool. Currently, only `function` is supported.
Type ChatCompletionMessageToolCallType `json:"type"`
// The function that the model called.
Function Function `json:"function"`
}
func (o *ChatCompletionMessageToolCall) GetID() string {
if o == nil {
return ""
}
return o.ID
}
func (o *ChatCompletionMessageToolCall) GetType() ChatCompletionMessageToolCallType {
if o == nil {
return ChatCompletionMessageToolCallType("")
}
return o.Type
}
func (o *ChatCompletionMessageToolCall) GetFunction() Function {
if o == nil {
return Function{}
}
return o.Function
}