Documentation
¶
Index ¶
- func Flatten(data any) string
- func Split(prefix, text string, ctxNum int) (list []string)
- type ChatRequest
- type DocumentSearch
- type DocumentUpload
- type FetchCategoryNamesRequest
- type FetchCategoryNamesResponse
- type SearchRequest
- type SearchResponse
- type Server
- func (s *Server) Chat(ctx context.Context, req ChatRequest) (resStream io.ReadCloser, err error)
- func (s *Server) ChatHttp(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteCategory(ctx context.Context, ownerName, categoryName string) (err error)
- func (s *Server) DeleteCategoryHttp(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteDocument(ctx context.Context, ownerName, categoryName string, documentID uint64) (err error)
- func (s *Server) DeleteDocumentHttp(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteOwner(ctx context.Context, owner string) (err error)
- func (s *Server) DeleteOwnerHttp(w http.ResponseWriter, r *http.Request)
- func (s *Server) FetchCategoryNames(ctx context.Context, owner string) (categoryNames []string, err error)
- func (s *Server) FetchCategoryNamesHttp(w http.ResponseWriter, r *http.Request)
- func (d *Server) RefreshCentroids(appCtx context.Context)
- func (s *Server) Search(ctx context.Context, req SearchRequest) (res SearchResponse, err error)
- func (s *Server) SearchHttp(w http.ResponseWriter, r *http.Request)
- func (s *Server) Upload(ctx context.Context, req UploadRequest) (res UploadResponse, err error)
- func (s *Server) UploadHttp(w http.ResponseWriter, r *http.Request)
- type UploadRequest
- type UploadResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChatRequest ¶
type DocumentSearch ¶
type DocumentSearch struct {
DocumentUpload
DocumentID uint64 `json:"document_id"`
DocumentSimilarity float32 `json:"document_similarity"`
}
type DocumentUpload ¶
type FetchCategoryNamesRequest ¶
type FetchCategoryNamesRequest struct {
Owner string `json:"owner"`
}
type FetchCategoryNamesResponse ¶
type FetchCategoryNamesResponse struct {
CategoryNames []string `json:"category_names"`
}
type SearchRequest ¶
type SearchResponse ¶
type SearchResponse struct {
Documents []DocumentSearch `json:"documents"`
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Chat ¶
func (s *Server) Chat(ctx context.Context, req ChatRequest) (resStream io.ReadCloser, err error)
Chat handles a chat request and returns a stream of bytes for the response.
func (*Server) DeleteCategory ¶
func (*Server) DeleteCategoryHttp ¶
func (s *Server) DeleteCategoryHttp(w http.ResponseWriter, r *http.Request)
func (*Server) DeleteDocument ¶
func (*Server) DeleteDocumentHttp ¶
func (s *Server) DeleteDocumentHttp(w http.ResponseWriter, r *http.Request)
func (*Server) DeleteOwner ¶
func (*Server) DeleteOwnerHttp ¶
func (s *Server) DeleteOwnerHttp(w http.ResponseWriter, r *http.Request)
func (*Server) FetchCategoryNames ¶
func (*Server) FetchCategoryNamesHttp ¶
func (s *Server) FetchCategoryNamesHttp(w http.ResponseWriter, r *http.Request)
func (*Server) RefreshCentroids ¶
func (*Server) Search ¶
func (s *Server) Search(ctx context.Context, req SearchRequest) (res SearchResponse, err error)
Search for a previously uploaded embedding vector in the database and return similar documents.
func (*Server) SearchHttp ¶
func (s *Server) SearchHttp(w http.ResponseWriter, r *http.Request)
func (*Server) Upload ¶
func (s *Server) Upload(ctx context.Context, req UploadRequest) (res UploadResponse, err error)
Upload calculates the embedding for the uploaded document then saves the document and embedding in the database.
func (*Server) UploadHttp ¶
func (s *Server) UploadHttp(w http.ResponseWriter, r *http.Request)
type UploadRequest ¶
type UploadRequest struct {
Owner string `json:"owner"`
Category string `json:"category"`
Documents []DocumentUpload `json:"documents"`
}
type UploadResponse ¶
type UploadResponse struct {
DocumentIDs []uint64 `json:"document_ids"`
}
Click to show internal directories.
Click to hide internal directories.