{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package classifier\n\n## Types\n\n```go\ntype Category string\n```\nCategory represents a conversation classification category.\n\n```go\nconst (\n\tCategoryCrisis         Category = \"crisis\"\n\tCategoryGeneralSupport Category = \"general-support\"\n\tCategoryInformation    Category = \"information\"\n\tCategoryReferral       Category = \"referral\"\n)\n```\n\n```go\nfunc AllCategories() []Category\n```\nAllCategories returns all valid classification categories.\n\n```go\ntype Classification struct {\n\tCategory     Category  `json:\"category\"`\n\tConfidence   float64   `json:\"confidence\"`\n\tPriority     int       `json:\"priority\"` // 1 (highest) to 5 (lowest)\n\tSubcategory  string    `json:\"subcategory,omitempty\"`\n\tTags         []string  `json:\"tags,omitempty\"`\n\tClassifiedAt time.Time `json:\"classifiedAt\"`\n}\n```\nClassification represents the result of classifying a conversation.\n\n```go\ntype Config struct {\n\tCacheTTL time.Duration\n}\n```\nConfig holds configuration for the ConversationClassifier.\n\n```go\nfunc DefaultConfig() Config\n```\nDefaultConfig returns default classifier configuration.\n\n```go\ntype ConversationClassifier struct {\n\t// contains filtered or unexported fields\n}\n```\nConversationClassifier classifies conversations into categories with priority scoring.\n\n```go\nfunc NewConversationClassifier(provider LLMProvider, cfg Config) *ConversationClassifier\n```\nNewConversationClassifier creates a new classifier. If provider is nil, only rule-based classification is used.\n\n```go\nfunc (c *ConversationClassifier) Classify(ctx context.Context, conversationID string, messages []Message) (*Classification, error)\n```\nClassify classifies a conversation and returns its category with priority.\n\n```go\nfunc (c *ConversationClassifier) ClearCache()\n```\nClearCache removes all cached classifications.\n\n```go\nfunc (c *ConversationClassifier) InvalidateConversation(conversationID string)\n```\nInvalidateConversation removes the cached classification for a conversation.\n\n```go\ntype LLMProvider interface {\n\tClassify(ctx context.Context, systemPrompt, userPrompt string) (*Classification, error)\n}\n```\nLLMProvider abstracts the AI classification backend.\n\n```go\ntype Message struct {\n\tBody string `json:\"body\"`\n\tRole string `json:\"role\"`\n}\n```\nMessage represents a conversation message for classification.\n\n","path":"github.com/GoCodeAlone/workflow/ai/classifier","name":"classifier","synopsis":"","isRedistributable":true}
