Documentation
¶
Index ¶
- Constants
- func DecorateStreamWithAnnotations(result *llm.TextStreamResult, searchData []WebSearchContextValue, ...) *llm.TextStreamResult
- type GetGithubIssueArgs
- type GetJiraIssueArgs
- type LookupMattermostUserArgs
- type MMToolProvider
- type SearchServerArgs
- type ToolProvider
- type WebSearchContextValue
- type WebSearchLog
- type WebSearchResult
- type WebSearchService
- type WebSearchSourceArgs
- type WebSearchToolArgs
Constants ¶
const ( MinSearchTermLength = 3 MaxSearchTermLength = 300 )
const ( // WebSearchContextKey is the key used within llm.Context.Parameters to store web search results WebSearchContextKey = "mm_web_search_results" // WebSearchAllowedURLsKey is the key used to store whitelisted URLs for source fetching WebSearchAllowedURLsKey = "mm_web_search_allowed_urls" // WebSearchExecutedQueriesKey is the key used to track which queries have been executed WebSearchExecutedQueriesKey = "mm_web_search_executed_queries" // WebSearchCountKey is the key used to track the number of searches executed WebSearchCountKey = "mm_web_search_count" WebSearchDescription = "" /* 684-byte string literal not displayed */ // WebSearchSourceFetchDescription describes the page retrieval tool. WebSearchSourceFetchDescription = "" /* 425-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func DecorateStreamWithAnnotations ¶ added in v1.8.0
func DecorateStreamWithAnnotations(result *llm.TextStreamResult, searchData []WebSearchContextValue, logger WebSearchLog) *llm.TextStreamResult
DecorateStreamWithAnnotations attaches annotation events based on search results to the provided stream.
Types ¶
type GetGithubIssueArgs ¶
type GetGithubIssueArgs struct {
RepoOwner string `jsonschema_description:"The owner of the repository to get issues from. Example: 'mattermost'"`
RepoName string `jsonschema_description:"The name of the repository to get issues from. Example: 'mattermost-plugin-ai'"`
Number int `jsonschema_description:"The issue number to get. Example: '1'"`
}
type GetJiraIssueArgs ¶
type LookupMattermostUserArgs ¶
type LookupMattermostUserArgs struct {
Username string `jsonschema_description:"The username of the user to lookup without a leading '@'. Example: 'firstname.lastname'"`
}
type MMToolProvider ¶
type MMToolProvider struct {
// contains filtered or unexported fields
}
MMToolProvider implements ToolProvider with all built-in Mattermost tools
func NewMMToolProvider ¶
func NewMMToolProvider(pluginAPI mmapi.Client, search *search.Search, httpClient *http.Client, webSearch WebSearchService) *MMToolProvider
NewMMToolProvider creates a new tool provider
func (*MMToolProvider) GetTools ¶
func (p *MMToolProvider) GetTools(bot *bots.Bot) []llm.Tool
GetTools returns all available tools. Tool execution is restricted at runtime via WithToolsDisabled() based on context (e.g., DM vs channel). This allows LLMs to be aware of tool capabilities even when they can't be executed in the current context.
type SearchServerArgs ¶
type SearchServerArgs struct {
Term string `jsonschema_description:"The terms to search for in the server. Must be more than 3 and less than 300 characters."`
}
type ToolProvider ¶
ToolProvider provides built-in tools for the AI assistant
type WebSearchContextValue ¶ added in v1.8.0
type WebSearchContextValue struct {
Query string `json:"query"`
Results []WebSearchResult `json:"results"`
}
WebSearchContextValue stores the results produced by a single tool invocation.
func ConsumeWebSearchContexts ¶ added in v1.8.0
func ConsumeWebSearchContexts(ctx *llm.Context) []WebSearchContextValue
ConsumeWebSearchContexts extracts the stored search context values without removing them. The data persists in the context for the duration of the request to support multiple reads.
type WebSearchLog ¶ added in v1.8.0
type WebSearchLog interface {
Debug(message string, keyValuePairs ...any)
Info(message string, keyValuePairs ...any)
Warn(message string, keyValuePairs ...any)
Error(message string, keyValuePairs ...any)
}
WebSearchLog abstracts the logging interface used by the service.
type WebSearchResult ¶ added in v1.8.0
type WebSearchResult struct {
Index int `json:"index"`
Title string `json:"title"`
URL string `json:"url"`
Snippet string `json:"snippet"`
Query string `json:"query"`
}
WebSearchResult represents a single web search result consumed by downstream components.
func FlattenWebSearchResults ¶ added in v1.8.0
func FlattenWebSearchResults(values []WebSearchContextValue) []WebSearchResult
FlattenWebSearchResults flattens the result sets from multiple tool executions into a single slice.
type WebSearchService ¶ added in v1.8.0
WebSearchService exposes the built-in web search tool if configured.
func NewWebSearchService ¶ added in v1.8.0
func NewWebSearchService(cfgGetter func() *config.Config, logger WebSearchLog, httpClient *http.Client) WebSearchService
NewWebSearchService constructs a new WebSearchService implementation.
type WebSearchSourceArgs ¶ added in v1.8.0
type WebSearchSourceArgs struct {
URL string `jsonschema_description:"The absolute URL of the web page to retrieve."`
}
WebSearchSourceArgs represents the input to fetch a single web page.
type WebSearchToolArgs ¶ added in v1.8.0
type WebSearchToolArgs struct {
Query string `jsonschema_description:"The web search query to execute."`
}
WebSearchToolArgs represents the JSON schema for the web search tool input.