plugin_models

package
v0.0.0-...-e06ca6e Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AiApiPlugin

type AiApiPlugin interface {
	Initialize(options *AiApiPluginOptions) error
	GetPluginId() string
	GetPluginName() string
	CompleteChat(chatCompletionRequest *ChatCompletionRequest) (*ChatCompletionResponse, error)
	GetModels() (*GetModelsResponse, error)
}

type AiApiPluginOptions

type AiApiPluginOptions struct {
	Client *logged_client.LoggedClient
	Logger *logger.Logger
}

type AiModel

type AiModel struct {
	Id string `json:"id"`
	// Person or Organization that created the model, e.g. "OpenAI"
	Name       string    `json:"name"`
	AuthorId   string    `json:"author_id"`
	AuthorName string    `json:"author_name"`
	CreatedAt  time.Time `json:"created_at"`
}

type ApiMiddlewareFactory

type ApiMiddlewareFactory interface {
	Initialize(options *ApiMiddlewareOptions) error
	GetPluginId() string
	Create(next http.Handler) http.Handler
}

type ApiMiddlewareOptions

type ApiMiddlewareOptions struct {
	UsersService *users_service.UsersService
}

type ChatCompletionMessage

type ChatCompletionMessage struct {
	Content string             `json:"content"`
	Role    ChatCompletionRole `json:"role"`
}

type ChatCompletionRequest

type ChatCompletionRequest struct {
	Model    string                   `json:"model"`
	Messages []*ChatCompletionMessage `json:"messages"`
	// Temperature is a float value between 0 and 1. Higher values will result in more creative completions.
	Temperature float64 `json:"temperature"`
}

type ChatCompletionResponse

type ChatCompletionResponse struct {
	Message *ChatCompletionMessage `json:"message"`
}

type ChatCompletionRole

type ChatCompletionRole string
const (
	ChatCompletionRoleUser      ChatCompletionRole = "user"
	ChatCompletionRoleAssistant ChatCompletionRole = "assistant"
	ChatCompletionRoleSystem    ChatCompletionRole = "system"
)

type GetModelsResponse

type GetModelsResponse struct {
	Models []*AiModel `json:"models"`
}

type Plugin

type Plugin interface {
	GetPluginId() string
}

type UserIdContextKey

type UserIdContextKey struct{}

Jump to

Keyboard shortcuts

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