Documentation ¶
Index ¶
- type LocalChat
- type LocalMessage
- type LocalOptions
- type LocalRequest
- type LocalResponse
- type MessageInput
- type OpenAIHandler
- func (h *OpenAIHandler) CreateTransaction(c *gin.Context)
- func (h *OpenAIHandler) DeleteTransaction(c *gin.Context)
- func (h *OpenAIHandler) FetchDrawing(c *gin.Context)
- func (h *OpenAIHandler) FetchSuggestion(c *gin.Context)
- func (h *OpenAIHandler) GenerateHint(c *gin.Context)
- func (h *OpenAIHandler) GetTransactionByID(c *gin.Context)
- func (h *OpenAIHandler) GetTransactionsByUserID(c *gin.Context)
- func (h *OpenAIHandler) MessageHanlder(c *gin.Context)
- func (h *OpenAIHandler) SSEHandler(c *gin.Context)
- func (h *OpenAIHandler) StopGeneration(threadID uuid.UUID) error
- func (h *OpenAIHandler) UpdateTransaction(c *gin.Context)
- func (h *OpenAIHandler) WebSocketHandler(c *gin.Context)
- type Options
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalChat ¶
type LocalChat struct { Model string `json:"model"` Messages []LocalMessage `json:"messages"` Stream bool `json:"stream"` Format string `json:"format"` }
type LocalMessage ¶
type LocalOptions ¶
type LocalOptions struct {
NumPredict int `json:"num_predict"`
}
type LocalRequest ¶
type LocalRequest struct { Model string `json:"model"` Prompt string `json:"prompt"` System string `json:"system"` Stream bool `json:"stream"` Options LocalOptions `json:"options"` }
type LocalResponse ¶
type MessageInput ¶
type MessageInput struct { Messages []LocalMessage `json:"messages"` Model string `json:"model"` }
type OpenAIHandler ¶
type OpenAIHandler struct { ThreadSSEChannels map[uuid.UUID]chan string Mutex *sync.RWMutex // CancelFuncs stores the cancel functions for each thread ID CancelFuncs map[uuid.UUID]context.CancelFunc CancelFuncsLLM map[uuid.UUID]context.CancelFunc // contains filtered or unexported fields }
func NewOpenAIHandler ¶
func NewOpenAIHandler(openAIService *openaibusiness.OpenAIService) *OpenAIHandler
NewOpenAIHandler creates a new instance of OpenAIHandler.
func (*OpenAIHandler) CreateTransaction ¶
func (h *OpenAIHandler) CreateTransaction(c *gin.Context)
CreateTransaction handles the creation of a new OpenAI transaction (HTTP Handler).
func (*OpenAIHandler) DeleteTransaction ¶
func (h *OpenAIHandler) DeleteTransaction(c *gin.Context)
DeleteTransaction handles the deletion of an OpenAI transaction.
func (*OpenAIHandler) FetchDrawing ¶
func (h *OpenAIHandler) FetchDrawing(c *gin.Context)
FetchSuggestion handles the request to fetch suggestions from OpenAI.
func (*OpenAIHandler) FetchSuggestion ¶
func (h *OpenAIHandler) FetchSuggestion(c *gin.Context)
FetchSuggestion handles the request to fetch suggestions from OpenAI.
func (*OpenAIHandler) GenerateHint ¶
func (h *OpenAIHandler) GenerateHint(c *gin.Context)
FetchSuggestion handles the request to fetch suggestions from OpenAI.
func (*OpenAIHandler) GetTransactionByID ¶
func (h *OpenAIHandler) GetTransactionByID(c *gin.Context)
GetTransactionByID handles fetching a specific transaction by its ID.
func (*OpenAIHandler) GetTransactionsByUserID ¶
func (h *OpenAIHandler) GetTransactionsByUserID(c *gin.Context)
GetTransactionsByUserID handles fetching transactions for a specific user.
func (*OpenAIHandler) MessageHanlder ¶
func (h *OpenAIHandler) MessageHanlder(c *gin.Context)
MessageHandler handles the incoming messages.
func (*OpenAIHandler) SSEHandler ¶
func (h *OpenAIHandler) SSEHandler(c *gin.Context)
func (*OpenAIHandler) StopGeneration ¶
func (h *OpenAIHandler) StopGeneration(threadID uuid.UUID) error
func (*OpenAIHandler) UpdateTransaction ¶
func (h *OpenAIHandler) UpdateTransaction(c *gin.Context)
UpdateTransaction handles the updating of an existing OpenAI transaction.
func (*OpenAIHandler) WebSocketHandler ¶
func (h *OpenAIHandler) WebSocketHandler(c *gin.Context)
WebSocketHandler is the Gin handler for WebSocket connections