provider

package
v0.8.2 Latest Latest
Warning

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

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

Documentation

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 DescribeListByOpenAI

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

DescribeListByOpenAI A wrapper to pass openai authorization to describer list functions

func DescribeSingleByOpenAI

func DescribeSingleByOpenAI(describe func(context.Context, *OpenAIAPIHandler, string) (*model.Resource, error)) model.SingleResourceDescriber

DescribeSingleByOpenAI A wrapper to pass openai authorization to describer get 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 AssistantDescription

type AssistantDescription struct {
	//Object         string
	//CreatedAt      time.Time
	ID            string                 `json:"id"`
	Name          *string                `json:"name"`
	Description   *string                `json:"description"`
	Model         string                 `json:"model"`
	Instructions  *string                `json:"instructions"`
	Tools         []interface{}          `json:"tools"`
	ToolResources *interface{}           `json:"tool_resources"`
	Metadata      map[string]interface{} `json:"metadata"`
	Temperature   *float32               `json:"temperature"`
	TopP          *float32               `json:"top_p"`
}

type AssistantObjectToolResources

type AssistantObjectToolResources struct {
	CodeInterpreter *AssistantObjectToolResourcesCodeInterpreter `json:"code_interpreter,omitempty"`
	FileSearch      *AssistantObjectToolResourcesFileSearch      `json:"file_search,omitempty"`
}

type AssistantObjectToolResourcesCodeInterpreter

type AssistantObjectToolResourcesCodeInterpreter struct {
	FileIds []string `json:"file_ids,omitempty"`
}

type AssistantObjectToolResourcesFileSearch

type AssistantObjectToolResourcesFileSearch struct {
	VectorStoreIds []string `json:"vector_store_ids,omitempty"`
}

type AssistantObjectToolsInner

type AssistantObjectToolsInner struct {
	AssistantToolsCode       *AssistantToolsCode
	AssistantToolsFileSearch *AssistantToolsFileSearch
	AssistantToolsFunction   *AssistantToolsFunction
}

type AssistantResponse

type AssistantResponse struct {
	Data    []AssistantDescription `json:"data"`
	LastID  string                 `json:"last_id"`
	HasMore bool                   `json:"has_more"`
}

type AssistantToolsCode

type AssistantToolsCode struct {
	Type string `json:"type"`
}

type AssistantToolsFileSearch

type AssistantToolsFileSearch struct {
	Type       string                              `json:"type"`
	FileSearch *AssistantToolsFileSearchFileSearch `json:"file_search,omitempty"`
}

type AssistantToolsFileSearchFileSearch

type AssistantToolsFileSearchFileSearch struct {
	MaxNumResults  *int32                    `json:"max_num_results,omitempty"`
	RankingOptions *FileSearchRankingOptions `json:"ranking_options,omitempty"`
}

type AssistantToolsFunction

type AssistantToolsFunction struct {
	Type     string         `json:"type"`
	Function FunctionObject `json:"function"`
}

type FileDescription

type FileDescription struct {
	ID        string `json:"id"`
	FileName  string `json:"file_name"`
	CreatedAt int32  `json:"created_at"`
	Bytes     int32  `json:"bytes"`
	Object    string `json:"object"`
	Purpose   string `json:"purpose"`
}

type FileResponse

type FileResponse struct {
	Data    []FileDescription `json:"data"`
	LastID  string            `json:"last_id"`
	HasMore bool              `json:"has_more"`
}

type FileSearchRankingOptions

type FileSearchRankingOptions struct {
	Ranker         *string `json:"ranker,omitempty"`
	ScoreThreshold float32 `json:"score_threshold"`
}

type FunctionObject

type FunctionObject struct {
	Description *string                `json:"description,omitempty"`
	Name        string                 `json:"name"`
	Parameters  map[string]interface{} `json:"parameters,omitempty"`
	Strict      NullableBool           `json:"strict,omitempty"`
}

type Metadata

type Metadata struct{}

type ModelsDescription

type ModelsDescription struct {
	ID         string       `json:"id"`
	CreatedAt  int32        `json:"created_at"`
	Object     string       `json:"object"`
	OwnedBy    string       `json:"owned_by"`
	Permission []Permission `json:"permission"`
	Root       string       `json:"root"`
}

type ModelsResponse

type ModelsResponse struct {
	Data []ModelsDescription `json:"data"`
}

type NullableBool

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

type NullableInt32

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

type OpenAIAPIHandler

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

func NewOpenAIAPIHandler

func NewOpenAIAPIHandler(apiKey, orgID, projectID string, rateLimit rate.Limit, burst int, maxConcurrency int, maxRetries int, retryBackoff time.Duration) *OpenAIAPIHandler

func (*OpenAIAPIHandler) DoRequest

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

type Permission

type Permission struct {
	CreatedAt          int64       `json:"created"`
	ID                 string      `json:"id"`
	Object             string      `json:"object"`
	AllowCreateEngine  bool        `json:"allow_create_engine"`
	AllowSampling      bool        `json:"allow_sampling"`
	AllowLogprobs      bool        `json:"allow_logprobs"`
	AllowSearchIndices bool        `json:"allow_search_indices"`
	AllowView          bool        `json:"allow_view"`
	AllowFineTuning    bool        `json:"allow_fine_tuning"`
	Organization       string      `json:"organization"`
	Group              interface{} `json:"group"`
	IsBlocking         bool        `json:"is_blocking"`
}

type ProjectApiKey

type ProjectApiKey struct {
	Object        string             `json:"object"`
	ID            string             `json:"id"`
	Name          string             `json:"name"`
	RedactedValue string             `json:"redacted_value"`
	CreatedAt     int32              `json:"created_at"`
	Owner         ProjectApiKeyOwner `json:"owner"`
}

type ProjectApiKeyDescription

type ProjectApiKeyDescription struct {
	ProjectApiKey
	ProjectID string `json:"project_id"`
}

type ProjectApiKeyOwner

type ProjectApiKeyOwner struct {
	Type           *string                `json:"type,omitempty"`
	User           *ProjectUser           `json:"user,omitempty"`
	ServiceAccount *ProjectServiceAccount `json:"service_account,omitempty"`
}

type ProjectApiKeyResponse

type ProjectApiKeyResponse struct {
	Data    []ProjectApiKey `json:"data"`
	LastID  string          `json:"last_id"`
	HasMore bool            `json:"has_more"`
}

type ProjectDescription

type ProjectDescription struct {
	ID         string        `json:"id"`
	Object     string        `json:"object"`
	Name       string        `json:"name"`
	CreatedAt  int32         `json:"created_at"`
	ArchivedAt NullableInt32 `json:"archived_at"`
	Status     string        `json:"status"`
}

type ProjectRateLimit

type ProjectRateLimit struct {
	Object                      string `json:"object"`
	ID                          string `json:"id"`
	Model                       string `json:"model"`
	MaxRequestsPer1Minute       int32  `json:"max_requests_per_1_minute"`
	MaxTokensPer1Minute         int32  `json:"max_tokens_per_1_minute"`
	MaxImagesPer1Minute         *int32 `json:"max_images_per_1_minute"`
	MaxAudioMegabytesPer1Minute *int32 `json:"max_audio_megabytes_per_1_minute"`
	MaxRequestsPer1Day          *int32 `json:"max_requests_per_1_day"`
	Batch1DayMaxInputTokens     *int32 `json:"batch_1_day_max_input_tokens"`
}

type ProjectRateLimitDescription

type ProjectRateLimitDescription struct {
	ProjectRateLimit
	ProjectID string `json:"project_id"`
}

type ProjectRateLimitResponse

type ProjectRateLimitResponse struct {
	Data    []ProjectRateLimit `json:"data"`
	LastID  string             `json:"last_id"`
	HasMore bool               `json:"has_more"`
}

type ProjectResponse

type ProjectResponse struct {
	Data    []ProjectDescription `json:"data"`
	LastID  string               `json:"last_id"`
	HasMore bool                 `json:"has_more"`
}

type ProjectServiceAccount

type ProjectServiceAccount struct {
	Object    string `json:"object"`
	ID        string `json:"id"`
	Name      string `json:"name"`
	Role      string `json:"role"`
	CreatedAt int32  `json:"created_at"`
}

type ProjectServiceAccountDescription

type ProjectServiceAccountDescription struct {
	ProjectServiceAccount
	ProjectID string `json:"project_id"`
}

type ProjectServiceAccountResponse

type ProjectServiceAccountResponse struct {
	Data    []ProjectServiceAccount `json:"data"`
	LastID  string                  `json:"last_id"`
	HasMore bool                    `json:"has_more"`
}

type ProjectUser

type ProjectUser struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Object  string `json:"object"`
	Email   string `json:"email"`
	Role    string `json:"role"`
	AddedAt int32  `json:"added_at"`
}

type ProjectUserDescription

type ProjectUserDescription struct {
	UserID    string `json:"user_id"`
	ProjectID string `json:"project_id"`
	Object    string
	Name      string
	Email     string
	Role      string
}

type ProjectUserResponse

type ProjectUserResponse struct {
	Data    []ProjectUser `json:"data"`
	LastID  string        `json:"last_id"`
	HasMore bool          `json:"has_more"`
}

type ResponseFormatJsonObject

type ResponseFormatJsonObject struct {
	Type string `json:"type"`
}

type ResponseFormatJsonSchema

type ResponseFormatJsonSchema struct {
	Type       string                             `json:"type"`
	JsonSchema ResponseFormatJsonSchemaJsonSchema `json:"json_schema"`
}

type ResponseFormatJsonSchemaJsonSchema

type ResponseFormatJsonSchemaJsonSchema struct {
	Description *string                `json:"description,omitempty"`
	Name        string                 `json:"name"`
	Schema      map[string]interface{} `json:"schema,omitempty"`
	Strict      NullableBool           `json:"strict,omitempty"`
}

type ResponseFormatText

type ResponseFormatText struct {
	Type string `json:"type"`
}

type VectorStoreDescription

type VectorStoreDescription struct {
	ID           string                      `json:"id"`
	Object       string                      `json:"object"`
	CreatedAt    int32                       `json:"created_at"`
	Name         string                      `json:"name"`
	UsageBytes   int32                       `json:"usage_bytes"`
	FileCounts   VectorStoreObjectFileCounts `json:"file_counts"`
	Status       string                      `json:"status"`
	ExpiresAfter *VectorStoreExpirationAfter `json:"expires_after"`
	ExpiresAt    *int32                      `json:"expires_at"`
	LastActiveAt *int32                      `json:"last_active_at"`
	Metadata     map[string]interface{}      `json:"metadata"`
}

type VectorStoreExpirationAfter

type VectorStoreExpirationAfter struct {
	Anchor string `json:"anchor"`
	Days   int32  `json:"days"`
}

type VectorStoreObjectFileCounts

type VectorStoreObjectFileCounts struct {
	InProgress int32 `json:"in_progress"`
	Completed  int32 `json:"completed"`
	Failed     int32 `json:"failed"`
	Cancelled  int32 `json:"cancelled"`
	Total      int32 `json:"total"`
}

type VectorStoreResponse

type VectorStoreResponse struct {
	Data    []VectorStoreDescription `json:"data"`
	LastID  string                   `json:"last_id"`
	HasMore bool                     `json:"has_more"`
}

Jump to

Keyboard shortcuts

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