Documentation
¶
Overview ¶
Package interpluginclient provides a client for interacting with the Mattermost AI plugin from other Mattermost plugins.
Security Notice: The AI plugin's inter-plugin API does not perform permission checks. The calling plugin is responsible for verifying that the user has appropriate permissions before making requests on their behalf.
Index ¶
Constants ¶
const ( // DefaultTimeout is the default timeout for all requests to the AI plugin DefaultTimeout = 10 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client allows calling the AI plugin functions from other plugins
func NewClient ¶
func NewClient(p *plugin.MattermostPlugin) *Client
NewClientFromPlugin creates a new Client using the plugin's API client
func (*Client) SimpleCompletion ¶
func (c *Client) SimpleCompletion(req SimpleCompletionRequest) (string, error)
SimpleCompletion sends a prompt to the AI plugin and returns the generated response (with default timeout). The calling plugin must ensure that the user specified in RequesterUserID has permission to use AI features and access any data being sent to the AI model.
func (*Client) SimpleCompletionWithContext ¶
func (c *Client) SimpleCompletionWithContext(ctx context.Context, req SimpleCompletionRequest) (string, error)
SimpleCompletionWithContext sends a prompt to the AI plugin with context and returns the generated response. The calling plugin must ensure that the user specified in RequesterUserID has permission to use AI features and access any data being sent to the AI model.
type SimpleCompletionRequest ¶
type SimpleCompletionRequest struct {
// SystemPrompt is the text system prompt to send to the AI model
SystemPrompt string `json:"systemPrompt"`
// UserPrompt is the text user prompt to send to the AI model
UserPrompt string `json:"userPrompt"`
// BotUsername specifies which AI bot to use (optional, uses default bot if empty)
BotUsername string `json:"botUsername,omitempty"`
// RequesterUserID is the user ID of the user requesting the completion
RequesterUserID string `json:"requesterUserID"`
// Parameters allows customizing the completion behavior
Parameters map[string]interface{} `json:"parameters,omitempty"`
}
CompletionRequest represents the data needed for an interplugin completion request
type SimpleCompletionResponse ¶
type SimpleCompletionResponse struct {
Response string `json:"response"`
}
CompletionResponse represents the response from an interplugin completion request