sorbet

package
v0.0.0-...-7bf56e6 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package sorbet implements analysis for test changepoint culprits.

Index

Constants

View Source
const (
	// The maximum number of CL suspects to analyse.
	MaxSuspectCLs = 50
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalysisRequest

type AnalysisRequest struct {
	// The LUCI Project.
	Project string
	// The identifier of the test.
	TestID              string
	VariantHash         string
	RefHash             testvariantbranch.RefHash
	StartSourcePosition int64
	// The realms the user is allowed to query test results for in the project.
	AllowedRealms []string
}

type AnalysisResponse

type AnalysisResponse struct {
	// The response.
	Response string
	// The prompt used to generate the response.
	Prompt string
}

type Analyzer

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

Analyzer provides analysis on the possible culprits of a changepoint.

func NewAnalyzer

func NewAnalyzer(gc GenerateClient, tvc TestVerdictClient) *Analyzer

NewAnalyzer initialises a new Analyzer.

func (*Analyzer) Analyze

func (a *Analyzer) Analyze(ctx context.Context, request AnalysisRequest) (AnalysisResponse, error)

Analyze generates an analysis of the possible culprits for a given changepoint. It returns appstatus-annotated errors for client errors.

type Client

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

func NewClient

func NewClient(ctx context.Context, gcpProject string) (*Client, error)

func (*Client) Generate

func (c *Client) Generate(ctx context.Context, prompt string) (GenerateResponse, error)

Generate generates a response for the given prompt.

type FakeClient

type FakeClient struct {
	// Response is the response provided to Generate requests.
	Response GenerateResponse
}

func NewFakeClient

func NewFakeClient() *FakeClient

func (*FakeClient) Generate

func (c *FakeClient) Generate(ctx context.Context, prompt string) (GenerateResponse, error)

Generate generates a response for the given prompt.

type GenerateClient

type GenerateClient interface {
	Generate(ctx context.Context, prompt string) (GenerateResponse, error)
}

GenerateClient represents the interface used to generate analysis from a prompt.

type GenerateResponse

type GenerateResponse struct {
	// The generated response.
	Candidate string
	// If the response is blocked, the reason why. Set if Candidate is empty.
	BlockReason string
}

type TestVerdictClient

type TestVerdictClient interface {
	ReadTestVerdictAfterPosition(ctx context.Context, options testverdicts.ReadVerdictAtOrAfterPositionOptions) (*testverdicts.SourceVerdict, error)
}

TestVerdictClient provides access to test verdicts.

Jump to

Keyboard shortcuts

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