provider

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Implement types for each resource

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountCredentialsFromMap

func AccountCredentialsFromMap(m map[string]any) (model.IntegrationCredentials, error)

AccountCredentialsFromMap TODO: converts a map to a configs.IntegrationCredentials.

func AdjustResource

func AdjustResource(job describe.DescribeJob, resource *model.Resource) error

AdjustResource TODO: Do any needed adjustment on resource object before storing

func DescribeListByCohereAI

func DescribeListByCohereAI(describe func(context.Context, *CohereAIAPIHandler, *model.StreamSender) ([]model.Resource, error)) model.ResourceDescriber

DescribeListByCohereAI A wrapper to pass cohereAI authorization to describer functions

func DescribeSingleByCohereAI

func DescribeSingleByCohereAI(describe func(context.Context, *CohereAIAPIHandler, string) (*model.Resource, error)) model.SingleResourceDescriber

DescribeSingleByCohereAI A wrapper to pass cohereAI authorization to describer functions

func GetAdditionalParameters

func GetAdditionalParameters(job describe.DescribeJob) (map[string]string, error)

GetAdditionalParameters TODO: pass additional parameters needed in describer wrappers in /provider/describer_wrapper.go

func GetResourceMetadata

func GetResourceMetadata(job describe.DescribeJob, resource model.Resource) (map[string]string, error)

GetResourceMetadata TODO: Get metadata as a map to add to the resources

Types

type BaseModel

type BaseModel struct {
	BaseType string `json:"base_type"`
	Name     string `json:"name"`
	Version  string `json:"version"`
	Strategy string `json:"strategy"`
}

type CohereAIAPIHandler

type CohereAIAPIHandler struct {
	Client       *http.Client
	APIKey       string
	RateLimiter  *rate.Limiter
	Semaphore    chan struct{}
	MaxRetries   int
	RetryBackoff time.Duration
	ClientName   string
}

func NewCohereAIAPIHandler

func NewCohereAIAPIHandler(APIKey string, rateLimit rate.Limit, burst int, maxConcurrency int, maxRetries int, retryBackoff time.Duration, clientName string) *CohereAIAPIHandler

func (*CohereAIAPIHandler) DoRequest

func (h *CohereAIAPIHandler) DoRequest(ctx context.Context, req *http.Request, requestFunc func(req *http.Request) (*http.Response, error)) error

DoRequest executes the openai API request with rate limiting, retries, and concurrency control.

type Connector

type Connector struct {
	ID                string    `json:"id"`
	Name              string    `json:"name"`
	CreatedAt         time.Time `json:"created_at"`
	UpdatedAt         time.Time `json:"updated_at"`
	OrganizationID    string    `json:"organization_id"`
	Description       string    `json:"description"`
	URL               string    `json:"url"`
	Excludes          []string  `json:"excludes"`
	AuthType          string    `json:"auth_type"`
	Oauth             Oauth     `json:"oauth"`
	AuthStatus        string    `json:"auth_status"`
	Active            bool      `json:"active"`
	ContinueOnFailure bool      `json:"continue_on_failure"`
}

type ConnectorDescription

type ConnectorDescription struct {
	Connectors []Connector `json:"connectors"`
	TotalCount float64     `json:"total_count"`
}

type ConnectorDetailResponse

type ConnectorDetailResponse struct {
	Connector Connector `json:"connector"`
}

type DatasetDescription

type DatasetDescription struct {
	ID                 string        `json:"id"`
	Name               string        `json:"name"`
	CreatedAt          time.Time     `json:"created_at"`
	UpdatedAt          time.Time     `json:"updated_at"`
	DatasetType        string        `json:"dataset_type"`
	ValidationStatus   string        `json:"validation_status"`
	ValidationError    string        `json:"validation_error"`
	Schema             string        `json:"schema"`
	RequiredFields     []string      `json:"required_fields"`
	PreserveFields     []string      `json:"preserve_fields"`
	DatasetParts       []DatasetPart `json:"dataset_parts"`
	ValidationWarnings []string      `json:"validation_warnings"`
	TotalUsage         float64       `json:"total_usage"`
}

type DatasetListResponse

type DatasetListResponse struct {
	Datasets []DatasetDescription `json:"datasets"`
}

type DatasetPart

type DatasetPart struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type EmbedJobDescription

type EmbedJobDescription struct {
	JobID           string    `json:"job_id"`
	Status          string    `json:"status"`
	CreatedAt       time.Time `json:"created_at"`
	InputDatasetID  string    `json:"input_dataset_id"`
	Model           string    `json:"model"`
	Truncate        string    `json:"truncate"`
	Name            string    `json:"name"`
	OutputDatasetID string    `json:"output_dataset_id"`
}

type FineTunedModelDescription

type FineTunedModelDescription struct {
	Name           string    `json:"name"`
	Settings       Settings  `json:"settings"`
	ID             string    `json:"id"`
	CreatorID      string    `json:"creator_id"`
	OrganizationID string    `json:"organization_id"`
	Status         string    `json:"status"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	CompletedAt    time.Time `json:"completed_at"`
	LastUsed       time.Time `json:"last_used"`
}

type Hyperparameters

type Hyperparameters struct {
	EarlyStoppingPatience  int64   `json:"early_stopping_patience"`
	EarlyStoppingThreshold float64 `json:"early_stopping_threshold"`
	TrainBatchSize         int64   `json:"train_batch_size"`
	TrainEpochs            int64   `json:"train_epochs"`
	LearningRate           float64 `json:"learning_rate"`
}

type ListEmbedJobsResponse

type ListEmbedJobsResponse struct {
	EmbedJobs []EmbedJobDescription `json:"embed_jobs"`
}

type ListFineTunedModelsResponse

type ListFineTunedModelsResponse struct {
	FinetunedModels []FineTunedModelDescription `json:"finetuned_models"`
	NextPageToken   string                      `json:"next_page_token"`
	TotalSize       int64                       `json:"total_size"`
}

type Metadata

type Metadata struct{}

type ModelDescription

type ModelDescription struct {
	Name             string   `json:"name"`
	Endpoints        []string `json:"endpoints"`
	Finetuned        bool     `json:"finetuned"`
	ContextLength    float64  `json:"context_length"`
	TokenizerURL     string   `json:"tokenizer_url"`
	DefaultEndpoints []string `json:"default_endpoints"`
}

type ModelListResponse

type ModelListResponse struct {
	Models        []ModelDescription `json:"models"`
	NextPageToken string             `json:"next_page_token"`
}

type Oauth

type Oauth struct {
	AuthorizeURL string `json:"authorize_url"`
	TokenURL     string `json:"token_url"`
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	Scope        string `json:"scope"`
}

type OrganizationUsage

type OrganizationUsage struct {
	OrganizationUsage int64 `json:"organization_usage"`
}

type Settings

type Settings struct {
	BaseModel       BaseModel        `json:"base_model"`
	DatasetID       string           `json:"dataset_id"`
	Hyperparameters *Hyperparameters `json:"hyperparameters,omitempty"`
}

Jump to

Keyboard shortcuts

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