write

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PackageName = "modelcall/write"
View Source
var PathURI = "/v1/api/agently/modelcall"

Functions

func DefineComponent

func DefineComponent(ctx context.Context, srv *datly.Service) (*repository.Component, error)

func DefineDeleteComponent

func DefineDeleteComponent(ctx context.Context, srv *datly.Service) (*repository.Component, error)

Types

type DeleteHandler

type DeleteHandler struct{}

func (*DeleteHandler) Exec

func (h *DeleteHandler) Exec(ctx context.Context, sess handler.Session) (interface{}, error)

type DeleteInput

type DeleteInput struct {
	Rows []*MutableModelCallView `parameter:",kind=body,in=data"`
}

type DeleteOutput

type DeleteOutput struct {
	response.Status `parameter:",kind=output,in=status" json:",omitempty"`
}

type Handler

type Handler struct{}

func (*Handler) Exec

func (h *Handler) Exec(ctx context.Context, sess handler.Session) (interface{}, error)

type Input

type Input struct {
	ModelCalls []*ModelCall `parameter:",kind=body,in=data"`

	CurIDs *struct{ Values []string } `parameter:",kind=param,in=ModelCalls,dataType=modelcall/write.ModelCalls" codec:"structql,uri=sql/cur_ids.sql"`

	Cur []*ModelCall `parameter:",kind=view,in=Cur" view:"Cur" sql:"uri=sql/cur_model_call.sql"`

	CurByID map[string]*ModelCall
}

func (*Input) EmbedFS

func (i *Input) EmbedFS() (fs *embed.FS)

func (*Input) Init

func (i *Input) Init(ctx context.Context, sess handler.Session, _ *Output) error

func (*Input) Validate

func (i *Input) Validate(ctx context.Context, sess handler.Session, output *Output) error

type ModelCall

type ModelCall struct {
	MessageID                          string        `sqlx:"message_id,primaryKey" validate:"required"`
	TurnID                             *string       `sqlx:"turn_id" json:",omitempty"`
	Provider                           string        `sqlx:"provider" validate:"required"`
	Model                              string        `sqlx:"model" validate:"required"`
	ModelKind                          string        `sqlx:"model_kind" validate:"required"`
	Status                             string        `sqlx:"status" validate:"required"`
	ErrorCode                          *string       `sqlx:"error_code" json:",omitempty"`
	ErrorMessage                       *string       `sqlx:"error_message" json:",omitempty"`
	PromptTokens                       *int          `sqlx:"prompt_tokens" json:",omitempty"`
	PromptCachedTokens                 *int          `sqlx:"prompt_cached_tokens" json:",omitempty"`
	CompletionTokens                   *int          `sqlx:"completion_tokens" json:",omitempty"`
	TotalTokens                        *int          `sqlx:"total_tokens" json:",omitempty"`
	PromptAudioTokens                  *int          `sqlx:"prompt_audio_tokens" json:",omitempty"`
	CompletionReasoningTokens          *int          `sqlx:"completion_reasoning_tokens" json:",omitempty"`
	CompletionAudioTokens              *int          `sqlx:"completion_audio_tokens" json:",omitempty"`
	CompletionAcceptedPredictionTokens *int          `sqlx:"completion_accepted_prediction_tokens" json:",omitempty"`
	CompletionRejectedPredictionTokens *int          `sqlx:"completion_rejected_prediction_tokens" json:",omitempty"`
	FinishReason                       *string       `sqlx:"finish_reason" json:",omitempty"`
	StartedAt                          *time.Time    `sqlx:"started_at" json:",omitempty"`
	CompletedAt                        *time.Time    `sqlx:"completed_at" json:",omitempty"`
	LatencyMS                          *int          `sqlx:"latency_ms" json:",omitempty"`
	Cost                               *float64      `sqlx:"cost" json:",omitempty"`
	TraceID                            *string       `sqlx:"trace_id" json:",omitempty"`
	SpanID                             *string       `sqlx:"span_id" json:",omitempty"`
	RequestPayloadID                   *string       `sqlx:"request_payload_id" json:",omitempty"`
	ResponsePayloadID                  *string       `sqlx:"response_payload_id" json:",omitempty"`
	ProviderRequestPayloadID           *string       `sqlx:"provider_request_payload_id" json:",omitempty"`
	ProviderResponsePayloadID          *string       `sqlx:"provider_response_payload_id" json:",omitempty"`
	StreamPayloadID                    *string       `sqlx:"stream_payload_id" json:",omitempty"`
	RunID                              *string       `sqlx:"run_id" json:",omitempty"`
	Iteration                          *int          `sqlx:"iteration" json:",omitempty"`
	Has                                *ModelCallHas `setMarker:"true" format:"-" sqlx:"-" diff:"-" json:"-"`
}

func (*ModelCall) SetCompletedAt

func (m *ModelCall) SetCompletedAt(v time.Time)

func (*ModelCall) SetCompletionTokens

func (m *ModelCall) SetCompletionTokens(v int)

func (*ModelCall) SetCost

func (m *ModelCall) SetCost(v float64)

func (*ModelCall) SetErrorCode

func (m *ModelCall) SetErrorCode(v string)

func (*ModelCall) SetErrorMessage

func (m *ModelCall) SetErrorMessage(v string)

func (*ModelCall) SetIteration

func (m *ModelCall) SetIteration(v int)

func (*ModelCall) SetMessageID

func (m *ModelCall) SetMessageID(v string)

func (*ModelCall) SetModel

func (m *ModelCall) SetModel(v string)

func (*ModelCall) SetModelKind

func (m *ModelCall) SetModelKind(v string)

func (*ModelCall) SetPromptCachedTokens

func (m *ModelCall) SetPromptCachedTokens(v int)

func (*ModelCall) SetPromptTokens

func (m *ModelCall) SetPromptTokens(v int)

func (*ModelCall) SetProvider

func (m *ModelCall) SetProvider(v string)

func (*ModelCall) SetProviderRequestPayloadID

func (m *ModelCall) SetProviderRequestPayloadID(v string)

func (*ModelCall) SetProviderResponsePayloadID

func (m *ModelCall) SetProviderResponsePayloadID(v string)

func (*ModelCall) SetRequestPayloadID

func (m *ModelCall) SetRequestPayloadID(v string)

func (*ModelCall) SetResponsePayloadID

func (m *ModelCall) SetResponsePayloadID(v string)

func (*ModelCall) SetRunID

func (m *ModelCall) SetRunID(v string)

func (*ModelCall) SetStartedAt

func (m *ModelCall) SetStartedAt(v time.Time)

func (*ModelCall) SetStatus

func (m *ModelCall) SetStatus(v string)

func (*ModelCall) SetStreamPayloadID

func (m *ModelCall) SetStreamPayloadID(v string)

func (*ModelCall) SetTotalTokens

func (m *ModelCall) SetTotalTokens(v int)

func (*ModelCall) SetTraceID

func (m *ModelCall) SetTraceID(v string)

func (*ModelCall) SetTurnID

func (m *ModelCall) SetTurnID(v string)

Added convenience setters to avoid manual Has management across call sites.

type ModelCallHas

type ModelCallHas struct {
	MessageID                          bool
	TurnID                             bool
	Provider                           bool
	Model                              bool
	ModelKind                          bool
	ErrorCode                          bool
	ErrorMessage                       bool
	PromptTokens                       bool
	PromptCachedTokens                 bool
	CompletionTokens                   bool
	TotalTokens                        bool
	PromptAudioTokens                  bool
	CompletionReasoningTokens          bool
	CompletionAudioTokens              bool
	CompletionAcceptedPredictionTokens bool
	CompletionRejectedPredictionTokens bool
	FinishReason                       bool
	StartedAt                          bool
	CompletedAt                        bool
	LatencyMS                          bool
	Cost                               bool
	TraceID                            bool
	SpanID                             bool
	RequestPayloadID                   bool
	ResponsePayloadID                  bool
	ProviderRequestPayloadID           bool
	ProviderResponsePayloadID          bool
	StreamPayloadID                    bool
	RunID                              bool
	Iteration                          bool
	Status                             bool
}

type MutableModelCallView

type MutableModelCallView = ModelCall

func NewMutableModelCallView

func NewMutableModelCallView(opts ...MutableModelCallViewOption) *MutableModelCallView

type MutableModelCallViewOption

type MutableModelCallViewOption func(*MutableModelCallView)

func WithModelCallIteration

func WithModelCallIteration(v int) MutableModelCallViewOption

func WithModelCallMessageID

func WithModelCallMessageID(v string) MutableModelCallViewOption

func WithModelCallModel

func WithModelCallModel(v string) MutableModelCallViewOption

func WithModelCallModelKind

func WithModelCallModelKind(v string) MutableModelCallViewOption

func WithModelCallProvider

func WithModelCallProvider(v string) MutableModelCallViewOption

func WithModelCallRunID

func WithModelCallRunID(v string) MutableModelCallViewOption

func WithModelCallStatus

func WithModelCallStatus(v string) MutableModelCallViewOption

func WithModelCallTurnID

func WithModelCallTurnID(v string) MutableModelCallViewOption

type MutableModelCallViews

type MutableModelCallViews struct {
	ModelCalls []*MutableModelCallView
}

func NewMutableModelCallViews

func NewMutableModelCallViews(rows ...*MutableModelCallView) *MutableModelCallViews

type Output

type Output struct {
	response.Status `parameter:",kind=output,in=status" anonymous:"true"`
	Data            []*ModelCall           `parameter:",kind=body"`
	Violations      []*validator.Violation `parameter:",kind=transient"`
}

Jump to

Keyboard shortcuts

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