Documentation
¶
Index ¶
- Variables
- type AIProvider
- type AdGenerationRequest
- type AdJob
- type AdJobStatus
- type AdRepository
- type AdvisorService
- func (s *AdvisorService) ContinueSession(ctx context.Context, sessionID uuid.UUID, content string) (*Message, error)
- func (s *AdvisorService) GetHistory(ctx context.Context, sessionID uuid.UUID) ([]*Message, error)
- func (s *AdvisorService) GetUserSessions(ctx context.Context, userID uuid.UUID) ([]*Session, error)
- func (s *AdvisorService) SetSystemPrompt(prompt string)
- func (s *AdvisorService) StartNewSession(ctx context.Context, userID uuid.UUID, initialMessage string) (*Session, *Message, error)
- type AnalysisResult
- type EventBus
- type Feedback
- type IncubatorService
- func (s *IncubatorService) BatchAnalyze(ctx context.Context, pitchIDs []string) error
- func (s *IncubatorService) CalculateMarketViability(pitch *Pitch) string
- func (s *IncubatorService) GetPitch(ctx context.Context, id string) (*Pitch, error)
- func (s *IncubatorService) GetUserPitches(ctx context.Context, userID string) ([]*Pitch, error)
- func (s *IncubatorService) RefinePitch(ctx context.Context, pitchID, newDescription string, newTechStack []string) (*Pitch, error)
- func (s *IncubatorService) RequestPivotIdeas(ctx context.Context, pitchID string) ([]string, error)
- func (s *IncubatorService) SubmitPitch(ctx context.Context, userID, title, description, market string, ...) (*Pitch, error)
- type Message
- type OracleInsight
- type OracleService
- type Pitch
- type PitchRepository
- type PitchStatus
- type Repository
- type Role
- type Service
- type Session
- type SimulationConfig
- type SimulationResult
- type SimulationType
- type StandardSimulationType
- type VideoGeneratorClient
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidPrompt = errors.New("invalid prompt: prompt cannot be empty") ErrJobNotFound = errors.New("job not found") ErrGenFailed = errors.New("generation failed") )
Common errors for the AI Ad Service.
var ( ErrSessionNotFound = errors.New("chat session not found") ErrEmptyMessage = errors.New("message content cannot be empty") )
Common errors
Functions ¶
This section is empty.
Types ¶
type AIProvider ¶
type AIProvider interface {
AnalyzePitch(ctx context.Context, pitch *Pitch) (*AnalysisResult, error)
GeneratePivotIdeas(ctx context.Context, pitch *Pitch) ([]string, error)
}
AIProvider defines the interface for the Large Language Model service.
type AdGenerationRequest ¶
type AdGenerationRequest struct {
UserID string
ProjectID string
Prompt string
Style string // e.g., "cinematic", "minimalist", "cyberpunk"
Duration int // Duration in seconds
AspectRatio string // e.g., "16:9", "9:16"
}
AdGenerationRequest encapsulates the parameters required to generate an AI video ad.
type AdJob ¶
type AdJob struct {
ID string `json:"id"`
UserID string `json:"user_id"`
ProjectID string `json:"project_id"`
Status AdJobStatus `json:"status"`
VideoURL string `json:"video_url,omitempty"`
ErrorMsg string `json:"error_msg,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
AdJob represents the database record for a generation task.
type AdJobStatus ¶
type AdJobStatus string
AdJobStatus represents the state of an asynchronous generation job.
const ( StatusPending AdJobStatus = "PENDING" StatusProcessing AdJobStatus = "PROCESSING" StatusCompleted AdJobStatus = "COMPLETED" StatusFailed AdJobStatus = "FAILED" )
type AdRepository ¶
type AdRepository interface {
CreateJob(ctx context.Context, job *AdJob) error
GetJob(ctx context.Context, id string) (*AdJob, error)
UpdateJobStatus(ctx context.Context, id string, status AdJobStatus, videoURL string, errorMsg string) error
}
AdRepository defines the data access layer requirements for this service. This follows the Consumer-Driven Interface pattern.
type AdvisorService ¶
type AdvisorService struct {
// contains filtered or unexported fields
}
AdvisorService implements the Service interface.
func NewAdvisorService ¶
func NewAdvisorService(repo Repository, ai AIProvider, logger *slog.Logger) *AdvisorService
NewAdvisorService creates a new instance of the AI Advisor service.
func (*AdvisorService) ContinueSession ¶
func (s *AdvisorService) ContinueSession(ctx context.Context, sessionID uuid.UUID, content string) (*Message, error)
ContinueSession handles an ongoing conversation.
func (*AdvisorService) GetHistory ¶
GetHistory retrieves the message history for a session.
func (*AdvisorService) GetUserSessions ¶
GetUserSessions retrieves all sessions for a specific user.
func (*AdvisorService) SetSystemPrompt ¶
func (s *AdvisorService) SetSystemPrompt(prompt string)
SetSystemPrompt allows dynamic updating of the system persona.
type AnalysisResult ¶
type AnalysisResult struct {
OverallScore float64
KeyStrengths []string
Weaknesses []string
PivotSuggestion string
FeedbackItems []Feedback
}
AnalysisResult is the raw output from the AI provider.
type Feedback ¶
type Feedback struct {
ID string `json:"id"`
PitchID string `json:"pitch_id"`
Category string `json:"category"` // e.g., "Viability", "Competition", "Tech"
Content string `json:"content"`
Sentiment string `json:"sentiment"` // "Positive", "Neutral", "Negative"
CreatedAt time.Time `json:"created_at"`
}
Feedback represents AI or mentor generated insights.
type IncubatorService ¶
type IncubatorService struct {
// contains filtered or unexported fields
}
IncubatorService manages the lifecycle of startup pitches and AI interactions.
func NewIncubatorService ¶
func NewIncubatorService( repo PitchRepository, ai AIProvider, events EventBus, logger *slog.Logger, ) *IncubatorService
NewIncubatorService creates a new instance of the service.
func (*IncubatorService) BatchAnalyze ¶
func (s *IncubatorService) BatchAnalyze(ctx context.Context, pitchIDs []string) error
BatchAnalyze is an administrative function to re-analyze multiple pitches (e.g., after model upgrade).
func (*IncubatorService) CalculateMarketViability ¶
func (s *IncubatorService) CalculateMarketViability(pitch *Pitch) string
CalculateMarketViability is a helper to aggregate scores and feedback sentiment.
func (*IncubatorService) GetUserPitches ¶
GetUserPitches retrieves all pitches for a specific user.
func (*IncubatorService) RefinePitch ¶
func (s *IncubatorService) RefinePitch(ctx context.Context, pitchID, newDescription string, newTechStack []string) (*Pitch, error)
RefinePitch allows a user to update their pitch based on feedback, triggering a re-analysis.
func (*IncubatorService) RequestPivotIdeas ¶
RequestPivotIdeas asks the AI for alternative directions based on the current pitch.
func (*IncubatorService) SubmitPitch ¶
func (s *IncubatorService) SubmitPitch(ctx context.Context, userID, title, description, market string, techStack []string) (*Pitch, error)
SubmitPitch accepts a new pitch from a user and initiates the analysis process.
type Message ¶
type Message struct {
ID uuid.UUID `json:"id"`
SessionID uuid.UUID `json:"session_id"`
Role Role `json:"role"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
Metadata map[string]interface{}
}
Message represents a single exchange in the conversation.
type OracleInsight ¶
OracleInsight represents AI-driven modifications to simulation parameters.
type OracleService ¶
type OracleService interface {
// RunStandardSimulation executes traditional financial models (e.g., GBM Monte Carlo).
RunStandardSimulation(ctx context.Context, config SimulationConfig) (*SimulationResult, error)
// RunAdvancedOracleSimulation executes a simulation where parameters are dynamically
// adjusted based on AI/ML derived market regime predictions.
RunAdvancedOracleSimulation(ctx context.Context, config SimulationConfig, marketContext string) (*SimulationResult, error)
}
OracleService defines the contract for the AI-enhanced financial oracle.
func NewOracleService ¶
func NewOracleService(logger *slog.Logger) OracleService
NewOracleService creates a new instance of the OracleService.
type Pitch ¶
type Pitch struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Title string `json:"title"`
Description string `json:"description"`
Market string `json:"market"`
TechStack []string `json:"tech_stack"`
Status PitchStatus `json:"status"`
Score float64 `json:"score"` // 0.0 to 10.0
Feedback []Feedback `json:"feedback"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Version int `json:"version"`
}
Pitch represents a startup idea submitted to the incubator.
type PitchRepository ¶
type PitchRepository interface {
Save(ctx context.Context, pitch *Pitch) error
GetByID(ctx context.Context, id string) (*Pitch, error)
Update(ctx context.Context, pitch *Pitch) error
ListByUserID(ctx context.Context, userID string) ([]*Pitch, error)
Delete(ctx context.Context, id string) error
}
PitchRepository defines the data access layer for pitches.
type PitchStatus ¶
type PitchStatus string
PitchStatus represents the lifecycle state of a startup pitch.
const ( PitchStatusDraft PitchStatus = "DRAFT" PitchStatusSubmitted PitchStatus = "SUBMITTED" PitchStatusProcessing PitchStatus = "PROCESSING" PitchStatusReviewed PitchStatus = "REVIEWED" PitchStatusRefining PitchStatus = "REFINING" PitchStatusFunded PitchStatus = "FUNDED" // Hypothetical end state PitchStatusRejected PitchStatus = "REJECTED" )
type Repository ¶
type Repository interface {
CreateSession(ctx context.Context, session *Session) error
GetSession(ctx context.Context, id uuid.UUID) (*Session, error)
GetUserSessions(ctx context.Context, userID uuid.UUID) ([]*Session, error)
SaveMessage(ctx context.Context, msg *Message) error
GetMessages(ctx context.Context, sessionID uuid.UUID) ([]*Message, error)
UpdateSessionTitle(ctx context.Context, sessionID uuid.UUID, title string) error
}
Repository defines the storage requirements for the advisor service. This interface allows the service to be decoupled from the specific database implementation.
type Service ¶
type Service interface {
StartNewSession(ctx context.Context, userID uuid.UUID, initialMessage string) (*Session, *Message, error)
ContinueSession(ctx context.Context, sessionID uuid.UUID, content string) (*Message, error)
GetHistory(ctx context.Context, sessionID uuid.UUID) ([]*Message, error)
GetUserSessions(ctx context.Context, userID uuid.UUID) ([]*Session, error)
}
Service defines the public API for the AI Advisor.
func NewAdService ¶
func NewAdService( repo AdRepository, aiClient VideoGeneratorClient, logger *slog.Logger, ) Service
NewAdService creates a new instance of the AI Ad Service with dependencies.
type Session ¶
type Session struct {
ID uuid.UUID `json:"id"`
UserID uuid.UUID `json:"user_id"`
Title string `json:"title"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Session represents a chat conversation context.
type SimulationConfig ¶
type SimulationConfig struct {
AssetID string
InitialPrice float64
Volatility float64 // Annualized volatility (sigma)
Drift float64 // Annualized return rate (mu)
TimeHorizon float64 // In years (e.g., 1.0 for 1 year)
TimeSteps int // Number of steps in the simulation
NumPaths int // Number of simulation paths (e.g., 10000)
RiskFreeRate float64
Seed int64 // Optional seed for reproducibility
IncludeOracle bool // If true, applies AI adjustments
}
SimulationConfig holds parameters for running a financial simulation.
type SimulationResult ¶
type SimulationResult struct {
SimulationID string
Timestamp time.Time
Config SimulationConfig
ExpectedPrice float64
MedianPrice float64
StandardDev float64
VaR95 float64 // Value at Risk (95% confidence)
VaR99 float64 // Value at Risk (99% confidence)
BestCase float64 // 95th percentile
WorstCase float64 // 5th percentile
SamplePaths [][]float64
ExecutionTime time.Duration
OracleInsights []string // Explanations of AI adjustments applied
}
SimulationResult contains the aggregated output of the simulation.
type SimulationType ¶
type SimulationType string
SimulationType defines the category of financial simulation.
type StandardSimulationType ¶
type StandardSimulationType string
const ( SimTypeMonteCarlo StandardSimulationType = "MONTE_CARLO" SimTypeHistorical StandardSimulationType = "HISTORICAL" SimTypeAIOracle StandardSimulationType = "AI_ORACLE" )
type VideoGeneratorClient ¶
type VideoGeneratorClient interface {
// GenerateVideo initiates the video generation and returns a URL or an identifier.
// If the provider is synchronous, it returns the final URL.
GenerateVideo(ctx context.Context, prompt, style string, duration int, ratio string) (string, error)
}
VideoGeneratorClient defines the interface for the external AI video generation provider.