import { BaseAIUseCase } from '../../middleware/usecases/base/base-ai.usecase'; import { BaseAIRequest, BaseAIResult } from '../../middleware/shared/types/base-request.types'; import { ModelParameterOverrides } from '../../middleware/services/model-parameter-manager/model-parameter-manager.service'; /** * Character generation prompt data */ export interface CharacterPromptData { characterName?: string; role: string; setting?: { Name: string; TimePeriod: string; Location: string; Culture: string; Atmosphere: string; }; genre?: { Name: string; Themes: string; Style: string; Conventions: string; }; targetAudience?: { Name: string; AgeRange: string; ReadingLevel: string; PreferredThemes: string; }; constraints: string[]; } /** * Character generation request interface * Extends BaseAIRequest to support complex prompt objects */ export interface CharacterGeneratorRequest extends BaseAIRequest { } /** * Generated character structure (expected JSON response) */ export interface GeneratedCharacter { Name: string; Age: string; Description: string; Appearance: string; Personality: string; Background: string; Goals: string; Conflicts: string; Relationships: string; SpecialAbilities?: string; Weaknesses: string; Motivation: string; CharacterArc: string; Dialogue_Style: string; Key_Relationships: string[]; Character_Flaws: string[]; Strengths: string[]; } /** * Character generation result interface * Extends BaseAIResult with character-specific data */ export interface CharacterGeneratorResult extends BaseAIResult { character: GeneratedCharacter; rawResponse: string; wasRepaired: boolean; } /** * Advanced character generator use case that demonstrates: * - FlatFormatter for input context preparation * - Structured JSON output with schema * - JSON cleaning and repair * - Complex context building with presets * - Message pattern with separate message files */ export declare class CharacterGeneratorUseCase extends BaseAIUseCase { /** * System message from message file */ protected readonly systemMessage: string; /** * Get the user template from message file */ protected getUserTemplate(): (formattedPrompt: string) => string; /** * Override model parameters for character generation * * Uses the Creative Writing preset optimized for generating rich, varied character descriptions. * This configuration balances creativity with coherence, ensuring characters are interesting * while maintaining consistency across all fields. * * @returns ModelParameterOverrides with Creative Writing preset * * **Parameter Selection Rationale:** * - `temperature: 0.8` - Higher temperature for creative, varied character traits and descriptions * - `repeatPenalty: 1.3` - Moderate penalty to reduce word repetition while allowing natural language flow * - `frequencyPenalty: 0.2` - Encourages diverse vocabulary for richer character descriptions * - `presencePenalty: 0.2` - Promotes introducing new character traits and avoiding clichés * - `topP: 0.92` - High nucleus sampling for creative token selection * - `topK: 60` - Moderate vocabulary diversity for balanced output * - `repeatLastN: 128` - Extended context window to maintain consistency across all character fields * * **Expected Impact:** * - More unique and memorable characters with distinct personalities * - Reduced repetitive phrasing across character description fields * - Natural, fluid writing style that doesn't feel formulaic * - Consistent character voice throughout the entire description * * For more information about parameter presets, see docs/OLLAMA_PARAMETERS.md */ protected getParameterOverrides(): ModelParameterOverrides; /** * Format the user message using FlatFormatter and presets */ protected formatUserMessage(prompt: CharacterPromptData | string): string; /** * Create the result with parsed character data */ protected createResult(content: string, usedPrompt: string, thinking?: string): CharacterGeneratorResult; /** * Validate that the character has all required fields */ private validateCharacter; /** * Create a fallback character when JSON parsing completely fails */ private createFallbackCharacter; } //# sourceMappingURL=character-generator.usecase.d.ts.map