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    ];
75
76    /**
77     * The attributes that are mass assignable.
78     *
79     * @var array<string>
80     */
81    protected $fillable = [
82        'product',
83        'name',
84        'status',
85        'model',
86        'version',
87        'temperature',
88        'tokens',
89        'top_p',
90        'mission',
91        'context',
92        'persona',
93        'instructions',
94        'examples',
95        'constraints',
96        'output_instructions',
97        'threshold',
98        'is_grounding',
99        'include_hashtags_prompt',
100        'exclude_hashtags_prompt',
101        'include_emojis_prompt',
102        'exclude_emojis_prompt',
103        'existent_content_instructions',
104        'existent_content_constraints',
105        'youtube_url_mission',
106        'blog_url_mission',
107        'youtube_url_instructions',
108        'blog_url_instructions',
109        'vapi_config',
110        'placeholders',
111        'call_type',
112    ];
113
114    /**
115     * The attributes that should be cast.
116     *
117     * @var array<string, string>
118     */
119    protected $casts = [
120        'version' => 'integer',
121        'tokens' => 'integer',
122        'is_grounding' => 'boolean',
123        'vapi_config' => 'array',
124        'placeholders' => 'array',
125    ];
126
127    /**
128     * The model's default attribute values.
129     *
130     * @var array<string, mixed>
131     */
132    protected $attributes = [
133        'version' => 1,
134        'is_grounding' => false,
135    ];
136}