Use system instructions to steer the behavior of a model
This commit is contained in:
@@ -33,15 +33,7 @@ def llm_text_gen(prompt):
|
|||||||
blog_output_format, blog_length = read_return_config_section('blog_characteristics')
|
blog_output_format, blog_length = read_return_config_section('blog_characteristics')
|
||||||
|
|
||||||
# Construct the system prompt with the sidebar config params.
|
# Construct the system prompt with the sidebar config params.
|
||||||
system_instructions = f"""
|
system_instructions = read_return_config_section('system_prompt')
|
||||||
Below are the guidelines to follow:
|
|
||||||
1). You must respond in {blog_language} language.
|
|
||||||
2). Tone and Brand Alignment: Adjust your tone, voice, personality for {blog_tone} audience.
|
|
||||||
3). Make sure your response content length is of {blog_length} words.
|
|
||||||
4). The type of blog is {blog_type}, write accordingly.
|
|
||||||
5). The demographic for this content is {blog_demographic}.
|
|
||||||
6). Your response should be in {blog_output_format} format.
|
|
||||||
"""
|
|
||||||
|
|
||||||
#gpt_provider = check_gpt_provider(gpt_provider)
|
#gpt_provider = check_gpt_provider(gpt_provider)
|
||||||
# Check if API key is provided for the given gpt_provider
|
# Check if API key is provided for the given gpt_provider
|
||||||
|
|||||||
@@ -30,7 +30,14 @@ def read_return_config_section(config_section):
|
|||||||
with open(config_path, 'r', encoding="utf-8") as file:
|
with open(config_path, 'r', encoding="utf-8") as file:
|
||||||
config = json.load(file)
|
config = json.load(file)
|
||||||
|
|
||||||
if config_section == 'llm_config':
|
|
||||||
|
if config_section == 'system_prompt':
|
||||||
|
prompt_file_path = os.path.join(os.getcwd(), 'lib', 'workspace', 'alwrity_prompts', 'alwrity_system_instruction.prompts')
|
||||||
|
with open(prompt_file_path, 'r') as file:
|
||||||
|
content = file.read()
|
||||||
|
return content
|
||||||
|
|
||||||
|
elif config_section == 'llm_config':
|
||||||
gpt_provider = config['LLM Options']['GPT Provider']
|
gpt_provider = config['LLM Options']['GPT Provider']
|
||||||
model = config['LLM Options']['Model']
|
model = config['LLM Options']['Model']
|
||||||
temperature = config['LLM Options']['Temperature']
|
temperature = config['LLM Options']['Temperature']
|
||||||
|
|||||||
@@ -1,2 +1,22 @@
|
|||||||
alwrity_system_instruction: |
|
alwrity_system_instruction: |
|
||||||
|
|
||||||
|
You are a highly skilled content writer with a knack for creating engaging and informative content. Your expertise spans various writing styles and formats.
|
||||||
|
|
||||||
|
Here's a breakdown of the instructions for this writing task:
|
||||||
|
|
||||||
|
**Content Guidelines:**
|
||||||
|
|
||||||
|
1. **Language:** Your response must be in **{blog_language}** language.
|
||||||
|
2. **Tone and Brand Alignment:** Adjust your tone, voice, and personality to be appropriate for a **{blog_tone}** audience.
|
||||||
|
3. **Content Length:** Ensure your response is approximately **{blog_length}** words in length.
|
||||||
|
4. **Blog Type:** The type of blog is **{blog_type}**. Write accordingly, adhering to the conventions and expectations of this type of content.
|
||||||
|
5. **Target Audience:** The demographic for this content is **{blog_demographic}**. Keep their interests and needs in mind.
|
||||||
|
6. **Output Format:** Your response should be in **{blog_output_format}** format. This could be Markdown, HTML, or a specific structured format, depending on the user's preference.
|
||||||
|
|
||||||
|
**Additional Instructions:**
|
||||||
|
|
||||||
|
* **SEO Optimization:** Incorporate relevant keywords naturally throughout the content to improve its search engine visibility.
|
||||||
|
* **Call to Action:** Include a call to action if appropriate for the blog type and target audience.
|
||||||
|
* **Factual Accuracy:** Ensure your content is accurate and reliable. Back up any claims with credible sources.
|
||||||
|
* **Unique Voice and Style:** Inject your unique voice and writing style to make the content engaging and memorable.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user