models

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package models defines the data structures for the REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsZeroValue

func IsZeroValue(val any) bool

IsZeroValue checks if the val is the zero-ed value.

func ToSessionEvent

func ToSessionEvent(event Event) *session.Event

ToSessionEvent maps Event data struct to session.Event

Types

type CreateSessionRequest

type CreateSessionRequest struct {
	State  map[string]any `json:"state"`
	Events []Event        `json:"events"`
}

type Event

type Event struct {
	ID                 string                   `json:"id"`
	Time               int64                    `json:"time"`
	InvocationID       string                   `json:"invocationId"`
	Branch             string                   `json:"branch"`
	Author             string                   `json:"author"`
	Partial            bool                     `json:"partial"`
	LongRunningToolIDs []string                 `json:"longRunningToolIds"`
	Content            *genai.Content           `json:"content"`
	GroundingMetadata  *genai.GroundingMetadata `json:"groundingMetadata"`
	TurnComplete       bool                     `json:"turnComplete"`
	Interrupted        bool                     `json:"interrupted"`
	ErrorCode          string                   `json:"errorCode"`
	ErrorMessage       string                   `json:"errorMessage"`
	Actions            EventActions             `json:"actions"`
}

Event represents a single event in a session.

func FromSessionEvent

func FromSessionEvent(event session.Event) Event

FromSessionEvent maps session.Event to Event data struct

type EventActions

type EventActions struct {
	StateDelta    map[string]any   `json:"stateDelta"`
	ArtifactDelta map[string]int64 `json:"artifactDelta"`
}

EventActions represent a data model for session.EventActions

type RunAgentRequest

type RunAgentRequest struct {
	AppName string `json:"appName"`

	UserId string `json:"userId"`

	SessionId string `json:"sessionId"`

	NewMessage genai.Content `json:"newMessage"`

	Streaming bool `json:"streaming,omitempty"`

	StateDelta *map[string]any `json:"stateDelta,omitempty"`
}

func (RunAgentRequest) AssertRunAgentRequestRequired

func (req RunAgentRequest) AssertRunAgentRequestRequired() error

AssertRunAgentRequestRequired checks if the required fields are not zero-ed

type Session

type Session struct {
	ID        string         `json:"id"`
	AppName   string         `json:"appName"`
	UserID    string         `json:"userId"`
	UpdatedAt int64          `json:"lastUpdateTime"`
	Events    []Event        `json:"events"`
	State     map[string]any `json:"state"`
}

Session represents an agent's session.

func FromSession

func FromSession(session session.Session) (Session, error)

func (Session) Validate

func (s Session) Validate() error

type SessionID

type SessionID struct {
	ID      string `mapstructure:"session_id,optional"`
	AppName string `mapstructure:"app_name,required"`
	UserID  string `mapstructure:"user_id,required"`
}

func SessionIDFromHTTPParameters

func SessionIDFromHTTPParameters(vars map[string]string) (SessionID, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL