Documentation
¶
Index ¶
- func ValidateConfig(cfg Config) error
- type Agent
- func (a *Agent) Chat(ctx context.Context, notebookID, message string, history []ChatMessage) (*ChatResponse, error)
- func (a *Agent) GenerateFAQ(ctx context.Context, sources []Source) (string, error)
- func (a *Agent) GenerateInfographImage(ctx context.Context, prompt string) (string, error)
- func (a *Agent) GenerateOutline(ctx context.Context, sources []Source) (string, error)
- func (a *Agent) GeneratePodcastScript(ctx context.Context, sources []Source, voice string) (string, error)
- func (a *Agent) GenerateStudyGuide(ctx context.Context, sources []Source) (string, error)
- func (a *Agent) GenerateSummary(ctx context.Context, sources []Source, length string) (string, error)
- func (a *Agent) GenerateTransformation(ctx context.Context, req *TransformationRequest, sources []Source) (*TransformationResponse, error)
- type ChatMessage
- type ChatRequest
- type ChatResponse
- type ChatSession
- type Config
- type ErrorResponse
- type HealthResponse
- type Note
- type Notebook
- type Podcast
- type Server
- type Source
- type SourceSummary
- type Store
- func (s *Store) AddChatMessage(ctx context.Context, sessionID, role, content string, sources []string) (*ChatMessage, error)
- func (s *Store) Close() error
- func (s *Store) CreateChatSession(ctx context.Context, notebookID, title string) (*ChatSession, error)
- func (s *Store) CreateNote(ctx context.Context, note *Note) error
- func (s *Store) CreateNotebook(ctx context.Context, name, description string, metadata map[string]interface{}) (*Notebook, error)
- func (s *Store) CreateSource(ctx context.Context, source *Source) error
- func (s *Store) DeleteChatSession(ctx context.Context, id string) error
- func (s *Store) DeleteNote(ctx context.Context, id string) error
- func (s *Store) DeleteNotebook(ctx context.Context, id string) error
- func (s *Store) DeleteSource(ctx context.Context, id string) error
- func (s *Store) GetChatSession(ctx context.Context, id string) (*ChatSession, error)
- func (s *Store) GetNote(ctx context.Context, id string) (*Note, error)
- func (s *Store) GetNotebook(ctx context.Context, id string) (*Notebook, error)
- func (s *Store) GetSource(ctx context.Context, id string) (*Source, error)
- func (s *Store) ListChatSessions(ctx context.Context, notebookID string) ([]ChatSession, error)
- func (s *Store) ListNotebooks(ctx context.Context) ([]Notebook, error)
- func (s *Store) ListNotes(ctx context.Context, notebookID string) ([]Note, error)
- func (s *Store) ListSources(ctx context.Context, notebookID string) ([]Source, error)
- func (s *Store) UpdateNotebook(ctx context.Context, id string, name, description string, ...) (*Notebook, error)
- func (s *Store) UpdateSourceChunkCount(ctx context.Context, id string, chunkCount int) error
- type TransformationRequest
- type TransformationResponse
- type VectorStats
- type VectorStore
- func (vs *VectorStore) Delete(ctx context.Context, source string) error
- func (vs *VectorStore) ExtractDocument(ctx context.Context, path string) (string, error)
- func (vs *VectorStore) GetStats(ctx context.Context) (VectorStats, error)
- func (vs *VectorStore) IngestDocuments(ctx context.Context, paths []string) error
- func (vs *VectorStore) IngestText(ctx context.Context, sourceName, content string) error
- func (vs *VectorStore) SimilaritySearch(ctx context.Context, query string, numDocs int) ([]schema.Document, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateConfig ¶
ValidateConfig validates the configuration
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent handles AI operations for generating notes and chat responses
func NewAgent ¶
func NewAgent(cfg Config, vectorStore *VectorStore) (*Agent, error)
NewAgent creates a new agent
func (*Agent) Chat ¶
func (a *Agent) Chat(ctx context.Context, notebookID, message string, history []ChatMessage) (*ChatResponse, error)
Chat performs a chat query with RAG
func (*Agent) GenerateFAQ ¶
GenerateFAQ generates an FAQ from sources
func (*Agent) GenerateInfographImage ¶
GenerateInfographImage generates an infographic image using the Nano Banana Pro SDK
func (*Agent) GenerateOutline ¶
GenerateOutline generates an outline from sources
func (*Agent) GeneratePodcastScript ¶
func (a *Agent) GeneratePodcastScript(ctx context.Context, sources []Source, voice string) (string, error)
GeneratePodcastScript generates a podcast script from sources
func (*Agent) GenerateStudyGuide ¶
GenerateStudyGuide generates a study guide from sources
func (*Agent) GenerateSummary ¶
func (a *Agent) GenerateSummary(ctx context.Context, sources []Source, length string) (string, error)
GenerateSummary generates a summary from sources
func (*Agent) GenerateTransformation ¶
func (a *Agent) GenerateTransformation(ctx context.Context, req *TransformationRequest, sources []Source) (*TransformationResponse, error)
GenerateTransformation generates a note based on transformation type
type ChatMessage ¶
type ChatMessage struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Role string `json:"role"` // "user", "assistant", "system"
Content string `json:"content"`
Sources []string `json:"sources,omitempty"` // Source IDs referenced
CreatedAt time.Time `json:"created_at"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
ChatMessage represents a chat message
type ChatRequest ¶
type ChatRequest struct {
Message string `json:"message"`
SessionID string `json:"session_id,omitempty"`
Context map[string]interface{} `json:"context,omitempty"`
}
ChatRequest represents a chat request
type ChatResponse ¶
type ChatResponse struct {
Message string `json:"message"`
Sources []SourceSummary `json:"sources"`
SessionID string `json:"session_id"`
MessageID string `json:"message_id"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
ChatResponse represents a chat response
type ChatSession ¶
type ChatSession struct {
ID string `json:"id"`
NotebookID string `json:"notebook_id"`
Title string `json:"title"`
Messages []ChatMessage `json:"messages"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
ChatSession represents a chat session within a notebook
type Config ¶
type Config struct {
// Server settings
ServerHost string
ServerPort string
// LLM settings
OpenAIAPIKey string
OpenAIBaseURL string
OpenAIModel string
EmbeddingModel string
GoogleAPIKey string
OllamaBaseURL string
OllamaModel string
// Vector store settings
VectorStoreType string // "memory", "supabase", "pgvector", "redis", "sqlite"
SupabaseURL string
SupabaseKey string
PostgreSQLURL string
RedisURL string
SQLitePath string
// Store settings (for checkpoints)
StoreType string // "memory", "sqlite", "postgres", "redis"
StorePath string
// Application settings
MaxSources int
MaxContextLength int
ChunkSize int
ChunkOverlap int
// Podcast generation
EnablePodcast bool
PodcastVoice string
// Document conversion
EnableMarkitdown bool
// LangSmith tracing (optional)
LangChainAPIKey string
LangChainProject string
}
Config holds the application configuration
func LoadConfig ¶
func LoadConfig() Config
LoadConfig loads configuration from environment variables with defaults
func (*Config) GetBaseURL ¶
GetBaseURL returns the appropriate base URL for the LLM provider
func (*Config) SupportsFunctionCalling ¶
SupportsFunctionCalling returns true if the configured model supports function calling
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Code string `json:"code,omitempty"`
Details string `json:"details,omitempty"`
}
ErrorResponse represents an error response
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
Version string `json:"version"`
Timestamp int64 `json:"timestamp"`
Services map[string]string `json:"services"`
}
HealthResponse represents the health check response
type Note ¶
type Note struct {
ID string `json:"id"`
NotebookID string `json:"notebook_id"`
Title string `json:"title"`
Content string `json:"content"`
Type string `json:"type"` // "summary", "faq", "study_guide", "outline", "custom"
SourceIDs []string `json:"source_ids"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Note represents a note generated from sources
type Notebook ¶
type Notebook struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Notebook represents a collection of sources and notes
type Podcast ¶
type Podcast struct {
ID string `json:"id"`
NotebookID string `json:"notebook_id"`
Title string `json:"title"`
Script string `json:"script"`
AudioURL string `json:"audio_url,omitempty"`
Duration int `json:"duration,omitempty"` // in seconds
Voice string `json:"voice"`
Status string `json:"status"` // "pending", "generating", "completed", "error"
SourceIDs []string `json:"source_ids"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Podcast represents an audio podcast generated from sources
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles HTTP requests
type Source ¶
type Source struct {
ID string `json:"id"`
NotebookID string `json:"notebook_id"`
Name string `json:"name"`
Type string `json:"type"` // "file", "url", "text", "youtube"
URL string `json:"url,omitempty"`
Content string `json:"content,omitempty"`
FileName string `json:"file_name,omitempty"`
FileSize int64 `json:"file_size,omitempty"`
ChunkCount int `json:"chunk_count"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Source represents a document source added to a notebook
type SourceSummary ¶
type SourceSummary struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
}
SourceSummary is a lightweight source reference
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store handles data persistence for notebooks, sources, notes, and chat sessions
func (*Store) AddChatMessage ¶
func (s *Store) AddChatMessage(ctx context.Context, sessionID, role, content string, sources []string) (*ChatMessage, error)
AddChatMessage adds a message to a chat session
func (*Store) CreateChatSession ¶
func (s *Store) CreateChatSession(ctx context.Context, notebookID, title string) (*ChatSession, error)
CreateChatSession creates a new chat session
func (*Store) CreateNote ¶
CreateNote creates a new note
func (*Store) CreateNotebook ¶
func (s *Store) CreateNotebook(ctx context.Context, name, description string, metadata map[string]interface{}) (*Notebook, error)
CreateNotebook creates a new notebook
func (*Store) CreateSource ¶
CreateSource creates a new source
func (*Store) DeleteChatSession ¶
DeleteChatSession deletes a chat session
func (*Store) DeleteNote ¶
DeleteNote deletes a note
func (*Store) DeleteNotebook ¶
DeleteNotebook deletes a notebook and all its data
func (*Store) DeleteSource ¶
DeleteSource deletes a source
func (*Store) GetChatSession ¶
GetChatSession retrieves a chat session by ID
func (*Store) GetNotebook ¶
GetNotebook retrieves a notebook by ID
func (*Store) ListChatSessions ¶
ListChatSessions retrieves all chat sessions for a notebook
func (*Store) ListNotebooks ¶
ListNotebooks retrieves all notebooks
func (*Store) ListSources ¶
ListSources retrieves all sources for a notebook
type TransformationRequest ¶
type TransformationRequest struct {
Type string `json:"type"` // "summary", "faq", "study_guide", "outline", "podcast", "custom"
Prompt string `json:"prompt"` // Custom prompt for "custom" type
SourceIDs []string `json:"source_ids"` // Specific sources to use, empty = all
Length string `json:"length"` // "short", "medium", "long"
Format string `json:"format"` // "markdown", "bullet_points", "paragraphs"
}
TransformationRequest represents a request to generate a note
type TransformationResponse ¶
type TransformationResponse struct {
ID string `json:"id"`
Type string `json:"type"`
Content string `json:"content"`
Sources []SourceSummary `json:"sources"`
CreatedAt time.Time `json:"created_at"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TransformationResponse represents the response from a transformation
type VectorStats ¶
VectorStats contains statistics about the vector store
type VectorStore ¶
type VectorStore struct {
// contains filtered or unexported fields
}
VectorStore wraps different vector store implementations
func NewVectorStore ¶
func NewVectorStore(cfg Config) (*VectorStore, error)
NewVectorStore creates a new vector store based on configuration
func (*VectorStore) Delete ¶
func (vs *VectorStore) Delete(ctx context.Context, source string) error
Delete removes documents by source
func (*VectorStore) ExtractDocument ¶
ExtractDocument reads and converts a document to text/markdown
func (*VectorStore) GetStats ¶
func (vs *VectorStore) GetStats(ctx context.Context) (VectorStats, error)
GetStats returns statistics about the vector store
func (*VectorStore) IngestDocuments ¶
func (vs *VectorStore) IngestDocuments(ctx context.Context, paths []string) error
IngestDocuments loads and indexes documents from file paths
func (*VectorStore) IngestText ¶
func (vs *VectorStore) IngestText(ctx context.Context, sourceName, content string) error
IngestText ingests raw text content
func (*VectorStore) SimilaritySearch ¶
func (vs *VectorStore) SimilaritySearch(ctx context.Context, query string, numDocs int) ([]schema.Document, error)
SimilaritySearch performs a similarity search (simple keyword matching for now)