You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Creates a language model session configured for excerpt generation.
24
37
publicfunc makeSession()->LanguageModelSession{
@@ -28,63 +41,48 @@ public struct ExcerptGeneration {
28
41
)
29
42
}
30
43
44
+
/// Instructions for the language model session.
45
+
publicstaticvarinstructions:String{
46
+
"""
47
+
Generate exactly 3 excerpts for the blog post and follow the instructions from the prompt regarding the length and the style.
48
+
49
+
Generate excerpts in the same language as the POST_CONTENT.
50
+
51
+
**Paramters**
52
+
- POST_CONTENT: contents of the post (HTML or plain text)
53
+
- GENERATED_CONTENT_LENGTH: the length of the generated content
54
+
- GENERATION_STYLE: the writing style to follow
55
+
56
+
**Requirements**
57
+
- Each excerpt must follow the provided GENERATED_CONTENT_LENGTH and use GENERATION_STYLE
58
+
59
+
**Excerpt best practices**
60
+
- Follow the best practices for post excerpts esteblished in the WordPress ecosystem
61
+
- Include the post's main value proposition
62
+
- Use active voice (avoid "is", "are", "was", "were" when possible)
63
+
- End with implicit promise of more information
64
+
- Do not use ellipsis (...) at the end
65
+
- Focus on value, not summary
66
+
- Include strategic keywords naturally
67
+
- Write independently from the introduction – excerpt shouldn't just duplicate your opening paragraph. While your introduction eases readers into the topic, your excerpt needs to work as standalone copy that makes sense out of context—whether it appears in search results, social media cards, or email newsletters.
68
+
"""
69
+
}
70
+
71
+
31
72
/// Creates a prompt for this excerpt configuration.
32
73
publicfunc makePrompt(content:String)->String{
33
74
"""
34
75
Generate three different excerpts for the given post and parameters
// MARK: - Building Blocks (for UI with session continuity)
60
-
61
-
/// Instructions for the language model session.
62
-
publicstaticvarinstructions:String{
63
-
"""
64
-
Generate exactly 3 excerpts for the blog post and follow the instructions from the prompt regarding the length and the style.
65
-
66
-
Generate excerpts in the same language as the POST_CONTENT.
67
-
68
-
**Paramters**
69
-
- POST_CONTENT: contents of the post (HTML or plain text)
70
-
- GENERATED_CONTENT_LENGTH: the length of the generated content
71
-
- GENERATION_STYLE: the writing style to follow
72
-
73
-
**Requirements**
74
-
- Each excerpt must follow the provided GENERATED_CONTENT_LENGTH and use GENERATION_STYLE
75
-
76
-
**Excerpt best practices**
77
-
- Follow the best practices for post excerpts esteblished in the WordPress ecosystem
78
-
- Include the post's main value proposition
79
-
- Use active voice (avoid "is", "are", "was", "were" when possible)
80
-
- End with implicit promise of more information
81
-
- Do not use ellipsis (...) at the end
82
-
- Focus on value, not summary
83
-
- Include strategic keywords naturally
84
-
- Write independently from the introduction – excerpt shouldn't just duplicate your opening paragraph. While your introduction eases readers into the topic, your excerpt needs to work as standalone copy that makes sense out of context—whether it appears in search results, social media cards, or email newsletters.
85
-
"""
86
-
}
87
-
88
86
/// Prompt for generating additional excerpt options.
0 commit comments