Documentation
¶
Index ¶
- Variables
- type Amount
- type CampaignCheck
- type Caps
- type FenceCheck
- type Lease
- type Limit
- type Quote
- type Reservation
- type Route
- type Scope
- type ScopeSnapshot
- type Service
- func (s *Service) CancelTx(ctx context.Context, tx pgx.Tx, org, id, unusedEvidence string) (Reservation, error)
- func (s *Service) CheckTx(ctx context.Context, tx pgx.Tx, l Lease, id string) (Reservation, error)
- func (s *Service) ConnectionHeadroomTx(ctx context.Context, tx pgx.Tx, org, connection string) error
- func (s *Service) Get(ctx context.Context, session auth.Session, org, id string) (Reservation, error)
- func (s *Service) GetLimit(ctx context.Context, session auth.Session, org string, scope Scope) (Limit, error)
- func (s *Service) GetRoute(ctx context.Context, session auth.Session, ...) (Route, error)
- func (s *Service) HeadroomTx(ctx context.Context, tx pgx.Tx, org string) error
- func (s *Service) MarkDispatchedTx(ctx context.Context, tx pgx.Tx, l Lease, id string) (Reservation, error)
- func (s *Service) MarkUnknownTx(ctx context.Context, tx pgx.Tx, org, id, reference string) (Reservation, error)
- func (s *Service) PutLimit(ctx context.Context, session auth.Session, org string, input Limit, ...) (Limit, error)
- func (s *Service) PutRoute(ctx context.Context, session auth.Session, org string, input Route, ...) (Route, error)
- func (s *Service) QualifyRouteTx(ctx context.Context, tx pgx.Tx, org, connection, model, route string, ...) (Route, error)
- func (s *Service) ReserveTx(ctx context.Context, tx pgx.Tx, l Lease, q Quote) (Reservation, error)
- func (s *Service) RouteTx(ctx context.Context, tx pgx.Tx, org, connection, model, route string) (Route, error)
- func (s *Service) SettleTx(ctx context.Context, tx pgx.Tx, org, id string, settlement Settlement) (Reservation, error)
- func (s *Service) SettleUnknownAtMaximumTx(ctx context.Context, tx pgx.Tx, org, id, reference string) error
- type Settlement
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Amount ¶
type Lease ¶
type Lease struct {
OrgID string `json:"org_id"`
RepositoryID string `json:"repository_id"`
TaskID string `json:"task_id"`
JobID string `json:"job_id"`
AttemptID string `json:"attempt_id"`
OperationID string `json:"operation_id"`
WorkerID string `json:"worker_id"`
Fence int64 `json:"fence"`
PolicyHash string `json:"policy_hash"`
ExpiresAt time.Time `json:"expires_at"`
}
type Quote ¶
type Quote struct {
OperationID string `json:"operation_id"`
Model string `json:"model"`
Route string `json:"route"`
RouteVersion int64 `json:"route_version"`
InputTokens int64 `json:"input_tokens"`
MaxOutputTokens int64 `json:"max_output_tokens"`
MaxMilliseconds int64 `json:"max_milliseconds"`
MaxRequests int64 `json:"max_requests"`
}
type Reservation ¶
type Reservation struct {
ID string `json:"id"`
Lease Lease `json:"lease"`
Quote Quote `json:"quote"`
ConnectionID string `json:"connection_id"`
ConnectionVersion int64 `json:"connection_version"`
CampaignID string `json:"campaign_id,omitempty"`
Route Route `json:"route"`
Scopes []ScopeSnapshot `json:"scopes"`
Maximum Amount `json:"maximum"`
Actual *Amount `json:"actual,omitempty"`
Debt Amount `json:"debt"`
State string `json:"state"`
Reference string `json:"reference,omitempty"`
CreatedAt time.Time `json:"created_at"`
DispatchedAt *time.Time `json:"dispatched_at,omitempty"`
}
type Route ¶
type Route struct {
ConnectionID string `json:"connection_id"`
Model string `json:"model"`
Name string `json:"name"`
Mode string `json:"mode"`
PricingVersion string `json:"pricing_version"`
InputMicroUSDPerMillion int64 `json:"input_micro_usd_per_million"`
OutputMicroUSDPerMillion int64 `json:"output_micro_usd_per_million"`
RequestMicroUSD int64 `json:"request_micro_usd"`
MaxInputTokens int64 `json:"max_input_tokens"`
MaxOutputTokens int64 `json:"max_output_tokens"`
MaxMilliseconds int64 `json:"max_milliseconds"`
MaxRequests int64 `json:"max_requests"`
Qualified bool `json:"qualified"`
QualificationRef string `json:"qualification_ref"`
Paused bool `json:"paused"`
Version int64 `json:"version"`
}
type ScopeSnapshot ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(db *store.Store, identity *auth.Service, fence FenceCheck, campaign CampaignCheck) *Service
func (*Service) ConnectionHeadroomTx ¶
func (*Service) HeadroomTx ¶
func (*Service) MarkDispatchedTx ¶
func (*Service) MarkUnknownTx ¶
func (*Service) QualifyRouteTx ¶
type Settlement ¶
Click to show internal directories.
Click to hide internal directories.