api

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPIHandlers

func GetAPIHandlers() map[string]types.APIInfo

GetAPIHandlers returns a map of all available API handlers

Types

type App

type App struct {
	APIs map[string]types.APIInfo
}

App represents the main application structure

func NewApp

func NewApp() *App

func (*App) GetAvailableAPIs

func (a *App) GetAvailableAPIs() []types.APIInfo

GetAvailableAPIs returns a list of available APIs

func (*App) HandleQuery

func (a *App) HandleQuery(apiShortcut, query string, chatID int, previousMessages []db.Message) (string, error)

HandleQuery processes a query for a specific API

type ClaudeAPI

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

ClaudeAPI implements the APIHandler interface for Claude API

func NewClaudeAPI

func NewClaudeAPI() (*ClaudeAPI, error)

NewClaudeAPI creates a new instance of ClaudeAPI

func (*ClaudeAPI) HandleQuery

func (c *ClaudeAPI) HandleQuery(query string) string

type ErrorAPI

type ErrorAPI struct {
	Err error
}

ErrorAPI is a placeholder API that returns an error message

func (*ErrorAPI) HandleQuery

func (e *ErrorAPI) HandleQuery(query string) string

type GroqAPI

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

GroqAPI implements the APIHandler interface for Groq API

func NewGroqAPI

func NewGroqAPI() (*GroqAPI, error)

NewGroqAPI creates a new instance of GroqAPI

func (*GroqAPI) HandleQuery

func (c *GroqAPI) HandleQuery(query string) string

type MockAPI

type MockAPI struct {
	Name string
}

MockAPI is a sample implementation of APIHandler

func (*MockAPI) HandleQuery

func (m *MockAPI) HandleQuery(query string) string

type OpenAIAPI

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

OpenAIAPI implements the APIHandler interface for OpenAI API

func NewOpenAIAPI

func NewOpenAIAPI() (*OpenAIAPI, error)

NewOpenAIAPI creates a new instance of OpenAIAPI

func (*OpenAIAPI) HandleQuery

func (o *OpenAIAPI) HandleQuery(query string) string

Jump to

Keyboard shortcuts

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