Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
AIPrompts
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
1<?php
2
3namespace App\Http\Models;
4
5use Illuminate\Database\Eloquent\Factories\HasFactory;
6
7/**
8 * AI Prompts model for managing AI prompt configurations.
9 *
10 * Stores prompt templates used by FlyRewrite, FlyPost, and other AI features.
11 * Each prompt defines the model configuration, instructions, constraints,
12 * and examples for a specific product and action combination.
13 *
14 * @property string $_id The prompt ID
15 * @property string $product The product identifier (paragraph_rewrite, sentence_rewrite, fly_post, watch_youtube, roleplay_cold_call, roleplay_discovery_call, roleplay_evaluation, roleplay_generate_icp, roleplay_regenerate_icp)
16 * @property string $name The action/prompt name (e.g., improve-writing, humanize, change-tone)
17 * @property string|null $model The AI model identifier (e.g., gemini-2.0-flash-001:streamGenerateContent)
18 * @property int $version The prompt version number
19 * @property float|null $temperature The model temperature setting
20 * @property int|null $tokens The maximum token limit
21 * @property float|null $top_p The top_p sampling parameter
22 * @property string|null $mission The mission/goal of the prompt
23 * @property string|null $context The context description for the AI
24 * @property string|null $persona The persona description for the AI
25 * @property array<string>|null $instructions List of instructions for the AI
26 * @property array<array{input: string, output: string, hashtags?: bool|null, emojis?: bool|null, language?: string|null, length?: string|null}>|null $examples Input/output examples with optional metadata
27 * @property array<string>|null $constraints List of constraints for the AI
28 * @property string|null $output_instructions Output formatting instructions
29 * @property float|null $threshold Score threshold (used for sentence_rewrite/score)
30 * @property bool|null $is_grounding Whether to enable Google Search grounding
31 * @property string|null $include_hashtags_prompt Prompt for including hashtags
32 * @property string|null $exclude_hashtags_prompt Prompt for excluding hashtags
33 * @property string|null $include_emojis_prompt Prompt for including emojis
34 * @property string|null $exclude_emojis_prompt Prompt for excluding emojis
35 * @property string|null $existent_content_instructions Instructions for regeneration
36 * @property array<string>|null $existent_content_constraints Constraints for regeneration
37 * @property string|null $youtube_url_mission Mission for YouTube-based posts
38 * @property string|null $blog_url_mission Mission for blog-based posts
39 * @property array<string>|null $youtube_url_instructions Instructions for YouTube-based posts
40 * @property array<string>|null $blog_url_instructions Instructions for blog-based posts
41 * @property array|null $vapi_config VAPI voice configuration for roleplay prompts
42 * @property array|null $placeholders Dynamic placeholder definitions for prompt templates
43 * @property string|null $call_type The call type for roleplay prompts (e.g., cold_call, discovery_call)
44 * @property \Carbon\Carbon|null $created_at
45 * @property \Carbon\Carbon|null $updated_at
46 */
47class AIPrompts extends Moloquent
48{
49    use HasFactory;
50
51    /**
52     * The table (collection) associated with the model.
53     *
54     * @var string
55     */
56    protected $table = 'ai_prompts';
57
58    /**
59     * Available product types.
60     */
61    public const PRODUCTS = [
62        'paragraph_rewrite',
63        'sentence_rewrite',
64        'fly_post',
65        'fly_engage',
66        'watch_youtube',
67        'roleplay_cold_call',
68        'roleplay_discovery_call',
69        'roleplay_evaluation',
70        'roleplay_generate_icp',
71        'roleplay_regenerate_icp',
72        'roleplay_auto_populate',
73        'roleplay_auto_populate_grounding',
74        'fly_persona',
75    ];
76
77    /**
78     * The attributes that are mass assignable.
79     *
80     * @var array<string>
81     */
82    protected $fillable = [
83        'product',
84        'name',
85        'status',
86        'model',
87        'version',
88        'temperature',
89        'tokens',
90        'top_p',
91        'mission',
92        'context',
93        'persona',
94        'instructions',
95        'examples',
96        'constraints',
97        'output_instructions',
98        'threshold',
99        'is_grounding',
100        'include_hashtags_prompt',
101        'exclude_hashtags_prompt',
102        'include_emojis_prompt',
103        'exclude_emojis_prompt',
104        'existent_content_instructions',
105        'existent_content_constraints',
106        'youtube_url_mission',
107        'blog_url_mission',
108        'youtube_url_instructions',
109        'blog_url_instructions',
110        'vapi_config',
111        'placeholders',
112        'call_type',
113    ];
114
115    /**
116     * The attributes that should be cast.
117     *
118     * @var array<string, string>
119     */
120    protected $casts = [
121        'version' => 'integer',
122        'tokens' => 'integer',
123        'is_grounding' => 'boolean',
124        'vapi_config' => 'array',
125        'placeholders' => 'array',
126    ];
127
128    /**
129     * The model's default attribute values.
130     *
131     * @var array<string, mixed>
132     */
133    protected $attributes = [
134        'version' => 1,
135        'is_grounding' => false,
136    ];
137}