sentinel

package module
v0.0.0-...-63247ac Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package sentinel provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

Index

Constants

View Source
const MAX_SUPERVISORS_PER_CLIENT = 8

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func InitAPI

func InitAPI(store Store)

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type Arguments

type Arguments map[string]interface{}

Arguments defines model for Arguments.

type AssistantMessage

type AssistantMessage struct {
	Content   string      `json:"content"`
	Role      string      `json:"role"`
	Source    *string     `json:"source,omitempty"`
	ToolCalls *[]ToolCall `json:"tool_calls,omitempty"`
}

AssistantMessage defines model for AssistantMessage.

type ChainExecution

type ChainExecution struct {
	ChainId        openapi_types.UUID `json:"chain_id"`
	CreatedAt      time.Time          `json:"created_at"`
	Id             openapi_types.UUID `json:"id"`
	RequestGroupId openapi_types.UUID `json:"request_group_id"`
}

ChainExecution defines model for ChainExecution.

type ChainExecutionState

type ChainExecutionState struct {
	Chain               SupervisorChain           `json:"chain"`
	ChainExecution      ChainExecution            `json:"chain_execution"`
	SupervisionRequests []SupervisionRequestState `json:"supervision_requests"`
}

ChainExecutionState defines model for ChainExecutionState.

type ChainRequest

type ChainRequest struct {
	// SupervisorIds Array of supervisor IDs to create chains with
	SupervisorIds *[]openapi_types.UUID `json:"supervisor_ids,omitempty"`
}

ChainRequest defines model for ChainRequest.

type Choice

type Choice struct {
	Message    AssistantMessage `json:"message"`
	StopReason *string          `json:"stop_reason,omitempty"`
}

Choice defines model for Choice.

type Client

type Client struct {
	Hub  *Hub
	Conn *websocket.Conn
	Send chan SupervisionRequest
}

Client represents a single WebSocket connection

func (*Client) ReadPump

func (c *Client) ReadPump()

ReadPump handles the reading of messages from the client and handles the processing of responses

func (*Client) WritePump

func (c *Client) WritePump()

WritePump handles the sending of reviews to the client

type CreateProjectJSONBody

type CreateProjectJSONBody struct {
	Name          string   `json:"name"`
	RunResultTags []string `json:"run_result_tags"`
}

CreateProjectJSONBody defines parameters for CreateProject.

type CreateProjectJSONRequestBody

type CreateProjectJSONRequestBody CreateProjectJSONBody

CreateProjectJSONRequestBody defines body for CreateProject for application/json ContentType.

type CreateRunToolJSONBody

type CreateRunToolJSONBody struct {
	Attributes        map[string]interface{} `json:"attributes"`
	Code              string                 `json:"code"`
	Description       string                 `json:"description"`
	IgnoredAttributes *[]string              `json:"ignored_attributes,omitempty"`
	Name              string                 `json:"name"`
}

CreateRunToolJSONBody defines parameters for CreateRunTool.

type CreateRunToolJSONRequestBody

type CreateRunToolJSONRequestBody CreateRunToolJSONBody

CreateRunToolJSONRequestBody defines body for CreateRunTool for application/json ContentType.

type CreateSupervisionRequestJSONRequestBody

type CreateSupervisionRequestJSONRequestBody = SupervisionRequest

CreateSupervisionRequestJSONRequestBody defines body for CreateSupervisionRequest for application/json ContentType.

type CreateSupervisionResultJSONRequestBody

type CreateSupervisionResultJSONRequestBody = SupervisionResult

CreateSupervisionResultJSONRequestBody defines body for CreateSupervisionResult for application/json ContentType.

type CreateSupervisorJSONRequestBody

type CreateSupervisorJSONRequestBody = Supervisor

CreateSupervisorJSONRequestBody defines body for CreateSupervisor for application/json ContentType.

type CreateTaskJSONBody

type CreateTaskJSONBody struct {
	Description *string `json:"description,omitempty"`
	Name        string  `json:"name"`
}

CreateTaskJSONBody defines parameters for CreateTask.

type CreateTaskJSONRequestBody

type CreateTaskJSONRequestBody CreateTaskJSONBody

CreateTaskJSONRequestBody defines body for CreateTask for application/json ContentType.

type CreateToolRequestGroupJSONRequestBody

type CreateToolRequestGroupJSONRequestBody = ToolRequestGroup

CreateToolRequestGroupJSONRequestBody defines body for CreateToolRequestGroup for application/json ContentType.

type CreateToolRequestJSONRequestBody

type CreateToolRequestJSONRequestBody = ToolRequest

CreateToolRequestJSONRequestBody defines body for CreateToolRequest for application/json ContentType.

type CreateToolSupervisorChainsJSONBody

type CreateToolSupervisorChainsJSONBody = []ChainRequest

CreateToolSupervisorChainsJSONBody defines parameters for CreateToolSupervisorChains.

type CreateToolSupervisorChainsJSONRequestBody

type CreateToolSupervisorChainsJSONRequestBody = CreateToolSupervisorChainsJSONBody

CreateToolSupervisorChainsJSONRequestBody defines body for CreateToolSupervisorChains for application/json ContentType.

type Decision

type Decision string

Decision defines model for Decision.

const (
	Approve   Decision = "approve"
	Escalate  Decision = "escalate"
	Modify    Decision = "modify"
	Reject    Decision = "reject"
	Terminate Decision = "terminate"
)

Defines values for Decision.

type ErrorResponse

type ErrorResponse struct {
	Details *string `json:"details,omitempty"`
	Error   string  `json:"error"`
}

ErrorResponse defines model for ErrorResponse.

type Hub

type Hub struct {
	// Clients is a map of clients to their connection status
	Clients      map[*Client]bool
	ClientsMutex sync.RWMutex
	// ReviewChan is a channel that receives new reviews, then assigns them to a connected client
	ReviewChan chan SupervisionRequest
	// Register and Unregister are used when a new client connects and disconnects
	Register   chan *Client
	Unregister chan *Client
	// AssignedReviews is a map of clients to the reviews they are currently processing
	AssignedReviews      map[*Client]map[string]bool
	AssignedReviewsMutex sync.RWMutex

	// CompletedReviewCount is used to count the number of reviews that have been completed
	CompletedReviewCount int
	Store                Store
}

Hub maintains active connections and broadcasts messages

func NewHub

func NewHub(store Store, humanReviewChan chan SupervisionRequest) *Hub

func (*Hub) Run

func (h *Hub) Run()

Run starts the hub and handles client connections/disconnections and supervisor assignments

type HubStats

type HubStats struct {
	AssignedReviews       map[string]int `json:"assigned_reviews"`
	AssignedReviewsCount  int            `json:"assigned_reviews_count"`
	BusyClients           int            `json:"busy_clients"`
	CompletedReviewsCount int            `json:"completed_reviews_count"`
	ConnectedClients      int            `json:"connected_clients"`
	FreeClients           int            `json:"free_clients"`
	PendingReviewsCount   int            `json:"pending_reviews_count"`
	ReviewDistribution    map[string]int `json:"review_distribution"`
}

HubStats defines model for HubStats.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type Message

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

Message defines model for Message.

type MessageRole

type MessageRole string

MessageRole defines model for MessageRole.

const (
	Assistant MessageRole = "assistant"
	System    MessageRole = "system"
	User      MessageRole = "user"
)

Defines values for MessageRole.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type Output

type Output struct {
	Choices *[]Choice `json:"choices,omitempty"`
	Model   *string   `json:"model,omitempty"`
	Usage   *Usage    `json:"usage,omitempty"`
}

Output defines model for Output.

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

func NewProcessor

func NewProcessor(store Store, humanReviewChan chan SupervisionRequest) *Processor

func (*Processor) Start

func (p *Processor) Start(ctx context.Context)

type Project

type Project struct {
	CreatedAt     time.Time          `json:"created_at"`
	Id            openapi_types.UUID `json:"id"`
	Name          string             `json:"name"`
	RunResultTags []string           `json:"run_result_tags"`
}

Project defines model for Project.

type ProjectStore

type ProjectStore interface {
	CreateProject(ctx context.Context, project Project) error
	GetProject(ctx context.Context, id uuid.UUID) (*Project, error)
	GetProjectFromName(ctx context.Context, name string) (*Project, error)
	GetProjects(ctx context.Context) ([]Project, error)
}

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ReviewPayload

type ReviewPayload struct {
	ChainState   ChainExecutionState `json:"chain_state"`
	RequestGroup ToolRequestGroup    `json:"request_group"`

	// RunId The ID of the run this review is for
	RunId              openapi_types.UUID `json:"run_id"`
	SupervisionRequest SupervisionRequest `json:"supervision_request"`
}

ReviewPayload Contains all the information needed for a human reviewer to make a supervision decision

type Run

type Run struct {
	CreatedAt time.Time          `json:"created_at"`
	Id        openapi_types.UUID `json:"id"`
	Result    *string            `json:"result,omitempty"`
	Status    *Status            `json:"status,omitempty"`
	TaskId    openapi_types.UUID `json:"task_id"`
}

Run defines model for Run.

type RunExecution

type RunExecution struct {
	Chains       []ChainExecutionState `json:"chains"`
	RequestGroup ToolRequestGroup      `json:"request_group"`
	Status       Status                `json:"status"`
}

RunExecution defines model for RunExecution.

type RunState

type RunState = []RunExecution

RunState defines model for RunState.

type RunStore

type RunStore interface {
	CreateRun(ctx context.Context, run Run) (uuid.UUID, error)
	GetRun(ctx context.Context, id uuid.UUID) (*Run, error)
	GetRuns(ctx context.Context, taskId uuid.UUID) ([]Run, error)
	GetTaskRuns(ctx context.Context, taskId uuid.UUID) ([]Run, error)
	UpdateRunStatus(ctx context.Context, runId uuid.UUID, status Status) error
	UpdateRunResult(ctx context.Context, runId uuid.UUID, result string) error
}

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

ServeMux is an abstraction of http.ServeMux.

type Server

type Server struct {
	Hub   *Hub
	Store Store
}

func (Server) CreateProject

func (s Server) CreateProject(w http.ResponseWriter, r *http.Request)

CreateProject

func (Server) CreateRun

func (s Server) CreateRun(w http.ResponseWriter, r *http.Request, taskId uuid.UUID)

CreateRun

func (Server) CreateRunTool

func (s Server) CreateRunTool(w http.ResponseWriter, r *http.Request, id uuid.UUID)

CreateRunTool

func (Server) CreateSupervisionRequest

func (s Server) CreateSupervisionRequest(w http.ResponseWriter, r *http.Request, requestGroupId uuid.UUID, chainId uuid.UUID, supervisorId uuid.UUID)

CreateSupervisionRequest

func (Server) CreateSupervisionResult

func (s Server) CreateSupervisionResult(w http.ResponseWriter, r *http.Request, supervisionRequestId uuid.UUID)

CreateSupervisionResult

func (Server) CreateSupervisor

func (s Server) CreateSupervisor(w http.ResponseWriter, r *http.Request, projectId uuid.UUID)

CreateSupervisor

func (Server) CreateTask

func (s Server) CreateTask(w http.ResponseWriter, r *http.Request, projectId uuid.UUID)

CreateTask

func (Server) CreateToolRequest

func (s Server) CreateToolRequest(w http.ResponseWriter, r *http.Request, requestGroupId uuid.UUID)

CreateToolRequest

func (Server) CreateToolRequestGroup

func (s Server) CreateToolRequestGroup(w http.ResponseWriter, r *http.Request, toolId uuid.UUID)

CreateToolRequestGroup

func (Server) CreateToolSupervisorChains

func (s Server) CreateToolSupervisorChains(w http.ResponseWriter, r *http.Request, toolId uuid.UUID)

CreateToolSupervisorChains

func (Server) GetHubStats

func (s Server) GetHubStats(w http.ResponseWriter, r *http.Request)

GetHubStats

func (Server) GetOpenAPI

func (s Server) GetOpenAPI(w http.ResponseWriter, r *http.Request)

func (Server) GetProject

func (s Server) GetProject(w http.ResponseWriter, r *http.Request, id uuid.UUID)

GetProjectById

func (Server) GetProjectTasks

func (s Server) GetProjectTasks(w http.ResponseWriter, r *http.Request, id uuid.UUID)

GetProjectTasks

func (Server) GetProjectTools

func (s Server) GetProjectTools(w http.ResponseWriter, r *http.Request, id uuid.UUID)

GetProjectTools

func (Server) GetProjects

func (s Server) GetProjects(w http.ResponseWriter, r *http.Request)

GetProjects

func (Server) GetRequestGroup

func (s Server) GetRequestGroup(w http.ResponseWriter, r *http.Request, requestGroupId uuid.UUID)

GetRequestGroup

func (Server) GetRequestGroupStatus

func (s Server) GetRequestGroupStatus(w http.ResponseWriter, r *http.Request, requestGroupId uuid.UUID)

GetRequestGroupStatus

func (Server) GetRunRequestGroups

func (s Server) GetRunRequestGroups(w http.ResponseWriter, r *http.Request, runId uuid.UUID)

GetRunRequestGroups

func (Server) GetRunState

func (s Server) GetRunState(w http.ResponseWriter, r *http.Request, runId uuid.UUID)

GetRunState

func (Server) GetRunStatus

func (s Server) GetRunStatus(w http.ResponseWriter, r *http.Request, runId uuid.UUID)

GetRunStatus

func (Server) GetRunTools

func (s Server) GetRunTools(w http.ResponseWriter, r *http.Request, id uuid.UUID)

GetRunTools

func (Server) GetSupervisionRequestStatus

func (s Server) GetSupervisionRequestStatus(w http.ResponseWriter, r *http.Request, supervisionRequestId uuid.UUID)

GetSupervisionRequestStatus

func (Server) GetSupervisionResult

func (s Server) GetSupervisionResult(w http.ResponseWriter, r *http.Request, supervisionRequestId uuid.UUID)

GetSupervisionResult

func (Server) GetSupervisionReviewPayload

func (s Server) GetSupervisionReviewPayload(w http.ResponseWriter, r *http.Request, supervisionRequestId uuid.UUID)

GetSupervisionReviewPayload

func (Server) GetSupervisor

func (s Server) GetSupervisor(w http.ResponseWriter, r *http.Request, id uuid.UUID)

func (Server) GetSupervisors

func (s Server) GetSupervisors(w http.ResponseWriter, r *http.Request, projectId uuid.UUID)

GetSupervisors

func (Server) GetSwaggerDocs

func (s Server) GetSwaggerDocs(w http.ResponseWriter, r *http.Request)

func (Server) GetTask

func (s Server) GetTask(w http.ResponseWriter, r *http.Request, id uuid.UUID)

GetTask

func (Server) GetTaskRuns

func (s Server) GetTaskRuns(w http.ResponseWriter, r *http.Request, id uuid.UUID)

GetTaskRuns

func (Server) GetTool

func (s Server) GetTool(w http.ResponseWriter, r *http.Request, id uuid.UUID)

GetTool

func (Server) GetToolSupervisorChains

func (s Server) GetToolSupervisorChains(w http.ResponseWriter, r *http.Request, toolId uuid.UUID)

GetToolSupervisorChains

func (Server) UpdateRunResult

func (s Server) UpdateRunResult(w http.ResponseWriter, r *http.Request, runId uuid.UUID)

UpdateRunResult

func (Server) UpdateRunStatus

func (s Server) UpdateRunStatus(w http.ResponseWriter, r *http.Request, runId uuid.UUID)

UpdateRunStatus

type ServerInterface

type ServerInterface interface {
	// Get the OpenAPI schema
	// (GET /api/openapi.yaml)
	GetOpenAPI(w http.ResponseWriter, r *http.Request)
	// Get all projects
	// (GET /api/project)
	GetProjects(w http.ResponseWriter, r *http.Request)
	// Create a new project
	// (POST /api/project)
	CreateProject(w http.ResponseWriter, r *http.Request)
	// Get a project
	// (GET /api/project/{projectId})
	GetProject(w http.ResponseWriter, r *http.Request, projectId openapi_types.UUID)
	// Get all supervisors
	// (GET /api/project/{projectId}/supervisor)
	GetSupervisors(w http.ResponseWriter, r *http.Request, projectId openapi_types.UUID)
	// Create a new supervisor
	// (POST /api/project/{projectId}/supervisor)
	CreateSupervisor(w http.ResponseWriter, r *http.Request, projectId openapi_types.UUID)
	// Get all tasks for a project
	// (GET /api/project/{projectId}/tasks)
	GetProjectTasks(w http.ResponseWriter, r *http.Request, projectId openapi_types.UUID)
	// Create a new task
	// (POST /api/project/{projectId}/tasks)
	CreateTask(w http.ResponseWriter, r *http.Request, projectId openapi_types.UUID)
	// Get all tools for a project
	// (GET /api/project/{projectId}/tools)
	GetProjectTools(w http.ResponseWriter, r *http.Request, projectId openapi_types.UUID)
	// Get a request group
	// (GET /api/request_group/{requestGroupId})
	GetRequestGroup(w http.ResponseWriter, r *http.Request, requestGroupId openapi_types.UUID)
	// Create a supervision request for a supervisor in a chain on a request group
	// (POST /api/request_group/{requestGroupId}/chain/{chainId}/supervisor/{supervisorId}/supervision_request)
	CreateSupervisionRequest(w http.ResponseWriter, r *http.Request, requestGroupId openapi_types.UUID, chainId openapi_types.UUID, supervisorId openapi_types.UUID)
	// Get a request group status
	// (GET /api/request_group/{requestGroupId}/status)
	GetRequestGroupStatus(w http.ResponseWriter, r *http.Request, requestGroupId openapi_types.UUID)
	// Create a new tool request for a request group
	// (POST /api/request_group/{requestGroupId}/tool_requests)
	CreateToolRequest(w http.ResponseWriter, r *http.Request, requestGroupId openapi_types.UUID)
	// Get all request groups for a run
	// (GET /api/run/{runId}/request_groups)
	GetRunRequestGroups(w http.ResponseWriter, r *http.Request, runId openapi_types.UUID)
	// Update a run with a result
	// (PUT /api/run/{runId}/result)
	UpdateRunResult(w http.ResponseWriter, r *http.Request, runId openapi_types.UUID)
	// Get the state of a run
	// (GET /api/run/{runId}/state)
	GetRunState(w http.ResponseWriter, r *http.Request, runId openapi_types.UUID)
	// Get the status of a run
	// (GET /api/run/{runId}/status)
	GetRunStatus(w http.ResponseWriter, r *http.Request, runId openapi_types.UUID)
	// Update the status of a run
	// (PUT /api/run/{runId}/status)
	UpdateRunStatus(w http.ResponseWriter, r *http.Request, runId openapi_types.UUID)
	// Get all tools for a run
	// (GET /api/run/{runId}/tool)
	GetRunTools(w http.ResponseWriter, r *http.Request, runId openapi_types.UUID)
	// Create a new tool for a run
	// (POST /api/run/{runId}/tool)
	CreateRunTool(w http.ResponseWriter, r *http.Request, runId openapi_types.UUID)
	// Get hub stats
	// (GET /api/stats)
	GetHubStats(w http.ResponseWriter, r *http.Request)
	// Get a supervision result
	// (GET /api/supervision_request/{supervisionRequestId}/result)
	GetSupervisionResult(w http.ResponseWriter, r *http.Request, supervisionRequestId openapi_types.UUID)
	// Create a supervision result for a supervision request
	// (POST /api/supervision_request/{supervisionRequestId}/result)
	CreateSupervisionResult(w http.ResponseWriter, r *http.Request, supervisionRequestId openapi_types.UUID)
	// Get the review payload for a supervision request
	// (GET /api/supervision_request/{supervisionRequestId}/review_payload)
	GetSupervisionReviewPayload(w http.ResponseWriter, r *http.Request, supervisionRequestId openapi_types.UUID)
	// Get a supervision request status
	// (GET /api/supervision_request/{supervisionRequestId}/status)
	GetSupervisionRequestStatus(w http.ResponseWriter, r *http.Request, supervisionRequestId openapi_types.UUID)
	// Get a supervisor
	// (GET /api/supervisor/{supervisorId})
	GetSupervisor(w http.ResponseWriter, r *http.Request, supervisorId openapi_types.UUID)
	// Get the Swagger UI
	// (GET /api/swagger-ui)
	GetSwaggerDocs(w http.ResponseWriter, r *http.Request)
	// Get a task
	// (GET /api/task/{taskId})
	GetTask(w http.ResponseWriter, r *http.Request, taskId openapi_types.UUID)
	// Get all runs for a task
	// (GET /api/task/{taskId}/run)
	GetTaskRuns(w http.ResponseWriter, r *http.Request, taskId openapi_types.UUID)
	// Create a new run for a task
	// (POST /api/task/{taskId}/run)
	CreateRun(w http.ResponseWriter, r *http.Request, taskId openapi_types.UUID)
	// Get a tool
	// (GET /api/tool/{toolId})
	GetTool(w http.ResponseWriter, r *http.Request, toolId openapi_types.UUID)
	// Create a new request group for a tool
	// (POST /api/tool/{toolId}/request_group)
	CreateToolRequestGroup(w http.ResponseWriter, r *http.Request, toolId openapi_types.UUID)
	// Get all supervisors for a tool, in chain format
	// (GET /api/tool/{toolId}/supervisors)
	GetToolSupervisorChains(w http.ResponseWriter, r *http.Request, toolId openapi_types.UUID)
	// Create new chains with supervisors for a tool
	// (POST /api/tool/{toolId}/supervisors)
	CreateToolSupervisorChains(w http.ResponseWriter, r *http.Request, toolId openapi_types.UUID)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateProject

func (siw *ServerInterfaceWrapper) CreateProject(w http.ResponseWriter, r *http.Request)

CreateProject operation middleware

func (*ServerInterfaceWrapper) CreateRun

func (siw *ServerInterfaceWrapper) CreateRun(w http.ResponseWriter, r *http.Request)

CreateRun operation middleware

func (*ServerInterfaceWrapper) CreateRunTool

func (siw *ServerInterfaceWrapper) CreateRunTool(w http.ResponseWriter, r *http.Request)

CreateRunTool operation middleware

func (*ServerInterfaceWrapper) CreateSupervisionRequest

func (siw *ServerInterfaceWrapper) CreateSupervisionRequest(w http.ResponseWriter, r *http.Request)

CreateSupervisionRequest operation middleware

func (*ServerInterfaceWrapper) CreateSupervisionResult

func (siw *ServerInterfaceWrapper) CreateSupervisionResult(w http.ResponseWriter, r *http.Request)

CreateSupervisionResult operation middleware

func (*ServerInterfaceWrapper) CreateSupervisor

func (siw *ServerInterfaceWrapper) CreateSupervisor(w http.ResponseWriter, r *http.Request)

CreateSupervisor operation middleware

func (*ServerInterfaceWrapper) CreateTask

func (siw *ServerInterfaceWrapper) CreateTask(w http.ResponseWriter, r *http.Request)

CreateTask operation middleware

func (*ServerInterfaceWrapper) CreateToolRequest

func (siw *ServerInterfaceWrapper) CreateToolRequest(w http.ResponseWriter, r *http.Request)

CreateToolRequest operation middleware

func (*ServerInterfaceWrapper) CreateToolRequestGroup

func (siw *ServerInterfaceWrapper) CreateToolRequestGroup(w http.ResponseWriter, r *http.Request)

CreateToolRequestGroup operation middleware

func (*ServerInterfaceWrapper) CreateToolSupervisorChains

func (siw *ServerInterfaceWrapper) CreateToolSupervisorChains(w http.ResponseWriter, r *http.Request)

CreateToolSupervisorChains operation middleware

func (*ServerInterfaceWrapper) GetHubStats

func (siw *ServerInterfaceWrapper) GetHubStats(w http.ResponseWriter, r *http.Request)

GetHubStats operation middleware

func (*ServerInterfaceWrapper) GetOpenAPI

func (siw *ServerInterfaceWrapper) GetOpenAPI(w http.ResponseWriter, r *http.Request)

GetOpenAPI operation middleware

func (*ServerInterfaceWrapper) GetProject

func (siw *ServerInterfaceWrapper) GetProject(w http.ResponseWriter, r *http.Request)

GetProject operation middleware

func (*ServerInterfaceWrapper) GetProjectTasks

func (siw *ServerInterfaceWrapper) GetProjectTasks(w http.ResponseWriter, r *http.Request)

GetProjectTasks operation middleware

func (*ServerInterfaceWrapper) GetProjectTools

func (siw *ServerInterfaceWrapper) GetProjectTools(w http.ResponseWriter, r *http.Request)

GetProjectTools operation middleware

func (*ServerInterfaceWrapper) GetProjects

func (siw *ServerInterfaceWrapper) GetProjects(w http.ResponseWriter, r *http.Request)

GetProjects operation middleware

func (*ServerInterfaceWrapper) GetRequestGroup

func (siw *ServerInterfaceWrapper) GetRequestGroup(w http.ResponseWriter, r *http.Request)

GetRequestGroup operation middleware

func (*ServerInterfaceWrapper) GetRequestGroupStatus

func (siw *ServerInterfaceWrapper) GetRequestGroupStatus(w http.ResponseWriter, r *http.Request)

GetRequestGroupStatus operation middleware

func (*ServerInterfaceWrapper) GetRunRequestGroups

func (siw *ServerInterfaceWrapper) GetRunRequestGroups(w http.ResponseWriter, r *http.Request)

GetRunRequestGroups operation middleware

func (*ServerInterfaceWrapper) GetRunState

func (siw *ServerInterfaceWrapper) GetRunState(w http.ResponseWriter, r *http.Request)

GetRunState operation middleware

func (*ServerInterfaceWrapper) GetRunStatus

func (siw *ServerInterfaceWrapper) GetRunStatus(w http.ResponseWriter, r *http.Request)

GetRunStatus operation middleware

func (*ServerInterfaceWrapper) GetRunTools

func (siw *ServerInterfaceWrapper) GetRunTools(w http.ResponseWriter, r *http.Request)

GetRunTools operation middleware

func (*ServerInterfaceWrapper) GetSupervisionRequestStatus

func (siw *ServerInterfaceWrapper) GetSupervisionRequestStatus(w http.ResponseWriter, r *http.Request)

GetSupervisionRequestStatus operation middleware

func (*ServerInterfaceWrapper) GetSupervisionResult

func (siw *ServerInterfaceWrapper) GetSupervisionResult(w http.ResponseWriter, r *http.Request)

GetSupervisionResult operation middleware

func (*ServerInterfaceWrapper) GetSupervisionReviewPayload

func (siw *ServerInterfaceWrapper) GetSupervisionReviewPayload(w http.ResponseWriter, r *http.Request)

GetSupervisionReviewPayload operation middleware

func (*ServerInterfaceWrapper) GetSupervisor

func (siw *ServerInterfaceWrapper) GetSupervisor(w http.ResponseWriter, r *http.Request)

GetSupervisor operation middleware

func (*ServerInterfaceWrapper) GetSupervisors

func (siw *ServerInterfaceWrapper) GetSupervisors(w http.ResponseWriter, r *http.Request)

GetSupervisors operation middleware

func (*ServerInterfaceWrapper) GetSwaggerDocs

func (siw *ServerInterfaceWrapper) GetSwaggerDocs(w http.ResponseWriter, r *http.Request)

GetSwaggerDocs operation middleware

func (*ServerInterfaceWrapper) GetTask

GetTask operation middleware

func (*ServerInterfaceWrapper) GetTaskRuns

func (siw *ServerInterfaceWrapper) GetTaskRuns(w http.ResponseWriter, r *http.Request)

GetTaskRuns operation middleware

func (*ServerInterfaceWrapper) GetTool

GetTool operation middleware

func (*ServerInterfaceWrapper) GetToolSupervisorChains

func (siw *ServerInterfaceWrapper) GetToolSupervisorChains(w http.ResponseWriter, r *http.Request)

GetToolSupervisorChains operation middleware

func (*ServerInterfaceWrapper) UpdateRunResult

func (siw *ServerInterfaceWrapper) UpdateRunResult(w http.ResponseWriter, r *http.Request)

UpdateRunResult operation middleware

func (*ServerInterfaceWrapper) UpdateRunStatus

func (siw *ServerInterfaceWrapper) UpdateRunStatus(w http.ResponseWriter, r *http.Request)

UpdateRunStatus operation middleware

type StateMessage

type StateMessage struct {
	Content    string      `json:"content"`
	Function   *string     `json:"function,omitempty"`
	Role       string      `json:"role"`
	Source     *string     `json:"source,omitempty"`
	ToolCallId *string     `json:"tool_call_id,omitempty"`
	ToolCalls  *[]ToolCall `json:"tool_calls,omitempty"`
}

StateMessage defines model for StateMessage.

type Status

type Status string

Status defines model for Status.

const (
	Assigned  Status = "assigned"
	Completed Status = "completed"
	Failed    Status = "failed"
	Pending   Status = "pending"
	Timeout   Status = "timeout"
)

Defines values for Status.

type StdHTTPServerOptions

type StdHTTPServerOptions struct {
	BaseURL          string
	BaseRouter       ServeMux
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type Store

Store defines the interface for all storage operations

type SupervisionRequest

type SupervisionRequest struct {
	ChainexecutionId *openapi_types.UUID `json:"chainexecution_id,omitempty"`
	Id               *openapi_types.UUID `json:"id,omitempty"`
	PositionInChain  int                 `json:"position_in_chain"`
	Status           *SupervisionStatus  `json:"status,omitempty"`
	SupervisorId     openapi_types.UUID  `json:"supervisor_id"`
}

SupervisionRequest defines model for SupervisionRequest.

type SupervisionRequestState

type SupervisionRequestState struct {
	Result             *SupervisionResult `json:"result,omitempty"`
	Status             SupervisionStatus  `json:"status"`
	SupervisionRequest SupervisionRequest `json:"supervision_request"`
}

SupervisionRequestState defines model for SupervisionRequestState.

type SupervisionResult

type SupervisionResult struct {
	ChosenToolrequestId  *openapi_types.UUID `json:"chosen_toolrequest_id,omitempty"`
	CreatedAt            time.Time           `json:"created_at"`
	Decision             Decision            `json:"decision"`
	Id                   *openapi_types.UUID `json:"id,omitempty"`
	Reasoning            string              `json:"reasoning"`
	SupervisionRequestId openapi_types.UUID  `json:"supervision_request_id"`
}

SupervisionResult defines model for SupervisionResult.

type SupervisionStatus

type SupervisionStatus struct {
	CreatedAt            time.Time           `json:"created_at"`
	Id                   int                 `json:"id"`
	Status               Status              `json:"status"`
	SupervisionRequestId *openapi_types.UUID `json:"supervision_request_id,omitempty"`
}

SupervisionStatus defines model for SupervisionStatus.

type SupervisionStore

type SupervisionStore interface {
	// Requests
	CreateSupervisionRequest(ctx context.Context, request SupervisionRequest, chainId uuid.UUID, requestGroupId uuid.UUID) (*uuid.UUID, error)
	GetSupervisionRequest(ctx context.Context, id uuid.UUID) (*SupervisionRequest, error)
	GetSupervisionRequestsForStatus(ctx context.Context, status Status) ([]SupervisionRequest, error)

	// Results
	GetSupervisionResultFromRequestID(ctx context.Context, requestId uuid.UUID) (*SupervisionResult, error)
	CreateSupervisionResult(ctx context.Context, result SupervisionResult, requestId uuid.UUID) (*uuid.UUID, error)

	// Statuses
	CreateSupervisionStatus(ctx context.Context, requestID uuid.UUID, status SupervisionStatus) error

	// Util
	CountSupervisionRequests(ctx context.Context, status Status) (int, error)

	GetChainExecutionSupervisionRequests(ctx context.Context, chainExecutionId uuid.UUID) ([]SupervisionRequest, error)
	GetSupervisionRequestStatus(ctx context.Context, requestId uuid.UUID) (*SupervisionStatus, error)

	GetExecutionFromChainId(ctx context.Context, chainId uuid.UUID) (*uuid.UUID, error)
	GetChainExecution(ctx context.Context, executionId uuid.UUID) (*uuid.UUID, *uuid.UUID, error)
	GetChainExecutionFromChainAndRequestGroup(ctx context.Context, chainId uuid.UUID, requestGroupId uuid.UUID) (*uuid.UUID, error)
	GetChainExecutionsFromRequestGroup(ctx context.Context, id uuid.UUID) ([]uuid.UUID, error)
	GetChainExecutionState(ctx context.Context, executionId uuid.UUID) (*ChainExecutionState, error)
}

type Supervisor

type Supervisor struct {
	Attributes  map[string]interface{} `json:"attributes"`
	Code        string                 `json:"code"`
	CreatedAt   time.Time              `json:"created_at"`
	Description string                 `json:"description"`
	Id          *openapi_types.UUID    `json:"id,omitempty"`
	Name        string                 `json:"name"`

	// Type The type of supervisor. ClientSupervisor means that the supervision is done client side and the server is merely informed. Other supervisor types are handled serverside, e.g. HumanSupervisor means that a human will review the request via the Sentinel UI.
	Type SupervisorType `json:"type"`
}

Supervisor defines model for Supervisor.

type SupervisorChain

type SupervisorChain struct {
	ChainId     openapi_types.UUID `json:"chain_id"`
	Supervisors []Supervisor       `json:"supervisors"`
}

SupervisorChain defines model for SupervisorChain.

type SupervisorStore

type SupervisorStore interface {
	CreateSupervisor(ctx context.Context, supervisor Supervisor) (uuid.UUID, error)
	GetSupervisor(ctx context.Context, id uuid.UUID) (*Supervisor, error)
	GetSupervisorFromValues(ctx context.Context, code string, name string, desc string, t SupervisorType, attributes map[string]interface{}) (*Supervisor, error)
	GetSupervisors(ctx context.Context, projectId uuid.UUID) ([]Supervisor, error)
	CreateSupervisorChain(ctx context.Context, toolId uuid.UUID, chain ChainRequest) (*uuid.UUID, error)
	GetSupervisorChains(ctx context.Context, toolId uuid.UUID) ([]SupervisorChain, error)
	GetSupervisorChain(ctx context.Context, id uuid.UUID) (*SupervisorChain, error)
}

type SupervisorType

type SupervisorType string

SupervisorType The type of supervisor. ClientSupervisor means that the supervision is done client side and the server is merely informed. Other supervisor types are handled serverside, e.g. HumanSupervisor means that a human will review the request via the Sentinel UI.

const (
	ClientSupervisor SupervisorType = "client_supervisor"
	HumanSupervisor  SupervisorType = "human_supervisor"
	NoSupervisor     SupervisorType = "no_supervisor"
)

Defines values for SupervisorType.

type Task

type Task struct {
	CreatedAt   time.Time          `json:"created_at"`
	Description *string            `json:"description,omitempty"`
	Id          openapi_types.UUID `json:"id"`
	Name        string             `json:"name"`
	ProjectId   openapi_types.UUID `json:"project_id"`
}

Task defines model for Task.

type TaskState

type TaskState struct {
	Completed  bool                    `json:"completed"`
	Messages   []StateMessage          `json:"messages"`
	Metadata   *map[string]interface{} `json:"metadata,omitempty"`
	Output     Output                  `json:"output"`
	Store      *map[string]interface{} `json:"store,omitempty"`
	ToolChoice *ToolChoice             `json:"tool_choice,omitempty"`
	Tools      []Tool                  `json:"tools"`
}

TaskState defines model for TaskState.

type TaskStore

type TaskStore interface {
	CreateTask(ctx context.Context, task Task) (*uuid.UUID, error)
	GetTask(ctx context.Context, id uuid.UUID) (*Task, error)
	GetProjectTasks(ctx context.Context, projectId uuid.UUID) ([]Task, error)
}

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type Tool

type Tool struct {
	Attributes        map[string]interface{} `json:"attributes"`
	Code              string                 `json:"code"`
	Description       string                 `json:"description"`
	Id                *openapi_types.UUID    `json:"id,omitempty"`
	IgnoredAttributes *[]string              `json:"ignored_attributes,omitempty"`
	Name              string                 `json:"name"`
	RunId             openapi_types.UUID     `json:"run_id"`
}

Tool defines model for Tool.

type ToolCall

type ToolCall struct {
	Arguments  map[string]interface{} `json:"arguments"`
	Function   string                 `json:"function"`
	Id         string                 `json:"id"`
	ParseError *string                `json:"parse_error,omitempty"`
	Type       string                 `json:"type"`
}

ToolCall defines model for ToolCall.

type ToolChoice

type ToolChoice struct {
	Arguments Arguments `json:"arguments"`
	Function  string    `json:"function"`
	Id        string    `json:"id"`
	Type      string    `json:"type"`
}

ToolChoice defines model for ToolChoice.

type ToolRequest

type ToolRequest struct {
	Arguments      Arguments           `json:"arguments"`
	Id             *openapi_types.UUID `json:"id,omitempty"`
	Message        Message             `json:"message"`
	RequestgroupId *openapi_types.UUID `json:"requestgroup_id,omitempty"`
	TaskState      TaskState           `json:"task_state"`
	ToolId         openapi_types.UUID  `json:"tool_id"`
}

ToolRequest defines model for ToolRequest.

type ToolRequestGroup

type ToolRequestGroup struct {
	CreatedAt    *time.Time          `json:"created_at,omitempty"`
	Id           *openapi_types.UUID `json:"id,omitempty"`
	ToolRequests []ToolRequest       `json:"tool_requests"`
}

ToolRequestGroup defines model for ToolRequestGroup.

type ToolRequestStore

type ToolRequestStore interface {
	CreateToolRequestGroup(ctx context.Context, toolId uuid.UUID, request ToolRequestGroup) (*ToolRequestGroup, error)
	GetRunRequestGroups(ctx context.Context, runId uuid.UUID, includeArgs bool) ([]ToolRequestGroup, error)
	GetRequestGroup(ctx context.Context, id uuid.UUID, includeArgs bool) (*ToolRequestGroup, error)
	CreateToolRequest(ctx context.Context, requestGroupId uuid.UUID, request ToolRequest) (*uuid.UUID, error)
	GetToolRequest(ctx context.Context, id uuid.UUID) (*ToolRequest, error)
}

type ToolStore

type ToolStore interface {
	CreateTool(ctx context.Context, runId uuid.UUID, attributes map[string]interface{}, name string, description string, ignoredAttributes []string, code string) (uuid.UUID, error)
	GetTool(ctx context.Context, id uuid.UUID) (*Tool, error)
	// GetToolFromValues(ctx context.Context, attributes map[string]interface{}, name string, description string, ignoredAttributes []string) (*Tool, error)
	GetRunTools(ctx context.Context, id uuid.UUID) ([]Tool, error)
	GetProjectTools(ctx context.Context, id uuid.UUID) ([]Tool, error)
}

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UpdateRunResultJSONBody

type UpdateRunResultJSONBody struct {
	Result *string `json:"result,omitempty"`
}

UpdateRunResultJSONBody defines parameters for UpdateRunResult.

type UpdateRunResultJSONRequestBody

type UpdateRunResultJSONRequestBody UpdateRunResultJSONBody

UpdateRunResultJSONRequestBody defines body for UpdateRunResult for application/json ContentType.

type UpdateRunStatusJSONRequestBody

type UpdateRunStatusJSONRequestBody = Status

UpdateRunStatusJSONRequestBody defines body for UpdateRunStatus for application/json ContentType.

type Usage

type Usage struct {
	InputTokens  int `json:"input_tokens"`
	OutputTokens int `json:"output_tokens"`
	TotalTokens  int `json:"total_tokens"`
}

Usage defines model for Usage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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