chat

package
v0.0.0-...-4ae6852 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: AGPL-3.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attach

func Attach(mux goahttp.Muxer, service *Service)

Types

type AgentChatOptions

type AgentChatOptions struct {
	SystemPrompt            *string
	ToolsetSlug             *string
	AdditionalTools         []AgentTool
	AddedEnvironmentEntries map[string]string
	AgentTimeout            *time.Duration
}

type AgentTool

type AgentTool struct {
	Definition openrouter.Tool
	Executor   func(ctx context.Context, rawArgs string) (string, error)
}

type ChatClient

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

func NewChatClient

func NewChatClient(logger *slog.Logger,
	tracerProvider trace.TracerProvider,
	meterProvider metric.MeterProvider,
	db *pgxpool.Pool,
	openRouter openrouter.Provisioner,
	chatClient *openrouter.ChatClient,
	env *environments.EnvironmentEntries,
	enc *encryption.Client,
	cacheImpl cache.Cache,
	guardianPolicy *guardian.Policy,
	funcCaller functions.ToolCaller,
	tcm tm.ToolMetricsProvider,
) *ChatClient

func (*ChatClient) AgentChat

func (c *ChatClient) AgentChat(
	ctx context.Context,
	orgID string,
	projectID uuid.UUID,
	prompt string,
	opts AgentChatOptions,
) (string, error)

AgentChat loops over tool calls until completion and returns the final message.

func (*ChatClient) LoadToolsetTools

func (c *ChatClient) LoadToolsetTools(
	ctx context.Context,
	projectID uuid.UUID,
	toolsetSlug string,
	addedEnvironmentEntries map[string]string,
) ([]AgentTool, error)

type FormatResult

type FormatResult struct {
	Type string `json:"type"`
	Text string `json:"text,omitempty"`
	Data string `json:"data,omitempty"`
}

type Service

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

func NewService

func NewService(logger *slog.Logger, db *pgxpool.Pool, sessions *sessions.Manager, openRouter openrouter.Provisioner) *Service

func (*Service) APIKeyAuth

func (s *Service) APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error)

func (*Service) CreditUsage

func (s *Service) CreditUsage(ctx context.Context, payload *gen.CreditUsagePayload) (*gen.CreditUsageResult, error)

func (*Service) HandleCompletion

func (s *Service) HandleCompletion(w http.ResponseWriter, r *http.Request) error

HandleCompletion is a proxy to the OpenAI API that logs request and response data.

func (*Service) ListChats

func (s *Service) ListChats(ctx context.Context, payload *gen.ListChatsPayload) (*gen.ListChatsResult, error)

func (*Service) LoadChat

func (s *Service) LoadChat(ctx context.Context, payload *gen.LoadChatPayload) (*gen.Chat, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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