database

package
v0.0.0-...-ae74f89 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresqlStore

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

func NewPostgresqlStore

func NewPostgresqlStore() (*PostgresqlStore, error)

NewPostgresqlStore creates a new PostgreSQL store

func (*PostgresqlStore) Close

func (s *PostgresqlStore) Close() error

Close closes the database connection

func (*PostgresqlStore) CountSupervisionRequests

func (s *PostgresqlStore) CountSupervisionRequests(ctx context.Context, status asteroid.Status) (int, error)

func (*PostgresqlStore) CreateChatRequest

func (s *PostgresqlStore) CreateChatRequest(
	ctx context.Context,
	runId uuid.UUID,
	request []byte,
	response []byte,
	choices []asteroid.AsteroidChoice,
	format string,
	requestMessages []asteroid.AsteroidMessage,
) (*uuid.UUID, error)

func (*PostgresqlStore) CreateProject

func (s *PostgresqlStore) CreateProject(ctx context.Context, project asteroid.Project) error

ProjectStore implementation

func (*PostgresqlStore) CreateRun

func (s *PostgresqlStore) CreateRun(ctx context.Context, run asteroid.Run) (uuid.UUID, error)

func (*PostgresqlStore) CreateSupervisionRequest

func (s *PostgresqlStore) CreateSupervisionRequest(
	ctx context.Context,
	request asteroid.SupervisionRequest,
	chainId uuid.UUID,
	toolCallId uuid.UUID,
) (*uuid.UUID, error)

func (*PostgresqlStore) CreateSupervisionResult

func (s *PostgresqlStore) CreateSupervisionResult(ctx context.Context, result asteroid.SupervisionResult, requestId uuid.UUID) (*uuid.UUID, error)

func (*PostgresqlStore) CreateSupervisionStatus

func (s *PostgresqlStore) CreateSupervisionStatus(ctx context.Context, requestID uuid.UUID, status asteroid.SupervisionStatus) error

func (*PostgresqlStore) CreateSupervisor

func (s *PostgresqlStore) CreateSupervisor(ctx context.Context, supervisor asteroid.Supervisor) (uuid.UUID, error)

func (*PostgresqlStore) CreateSupervisorChain

func (s *PostgresqlStore) CreateSupervisorChain(ctx context.Context, toolId uuid.UUID, chain asteroid.ChainRequest) (*uuid.UUID, error)

func (*PostgresqlStore) CreateTask

func (s *PostgresqlStore) CreateTask(ctx context.Context, task asteroid.Task) (*uuid.UUID, error)

func (*PostgresqlStore) CreateTool

func (s *PostgresqlStore) CreateTool(
	ctx context.Context,
	runId uuid.UUID,
	attributes map[string]interface{},
	name string,
	description string,
	ignoredAttributes []string,
	code string,
) (*asteroid.Tool, error)

func (*PostgresqlStore) GetChainExecution

func (s *PostgresqlStore) GetChainExecution(ctx context.Context, executionId uuid.UUID) (*uuid.UUID, *uuid.UUID, error)

func (*PostgresqlStore) GetChainExecutionFromChainAndToolCall

func (s *PostgresqlStore) GetChainExecutionFromChainAndToolCall(ctx context.Context, chainId uuid.UUID, toolCallId uuid.UUID) (*uuid.UUID, error)

GetChainExecutionFromChainAndToolCall gets the chain execution ID for a given chain ID and tool call ID

func (*PostgresqlStore) GetChainExecutionState

func (s *PostgresqlStore) GetChainExecutionState(ctx context.Context, executionId uuid.UUID) (*asteroid.ChainExecutionState, error)

GetChainExecutionState returns the chain state for a given chain execution ID

func (*PostgresqlStore) GetChainExecutionSupervisionRequests

func (s *PostgresqlStore) GetChainExecutionSupervisionRequests(ctx context.Context, chainExecutionId uuid.UUID) ([]asteroid.SupervisionRequest, error)

GetChainExecutionSupervisionRequests gets all supervision requests for a specific chain execution

func (*PostgresqlStore) GetChainExecutionsFromToolCall

func (s *PostgresqlStore) GetChainExecutionsFromToolCall(ctx context.Context, id uuid.UUID) ([]uuid.UUID, error)

func (*PostgresqlStore) GetChat

func (s *PostgresqlStore) GetChat(
	ctx context.Context,
	runId uuid.UUID,
	index int,
) ([]byte, []byte, error)

func (*PostgresqlStore) GetExecutionFromChainId

func (s *PostgresqlStore) GetExecutionFromChainId(ctx context.Context, chainId uuid.UUID) (*uuid.UUID, error)

func (*PostgresqlStore) GetMessage

func (*PostgresqlStore) GetProject

func (s *PostgresqlStore) GetProject(ctx context.Context, id uuid.UUID) (*asteroid.Project, error)

func (*PostgresqlStore) GetProjectFromName

func (s *PostgresqlStore) GetProjectFromName(ctx context.Context, name string) (*asteroid.Project, error)

func (*PostgresqlStore) GetProjectTasks

func (s *PostgresqlStore) GetProjectTasks(ctx context.Context, projectId uuid.UUID) ([]asteroid.Task, error)

func (*PostgresqlStore) GetProjectTools

func (s *PostgresqlStore) GetProjectTools(ctx context.Context, projectId uuid.UUID) ([]asteroid.Tool, error)

func (*PostgresqlStore) GetProjects

func (s *PostgresqlStore) GetProjects(ctx context.Context) ([]asteroid.Project, error)

func (*PostgresqlStore) GetRun

func (s *PostgresqlStore) GetRun(ctx context.Context, id uuid.UUID) (*asteroid.Run, error)

func (*PostgresqlStore) GetRunChatCount

func (s *PostgresqlStore) GetRunChatCount(ctx context.Context, runId uuid.UUID) (int, error)

func (*PostgresqlStore) GetRunTools

func (s *PostgresqlStore) GetRunTools(ctx context.Context, runId uuid.UUID) ([]asteroid.Tool, error)

func (*PostgresqlStore) GetRuns

func (s *PostgresqlStore) GetRuns(ctx context.Context, taskId uuid.UUID) ([]asteroid.Run, error)

func (*PostgresqlStore) GetSupervisionRequest

func (s *PostgresqlStore) GetSupervisionRequest(ctx context.Context, id uuid.UUID) (*asteroid.SupervisionRequest, error)

func (*PostgresqlStore) GetSupervisionRequestStatus

func (s *PostgresqlStore) GetSupervisionRequestStatus(ctx context.Context, requestId uuid.UUID) (*asteroid.SupervisionStatus, error)

GetSupervisionRequestStatus gets the latest status for a supervision request

func (*PostgresqlStore) GetSupervisionRequestsForStatus

func (s *PostgresqlStore) GetSupervisionRequestsForStatus(ctx context.Context, status asteroid.Status) ([]asteroid.SupervisionRequest, error)

func (*PostgresqlStore) GetSupervisionResultFromRequestID

func (s *PostgresqlStore) GetSupervisionResultFromRequestID(ctx context.Context, requestId uuid.UUID) (*asteroid.SupervisionResult, error)

func (*PostgresqlStore) GetSupervisionResultsForChainExecution

func (s *PostgresqlStore) GetSupervisionResultsForChainExecution(ctx context.Context, executionId uuid.UUID) ([]asteroid.SupervisionResult, error)

func (*PostgresqlStore) GetSupervisionStatusesForChainExecution

func (s *PostgresqlStore) GetSupervisionStatusesForChainExecution(ctx context.Context, executionId uuid.UUID) ([]asteroid.SupervisionStatus, error)

func (*PostgresqlStore) GetSupervisionStatusesForRequest

func (s *PostgresqlStore) GetSupervisionStatusesForRequest(ctx context.Context, requestId uuid.UUID) ([]asteroid.SupervisionStatus, error)

func (*PostgresqlStore) GetSupervisor

func (s *PostgresqlStore) GetSupervisor(ctx context.Context, id uuid.UUID) (*asteroid.Supervisor, error)

func (*PostgresqlStore) GetSupervisorChain

func (s *PostgresqlStore) GetSupervisorChain(ctx context.Context, chainId uuid.UUID) (*asteroid.SupervisorChain, error)

func (*PostgresqlStore) GetSupervisorChains

func (s *PostgresqlStore) GetSupervisorChains(ctx context.Context, toolId uuid.UUID) ([]asteroid.SupervisorChain, error)

func (*PostgresqlStore) GetSupervisorFromValues

func (s *PostgresqlStore) GetSupervisorFromValues(
	ctx context.Context,
	code string,
	name string,
	desc string,
	t asteroid.SupervisorType,
	attributes map[string]interface{},
) (*asteroid.Supervisor, error)

func (*PostgresqlStore) GetSupervisors

func (s *PostgresqlStore) GetSupervisors(ctx context.Context, projectId uuid.UUID) ([]asteroid.Supervisor, error)

func (*PostgresqlStore) GetTask

func (s *PostgresqlStore) GetTask(ctx context.Context, id uuid.UUID) (*asteroid.Task, error)

func (*PostgresqlStore) GetTaskRuns

func (s *PostgresqlStore) GetTaskRuns(ctx context.Context, taskId uuid.UUID) ([]asteroid.Run, error)

func (*PostgresqlStore) GetTool

func (s *PostgresqlStore) GetTool(ctx context.Context, id uuid.UUID) (*asteroid.Tool, error)

func (*PostgresqlStore) GetToolCall

func (s *PostgresqlStore) GetToolCall(ctx context.Context, id uuid.UUID) (*asteroid.AsteroidToolCall, error)

func (*PostgresqlStore) GetToolCallFromCallId

func (s *PostgresqlStore) GetToolCallFromCallId(ctx context.Context, id string) (*asteroid.AsteroidToolCall, error)

func (*PostgresqlStore) GetToolFromNameAndRunId

func (s *PostgresqlStore) GetToolFromNameAndRunId(ctx context.Context, name string, runId uuid.UUID) (*asteroid.Tool, error)

func (*PostgresqlStore) GetToolFromValues

func (s *PostgresqlStore) GetToolFromValues(ctx context.Context, attributes map[string]interface{}, name string, description string, ignoredAttributes []string, code string) (*asteroid.Tool, error)

func (*PostgresqlStore) UpdateMessage

func (s *PostgresqlStore) UpdateMessage(ctx context.Context, id uuid.UUID, message asteroid.AsteroidMessage) error

func (*PostgresqlStore) UpdateRunResult

func (s *PostgresqlStore) UpdateRunResult(ctx context.Context, runId uuid.UUID, result string) error

func (*PostgresqlStore) UpdateRunStatus

func (s *PostgresqlStore) UpdateRunStatus(ctx context.Context, runId uuid.UUID, status asteroid.Status) error

Jump to

Keyboard shortcuts

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