search

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SearchResultsProp = "search_results"
	SearchQueryProp   = "search_query"
)

Variables

This section is empty.

Functions

func InitEmbeddingsSearch

func InitEmbeddingsSearch(db *sqlx.DB, httpClient *http.Client, cfg embeddings.EmbeddingSearchConfig, licenseChecker *enterprise.LicenseChecker) (embeddings.EmbeddingSearch, error)

InitEmbeddingsSearch creates and initializes the embedding search system

Types

type RAGResult

type RAGResult struct {
	PostID      string  `json:"postId"`
	ChannelID   string  `json:"channelId"`
	ChannelName string  `json:"channelName"`
	UserID      string  `json:"userId"`
	Username    string  `json:"username"`
	Content     string  `json:"content"`
	Score       float32 `json:"score"`
}

RAGResult represents an enriched search result with metadata

type Request

type Request struct {
	Query      string `json:"query"`
	TeamID     string `json:"teamId"`
	ChannelID  string `json:"channelId"`
	MaxResults int    `json:"maxResults"`
}

Request represents a search query request

type Response

type Response struct {
	Answer    string      `json:"answer"`
	Results   []RAGResult `json:"results"`
	PostID    string      `json:"postid,omitempty"`
	ChannelID string      `json:"channelid,omitempty"`
}

Response represents a response to a search query

type Search struct {
	embeddings.EmbeddingSearch
	// contains filtered or unexported fields
}

func New

func New(
	search embeddings.EmbeddingSearch,
	mmclient mmapi.Client,
	prompts *llm.Prompts,
	streamingService streaming.Service,
	licenseChecker *enterprise.LicenseChecker,
) *Search

func (*Search) Enabled added in v1.2.2

func (s *Search) Enabled() bool

Enabled returns true if the search service is enabled and functional

func (*Search) RunSearch

func (s *Search) RunSearch(ctx context.Context, userID string, bot *bots.Bot, query, teamID, channelID string, maxResults int) (map[string]string, error)

RunSearch initiates a search and sends results to a DM

func (*Search) SearchQuery

func (s *Search) SearchQuery(ctx context.Context, userID string, bot *bots.Bot, query, teamID, channelID string, maxResults int) (Response, error)

SearchQuery performs a search and returns results immediately

Jump to

Keyboard shortcuts

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