llmcontext

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder builds contexts for LLM requests

func NewLLMContextBuilder

func NewLLMContextBuilder(
	pluginAPI *pluginapi.Client,
	toolProvider ToolProvider,
	mcpToolProvider MCPToolProvider,
	configProvider ConfigProvider,
) *Builder

NewLLMContextBuilder creates a new LLM context builder

func (*Builder) BuildLLMContextUserRequest

func (b *Builder) BuildLLMContextUserRequest(bot *bots.Bot, requestingUser *model.User, channel *model.Channel, opts ...llm.ContextOption) *llm.Context

BuildLLMContextUserRequest is a helper function to collect the required context for a user request.

func (*Builder) WithLLMContextBot

func (b *Builder) WithLLMContextBot(bot *bots.Bot) llm.ContextOption

func (*Builder) WithLLMContextChannel

func (b *Builder) WithLLMContextChannel(channel *model.Channel) llm.ContextOption

func (*Builder) WithLLMContextDefaultTools

func (b *Builder) WithLLMContextDefaultTools(bot *bots.Bot) llm.ContextOption

WithLLMContextDefaultTools adds default tools to the LLM context for the requesting user

func (*Builder) WithLLMContextNoTools added in v1.4.0

func (b *Builder) WithLLMContextNoTools() llm.ContextOption

WithLLMContextNoTools explicitly disables tools for this context session only, overriding the bot's DisableTools configuration. This allows inter-plugin requests to work with tool-enabled bots by bypassing tools for non-streaming calls.

func (*Builder) WithLLMContextParameters

func (b *Builder) WithLLMContextParameters(params map[string]interface{}) llm.ContextOption

func (*Builder) WithLLMContextRequestingUser

func (b *Builder) WithLLMContextRequestingUser(user *model.User) llm.ContextOption

func (*Builder) WithLLMContextServerInfo

func (b *Builder) WithLLMContextServerInfo() llm.ContextOption

func (*Builder) WithLLMContextTools added in v1.5.0

func (b *Builder) WithLLMContextTools(bot *bots.Bot) llm.ContextOption

WithLLMContextTools adds tools to the LLM context the requester can access. Tools are always added for LLM awareness; execution is controlled via WithToolsDisabled() based on the context (e.g., DM vs channel).

type ConfigProvider

type ConfigProvider interface {
	GetEnableLLMTrace() bool
	GetServiceByID(id string) (llm.ServiceConfig, bool)
}

ConfigProvider provides configuration access

type MCPToolProvider

type MCPToolProvider interface {
	GetToolsForUser(userID string) ([]llm.Tool, *mcp.Errors)
}

MCPToolProvider provides MCP tools for a user

type ToolProvider

type ToolProvider interface {
	GetTools(bot *bots.Bot) []llm.Tool
}

ToolProvider provides built-in tools for a bot and context

Jump to

Keyboard shortcuts

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