context

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package context provides context assembly for OpenBotStack.

The ContextAssembler builds the LLM prompt from:

  • AssistantProfile (persona, system prompt)
  • Memory (short-term and long-term)
  • Current request

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrProfileNotFound is returned when the assistant profile doesn't exist.
	ErrProfileNotFound = errors.New("context: profile not found")

	// ErrMemoryRetrievalFailed is returned when memory retrieval fails.
	ErrMemoryRetrievalFailed = errors.New("context: memory retrieval failed")

	// ErrAssemblyFailed is returned when context assembly fails.
	ErrAssemblyFailed = errors.New("context: assembly failed")
)

Functions

This section is empty.

Types

type AssembledContext

type AssembledContext struct {
	// SystemPrompt is the final system prompt including persona.
	SystemPrompt string

	// Messages is the conversation history with injected memory.
	Messages []skills.Message

	// AvailableTools is the list of tools the model can call.
	AvailableTools []skills.ToolDefinition

	// Constraints limits applied to this request.
	Constraints skills.ModelConstraints

	// RelevantMemories are the memories retrieved for this context.
	RelevantMemories []abstraction.MemoryEntry
}

AssembledContext is the complete context for an LLM call.

type AssistantContext

type AssistantContext struct {
	// ProfileID is the assistant profile identifier.
	ProfileID string

	// Persona defines tone, verbosity, domain.
	Persona Persona

	// BaseSystemPrompt is the foundation system prompt.
	BaseSystemPrompt string

	// EnabledSkillIDs lists available skills.
	EnabledSkillIDs []string

	// MaxReflections bounds the reflection loop.
	MaxReflections int
}

AssistantContext provides the assistant's static configuration.

type ContextAssembler

type ContextAssembler interface {
	// Assemble builds the context from profile, memory, and request.
	Assemble(
		ctx context.Context,
		assistant AssistantContext,
		request UserRequest,
		conversationHistory []skills.Message,
	) (*AssembledContext, error)
}

ContextAssembler builds the complete context for an LLM request.

type Persona

type Persona struct {
	Tone      string // "professional", "friendly", "neutral"
	Verbosity string // "low", "medium", "high"
	Domain    string // e.g., "cardiology", "general"
}

Persona defines the assistant's personality.

type UserRequest

type UserRequest struct {
	// Message is the user's input.
	Message string

	// ConversationID links to the ongoing conversation.
	ConversationID string

	// TenantID identifies the tenant.
	TenantID string

	// UserID identifies the user.
	UserID string
}

UserRequest is the incoming user message.

Jump to

Keyboard shortcuts

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