describer

package
v0.1.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAssistant

func GetAssistant(ctx context.Context, handler *OpenAIAPIHandler, resourceID string) (*models.Resource, error)

func GetLoggerFromContext

func GetLoggerFromContext(ctx context.Context) *zap.Logger

func GetModel

func GetModel(ctx context.Context, handler *OpenAIAPIHandler, resourceID string) (*models.Resource, error)

func GetParameterFromContext

func GetParameterFromContext(ctx context.Context, key string) any

func GetProject

func GetProject(ctx context.Context, handler *OpenAIAPIHandler, resourceID string) (*models.Resource, error)

func GetTriggerTypeFromContext

func GetTriggerTypeFromContext(ctx context.Context) enums.DescribeTriggerType

func GetVectorStore

func GetVectorStore(ctx context.Context, handler *OpenAIAPIHandler, resourceID string) (*models.Resource, error)

func ListAssistants

func ListAssistants(ctx context.Context, handler *OpenAIAPIHandler, stream *models.StreamSender) ([]models.Resource, error)

func ListFiles

func ListFiles(ctx context.Context, handler *OpenAIAPIHandler, stream *models.StreamSender) ([]models.Resource, error)

func ListModels added in v0.1.4

func ListModels(ctx context.Context, handler *OpenAIAPIHandler, stream *models.StreamSender) ([]models.Resource, error)

func ListProjectAPIKeys

func ListProjectAPIKeys(ctx context.Context, handler *OpenAIAPIHandler, stream *models.StreamSender) ([]models.Resource, error)

func ListProjectRateLimits

func ListProjectRateLimits(ctx context.Context, handler *OpenAIAPIHandler, stream *models.StreamSender) ([]models.Resource, error)

func ListProjectServiceAccounts

func ListProjectServiceAccounts(ctx context.Context, handler *OpenAIAPIHandler, stream *models.StreamSender) ([]models.Resource, error)

func ListProjectUsers

func ListProjectUsers(ctx context.Context, handler *OpenAIAPIHandler, stream *models.StreamSender) ([]models.Resource, error)

func ListProjects

func ListProjects(ctx context.Context, handler *OpenAIAPIHandler, stream *models.StreamSender) ([]models.Resource, error)

func ListVectorStores

func ListVectorStores(ctx context.Context, handler *OpenAIAPIHandler, stream *models.StreamSender) ([]models.Resource, error)

func WithLogger

func WithLogger(ctx context.Context, logger *zap.Logger) context.Context

Types

type JSONAllFieldsMarshaller

type JSONAllFieldsMarshaller struct {
	Value interface{}
}

func (JSONAllFieldsMarshaller) MarshalJSON

func (x JSONAllFieldsMarshaller) MarshalJSON() (res []byte, err error)

func (*JSONAllFieldsMarshaller) UnmarshalJSON

func (x *JSONAllFieldsMarshaller) UnmarshalJSON(data []byte) (err error)

type OpenAIAPIHandler

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

func NewOpenAIAPIHandler

func NewOpenAIAPIHandler(apiKey string, orgID 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

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

Jump to

Keyboard shortcuts

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