Skip to main content

internal/api/contexts.go

internal/api · 110 lines · 6 declarations · source

Declarations

type contextRequest

type contextRequest struct {
DataSubjectID string `json:"data_subject_id"`
// MaxCharacters is the content allowance, in Unicode code points of message text and summary
// text; omitted means the server's recall budget.
MaxCharacters *int `json:"max_characters"`
}

contextRequest asks for one subject's history under a budget: the newest turns verbatim, the rest as the segments the compaction pass wrote.

source

type contextResponse

type contextResponse struct {
// Segments stand in for the older history, oldest first; each names the range it covers.
Segments []contextSegment `json:"segments"`
// Turns are the newest turns as they were said, oldest first.
Turns []contextTurn `json:"turns"`
// Watermark is how far the deployment has formed, so a caller knows what the context cannot
// yet include.
Watermark freshnessResponse `json:"watermark"`
Characters int `json:"characters"`
Truncated bool `json:"truncated"`
}

source

type contextSegment

type contextSegment struct {
SegmentID string `json:"segment_id"`
Level int `json:"level"`
FromOffset int64 `json:"from_offset"`
ToOffset int64 `json:"to_offset"`
Covered int `json:"covered"`
Summary string `json:"summary"`
}

source

type contextTurn

type contextTurn struct {
LogOffset int64 `json:"log_offset"`
OccurredAt time.Time `json:"occurred_at"`
Messages []contextMessage `json:"messages"`
}

source

type contextMessage

type contextMessage struct {
Role string `json:"role"`
Content string `json:"content"`
}

source

method Server.assembleContext

func (s *Server) assembleContext(w http.ResponseWriter, r *http.Request, grant credential.Grant)

assembleContext answers with no model call: the planner's choice over what the store holds.

source