// Code generated by Fern. DO NOT EDIT.

package api

import (
	json "encoding/json"
	fmt "fmt"
	big "math/big"
	internal "pentagi/pkg/observability/langfuse/api/internal"
	time "time"
)

var (
	basePromptFieldName            = big.NewInt(1 << 0)
	basePromptFieldVersion         = big.NewInt(1 << 1)
	basePromptFieldConfig          = big.NewInt(1 << 2)
	basePromptFieldLabels          = big.NewInt(1 << 3)
	basePromptFieldTags            = big.NewInt(1 << 4)
	basePromptFieldCommitMessage   = big.NewInt(1 << 5)
	basePromptFieldResolutionGraph = big.NewInt(1 << 6)
)

type BasePrompt struct {
	Name    string      `json:"name" url:"name"`
	Version int         `json:"version" url:"version"`
	Config  interface{} `json:"config" url:"config"`
	// List of deployment labels of this prompt version.
	Labels []string `json:"labels" url:"labels"`
	// List of tags. Used to filter via UI and API. The same across versions of a prompt.
	Tags []string `json:"tags" url:"tags"`
	// Commit message for this prompt version.
	CommitMessage *string `json:"commitMessage,omitempty" url:"commitMessage,omitempty"`
	// The dependency resolution graph for the current prompt. Null if prompt has no dependencies.
	ResolutionGraph map[string]interface{} `json:"resolutionGraph,omitempty" url:"resolutionGraph,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (b *BasePrompt) GetName() string {
	if b == nil {
		return ""
	}
	return b.Name
}

func (b *BasePrompt) GetVersion() int {
	if b == nil {
		return 0
	}
	return b.Version
}

func (b *BasePrompt) GetConfig() interface{} {
	if b == nil {
		return nil
	}
	return b.Config
}

func (b *BasePrompt) GetLabels() []string {
	if b == nil {
		return nil
	}
	return b.Labels
}

func (b *BasePrompt) GetTags() []string {
	if b == nil {
		return nil
	}
	return b.Tags
}

func (b *BasePrompt) GetCommitMessage() *string {
	if b == nil {
		return nil
	}
	return b.CommitMessage
}

func (b *BasePrompt) GetResolutionGraph() map[string]interface{} {
	if b == nil {
		return nil
	}
	return b.ResolutionGraph
}

func (b *BasePrompt) GetExtraProperties() map[string]interface{} {
	return b.extraProperties
}

func (b *BasePrompt) require(field *big.Int) {
	if b.explicitFields == nil {
		b.explicitFields = big.NewInt(0)
	}
	b.explicitFields.Or(b.explicitFields, field)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (b *BasePrompt) SetName(name string) {
	b.Name = name
	b.require(basePromptFieldName)
}

// SetVersion sets the Version field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (b *BasePrompt) SetVersion(version int) {
	b.Version = version
	b.require(basePromptFieldVersion)
}

// SetConfig sets the Config field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (b *BasePrompt) SetConfig(config interface{}) {
	b.Config = config
	b.require(basePromptFieldConfig)
}

// SetLabels sets the Labels field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (b *BasePrompt) SetLabels(labels []string) {
	b.Labels = labels
	b.require(basePromptFieldLabels)
}

// SetTags sets the Tags field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (b *BasePrompt) SetTags(tags []string) {
	b.Tags = tags
	b.require(basePromptFieldTags)
}

// SetCommitMessage sets the CommitMessage field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (b *BasePrompt) SetCommitMessage(commitMessage *string) {
	b.CommitMessage = commitMessage
	b.require(basePromptFieldCommitMessage)
}

// SetResolutionGraph sets the ResolutionGraph field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (b *BasePrompt) SetResolutionGraph(resolutionGraph map[string]interface{}) {
	b.ResolutionGraph = resolutionGraph
	b.require(basePromptFieldResolutionGraph)
}

func (b *BasePrompt) UnmarshalJSON(data []byte) error {
	type unmarshaler BasePrompt
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*b = BasePrompt(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *b)
	if err != nil {
		return err
	}
	b.extraProperties = extraProperties
	b.rawJSON = json.RawMessage(data)
	return nil
}

func (b *BasePrompt) MarshalJSON() ([]byte, error) {
	type embed BasePrompt
	var marshaler = struct {
		embed
	}{
		embed: embed(*b),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (b *BasePrompt) String() string {
	if len(b.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(b.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(b); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", b)
}

var (
	chatMessageFieldRole    = big.NewInt(1 << 0)
	chatMessageFieldContent = big.NewInt(1 << 1)
)

type ChatMessage struct {
	Role    string `json:"role" url:"role"`
	Content string `json:"content" url:"content"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (c *ChatMessage) GetRole() string {
	if c == nil {
		return ""
	}
	return c.Role
}

func (c *ChatMessage) GetContent() string {
	if c == nil {
		return ""
	}
	return c.Content
}

func (c *ChatMessage) GetExtraProperties() map[string]interface{} {
	return c.extraProperties
}

func (c *ChatMessage) require(field *big.Int) {
	if c.explicitFields == nil {
		c.explicitFields = big.NewInt(0)
	}
	c.explicitFields.Or(c.explicitFields, field)
}

// SetRole sets the Role field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatMessage) SetRole(role string) {
	c.Role = role
	c.require(chatMessageFieldRole)
}

// SetContent sets the Content field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatMessage) SetContent(content string) {
	c.Content = content
	c.require(chatMessageFieldContent)
}

func (c *ChatMessage) UnmarshalJSON(data []byte) error {
	type unmarshaler ChatMessage
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*c = ChatMessage(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *c)
	if err != nil {
		return err
	}
	c.extraProperties = extraProperties
	c.rawJSON = json.RawMessage(data)
	return nil
}

func (c *ChatMessage) MarshalJSON() ([]byte, error) {
	type embed ChatMessage
	var marshaler = struct {
		embed
	}{
		embed: embed(*c),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (c *ChatMessage) String() string {
	if len(c.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(c.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(c); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", c)
}

type ChatMessageWithPlaceholders struct {
	ChatMessageWithPlaceholdersZero *ChatMessageWithPlaceholdersZero
	ChatMessageWithPlaceholdersOne  *ChatMessageWithPlaceholdersOne

	typ string
}

func (c *ChatMessageWithPlaceholders) GetChatMessageWithPlaceholdersZero() *ChatMessageWithPlaceholdersZero {
	if c == nil {
		return nil
	}
	return c.ChatMessageWithPlaceholdersZero
}

func (c *ChatMessageWithPlaceholders) GetChatMessageWithPlaceholdersOne() *ChatMessageWithPlaceholdersOne {
	if c == nil {
		return nil
	}
	return c.ChatMessageWithPlaceholdersOne
}

func (c *ChatMessageWithPlaceholders) UnmarshalJSON(data []byte) error {
	valueChatMessageWithPlaceholdersZero := new(ChatMessageWithPlaceholdersZero)
	if err := json.Unmarshal(data, &valueChatMessageWithPlaceholdersZero); err == nil {
		c.typ = "ChatMessageWithPlaceholdersZero"
		c.ChatMessageWithPlaceholdersZero = valueChatMessageWithPlaceholdersZero
		return nil
	}
	valueChatMessageWithPlaceholdersOne := new(ChatMessageWithPlaceholdersOne)
	if err := json.Unmarshal(data, &valueChatMessageWithPlaceholdersOne); err == nil {
		c.typ = "ChatMessageWithPlaceholdersOne"
		c.ChatMessageWithPlaceholdersOne = valueChatMessageWithPlaceholdersOne
		return nil
	}
	return fmt.Errorf("%s cannot be deserialized as a %T", data, c)
}

func (c ChatMessageWithPlaceholders) MarshalJSON() ([]byte, error) {
	if c.typ == "ChatMessageWithPlaceholdersZero" || c.ChatMessageWithPlaceholdersZero != nil {
		return json.Marshal(c.ChatMessageWithPlaceholdersZero)
	}
	if c.typ == "ChatMessageWithPlaceholdersOne" || c.ChatMessageWithPlaceholdersOne != nil {
		return json.Marshal(c.ChatMessageWithPlaceholdersOne)
	}
	return nil, fmt.Errorf("type %T does not include a non-empty union type", c)
}

type ChatMessageWithPlaceholdersVisitor interface {
	VisitChatMessageWithPlaceholdersZero(*ChatMessageWithPlaceholdersZero) error
	VisitChatMessageWithPlaceholdersOne(*ChatMessageWithPlaceholdersOne) error
}

func (c *ChatMessageWithPlaceholders) Accept(visitor ChatMessageWithPlaceholdersVisitor) error {
	if c.typ == "ChatMessageWithPlaceholdersZero" || c.ChatMessageWithPlaceholdersZero != nil {
		return visitor.VisitChatMessageWithPlaceholdersZero(c.ChatMessageWithPlaceholdersZero)
	}
	if c.typ == "ChatMessageWithPlaceholdersOne" || c.ChatMessageWithPlaceholdersOne != nil {
		return visitor.VisitChatMessageWithPlaceholdersOne(c.ChatMessageWithPlaceholdersOne)
	}
	return fmt.Errorf("type %T does not include a non-empty union type", c)
}

var (
	chatMessageWithPlaceholdersOneFieldName = big.NewInt(1 << 0)
	chatMessageWithPlaceholdersOneFieldType = big.NewInt(1 << 1)
)

type ChatMessageWithPlaceholdersOne struct {
	Name string                              `json:"name" url:"name"`
	Type *ChatMessageWithPlaceholdersOneType `json:"type,omitempty" url:"type,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (c *ChatMessageWithPlaceholdersOne) GetName() string {
	if c == nil {
		return ""
	}
	return c.Name
}

func (c *ChatMessageWithPlaceholdersOne) GetType() *ChatMessageWithPlaceholdersOneType {
	if c == nil {
		return nil
	}
	return c.Type
}

func (c *ChatMessageWithPlaceholdersOne) GetExtraProperties() map[string]interface{} {
	return c.extraProperties
}

func (c *ChatMessageWithPlaceholdersOne) require(field *big.Int) {
	if c.explicitFields == nil {
		c.explicitFields = big.NewInt(0)
	}
	c.explicitFields.Or(c.explicitFields, field)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatMessageWithPlaceholdersOne) SetName(name string) {
	c.Name = name
	c.require(chatMessageWithPlaceholdersOneFieldName)
}

// SetType sets the Type field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatMessageWithPlaceholdersOne) SetType(type_ *ChatMessageWithPlaceholdersOneType) {
	c.Type = type_
	c.require(chatMessageWithPlaceholdersOneFieldType)
}

func (c *ChatMessageWithPlaceholdersOne) UnmarshalJSON(data []byte) error {
	type unmarshaler ChatMessageWithPlaceholdersOne
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*c = ChatMessageWithPlaceholdersOne(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *c)
	if err != nil {
		return err
	}
	c.extraProperties = extraProperties
	c.rawJSON = json.RawMessage(data)
	return nil
}

func (c *ChatMessageWithPlaceholdersOne) MarshalJSON() ([]byte, error) {
	type embed ChatMessageWithPlaceholdersOne
	var marshaler = struct {
		embed
	}{
		embed: embed(*c),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (c *ChatMessageWithPlaceholdersOne) String() string {
	if len(c.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(c.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(c); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", c)
}

type ChatMessageWithPlaceholdersOneType string

const (
	ChatMessageWithPlaceholdersOneTypePlaceholder ChatMessageWithPlaceholdersOneType = "placeholder"
)

func NewChatMessageWithPlaceholdersOneTypeFromString(s string) (ChatMessageWithPlaceholdersOneType, error) {
	switch s {
	case "placeholder":
		return ChatMessageWithPlaceholdersOneTypePlaceholder, nil
	}
	var t ChatMessageWithPlaceholdersOneType
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (c ChatMessageWithPlaceholdersOneType) Ptr() *ChatMessageWithPlaceholdersOneType {
	return &c
}

var (
	chatMessageWithPlaceholdersZeroFieldRole    = big.NewInt(1 << 0)
	chatMessageWithPlaceholdersZeroFieldContent = big.NewInt(1 << 1)
	chatMessageWithPlaceholdersZeroFieldType    = big.NewInt(1 << 2)
)

type ChatMessageWithPlaceholdersZero struct {
	Role    string                               `json:"role" url:"role"`
	Content string                               `json:"content" url:"content"`
	Type    *ChatMessageWithPlaceholdersZeroType `json:"type,omitempty" url:"type,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (c *ChatMessageWithPlaceholdersZero) GetRole() string {
	if c == nil {
		return ""
	}
	return c.Role
}

func (c *ChatMessageWithPlaceholdersZero) GetContent() string {
	if c == nil {
		return ""
	}
	return c.Content
}

func (c *ChatMessageWithPlaceholdersZero) GetType() *ChatMessageWithPlaceholdersZeroType {
	if c == nil {
		return nil
	}
	return c.Type
}

func (c *ChatMessageWithPlaceholdersZero) GetExtraProperties() map[string]interface{} {
	return c.extraProperties
}

func (c *ChatMessageWithPlaceholdersZero) require(field *big.Int) {
	if c.explicitFields == nil {
		c.explicitFields = big.NewInt(0)
	}
	c.explicitFields.Or(c.explicitFields, field)
}

// SetRole sets the Role field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatMessageWithPlaceholdersZero) SetRole(role string) {
	c.Role = role
	c.require(chatMessageWithPlaceholdersZeroFieldRole)
}

// SetContent sets the Content field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatMessageWithPlaceholdersZero) SetContent(content string) {
	c.Content = content
	c.require(chatMessageWithPlaceholdersZeroFieldContent)
}

// SetType sets the Type field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatMessageWithPlaceholdersZero) SetType(type_ *ChatMessageWithPlaceholdersZeroType) {
	c.Type = type_
	c.require(chatMessageWithPlaceholdersZeroFieldType)
}

func (c *ChatMessageWithPlaceholdersZero) UnmarshalJSON(data []byte) error {
	type unmarshaler ChatMessageWithPlaceholdersZero
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*c = ChatMessageWithPlaceholdersZero(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *c)
	if err != nil {
		return err
	}
	c.extraProperties = extraProperties
	c.rawJSON = json.RawMessage(data)
	return nil
}

func (c *ChatMessageWithPlaceholdersZero) MarshalJSON() ([]byte, error) {
	type embed ChatMessageWithPlaceholdersZero
	var marshaler = struct {
		embed
	}{
		embed: embed(*c),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (c *ChatMessageWithPlaceholdersZero) String() string {
	if len(c.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(c.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(c); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", c)
}

type ChatMessageWithPlaceholdersZeroType string

const (
	ChatMessageWithPlaceholdersZeroTypeChatmessage ChatMessageWithPlaceholdersZeroType = "chatmessage"
)

func NewChatMessageWithPlaceholdersZeroTypeFromString(s string) (ChatMessageWithPlaceholdersZeroType, error) {
	switch s {
	case "chatmessage":
		return ChatMessageWithPlaceholdersZeroTypeChatmessage, nil
	}
	var t ChatMessageWithPlaceholdersZeroType
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (c ChatMessageWithPlaceholdersZeroType) Ptr() *ChatMessageWithPlaceholdersZeroType {
	return &c
}

var (
	chatPromptFieldName            = big.NewInt(1 << 0)
	chatPromptFieldVersion         = big.NewInt(1 << 1)
	chatPromptFieldConfig          = big.NewInt(1 << 2)
	chatPromptFieldLabels          = big.NewInt(1 << 3)
	chatPromptFieldTags            = big.NewInt(1 << 4)
	chatPromptFieldCommitMessage   = big.NewInt(1 << 5)
	chatPromptFieldResolutionGraph = big.NewInt(1 << 6)
	chatPromptFieldPrompt          = big.NewInt(1 << 7)
)

type ChatPrompt struct {
	Name    string      `json:"name" url:"name"`
	Version int         `json:"version" url:"version"`
	Config  interface{} `json:"config" url:"config"`
	// List of deployment labels of this prompt version.
	Labels []string `json:"labels" url:"labels"`
	// List of tags. Used to filter via UI and API. The same across versions of a prompt.
	Tags []string `json:"tags" url:"tags"`
	// Commit message for this prompt version.
	CommitMessage *string `json:"commitMessage,omitempty" url:"commitMessage,omitempty"`
	// The dependency resolution graph for the current prompt. Null if prompt has no dependencies.
	ResolutionGraph map[string]interface{}         `json:"resolutionGraph,omitempty" url:"resolutionGraph,omitempty"`
	Prompt          []*ChatMessageWithPlaceholders `json:"prompt" url:"prompt"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (c *ChatPrompt) GetName() string {
	if c == nil {
		return ""
	}
	return c.Name
}

func (c *ChatPrompt) GetVersion() int {
	if c == nil {
		return 0
	}
	return c.Version
}

func (c *ChatPrompt) GetConfig() interface{} {
	if c == nil {
		return nil
	}
	return c.Config
}

func (c *ChatPrompt) GetLabels() []string {
	if c == nil {
		return nil
	}
	return c.Labels
}

func (c *ChatPrompt) GetTags() []string {
	if c == nil {
		return nil
	}
	return c.Tags
}

func (c *ChatPrompt) GetCommitMessage() *string {
	if c == nil {
		return nil
	}
	return c.CommitMessage
}

func (c *ChatPrompt) GetResolutionGraph() map[string]interface{} {
	if c == nil {
		return nil
	}
	return c.ResolutionGraph
}

func (c *ChatPrompt) GetPrompt() []*ChatMessageWithPlaceholders {
	if c == nil {
		return nil
	}
	return c.Prompt
}

func (c *ChatPrompt) GetExtraProperties() map[string]interface{} {
	return c.extraProperties
}

func (c *ChatPrompt) require(field *big.Int) {
	if c.explicitFields == nil {
		c.explicitFields = big.NewInt(0)
	}
	c.explicitFields.Or(c.explicitFields, field)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatPrompt) SetName(name string) {
	c.Name = name
	c.require(chatPromptFieldName)
}

// SetVersion sets the Version field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatPrompt) SetVersion(version int) {
	c.Version = version
	c.require(chatPromptFieldVersion)
}

// SetConfig sets the Config field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatPrompt) SetConfig(config interface{}) {
	c.Config = config
	c.require(chatPromptFieldConfig)
}

// SetLabels sets the Labels field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatPrompt) SetLabels(labels []string) {
	c.Labels = labels
	c.require(chatPromptFieldLabels)
}

// SetTags sets the Tags field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatPrompt) SetTags(tags []string) {
	c.Tags = tags
	c.require(chatPromptFieldTags)
}

// SetCommitMessage sets the CommitMessage field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatPrompt) SetCommitMessage(commitMessage *string) {
	c.CommitMessage = commitMessage
	c.require(chatPromptFieldCommitMessage)
}

// SetResolutionGraph sets the ResolutionGraph field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatPrompt) SetResolutionGraph(resolutionGraph map[string]interface{}) {
	c.ResolutionGraph = resolutionGraph
	c.require(chatPromptFieldResolutionGraph)
}

// SetPrompt sets the Prompt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *ChatPrompt) SetPrompt(prompt []*ChatMessageWithPlaceholders) {
	c.Prompt = prompt
	c.require(chatPromptFieldPrompt)
}

func (c *ChatPrompt) UnmarshalJSON(data []byte) error {
	type unmarshaler ChatPrompt
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*c = ChatPrompt(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *c)
	if err != nil {
		return err
	}
	c.extraProperties = extraProperties
	c.rawJSON = json.RawMessage(data)
	return nil
}

func (c *ChatPrompt) MarshalJSON() ([]byte, error) {
	type embed ChatPrompt
	var marshaler = struct {
		embed
	}{
		embed: embed(*c),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (c *ChatPrompt) String() string {
	if len(c.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(c.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(c); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", c)
}

// The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores
type CreateScoreValue struct {
	Double float64
	String string

	typ string
}

func (c *CreateScoreValue) GetDouble() float64 {
	if c == nil {
		return 0
	}
	return c.Double
}

func (c *CreateScoreValue) GetString() string {
	if c == nil {
		return ""
	}
	return c.String
}

func (c *CreateScoreValue) UnmarshalJSON(data []byte) error {
	var valueDouble float64
	if err := json.Unmarshal(data, &valueDouble); err == nil {
		c.typ = "Double"
		c.Double = valueDouble
		return nil
	}
	var valueString string
	if err := json.Unmarshal(data, &valueString); err == nil {
		c.typ = "String"
		c.String = valueString
		return nil
	}
	return fmt.Errorf("%s cannot be deserialized as a %T", data, c)
}

func (c CreateScoreValue) MarshalJSON() ([]byte, error) {
	if c.typ == "Double" || c.Double != 0 {
		return json.Marshal(c.Double)
	}
	if c.typ == "String" || c.String != "" {
		return json.Marshal(c.String)
	}
	return nil, fmt.Errorf("type %T does not include a non-empty union type", c)
}

type CreateScoreValueVisitor interface {
	VisitDouble(float64) error
	VisitString(string) error
}

func (c *CreateScoreValue) Accept(visitor CreateScoreValueVisitor) error {
	if c.typ == "Double" || c.Double != 0 {
		return visitor.VisitDouble(c.Double)
	}
	if c.typ == "String" || c.String != "" {
		return visitor.VisitString(c.String)
	}
	return fmt.Errorf("type %T does not include a non-empty union type", c)
}

var (
	datasetRunItemFieldID             = big.NewInt(1 << 0)
	datasetRunItemFieldDatasetRunID   = big.NewInt(1 << 1)
	datasetRunItemFieldDatasetRunName = big.NewInt(1 << 2)
	datasetRunItemFieldDatasetItemID  = big.NewInt(1 << 3)
	datasetRunItemFieldTraceID        = big.NewInt(1 << 4)
	datasetRunItemFieldObservationID  = big.NewInt(1 << 5)
	datasetRunItemFieldCreatedAt      = big.NewInt(1 << 6)
	datasetRunItemFieldUpdatedAt      = big.NewInt(1 << 7)
)

type DatasetRunItem struct {
	ID             string `json:"id" url:"id"`
	DatasetRunID   string `json:"datasetRunId" url:"datasetRunId"`
	DatasetRunName string `json:"datasetRunName" url:"datasetRunName"`
	DatasetItemID  string `json:"datasetItemId" url:"datasetItemId"`
	TraceID        string `json:"traceId" url:"traceId"`
	// The observation ID associated with this run item
	ObservationID *string   `json:"observationId,omitempty" url:"observationId,omitempty"`
	CreatedAt     time.Time `json:"createdAt" url:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt" url:"updatedAt"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (d *DatasetRunItem) GetID() string {
	if d == nil {
		return ""
	}
	return d.ID
}

func (d *DatasetRunItem) GetDatasetRunID() string {
	if d == nil {
		return ""
	}
	return d.DatasetRunID
}

func (d *DatasetRunItem) GetDatasetRunName() string {
	if d == nil {
		return ""
	}
	return d.DatasetRunName
}

func (d *DatasetRunItem) GetDatasetItemID() string {
	if d == nil {
		return ""
	}
	return d.DatasetItemID
}

func (d *DatasetRunItem) GetTraceID() string {
	if d == nil {
		return ""
	}
	return d.TraceID
}

func (d *DatasetRunItem) GetObservationID() *string {
	if d == nil {
		return nil
	}
	return d.ObservationID
}

func (d *DatasetRunItem) GetCreatedAt() time.Time {
	if d == nil {
		return time.Time{}
	}
	return d.CreatedAt
}

func (d *DatasetRunItem) GetUpdatedAt() time.Time {
	if d == nil {
		return time.Time{}
	}
	return d.UpdatedAt
}

func (d *DatasetRunItem) GetExtraProperties() map[string]interface{} {
	return d.extraProperties
}

func (d *DatasetRunItem) require(field *big.Int) {
	if d.explicitFields == nil {
		d.explicitFields = big.NewInt(0)
	}
	d.explicitFields.Or(d.explicitFields, field)
}

// SetID sets the ID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItem) SetID(id string) {
	d.ID = id
	d.require(datasetRunItemFieldID)
}

// SetDatasetRunID sets the DatasetRunID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItem) SetDatasetRunID(datasetRunID string) {
	d.DatasetRunID = datasetRunID
	d.require(datasetRunItemFieldDatasetRunID)
}

// SetDatasetRunName sets the DatasetRunName field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItem) SetDatasetRunName(datasetRunName string) {
	d.DatasetRunName = datasetRunName
	d.require(datasetRunItemFieldDatasetRunName)
}

// SetDatasetItemID sets the DatasetItemID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItem) SetDatasetItemID(datasetItemID string) {
	d.DatasetItemID = datasetItemID
	d.require(datasetRunItemFieldDatasetItemID)
}

// SetTraceID sets the TraceID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItem) SetTraceID(traceID string) {
	d.TraceID = traceID
	d.require(datasetRunItemFieldTraceID)
}

// SetObservationID sets the ObservationID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItem) SetObservationID(observationID *string) {
	d.ObservationID = observationID
	d.require(datasetRunItemFieldObservationID)
}

// SetCreatedAt sets the CreatedAt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItem) SetCreatedAt(createdAt time.Time) {
	d.CreatedAt = createdAt
	d.require(datasetRunItemFieldCreatedAt)
}

// SetUpdatedAt sets the UpdatedAt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItem) SetUpdatedAt(updatedAt time.Time) {
	d.UpdatedAt = updatedAt
	d.require(datasetRunItemFieldUpdatedAt)
}

func (d *DatasetRunItem) UnmarshalJSON(data []byte) error {
	type embed DatasetRunItem
	var unmarshaler = struct {
		embed
		CreatedAt *internal.DateTime `json:"createdAt"`
		UpdatedAt *internal.DateTime `json:"updatedAt"`
	}{
		embed: embed(*d),
	}
	if err := json.Unmarshal(data, &unmarshaler); err != nil {
		return err
	}
	*d = DatasetRunItem(unmarshaler.embed)
	d.CreatedAt = unmarshaler.CreatedAt.Time()
	d.UpdatedAt = unmarshaler.UpdatedAt.Time()
	extraProperties, err := internal.ExtractExtraProperties(data, *d)
	if err != nil {
		return err
	}
	d.extraProperties = extraProperties
	d.rawJSON = json.RawMessage(data)
	return nil
}

func (d *DatasetRunItem) MarshalJSON() ([]byte, error) {
	type embed DatasetRunItem
	var marshaler = struct {
		embed
		CreatedAt *internal.DateTime `json:"createdAt"`
		UpdatedAt *internal.DateTime `json:"updatedAt"`
	}{
		embed:     embed(*d),
		CreatedAt: internal.NewDateTime(d.CreatedAt),
		UpdatedAt: internal.NewDateTime(d.UpdatedAt),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (d *DatasetRunItem) String() string {
	if len(d.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(d.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(d); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", d)
}

var (
	observationFieldID                  = big.NewInt(1 << 0)
	observationFieldTraceID             = big.NewInt(1 << 1)
	observationFieldType                = big.NewInt(1 << 2)
	observationFieldName                = big.NewInt(1 << 3)
	observationFieldStartTime           = big.NewInt(1 << 4)
	observationFieldEndTime             = big.NewInt(1 << 5)
	observationFieldCompletionStartTime = big.NewInt(1 << 6)
	observationFieldModel               = big.NewInt(1 << 7)
	observationFieldModelParameters     = big.NewInt(1 << 8)
	observationFieldInput               = big.NewInt(1 << 9)
	observationFieldVersion             = big.NewInt(1 << 10)
	observationFieldMetadata            = big.NewInt(1 << 11)
	observationFieldOutput              = big.NewInt(1 << 12)
	observationFieldUsage               = big.NewInt(1 << 13)
	observationFieldLevel               = big.NewInt(1 << 14)
	observationFieldStatusMessage       = big.NewInt(1 << 15)
	observationFieldParentObservationID = big.NewInt(1 << 16)
	observationFieldPromptID            = big.NewInt(1 << 17)
	observationFieldUsageDetails        = big.NewInt(1 << 18)
	observationFieldCostDetails         = big.NewInt(1 << 19)
	observationFieldEnvironment         = big.NewInt(1 << 20)
)

type Observation struct {
	// The unique identifier of the observation
	ID string `json:"id" url:"id"`
	// The trace ID associated with the observation
	TraceID *string `json:"traceId,omitempty" url:"traceId,omitempty"`
	// The type of the observation
	Type string `json:"type" url:"type"`
	// The name of the observation
	Name *string `json:"name,omitempty" url:"name,omitempty"`
	// The start time of the observation
	StartTime time.Time `json:"startTime" url:"startTime"`
	// The end time of the observation.
	EndTime *time.Time `json:"endTime,omitempty" url:"endTime,omitempty"`
	// The completion start time of the observation
	CompletionStartTime *time.Time `json:"completionStartTime,omitempty" url:"completionStartTime,omitempty"`
	// The model used for the observation
	Model           *string     `json:"model,omitempty" url:"model,omitempty"`
	ModelParameters interface{} `json:"modelParameters" url:"modelParameters"`
	Input           interface{} `json:"input" url:"input"`
	// The version of the observation
	Version  *string     `json:"version,omitempty" url:"version,omitempty"`
	Metadata interface{} `json:"metadata" url:"metadata"`
	Output   interface{} `json:"output" url:"output"`
	// (Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation
	Usage *Usage `json:"usage" url:"usage"`
	// The level of the observation
	Level ObservationLevel `json:"level" url:"level"`
	// The status message of the observation
	StatusMessage *string `json:"statusMessage,omitempty" url:"statusMessage,omitempty"`
	// The parent observation ID
	ParentObservationID *string `json:"parentObservationId,omitempty" url:"parentObservationId,omitempty"`
	// The prompt ID associated with the observation
	PromptID *string `json:"promptId,omitempty" url:"promptId,omitempty"`
	// The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested.
	UsageDetails map[string]int `json:"usageDetails" url:"usageDetails"`
	// The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested.
	CostDetails map[string]float64 `json:"costDetails" url:"costDetails"`
	// The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
	Environment string `json:"environment" url:"environment"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (o *Observation) GetID() string {
	if o == nil {
		return ""
	}
	return o.ID
}

func (o *Observation) GetTraceID() *string {
	if o == nil {
		return nil
	}
	return o.TraceID
}

func (o *Observation) GetType() string {
	if o == nil {
		return ""
	}
	return o.Type
}

func (o *Observation) GetName() *string {
	if o == nil {
		return nil
	}
	return o.Name
}

func (o *Observation) GetStartTime() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.StartTime
}

func (o *Observation) GetEndTime() *time.Time {
	if o == nil {
		return nil
	}
	return o.EndTime
}

func (o *Observation) GetCompletionStartTime() *time.Time {
	if o == nil {
		return nil
	}
	return o.CompletionStartTime
}

func (o *Observation) GetModel() *string {
	if o == nil {
		return nil
	}
	return o.Model
}

func (o *Observation) GetModelParameters() interface{} {
	if o == nil {
		return nil
	}
	return o.ModelParameters
}

func (o *Observation) GetInput() interface{} {
	if o == nil {
		return nil
	}
	return o.Input
}

func (o *Observation) GetVersion() *string {
	if o == nil {
		return nil
	}
	return o.Version
}

func (o *Observation) GetMetadata() interface{} {
	if o == nil {
		return nil
	}
	return o.Metadata
}

func (o *Observation) GetOutput() interface{} {
	if o == nil {
		return nil
	}
	return o.Output
}

func (o *Observation) GetUsage() *Usage {
	if o == nil {
		return nil
	}
	return o.Usage
}

func (o *Observation) GetLevel() ObservationLevel {
	if o == nil {
		return ""
	}
	return o.Level
}

func (o *Observation) GetStatusMessage() *string {
	if o == nil {
		return nil
	}
	return o.StatusMessage
}

func (o *Observation) GetParentObservationID() *string {
	if o == nil {
		return nil
	}
	return o.ParentObservationID
}

func (o *Observation) GetPromptID() *string {
	if o == nil {
		return nil
	}
	return o.PromptID
}

func (o *Observation) GetUsageDetails() map[string]int {
	if o == nil {
		return nil
	}
	return o.UsageDetails
}

func (o *Observation) GetCostDetails() map[string]float64 {
	if o == nil {
		return nil
	}
	return o.CostDetails
}

func (o *Observation) GetEnvironment() string {
	if o == nil {
		return ""
	}
	return o.Environment
}

func (o *Observation) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

func (o *Observation) require(field *big.Int) {
	if o.explicitFields == nil {
		o.explicitFields = big.NewInt(0)
	}
	o.explicitFields.Or(o.explicitFields, field)
}

// SetID sets the ID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetID(id string) {
	o.ID = id
	o.require(observationFieldID)
}

// SetTraceID sets the TraceID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetTraceID(traceID *string) {
	o.TraceID = traceID
	o.require(observationFieldTraceID)
}

// SetType sets the Type field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetType(type_ string) {
	o.Type = type_
	o.require(observationFieldType)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetName(name *string) {
	o.Name = name
	o.require(observationFieldName)
}

// SetStartTime sets the StartTime field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetStartTime(startTime time.Time) {
	o.StartTime = startTime
	o.require(observationFieldStartTime)
}

// SetEndTime sets the EndTime field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetEndTime(endTime *time.Time) {
	o.EndTime = endTime
	o.require(observationFieldEndTime)
}

// SetCompletionStartTime sets the CompletionStartTime field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetCompletionStartTime(completionStartTime *time.Time) {
	o.CompletionStartTime = completionStartTime
	o.require(observationFieldCompletionStartTime)
}

// SetModel sets the Model field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetModel(model *string) {
	o.Model = model
	o.require(observationFieldModel)
}

// SetModelParameters sets the ModelParameters field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetModelParameters(modelParameters interface{}) {
	o.ModelParameters = modelParameters
	o.require(observationFieldModelParameters)
}

// SetInput sets the Input field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetInput(input interface{}) {
	o.Input = input
	o.require(observationFieldInput)
}

// SetVersion sets the Version field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetVersion(version *string) {
	o.Version = version
	o.require(observationFieldVersion)
}

// SetMetadata sets the Metadata field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetMetadata(metadata interface{}) {
	o.Metadata = metadata
	o.require(observationFieldMetadata)
}

// SetOutput sets the Output field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetOutput(output interface{}) {
	o.Output = output
	o.require(observationFieldOutput)
}

// SetUsage sets the Usage field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetUsage(usage *Usage) {
	o.Usage = usage
	o.require(observationFieldUsage)
}

// SetLevel sets the Level field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetLevel(level ObservationLevel) {
	o.Level = level
	o.require(observationFieldLevel)
}

// SetStatusMessage sets the StatusMessage field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetStatusMessage(statusMessage *string) {
	o.StatusMessage = statusMessage
	o.require(observationFieldStatusMessage)
}

// SetParentObservationID sets the ParentObservationID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetParentObservationID(parentObservationID *string) {
	o.ParentObservationID = parentObservationID
	o.require(observationFieldParentObservationID)
}

// SetPromptID sets the PromptID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetPromptID(promptID *string) {
	o.PromptID = promptID
	o.require(observationFieldPromptID)
}

// SetUsageDetails sets the UsageDetails field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetUsageDetails(usageDetails map[string]int) {
	o.UsageDetails = usageDetails
	o.require(observationFieldUsageDetails)
}

// SetCostDetails sets the CostDetails field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetCostDetails(costDetails map[string]float64) {
	o.CostDetails = costDetails
	o.require(observationFieldCostDetails)
}

// SetEnvironment sets the Environment field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observation) SetEnvironment(environment string) {
	o.Environment = environment
	o.require(observationFieldEnvironment)
}

func (o *Observation) UnmarshalJSON(data []byte) error {
	type embed Observation
	var unmarshaler = struct {
		embed
		StartTime           *internal.DateTime `json:"startTime"`
		EndTime             *internal.DateTime `json:"endTime,omitempty"`
		CompletionStartTime *internal.DateTime `json:"completionStartTime,omitempty"`
	}{
		embed: embed(*o),
	}
	if err := json.Unmarshal(data, &unmarshaler); err != nil {
		return err
	}
	*o = Observation(unmarshaler.embed)
	o.StartTime = unmarshaler.StartTime.Time()
	o.EndTime = unmarshaler.EndTime.TimePtr()
	o.CompletionStartTime = unmarshaler.CompletionStartTime.TimePtr()
	extraProperties, err := internal.ExtractExtraProperties(data, *o)
	if err != nil {
		return err
	}
	o.extraProperties = extraProperties
	o.rawJSON = json.RawMessage(data)
	return nil
}

func (o *Observation) MarshalJSON() ([]byte, error) {
	type embed Observation
	var marshaler = struct {
		embed
		StartTime           *internal.DateTime `json:"startTime"`
		EndTime             *internal.DateTime `json:"endTime,omitempty"`
		CompletionStartTime *internal.DateTime `json:"completionStartTime,omitempty"`
	}{
		embed:               embed(*o),
		StartTime:           internal.NewDateTime(o.StartTime),
		EndTime:             internal.NewOptionalDateTime(o.EndTime),
		CompletionStartTime: internal.NewOptionalDateTime(o.CompletionStartTime),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, o.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (o *Observation) String() string {
	if len(o.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(o.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(o); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", o)
}

type ObservationLevel string

const (
	ObservationLevelDebug   ObservationLevel = "DEBUG"
	ObservationLevelDefault ObservationLevel = "DEFAULT"
	ObservationLevelWarning ObservationLevel = "WARNING"
	ObservationLevelError   ObservationLevel = "ERROR"
)

func NewObservationLevelFromString(s string) (ObservationLevel, error) {
	switch s {
	case "DEBUG":
		return ObservationLevelDebug, nil
	case "DEFAULT":
		return ObservationLevelDefault, nil
	case "WARNING":
		return ObservationLevelWarning, nil
	case "ERROR":
		return ObservationLevelError, nil
	}
	var t ObservationLevel
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (o ObservationLevel) Ptr() *ObservationLevel {
	return &o
}

var (
	observationsFieldData = big.NewInt(1 << 0)
	observationsFieldMeta = big.NewInt(1 << 1)
)

type Observations struct {
	Data []*Observation     `json:"data" url:"data"`
	Meta *UtilsMetaResponse `json:"meta" url:"meta"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (o *Observations) GetData() []*Observation {
	if o == nil {
		return nil
	}
	return o.Data
}

func (o *Observations) GetMeta() *UtilsMetaResponse {
	if o == nil {
		return nil
	}
	return o.Meta
}

func (o *Observations) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

func (o *Observations) require(field *big.Int) {
	if o.explicitFields == nil {
		o.explicitFields = big.NewInt(0)
	}
	o.explicitFields.Or(o.explicitFields, field)
}

// SetData sets the Data field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observations) SetData(data []*Observation) {
	o.Data = data
	o.require(observationsFieldData)
}

// SetMeta sets the Meta field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *Observations) SetMeta(meta *UtilsMetaResponse) {
	o.Meta = meta
	o.require(observationsFieldMeta)
}

func (o *Observations) UnmarshalJSON(data []byte) error {
	type unmarshaler Observations
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*o = Observations(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *o)
	if err != nil {
		return err
	}
	o.extraProperties = extraProperties
	o.rawJSON = json.RawMessage(data)
	return nil
}

func (o *Observations) MarshalJSON() ([]byte, error) {
	type embed Observations
	var marshaler = struct {
		embed
	}{
		embed: embed(*o),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, o.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (o *Observations) String() string {
	if len(o.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(o.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(o); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", o)
}

var (
	observationsViewFieldID                   = big.NewInt(1 << 0)
	observationsViewFieldTraceID              = big.NewInt(1 << 1)
	observationsViewFieldType                 = big.NewInt(1 << 2)
	observationsViewFieldName                 = big.NewInt(1 << 3)
	observationsViewFieldStartTime            = big.NewInt(1 << 4)
	observationsViewFieldEndTime              = big.NewInt(1 << 5)
	observationsViewFieldCompletionStartTime  = big.NewInt(1 << 6)
	observationsViewFieldModel                = big.NewInt(1 << 7)
	observationsViewFieldModelParameters      = big.NewInt(1 << 8)
	observationsViewFieldInput                = big.NewInt(1 << 9)
	observationsViewFieldVersion              = big.NewInt(1 << 10)
	observationsViewFieldMetadata             = big.NewInt(1 << 11)
	observationsViewFieldOutput               = big.NewInt(1 << 12)
	observationsViewFieldUsage                = big.NewInt(1 << 13)
	observationsViewFieldLevel                = big.NewInt(1 << 14)
	observationsViewFieldStatusMessage        = big.NewInt(1 << 15)
	observationsViewFieldParentObservationID  = big.NewInt(1 << 16)
	observationsViewFieldPromptID             = big.NewInt(1 << 17)
	observationsViewFieldUsageDetails         = big.NewInt(1 << 18)
	observationsViewFieldCostDetails          = big.NewInt(1 << 19)
	observationsViewFieldEnvironment          = big.NewInt(1 << 20)
	observationsViewFieldPromptName           = big.NewInt(1 << 21)
	observationsViewFieldPromptVersion        = big.NewInt(1 << 22)
	observationsViewFieldModelID              = big.NewInt(1 << 23)
	observationsViewFieldInputPrice           = big.NewInt(1 << 24)
	observationsViewFieldOutputPrice          = big.NewInt(1 << 25)
	observationsViewFieldTotalPrice           = big.NewInt(1 << 26)
	observationsViewFieldCalculatedInputCost  = big.NewInt(1 << 27)
	observationsViewFieldCalculatedOutputCost = big.NewInt(1 << 28)
	observationsViewFieldCalculatedTotalCost  = big.NewInt(1 << 29)
	observationsViewFieldLatency              = big.NewInt(1 << 30)
	observationsViewFieldTimeToFirstToken     = big.NewInt(1 << 31)
)

type ObservationsView struct {
	// The unique identifier of the observation
	ID string `json:"id" url:"id"`
	// The trace ID associated with the observation
	TraceID *string `json:"traceId,omitempty" url:"traceId,omitempty"`
	// The type of the observation
	Type string `json:"type" url:"type"`
	// The name of the observation
	Name *string `json:"name,omitempty" url:"name,omitempty"`
	// The start time of the observation
	StartTime time.Time `json:"startTime" url:"startTime"`
	// The end time of the observation.
	EndTime *time.Time `json:"endTime,omitempty" url:"endTime,omitempty"`
	// The completion start time of the observation
	CompletionStartTime *time.Time `json:"completionStartTime,omitempty" url:"completionStartTime,omitempty"`
	// The model used for the observation
	Model           *string     `json:"model,omitempty" url:"model,omitempty"`
	ModelParameters interface{} `json:"modelParameters" url:"modelParameters"`
	Input           interface{} `json:"input" url:"input"`
	// The version of the observation
	Version  *string     `json:"version,omitempty" url:"version,omitempty"`
	Metadata interface{} `json:"metadata" url:"metadata"`
	Output   interface{} `json:"output" url:"output"`
	// (Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation
	Usage *Usage `json:"usage" url:"usage"`
	// The level of the observation
	Level ObservationLevel `json:"level" url:"level"`
	// The status message of the observation
	StatusMessage *string `json:"statusMessage,omitempty" url:"statusMessage,omitempty"`
	// The parent observation ID
	ParentObservationID *string `json:"parentObservationId,omitempty" url:"parentObservationId,omitempty"`
	// The prompt ID associated with the observation
	PromptID *string `json:"promptId,omitempty" url:"promptId,omitempty"`
	// The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested.
	UsageDetails map[string]int `json:"usageDetails" url:"usageDetails"`
	// The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested.
	CostDetails map[string]float64 `json:"costDetails" url:"costDetails"`
	// The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
	Environment string `json:"environment" url:"environment"`
	// The name of the prompt associated with the observation
	PromptName *string `json:"promptName,omitempty" url:"promptName,omitempty"`
	// The version of the prompt associated with the observation
	PromptVersion *int `json:"promptVersion,omitempty" url:"promptVersion,omitempty"`
	// The unique identifier of the model
	ModelID *string `json:"modelId,omitempty" url:"modelId,omitempty"`
	// The price of the input in USD
	InputPrice *float64 `json:"inputPrice,omitempty" url:"inputPrice,omitempty"`
	// The price of the output in USD.
	OutputPrice *float64 `json:"outputPrice,omitempty" url:"outputPrice,omitempty"`
	// The total price in USD.
	TotalPrice *float64 `json:"totalPrice,omitempty" url:"totalPrice,omitempty"`
	// (Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the input in USD
	CalculatedInputCost *float64 `json:"calculatedInputCost,omitempty" url:"calculatedInputCost,omitempty"`
	// (Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the output in USD
	CalculatedOutputCost *float64 `json:"calculatedOutputCost,omitempty" url:"calculatedOutputCost,omitempty"`
	// (Deprecated. Use usageDetails and costDetails instead.) The calculated total cost in USD
	CalculatedTotalCost *float64 `json:"calculatedTotalCost,omitempty" url:"calculatedTotalCost,omitempty"`
	// The latency in seconds.
	Latency *float64 `json:"latency,omitempty" url:"latency,omitempty"`
	// The time to the first token in seconds
	TimeToFirstToken *float64 `json:"timeToFirstToken,omitempty" url:"timeToFirstToken,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (o *ObservationsView) GetID() string {
	if o == nil {
		return ""
	}
	return o.ID
}

func (o *ObservationsView) GetTraceID() *string {
	if o == nil {
		return nil
	}
	return o.TraceID
}

func (o *ObservationsView) GetType() string {
	if o == nil {
		return ""
	}
	return o.Type
}

func (o *ObservationsView) GetName() *string {
	if o == nil {
		return nil
	}
	return o.Name
}

func (o *ObservationsView) GetStartTime() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.StartTime
}

func (o *ObservationsView) GetEndTime() *time.Time {
	if o == nil {
		return nil
	}
	return o.EndTime
}

func (o *ObservationsView) GetCompletionStartTime() *time.Time {
	if o == nil {
		return nil
	}
	return o.CompletionStartTime
}

func (o *ObservationsView) GetModel() *string {
	if o == nil {
		return nil
	}
	return o.Model
}

func (o *ObservationsView) GetModelParameters() interface{} {
	if o == nil {
		return nil
	}
	return o.ModelParameters
}

func (o *ObservationsView) GetInput() interface{} {
	if o == nil {
		return nil
	}
	return o.Input
}

func (o *ObservationsView) GetVersion() *string {
	if o == nil {
		return nil
	}
	return o.Version
}

func (o *ObservationsView) GetMetadata() interface{} {
	if o == nil {
		return nil
	}
	return o.Metadata
}

func (o *ObservationsView) GetOutput() interface{} {
	if o == nil {
		return nil
	}
	return o.Output
}

func (o *ObservationsView) GetUsage() *Usage {
	if o == nil {
		return nil
	}
	return o.Usage
}

func (o *ObservationsView) GetLevel() ObservationLevel {
	if o == nil {
		return ""
	}
	return o.Level
}

func (o *ObservationsView) GetStatusMessage() *string {
	if o == nil {
		return nil
	}
	return o.StatusMessage
}

func (o *ObservationsView) GetParentObservationID() *string {
	if o == nil {
		return nil
	}
	return o.ParentObservationID
}

func (o *ObservationsView) GetPromptID() *string {
	if o == nil {
		return nil
	}
	return o.PromptID
}

func (o *ObservationsView) GetUsageDetails() map[string]int {
	if o == nil {
		return nil
	}
	return o.UsageDetails
}

func (o *ObservationsView) GetCostDetails() map[string]float64 {
	if o == nil {
		return nil
	}
	return o.CostDetails
}

func (o *ObservationsView) GetEnvironment() string {
	if o == nil {
		return ""
	}
	return o.Environment
}

func (o *ObservationsView) GetPromptName() *string {
	if o == nil {
		return nil
	}
	return o.PromptName
}

func (o *ObservationsView) GetPromptVersion() *int {
	if o == nil {
		return nil
	}
	return o.PromptVersion
}

func (o *ObservationsView) GetModelID() *string {
	if o == nil {
		return nil
	}
	return o.ModelID
}

func (o *ObservationsView) GetInputPrice() *float64 {
	if o == nil {
		return nil
	}
	return o.InputPrice
}

func (o *ObservationsView) GetOutputPrice() *float64 {
	if o == nil {
		return nil
	}
	return o.OutputPrice
}

func (o *ObservationsView) GetTotalPrice() *float64 {
	if o == nil {
		return nil
	}
	return o.TotalPrice
}

func (o *ObservationsView) GetCalculatedInputCost() *float64 {
	if o == nil {
		return nil
	}
	return o.CalculatedInputCost
}

func (o *ObservationsView) GetCalculatedOutputCost() *float64 {
	if o == nil {
		return nil
	}
	return o.CalculatedOutputCost
}

func (o *ObservationsView) GetCalculatedTotalCost() *float64 {
	if o == nil {
		return nil
	}
	return o.CalculatedTotalCost
}

func (o *ObservationsView) GetLatency() *float64 {
	if o == nil {
		return nil
	}
	return o.Latency
}

func (o *ObservationsView) GetTimeToFirstToken() *float64 {
	if o == nil {
		return nil
	}
	return o.TimeToFirstToken
}

func (o *ObservationsView) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

func (o *ObservationsView) require(field *big.Int) {
	if o.explicitFields == nil {
		o.explicitFields = big.NewInt(0)
	}
	o.explicitFields.Or(o.explicitFields, field)
}

// SetID sets the ID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetID(id string) {
	o.ID = id
	o.require(observationsViewFieldID)
}

// SetTraceID sets the TraceID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetTraceID(traceID *string) {
	o.TraceID = traceID
	o.require(observationsViewFieldTraceID)
}

// SetType sets the Type field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetType(type_ string) {
	o.Type = type_
	o.require(observationsViewFieldType)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetName(name *string) {
	o.Name = name
	o.require(observationsViewFieldName)
}

// SetStartTime sets the StartTime field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetStartTime(startTime time.Time) {
	o.StartTime = startTime
	o.require(observationsViewFieldStartTime)
}

// SetEndTime sets the EndTime field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetEndTime(endTime *time.Time) {
	o.EndTime = endTime
	o.require(observationsViewFieldEndTime)
}

// SetCompletionStartTime sets the CompletionStartTime field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetCompletionStartTime(completionStartTime *time.Time) {
	o.CompletionStartTime = completionStartTime
	o.require(observationsViewFieldCompletionStartTime)
}

// SetModel sets the Model field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetModel(model *string) {
	o.Model = model
	o.require(observationsViewFieldModel)
}

// SetModelParameters sets the ModelParameters field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetModelParameters(modelParameters interface{}) {
	o.ModelParameters = modelParameters
	o.require(observationsViewFieldModelParameters)
}

// SetInput sets the Input field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetInput(input interface{}) {
	o.Input = input
	o.require(observationsViewFieldInput)
}

// SetVersion sets the Version field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetVersion(version *string) {
	o.Version = version
	o.require(observationsViewFieldVersion)
}

// SetMetadata sets the Metadata field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetMetadata(metadata interface{}) {
	o.Metadata = metadata
	o.require(observationsViewFieldMetadata)
}

// SetOutput sets the Output field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetOutput(output interface{}) {
	o.Output = output
	o.require(observationsViewFieldOutput)
}

// SetUsage sets the Usage field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetUsage(usage *Usage) {
	o.Usage = usage
	o.require(observationsViewFieldUsage)
}

// SetLevel sets the Level field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetLevel(level ObservationLevel) {
	o.Level = level
	o.require(observationsViewFieldLevel)
}

// SetStatusMessage sets the StatusMessage field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetStatusMessage(statusMessage *string) {
	o.StatusMessage = statusMessage
	o.require(observationsViewFieldStatusMessage)
}

// SetParentObservationID sets the ParentObservationID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetParentObservationID(parentObservationID *string) {
	o.ParentObservationID = parentObservationID
	o.require(observationsViewFieldParentObservationID)
}

// SetPromptID sets the PromptID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetPromptID(promptID *string) {
	o.PromptID = promptID
	o.require(observationsViewFieldPromptID)
}

// SetUsageDetails sets the UsageDetails field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetUsageDetails(usageDetails map[string]int) {
	o.UsageDetails = usageDetails
	o.require(observationsViewFieldUsageDetails)
}

// SetCostDetails sets the CostDetails field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetCostDetails(costDetails map[string]float64) {
	o.CostDetails = costDetails
	o.require(observationsViewFieldCostDetails)
}

// SetEnvironment sets the Environment field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetEnvironment(environment string) {
	o.Environment = environment
	o.require(observationsViewFieldEnvironment)
}

// SetPromptName sets the PromptName field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetPromptName(promptName *string) {
	o.PromptName = promptName
	o.require(observationsViewFieldPromptName)
}

// SetPromptVersion sets the PromptVersion field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetPromptVersion(promptVersion *int) {
	o.PromptVersion = promptVersion
	o.require(observationsViewFieldPromptVersion)
}

// SetModelID sets the ModelID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetModelID(modelID *string) {
	o.ModelID = modelID
	o.require(observationsViewFieldModelID)
}

// SetInputPrice sets the InputPrice field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetInputPrice(inputPrice *float64) {
	o.InputPrice = inputPrice
	o.require(observationsViewFieldInputPrice)
}

// SetOutputPrice sets the OutputPrice field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetOutputPrice(outputPrice *float64) {
	o.OutputPrice = outputPrice
	o.require(observationsViewFieldOutputPrice)
}

// SetTotalPrice sets the TotalPrice field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetTotalPrice(totalPrice *float64) {
	o.TotalPrice = totalPrice
	o.require(observationsViewFieldTotalPrice)
}

// SetCalculatedInputCost sets the CalculatedInputCost field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetCalculatedInputCost(calculatedInputCost *float64) {
	o.CalculatedInputCost = calculatedInputCost
	o.require(observationsViewFieldCalculatedInputCost)
}

// SetCalculatedOutputCost sets the CalculatedOutputCost field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetCalculatedOutputCost(calculatedOutputCost *float64) {
	o.CalculatedOutputCost = calculatedOutputCost
	o.require(observationsViewFieldCalculatedOutputCost)
}

// SetCalculatedTotalCost sets the CalculatedTotalCost field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetCalculatedTotalCost(calculatedTotalCost *float64) {
	o.CalculatedTotalCost = calculatedTotalCost
	o.require(observationsViewFieldCalculatedTotalCost)
}

// SetLatency sets the Latency field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetLatency(latency *float64) {
	o.Latency = latency
	o.require(observationsViewFieldLatency)
}

// SetTimeToFirstToken sets the TimeToFirstToken field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *ObservationsView) SetTimeToFirstToken(timeToFirstToken *float64) {
	o.TimeToFirstToken = timeToFirstToken
	o.require(observationsViewFieldTimeToFirstToken)
}

func (o *ObservationsView) UnmarshalJSON(data []byte) error {
	type embed ObservationsView
	var unmarshaler = struct {
		embed
		StartTime           *internal.DateTime `json:"startTime"`
		EndTime             *internal.DateTime `json:"endTime,omitempty"`
		CompletionStartTime *internal.DateTime `json:"completionStartTime,omitempty"`
	}{
		embed: embed(*o),
	}
	if err := json.Unmarshal(data, &unmarshaler); err != nil {
		return err
	}
	*o = ObservationsView(unmarshaler.embed)
	o.StartTime = unmarshaler.StartTime.Time()
	o.EndTime = unmarshaler.EndTime.TimePtr()
	o.CompletionStartTime = unmarshaler.CompletionStartTime.TimePtr()
	extraProperties, err := internal.ExtractExtraProperties(data, *o)
	if err != nil {
		return err
	}
	o.extraProperties = extraProperties
	o.rawJSON = json.RawMessage(data)
	return nil
}

func (o *ObservationsView) MarshalJSON() ([]byte, error) {
	type embed ObservationsView
	var marshaler = struct {
		embed
		StartTime           *internal.DateTime `json:"startTime"`
		EndTime             *internal.DateTime `json:"endTime,omitempty"`
		CompletionStartTime *internal.DateTime `json:"completionStartTime,omitempty"`
	}{
		embed:               embed(*o),
		StartTime:           internal.NewDateTime(o.StartTime),
		EndTime:             internal.NewOptionalDateTime(o.EndTime),
		CompletionStartTime: internal.NewOptionalDateTime(o.CompletionStartTime),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, o.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (o *ObservationsView) String() string {
	if len(o.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(o.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(o); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", o)
}

var (
	placeholderMessageFieldName = big.NewInt(1 << 0)
)

type PlaceholderMessage struct {
	Name string `json:"name" url:"name"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (p *PlaceholderMessage) GetName() string {
	if p == nil {
		return ""
	}
	return p.Name
}

func (p *PlaceholderMessage) GetExtraProperties() map[string]interface{} {
	return p.extraProperties
}

func (p *PlaceholderMessage) require(field *big.Int) {
	if p.explicitFields == nil {
		p.explicitFields = big.NewInt(0)
	}
	p.explicitFields.Or(p.explicitFields, field)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PlaceholderMessage) SetName(name string) {
	p.Name = name
	p.require(placeholderMessageFieldName)
}

func (p *PlaceholderMessage) UnmarshalJSON(data []byte) error {
	type unmarshaler PlaceholderMessage
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*p = PlaceholderMessage(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *p)
	if err != nil {
		return err
	}
	p.extraProperties = extraProperties
	p.rawJSON = json.RawMessage(data)
	return nil
}

func (p *PlaceholderMessage) MarshalJSON() ([]byte, error) {
	type embed PlaceholderMessage
	var marshaler = struct {
		embed
	}{
		embed: embed(*p),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (p *PlaceholderMessage) String() string {
	if len(p.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(p.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(p); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", p)
}

type Prompt struct {
	PromptZero *PromptZero
	PromptOne  *PromptOne

	typ string
}

func (p *Prompt) GetPromptZero() *PromptZero {
	if p == nil {
		return nil
	}
	return p.PromptZero
}

func (p *Prompt) GetPromptOne() *PromptOne {
	if p == nil {
		return nil
	}
	return p.PromptOne
}

func (p *Prompt) UnmarshalJSON(data []byte) error {
	valuePromptZero := new(PromptZero)
	if err := json.Unmarshal(data, &valuePromptZero); err == nil {
		p.typ = "PromptZero"
		p.PromptZero = valuePromptZero
		return nil
	}
	valuePromptOne := new(PromptOne)
	if err := json.Unmarshal(data, &valuePromptOne); err == nil {
		p.typ = "PromptOne"
		p.PromptOne = valuePromptOne
		return nil
	}
	return fmt.Errorf("%s cannot be deserialized as a %T", data, p)
}

func (p Prompt) MarshalJSON() ([]byte, error) {
	if p.typ == "PromptZero" || p.PromptZero != nil {
		return json.Marshal(p.PromptZero)
	}
	if p.typ == "PromptOne" || p.PromptOne != nil {
		return json.Marshal(p.PromptOne)
	}
	return nil, fmt.Errorf("type %T does not include a non-empty union type", p)
}

type PromptVisitor interface {
	VisitPromptZero(*PromptZero) error
	VisitPromptOne(*PromptOne) error
}

func (p *Prompt) Accept(visitor PromptVisitor) error {
	if p.typ == "PromptZero" || p.PromptZero != nil {
		return visitor.VisitPromptZero(p.PromptZero)
	}
	if p.typ == "PromptOne" || p.PromptOne != nil {
		return visitor.VisitPromptOne(p.PromptOne)
	}
	return fmt.Errorf("type %T does not include a non-empty union type", p)
}

var (
	promptOneFieldName            = big.NewInt(1 << 0)
	promptOneFieldVersion         = big.NewInt(1 << 1)
	promptOneFieldConfig          = big.NewInt(1 << 2)
	promptOneFieldLabels          = big.NewInt(1 << 3)
	promptOneFieldTags            = big.NewInt(1 << 4)
	promptOneFieldCommitMessage   = big.NewInt(1 << 5)
	promptOneFieldResolutionGraph = big.NewInt(1 << 6)
	promptOneFieldPrompt          = big.NewInt(1 << 7)
	promptOneFieldType            = big.NewInt(1 << 8)
)

type PromptOne struct {
	Name    string      `json:"name" url:"name"`
	Version int         `json:"version" url:"version"`
	Config  interface{} `json:"config" url:"config"`
	// List of deployment labels of this prompt version.
	Labels []string `json:"labels" url:"labels"`
	// List of tags. Used to filter via UI and API. The same across versions of a prompt.
	Tags []string `json:"tags" url:"tags"`
	// Commit message for this prompt version.
	CommitMessage *string `json:"commitMessage,omitempty" url:"commitMessage,omitempty"`
	// The dependency resolution graph for the current prompt. Null if prompt has no dependencies.
	ResolutionGraph map[string]interface{} `json:"resolutionGraph,omitempty" url:"resolutionGraph,omitempty"`
	Prompt          string                 `json:"prompt" url:"prompt"`
	Type            *PromptOneType         `json:"type,omitempty" url:"type,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (p *PromptOne) GetName() string {
	if p == nil {
		return ""
	}
	return p.Name
}

func (p *PromptOne) GetVersion() int {
	if p == nil {
		return 0
	}
	return p.Version
}

func (p *PromptOne) GetConfig() interface{} {
	if p == nil {
		return nil
	}
	return p.Config
}

func (p *PromptOne) GetLabels() []string {
	if p == nil {
		return nil
	}
	return p.Labels
}

func (p *PromptOne) GetTags() []string {
	if p == nil {
		return nil
	}
	return p.Tags
}

func (p *PromptOne) GetCommitMessage() *string {
	if p == nil {
		return nil
	}
	return p.CommitMessage
}

func (p *PromptOne) GetResolutionGraph() map[string]interface{} {
	if p == nil {
		return nil
	}
	return p.ResolutionGraph
}

func (p *PromptOne) GetPrompt() string {
	if p == nil {
		return ""
	}
	return p.Prompt
}

func (p *PromptOne) GetType() *PromptOneType {
	if p == nil {
		return nil
	}
	return p.Type
}

func (p *PromptOne) GetExtraProperties() map[string]interface{} {
	return p.extraProperties
}

func (p *PromptOne) require(field *big.Int) {
	if p.explicitFields == nil {
		p.explicitFields = big.NewInt(0)
	}
	p.explicitFields.Or(p.explicitFields, field)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptOne) SetName(name string) {
	p.Name = name
	p.require(promptOneFieldName)
}

// SetVersion sets the Version field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptOne) SetVersion(version int) {
	p.Version = version
	p.require(promptOneFieldVersion)
}

// SetConfig sets the Config field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptOne) SetConfig(config interface{}) {
	p.Config = config
	p.require(promptOneFieldConfig)
}

// SetLabels sets the Labels field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptOne) SetLabels(labels []string) {
	p.Labels = labels
	p.require(promptOneFieldLabels)
}

// SetTags sets the Tags field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptOne) SetTags(tags []string) {
	p.Tags = tags
	p.require(promptOneFieldTags)
}

// SetCommitMessage sets the CommitMessage field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptOne) SetCommitMessage(commitMessage *string) {
	p.CommitMessage = commitMessage
	p.require(promptOneFieldCommitMessage)
}

// SetResolutionGraph sets the ResolutionGraph field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptOne) SetResolutionGraph(resolutionGraph map[string]interface{}) {
	p.ResolutionGraph = resolutionGraph
	p.require(promptOneFieldResolutionGraph)
}

// SetPrompt sets the Prompt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptOne) SetPrompt(prompt string) {
	p.Prompt = prompt
	p.require(promptOneFieldPrompt)
}

// SetType sets the Type field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptOne) SetType(type_ *PromptOneType) {
	p.Type = type_
	p.require(promptOneFieldType)
}

func (p *PromptOne) UnmarshalJSON(data []byte) error {
	type unmarshaler PromptOne
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*p = PromptOne(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *p)
	if err != nil {
		return err
	}
	p.extraProperties = extraProperties
	p.rawJSON = json.RawMessage(data)
	return nil
}

func (p *PromptOne) MarshalJSON() ([]byte, error) {
	type embed PromptOne
	var marshaler = struct {
		embed
	}{
		embed: embed(*p),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (p *PromptOne) String() string {
	if len(p.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(p.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(p); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", p)
}

type PromptOneType string

const (
	PromptOneTypeText PromptOneType = "text"
)

func NewPromptOneTypeFromString(s string) (PromptOneType, error) {
	switch s {
	case "text":
		return PromptOneTypeText, nil
	}
	var t PromptOneType
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (p PromptOneType) Ptr() *PromptOneType {
	return &p
}

var (
	promptZeroFieldName            = big.NewInt(1 << 0)
	promptZeroFieldVersion         = big.NewInt(1 << 1)
	promptZeroFieldConfig          = big.NewInt(1 << 2)
	promptZeroFieldLabels          = big.NewInt(1 << 3)
	promptZeroFieldTags            = big.NewInt(1 << 4)
	promptZeroFieldCommitMessage   = big.NewInt(1 << 5)
	promptZeroFieldResolutionGraph = big.NewInt(1 << 6)
	promptZeroFieldPrompt          = big.NewInt(1 << 7)
	promptZeroFieldType            = big.NewInt(1 << 8)
)

type PromptZero struct {
	Name    string      `json:"name" url:"name"`
	Version int         `json:"version" url:"version"`
	Config  interface{} `json:"config" url:"config"`
	// List of deployment labels of this prompt version.
	Labels []string `json:"labels" url:"labels"`
	// List of tags. Used to filter via UI and API. The same across versions of a prompt.
	Tags []string `json:"tags" url:"tags"`
	// Commit message for this prompt version.
	CommitMessage *string `json:"commitMessage,omitempty" url:"commitMessage,omitempty"`
	// The dependency resolution graph for the current prompt. Null if prompt has no dependencies.
	ResolutionGraph map[string]interface{}         `json:"resolutionGraph,omitempty" url:"resolutionGraph,omitempty"`
	Prompt          []*ChatMessageWithPlaceholders `json:"prompt" url:"prompt"`
	Type            *PromptZeroType                `json:"type,omitempty" url:"type,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (p *PromptZero) GetName() string {
	if p == nil {
		return ""
	}
	return p.Name
}

func (p *PromptZero) GetVersion() int {
	if p == nil {
		return 0
	}
	return p.Version
}

func (p *PromptZero) GetConfig() interface{} {
	if p == nil {
		return nil
	}
	return p.Config
}

func (p *PromptZero) GetLabels() []string {
	if p == nil {
		return nil
	}
	return p.Labels
}

func (p *PromptZero) GetTags() []string {
	if p == nil {
		return nil
	}
	return p.Tags
}

func (p *PromptZero) GetCommitMessage() *string {
	if p == nil {
		return nil
	}
	return p.CommitMessage
}

func (p *PromptZero) GetResolutionGraph() map[string]interface{} {
	if p == nil {
		return nil
	}
	return p.ResolutionGraph
}

func (p *PromptZero) GetPrompt() []*ChatMessageWithPlaceholders {
	if p == nil {
		return nil
	}
	return p.Prompt
}

func (p *PromptZero) GetType() *PromptZeroType {
	if p == nil {
		return nil
	}
	return p.Type
}

func (p *PromptZero) GetExtraProperties() map[string]interface{} {
	return p.extraProperties
}

func (p *PromptZero) require(field *big.Int) {
	if p.explicitFields == nil {
		p.explicitFields = big.NewInt(0)
	}
	p.explicitFields.Or(p.explicitFields, field)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptZero) SetName(name string) {
	p.Name = name
	p.require(promptZeroFieldName)
}

// SetVersion sets the Version field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptZero) SetVersion(version int) {
	p.Version = version
	p.require(promptZeroFieldVersion)
}

// SetConfig sets the Config field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptZero) SetConfig(config interface{}) {
	p.Config = config
	p.require(promptZeroFieldConfig)
}

// SetLabels sets the Labels field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptZero) SetLabels(labels []string) {
	p.Labels = labels
	p.require(promptZeroFieldLabels)
}

// SetTags sets the Tags field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptZero) SetTags(tags []string) {
	p.Tags = tags
	p.require(promptZeroFieldTags)
}

// SetCommitMessage sets the CommitMessage field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptZero) SetCommitMessage(commitMessage *string) {
	p.CommitMessage = commitMessage
	p.require(promptZeroFieldCommitMessage)
}

// SetResolutionGraph sets the ResolutionGraph field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptZero) SetResolutionGraph(resolutionGraph map[string]interface{}) {
	p.ResolutionGraph = resolutionGraph
	p.require(promptZeroFieldResolutionGraph)
}

// SetPrompt sets the Prompt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptZero) SetPrompt(prompt []*ChatMessageWithPlaceholders) {
	p.Prompt = prompt
	p.require(promptZeroFieldPrompt)
}

// SetType sets the Type field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PromptZero) SetType(type_ *PromptZeroType) {
	p.Type = type_
	p.require(promptZeroFieldType)
}

func (p *PromptZero) UnmarshalJSON(data []byte) error {
	type unmarshaler PromptZero
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*p = PromptZero(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *p)
	if err != nil {
		return err
	}
	p.extraProperties = extraProperties
	p.rawJSON = json.RawMessage(data)
	return nil
}

func (p *PromptZero) MarshalJSON() ([]byte, error) {
	type embed PromptZero
	var marshaler = struct {
		embed
	}{
		embed: embed(*p),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (p *PromptZero) String() string {
	if len(p.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(p.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(p); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", p)
}

type PromptZeroType string

const (
	PromptZeroTypeChat PromptZeroType = "chat"
)

func NewPromptZeroTypeFromString(s string) (PromptZeroType, error) {
	switch s {
	case "chat":
		return PromptZeroTypeChat, nil
	}
	var t PromptZeroType
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (p PromptZeroType) Ptr() *PromptZeroType {
	return &p
}

type ScoreDataType string

const (
	ScoreDataTypeNumeric     ScoreDataType = "NUMERIC"
	ScoreDataTypeBoolean     ScoreDataType = "BOOLEAN"
	ScoreDataTypeCategorical ScoreDataType = "CATEGORICAL"
	ScoreDataTypeCorrection  ScoreDataType = "CORRECTION"
)

func NewScoreDataTypeFromString(s string) (ScoreDataType, error) {
	switch s {
	case "NUMERIC":
		return ScoreDataTypeNumeric, nil
	case "BOOLEAN":
		return ScoreDataTypeBoolean, nil
	case "CATEGORICAL":
		return ScoreDataTypeCategorical, nil
	case "CORRECTION":
		return ScoreDataTypeCorrection, nil
	}
	var t ScoreDataType
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (s ScoreDataType) Ptr() *ScoreDataType {
	return &s
}

type ScoreSource string

const (
	ScoreSourceAnnotation ScoreSource = "ANNOTATION"
	ScoreSourceAPI        ScoreSource = "API"
	ScoreSourceEval       ScoreSource = "EVAL"
)

func NewScoreSourceFromString(s string) (ScoreSource, error) {
	switch s {
	case "ANNOTATION":
		return ScoreSourceAnnotation, nil
	case "API":
		return ScoreSourceAPI, nil
	case "EVAL":
		return ScoreSourceEval, nil
	}
	var t ScoreSource
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (s ScoreSource) Ptr() *ScoreSource {
	return &s
}

var (
	sortFieldID = big.NewInt(1 << 0)
)

type Sort struct {
	ID string `json:"id" url:"id"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (s *Sort) GetID() string {
	if s == nil {
		return ""
	}
	return s.ID
}

func (s *Sort) GetExtraProperties() map[string]interface{} {
	return s.extraProperties
}

func (s *Sort) require(field *big.Int) {
	if s.explicitFields == nil {
		s.explicitFields = big.NewInt(0)
	}
	s.explicitFields.Or(s.explicitFields, field)
}

// SetID sets the ID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *Sort) SetID(id string) {
	s.ID = id
	s.require(sortFieldID)
}

func (s *Sort) UnmarshalJSON(data []byte) error {
	type unmarshaler Sort
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*s = Sort(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *s)
	if err != nil {
		return err
	}
	s.extraProperties = extraProperties
	s.rawJSON = json.RawMessage(data)
	return nil
}

func (s *Sort) MarshalJSON() ([]byte, error) {
	type embed Sort
	var marshaler = struct {
		embed
	}{
		embed: embed(*s),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (s *Sort) String() string {
	if len(s.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(s.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(s); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", s)
}

var (
	textPromptFieldName            = big.NewInt(1 << 0)
	textPromptFieldVersion         = big.NewInt(1 << 1)
	textPromptFieldConfig          = big.NewInt(1 << 2)
	textPromptFieldLabels          = big.NewInt(1 << 3)
	textPromptFieldTags            = big.NewInt(1 << 4)
	textPromptFieldCommitMessage   = big.NewInt(1 << 5)
	textPromptFieldResolutionGraph = big.NewInt(1 << 6)
	textPromptFieldPrompt          = big.NewInt(1 << 7)
)

type TextPrompt struct {
	Name    string      `json:"name" url:"name"`
	Version int         `json:"version" url:"version"`
	Config  interface{} `json:"config" url:"config"`
	// List of deployment labels of this prompt version.
	Labels []string `json:"labels" url:"labels"`
	// List of tags. Used to filter via UI and API. The same across versions of a prompt.
	Tags []string `json:"tags" url:"tags"`
	// Commit message for this prompt version.
	CommitMessage *string `json:"commitMessage,omitempty" url:"commitMessage,omitempty"`
	// The dependency resolution graph for the current prompt. Null if prompt has no dependencies.
	ResolutionGraph map[string]interface{} `json:"resolutionGraph,omitempty" url:"resolutionGraph,omitempty"`
	Prompt          string                 `json:"prompt" url:"prompt"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (t *TextPrompt) GetName() string {
	if t == nil {
		return ""
	}
	return t.Name
}

func (t *TextPrompt) GetVersion() int {
	if t == nil {
		return 0
	}
	return t.Version
}

func (t *TextPrompt) GetConfig() interface{} {
	if t == nil {
		return nil
	}
	return t.Config
}

func (t *TextPrompt) GetLabels() []string {
	if t == nil {
		return nil
	}
	return t.Labels
}

func (t *TextPrompt) GetTags() []string {
	if t == nil {
		return nil
	}
	return t.Tags
}

func (t *TextPrompt) GetCommitMessage() *string {
	if t == nil {
		return nil
	}
	return t.CommitMessage
}

func (t *TextPrompt) GetResolutionGraph() map[string]interface{} {
	if t == nil {
		return nil
	}
	return t.ResolutionGraph
}

func (t *TextPrompt) GetPrompt() string {
	if t == nil {
		return ""
	}
	return t.Prompt
}

func (t *TextPrompt) GetExtraProperties() map[string]interface{} {
	return t.extraProperties
}

func (t *TextPrompt) require(field *big.Int) {
	if t.explicitFields == nil {
		t.explicitFields = big.NewInt(0)
	}
	t.explicitFields.Or(t.explicitFields, field)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *TextPrompt) SetName(name string) {
	t.Name = name
	t.require(textPromptFieldName)
}

// SetVersion sets the Version field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *TextPrompt) SetVersion(version int) {
	t.Version = version
	t.require(textPromptFieldVersion)
}

// SetConfig sets the Config field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *TextPrompt) SetConfig(config interface{}) {
	t.Config = config
	t.require(textPromptFieldConfig)
}

// SetLabels sets the Labels field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *TextPrompt) SetLabels(labels []string) {
	t.Labels = labels
	t.require(textPromptFieldLabels)
}

// SetTags sets the Tags field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *TextPrompt) SetTags(tags []string) {
	t.Tags = tags
	t.require(textPromptFieldTags)
}

// SetCommitMessage sets the CommitMessage field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *TextPrompt) SetCommitMessage(commitMessage *string) {
	t.CommitMessage = commitMessage
	t.require(textPromptFieldCommitMessage)
}

// SetResolutionGraph sets the ResolutionGraph field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *TextPrompt) SetResolutionGraph(resolutionGraph map[string]interface{}) {
	t.ResolutionGraph = resolutionGraph
	t.require(textPromptFieldResolutionGraph)
}

// SetPrompt sets the Prompt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *TextPrompt) SetPrompt(prompt string) {
	t.Prompt = prompt
	t.require(textPromptFieldPrompt)
}

func (t *TextPrompt) UnmarshalJSON(data []byte) error {
	type unmarshaler TextPrompt
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*t = TextPrompt(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *t)
	if err != nil {
		return err
	}
	t.extraProperties = extraProperties
	t.rawJSON = json.RawMessage(data)
	return nil
}

func (t *TextPrompt) MarshalJSON() ([]byte, error) {
	type embed TextPrompt
	var marshaler = struct {
		embed
	}{
		embed: embed(*t),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (t *TextPrompt) String() string {
	if len(t.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(t.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(t); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", t)
}

var (
	traceFieldID          = big.NewInt(1 << 0)
	traceFieldTimestamp   = big.NewInt(1 << 1)
	traceFieldName        = big.NewInt(1 << 2)
	traceFieldInput       = big.NewInt(1 << 3)
	traceFieldOutput      = big.NewInt(1 << 4)
	traceFieldSessionID   = big.NewInt(1 << 5)
	traceFieldRelease     = big.NewInt(1 << 6)
	traceFieldVersion     = big.NewInt(1 << 7)
	traceFieldUserID      = big.NewInt(1 << 8)
	traceFieldMetadata    = big.NewInt(1 << 9)
	traceFieldTags        = big.NewInt(1 << 10)
	traceFieldPublic      = big.NewInt(1 << 11)
	traceFieldEnvironment = big.NewInt(1 << 12)
)

type Trace struct {
	// The unique identifier of a trace
	ID string `json:"id" url:"id"`
	// The timestamp when the trace was created
	Timestamp time.Time `json:"timestamp" url:"timestamp"`
	// The name of the trace
	Name *string `json:"name,omitempty" url:"name,omitempty"`
	// The input data of the trace. Can be any JSON.
	Input interface{} `json:"input,omitempty" url:"input,omitempty"`
	// The output data of the trace. Can be any JSON.
	Output interface{} `json:"output,omitempty" url:"output,omitempty"`
	// The session identifier associated with the trace
	SessionID *string `json:"sessionId,omitempty" url:"sessionId,omitempty"`
	// The release version of the application when the trace was created
	Release *string `json:"release,omitempty" url:"release,omitempty"`
	// The version of the trace
	Version *string `json:"version,omitempty" url:"version,omitempty"`
	// The user identifier associated with the trace
	UserID *string `json:"userId,omitempty" url:"userId,omitempty"`
	// The metadata associated with the trace. Can be any JSON.
	Metadata interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
	// The tags associated with the trace.
	Tags []string `json:"tags" url:"tags"`
	// Public traces are accessible via url without login
	Public bool `json:"public" url:"public"`
	// The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
	Environment string `json:"environment" url:"environment"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (t *Trace) GetID() string {
	if t == nil {
		return ""
	}
	return t.ID
}

func (t *Trace) GetTimestamp() time.Time {
	if t == nil {
		return time.Time{}
	}
	return t.Timestamp
}

func (t *Trace) GetName() *string {
	if t == nil {
		return nil
	}
	return t.Name
}

func (t *Trace) GetInput() interface{} {
	if t == nil {
		return nil
	}
	return t.Input
}

func (t *Trace) GetOutput() interface{} {
	if t == nil {
		return nil
	}
	return t.Output
}

func (t *Trace) GetSessionID() *string {
	if t == nil {
		return nil
	}
	return t.SessionID
}

func (t *Trace) GetRelease() *string {
	if t == nil {
		return nil
	}
	return t.Release
}

func (t *Trace) GetVersion() *string {
	if t == nil {
		return nil
	}
	return t.Version
}

func (t *Trace) GetUserID() *string {
	if t == nil {
		return nil
	}
	return t.UserID
}

func (t *Trace) GetMetadata() interface{} {
	if t == nil {
		return nil
	}
	return t.Metadata
}

func (t *Trace) GetTags() []string {
	if t == nil {
		return nil
	}
	return t.Tags
}

func (t *Trace) GetPublic() bool {
	if t == nil {
		return false
	}
	return t.Public
}

func (t *Trace) GetEnvironment() string {
	if t == nil {
		return ""
	}
	return t.Environment
}

func (t *Trace) GetExtraProperties() map[string]interface{} {
	return t.extraProperties
}

func (t *Trace) require(field *big.Int) {
	if t.explicitFields == nil {
		t.explicitFields = big.NewInt(0)
	}
	t.explicitFields.Or(t.explicitFields, field)
}

// SetID sets the ID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetID(id string) {
	t.ID = id
	t.require(traceFieldID)
}

// SetTimestamp sets the Timestamp field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetTimestamp(timestamp time.Time) {
	t.Timestamp = timestamp
	t.require(traceFieldTimestamp)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetName(name *string) {
	t.Name = name
	t.require(traceFieldName)
}

// SetInput sets the Input field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetInput(input interface{}) {
	t.Input = input
	t.require(traceFieldInput)
}

// SetOutput sets the Output field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetOutput(output interface{}) {
	t.Output = output
	t.require(traceFieldOutput)
}

// SetSessionID sets the SessionID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetSessionID(sessionID *string) {
	t.SessionID = sessionID
	t.require(traceFieldSessionID)
}

// SetRelease sets the Release field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetRelease(release *string) {
	t.Release = release
	t.require(traceFieldRelease)
}

// SetVersion sets the Version field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetVersion(version *string) {
	t.Version = version
	t.require(traceFieldVersion)
}

// SetUserID sets the UserID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetUserID(userID *string) {
	t.UserID = userID
	t.require(traceFieldUserID)
}

// SetMetadata sets the Metadata field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetMetadata(metadata interface{}) {
	t.Metadata = metadata
	t.require(traceFieldMetadata)
}

// SetTags sets the Tags field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetTags(tags []string) {
	t.Tags = tags
	t.require(traceFieldTags)
}

// SetPublic sets the Public field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetPublic(public bool) {
	t.Public = public
	t.require(traceFieldPublic)
}

// SetEnvironment sets the Environment field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (t *Trace) SetEnvironment(environment string) {
	t.Environment = environment
	t.require(traceFieldEnvironment)
}

func (t *Trace) UnmarshalJSON(data []byte) error {
	type embed Trace
	var unmarshaler = struct {
		embed
		Timestamp *internal.DateTime `json:"timestamp"`
	}{
		embed: embed(*t),
	}
	if err := json.Unmarshal(data, &unmarshaler); err != nil {
		return err
	}
	*t = Trace(unmarshaler.embed)
	t.Timestamp = unmarshaler.Timestamp.Time()
	extraProperties, err := internal.ExtractExtraProperties(data, *t)
	if err != nil {
		return err
	}
	t.extraProperties = extraProperties
	t.rawJSON = json.RawMessage(data)
	return nil
}

func (t *Trace) MarshalJSON() ([]byte, error) {
	type embed Trace
	var marshaler = struct {
		embed
		Timestamp *internal.DateTime `json:"timestamp"`
	}{
		embed:     embed(*t),
		Timestamp: internal.NewDateTime(t.Timestamp),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (t *Trace) String() string {
	if len(t.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(t.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(t); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", t)
}

// (Deprecated. Use usageDetails and costDetails instead.) Standard interface for usage and cost
var (
	usageFieldInput      = big.NewInt(1 << 0)
	usageFieldOutput     = big.NewInt(1 << 1)
	usageFieldTotal      = big.NewInt(1 << 2)
	usageFieldUnit       = big.NewInt(1 << 3)
	usageFieldInputCost  = big.NewInt(1 << 4)
	usageFieldOutputCost = big.NewInt(1 << 5)
	usageFieldTotalCost  = big.NewInt(1 << 6)
)

type Usage struct {
	// Number of input units (e.g. tokens)
	Input int `json:"input" url:"input"`
	// Number of output units (e.g. tokens)
	Output int `json:"output" url:"output"`
	// Defaults to input+output if not set
	Total int `json:"total" url:"total"`
	// Unit of measurement
	Unit *string `json:"unit,omitempty" url:"unit,omitempty"`
	// USD input cost
	InputCost *float64 `json:"inputCost,omitempty" url:"inputCost,omitempty"`
	// USD output cost
	OutputCost *float64 `json:"outputCost,omitempty" url:"outputCost,omitempty"`
	// USD total cost, defaults to input+output
	TotalCost *float64 `json:"totalCost,omitempty" url:"totalCost,omitempty"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (u *Usage) GetInput() int {
	if u == nil {
		return 0
	}
	return u.Input
}

func (u *Usage) GetOutput() int {
	if u == nil {
		return 0
	}
	return u.Output
}

func (u *Usage) GetTotal() int {
	if u == nil {
		return 0
	}
	return u.Total
}

func (u *Usage) GetUnit() *string {
	if u == nil {
		return nil
	}
	return u.Unit
}

func (u *Usage) GetInputCost() *float64 {
	if u == nil {
		return nil
	}
	return u.InputCost
}

func (u *Usage) GetOutputCost() *float64 {
	if u == nil {
		return nil
	}
	return u.OutputCost
}

func (u *Usage) GetTotalCost() *float64 {
	if u == nil {
		return nil
	}
	return u.TotalCost
}

func (u *Usage) GetExtraProperties() map[string]interface{} {
	return u.extraProperties
}

func (u *Usage) require(field *big.Int) {
	if u.explicitFields == nil {
		u.explicitFields = big.NewInt(0)
	}
	u.explicitFields.Or(u.explicitFields, field)
}

// SetInput sets the Input field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *Usage) SetInput(input int) {
	u.Input = input
	u.require(usageFieldInput)
}

// SetOutput sets the Output field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *Usage) SetOutput(output int) {
	u.Output = output
	u.require(usageFieldOutput)
}

// SetTotal sets the Total field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *Usage) SetTotal(total int) {
	u.Total = total
	u.require(usageFieldTotal)
}

// SetUnit sets the Unit field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *Usage) SetUnit(unit *string) {
	u.Unit = unit
	u.require(usageFieldUnit)
}

// SetInputCost sets the InputCost field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *Usage) SetInputCost(inputCost *float64) {
	u.InputCost = inputCost
	u.require(usageFieldInputCost)
}

// SetOutputCost sets the OutputCost field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *Usage) SetOutputCost(outputCost *float64) {
	u.OutputCost = outputCost
	u.require(usageFieldOutputCost)
}

// SetTotalCost sets the TotalCost field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *Usage) SetTotalCost(totalCost *float64) {
	u.TotalCost = totalCost
	u.require(usageFieldTotalCost)
}

func (u *Usage) UnmarshalJSON(data []byte) error {
	type unmarshaler Usage
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*u = Usage(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *u)
	if err != nil {
		return err
	}
	u.extraProperties = extraProperties
	u.rawJSON = json.RawMessage(data)
	return nil
}

func (u *Usage) MarshalJSON() ([]byte, error) {
	type embed Usage
	var marshaler = struct {
		embed
	}{
		embed: embed(*u),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (u *Usage) String() string {
	if len(u.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(u.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(u); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", u)
}

var (
	utilsMetaResponseFieldPage       = big.NewInt(1 << 0)
	utilsMetaResponseFieldLimit      = big.NewInt(1 << 1)
	utilsMetaResponseFieldTotalItems = big.NewInt(1 << 2)
	utilsMetaResponseFieldTotalPages = big.NewInt(1 << 3)
)

type UtilsMetaResponse struct {
	// current page number
	Page int `json:"page" url:"page"`
	// number of items per page
	Limit int `json:"limit" url:"limit"`
	// number of total items given the current filters/selection (if any)
	TotalItems int `json:"totalItems" url:"totalItems"`
	// number of total pages given the current limit
	TotalPages int `json:"totalPages" url:"totalPages"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (u *UtilsMetaResponse) GetPage() int {
	if u == nil {
		return 0
	}
	return u.Page
}

func (u *UtilsMetaResponse) GetLimit() int {
	if u == nil {
		return 0
	}
	return u.Limit
}

func (u *UtilsMetaResponse) GetTotalItems() int {
	if u == nil {
		return 0
	}
	return u.TotalItems
}

func (u *UtilsMetaResponse) GetTotalPages() int {
	if u == nil {
		return 0
	}
	return u.TotalPages
}

func (u *UtilsMetaResponse) GetExtraProperties() map[string]interface{} {
	return u.extraProperties
}

func (u *UtilsMetaResponse) require(field *big.Int) {
	if u.explicitFields == nil {
		u.explicitFields = big.NewInt(0)
	}
	u.explicitFields.Or(u.explicitFields, field)
}

// SetPage sets the Page field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UtilsMetaResponse) SetPage(page int) {
	u.Page = page
	u.require(utilsMetaResponseFieldPage)
}

// SetLimit sets the Limit field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UtilsMetaResponse) SetLimit(limit int) {
	u.Limit = limit
	u.require(utilsMetaResponseFieldLimit)
}

// SetTotalItems sets the TotalItems field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UtilsMetaResponse) SetTotalItems(totalItems int) {
	u.TotalItems = totalItems
	u.require(utilsMetaResponseFieldTotalItems)
}

// SetTotalPages sets the TotalPages field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (u *UtilsMetaResponse) SetTotalPages(totalPages int) {
	u.TotalPages = totalPages
	u.require(utilsMetaResponseFieldTotalPages)
}

func (u *UtilsMetaResponse) UnmarshalJSON(data []byte) error {
	type unmarshaler UtilsMetaResponse
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*u = UtilsMetaResponse(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *u)
	if err != nil {
		return err
	}
	u.extraProperties = extraProperties
	u.rawJSON = json.RawMessage(data)
	return nil
}

func (u *UtilsMetaResponse) MarshalJSON() ([]byte, error) {
	type embed UtilsMetaResponse
	var marshaler = struct {
		embed
	}{
		embed: embed(*u),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (u *UtilsMetaResponse) String() string {
	if len(u.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(u.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(u); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", u)
}
