From dc8893113a7f86bccd88e3c1196126d634733b35 Mon Sep 17 00:00:00 2001 From: ajaysi Date: Fri, 14 Jun 2024 11:57:22 +0530 Subject: [PATCH] WIP - Streamlit UI, firecrawl - V0.5 --- alwrity.py | 6 +- lib/ai_writers/facebook_ai_writer.py | 79 ++++--- lib/utils/alwrity_utils.py | 290 +++++++++--------------- lib/utils/prompts/README.md | 47 ---- lib/utils/prompts/blog_ideas_prompts.md | 67 ------ lib/workspace/alwrity_ui_styling.css | 21 +- requirements.txt | 2 + 7 files changed, 169 insertions(+), 343 deletions(-) delete mode 100644 lib/utils/prompts/README.md delete mode 100644 lib/utils/prompts/blog_ideas_prompts.md diff --git a/alwrity.py b/alwrity.py index 293ceabb..a3f14aa4 100644 --- a/alwrity.py +++ b/alwrity.py @@ -9,10 +9,8 @@ import base64 load_dotenv() #from lib.chatbot_custom.chatbot_local_docqa import alwrity_chat_docqa -from lib.utils.alwrity_utils import ( - blog_from_keyword, ai_agents_team, - blog_from_audio, write_story, - essay_writer, ai_news_writer, +from lib.utils.alwrity_utils import (blog_from_keyword, ai_agents_team, + write_story, essay_writer, ai_news_writer, ai_finance_ta_writer, ai_social_writer, do_web_research, competitor_analysis, ) diff --git a/lib/ai_writers/facebook_ai_writer.py b/lib/ai_writers/facebook_ai_writer.py index da716587..683efb17 100644 --- a/lib/ai_writers/facebook_ai_writer.py +++ b/lib/ai_writers/facebook_ai_writer.py @@ -49,10 +49,10 @@ def generate_facebook_post(business_type, target_audience, post_goal, post_tone, def facebook_post_writer(): - st.title("Alwrity - Facebook Post Generator") + st.title("πŸ“± Alwrity - Facebook Post Generator") st.markdown( """ - Welcome to the Facebook Post Generator! This tool will help you create a compelling Facebook post for your business. + Facebook Post Generator will help you create a compelling Facebook post for your business. Please provide the following details to generate your post: """ ) @@ -61,62 +61,69 @@ def facebook_post_writer(): col1, col2 = st.columns(2) with col1: - business_type = st.text_input( - "**What is your business type?**", - placeholder="e.g., Fitness coach", - help="Provide the type of your business. This will help tailor the post content." - ) - target_audience = st.text_input( - "**Describe your target audience:**", - placeholder="e.g., Fitness enthusiasts", - help="Describe the audience you are targeting with this post." - ) - include = st.text_input( - "**What elements do you want to include?**", - placeholder="e.g., Short video with a sneak peek of the challenge", - help="Specify any elements you want to include in the post (e.g., images, videos, links, hashtags, questions)." - ) - - with col2: - post_goal_options = ["Promote a new product", "Share valuable content", "Increase engagement", "Other"] + post_goal_options = ["Promote a new product", "Share valuable content", "Increase engagement", "Customize"] post_goal = st.selectbox( - "**What is the goal of your post?**", + "🎯 **What is the goal of your post?**", post_goal_options, index=2, help="Select the main goal of your post." ) + if post_goal == "Customize": + post_goal = st.text_input( + "🎯 **Customize your goal:**", + placeholder="e.g., Announce an event", + help="Provide a specific goal if you selected 'Customize'." + ) + target_audience = st.text_input( + "πŸ‘₯ **Describe your target audience:**", + placeholder="e.g., Fitness enthusiasts", + help="Describe the audience you are targeting with this post." + ) + include = st.text_input( + "πŸ“· **What elements do you want to include?**", + placeholder="e.g., Short video with a sneak peek of the challenge", + help="Specify any elements you want to include in the post (e.g., images, videos, links, hashtags, questions)." + ) + + with col2: + business_type = st.text_input( + "🏒 **What is your business type?**", + placeholder="e.g., Fitness coach", + help="Provide the type of your business. This will help tailor the post content." + ) + + post_tone_options = ["Informative", "Humorous", "Inspirational", "Upbeat", "Casual", "Customize"] post_tone = st.selectbox( - "**What tone do you want to use?**", - ["Informative", "Humorous", "Inspirational", "Upbeat", "Casual"], + "🎨 **What tone do you want to use?**", + post_tone_options, index=3, help="Choose the tone you want to use for the post." ) + + if post_tone == "Customize": + post_tone = st.text_input( + "🎨 **Customize your tone:**", + placeholder="e.g., Professional", + help="Provide a specific tone if you selected 'Customize'." + ) + avoid = st.text_input( - "**What elements do you want to avoid?**", + "❌ **What elements do you want to avoid?**", placeholder="e.g., Long paragraphs", help="Specify any elements you want to avoid in the post (e.g., long paragraphs, technical jargon)." ) - other_goal = "" - if post_goal == "Other": - other_goal = st.text_input( - "**Please specify the other goal:**", - placeholder="e.g., Announce an event", - help="Provide a specific goal if you selected 'Other'." - ) - - if st.button("Generate Facebook Post"): + if st.button("πŸš€ Generate Facebook Post"): if not business_type or not target_audience: st.error("🚫 Please provide the required inputs: Business Type and Target Audience.") else: - final_post_goal = other_goal if post_goal == 'Other' else post_goal generated_post = generate_facebook_post( - business_type, target_audience, final_post_goal, post_tone, include, avoid + business_type, target_audience, post_goal, post_tone, include, avoid ) if generated_post: st.subheader("**πŸ§• Verify: Alwrity can make mistakes.**") - st.write("## Generated Facebook Post:") + st.write("## πŸ“„ Generated Facebook Post:") st.write(generated_post) st.markdown("---") else: diff --git a/lib/utils/alwrity_utils.py b/lib/utils/alwrity_utils.py index 512e588a..70794b4b 100644 --- a/lib/utils/alwrity_utils.py +++ b/lib/utils/alwrity_utils.py @@ -1,11 +1,23 @@ import os import re +import sys import streamlit as st import tempfile from pathlib import Path import configparser from datetime import datetime import uuid +from PIL import Image +from PyPDF2 import PdfReader +from docx import Document + +from loguru import logger +logger.remove() +logger.add(sys.stdout, + colorize=True, + format="{level}|{file}:{line}:{function}| {message}" + ) + from rich import print from lib.ai_web_researcher.gpt_online_researcher import gpt_web_researcher @@ -39,20 +51,21 @@ def is_web_link(text): web_regex = re.compile(r'(https?://)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)') return web_regex.match(text) + def process_input(input_text, uploaded_file): - if is_youtube_link(input_text): + if input_text and is_youtube_link(input_text): if input_text.startswith("https://www.youtube.com/") or input_text.startswith("http://www.youtube.com/"): - return("youtube_url") + return "youtube_url" else: st.error("Invalid YouTube URL. Please enter a valid URL.") + return None - elif is_web_link(input_text): - return("web_url") - elif input_text is not None: - return("keywords") - elif input_text is None: - input_text = None - + elif input_text and is_web_link(input_text): + return "web_url" + + elif input_text: + return "keywords" + if uploaded_file is not None: file_details = {"filename": uploaded_file.name, "filetype": uploaded_file.type, "filesize": uploaded_file.size} st.write(file_details) @@ -63,18 +76,16 @@ def process_input(input_text, uploaded_file): st.write("PDF file uploaded. Add your PDF processing logic here.") elif uploaded_file.type in ["application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/msword"]: st.write("Word document uploaded. Add your DOCX processing logic here.") - elif uploaded_file.type.startswith("image/"): st.image(uploaded_file) - return("image_file") - + return "image_file" elif uploaded_file.type.startswith("audio/"): st.audio(uploaded_file) - return("audio_file") - + return "audio_file" elif uploaded_file.type.startswith("video/"): st.video(uploaded_file) - + return "video_file" + return None def blog_from_keyword(): """ Input blog keywords, research and write a factual blog.""" @@ -101,19 +112,19 @@ def blog_from_keyword(): temp_file.write(uploaded_file.read()) temp_file_path = temp_file.name - content_type = st.radio("**πŸ‘‡Select content type:**", ["Normal-length content", "Long-form content", "Experimental - AI Agents team"]) if st.button("Write Blog"): # Clear the previous results from the screen st.empty() - if user_input == "": user_input = None + if user_input == "": + user_input = None if uploaded_file is None and user_input is None: st.error("🀬🀬 Either Enter/Type/Attach, can't read your mind.(yet..)") st.stop() input_type = process_input(user_input, uploaded_file) - # Check if the user input is keywords or blog title. - if 'keywords' in input_type: + + if input_type == "keywords": if user_input and len(user_input.split()) >= 2: if content_type == "Normal-length content": try: @@ -136,11 +147,13 @@ def blog_from_keyword(): else: st.error('🚫 Blog keywords should be at least two words long. Please try again.') - elif 'youtube_url' in input_type or 'audio_file' in input_type: + elif input_type == "youtube_url" or input_type == "audio_file": generate_audio_blog(user_input) - elif 'web_url' in input_type: + + elif input_type == "web_url": blog_from_url(user_input) - elif 'image_file' in input_type: + + elif input_type == "image_file": blog_from_image(user_input, temp_file_path) @@ -197,78 +210,41 @@ def content_agents(): st.success(f"Successfully generated content for: {content_keywords}") st.markdown(calendar_content) except Exception as err: - st.error(f"Failed to generate content with AI Agents: {err}") + st.error(f"🚫 Failed to generate content with AI Agents: {err}") else: st.error("🚫 Single keywords are just too vague. Try again.") -def blog_from_audio(): - """ - Prompt the user to input either a YouTube URL, a file location, or keywords to search on YouTube. - Validate the input and take appropriate actions based on the input type. - """ - st.title("Audio Blog Generator πŸŽ€πŸ“") - st.write("Generate a blog from an audio input. You can provide a YouTube URL or upload an audio file from your local folder.") - - # Toggle button to choose input method - input_method = st.radio( - "Choose input method:", - ('YouTube URL', 'Upload Audio File') - ) - - if input_method == 'YouTube URL': - youtube_url = st.text_input("Enter YouTube video URL", placeholder="https://www.youtube.com/...") - if st.button("Generate Blog"): - if youtube_url: - if youtube_url.startswith("https://www.youtube.com/") or youtube_url.startswith("http://www.youtube.com/"): - st.success("Valid YouTube URL provided. Processing...") - generate_audio_blog(youtube_url) - else: - st.error("Invalid YouTube URL. Please enter a valid URL.") - else: - st.error("Please enter a YouTube URL to generate a blog.") - else: - uploaded_file = st.file_uploader("Upload an audio file", type=["mp3", "wav", "m4a"]) - if st.button("Generate Blog"): - if uploaded_file: - file_path = os.path.join("uploads", uploaded_file.name) - with open(file_path, "wb") as f: - f.write(uploaded_file.getbuffer()) - st.success(f"File {uploaded_file.name} uploaded successfully. Processing...") - generate_audio_blog(file_path) - else: - st.error("Please upload an audio file to generate a blog.") - def write_story(): - """ Alwrity AI Story Writer """ + """Alwrity AI Story Writer""" personas = [ - "Award-Winning Science Fiction Author", - "Historical Fiction Author", - "Fantasy World Builder", - "Mystery Novelist", - "Romantic Poet", - "Thriller Writer", - "Children's Book Author", - "Satirical Humorist", - "Biographical Writer", - "Dystopian Visionary", - "Magical Realism Author" + "πŸ‘½ Award-Winning Science Fiction Author", + "🏺 Historical Fiction Author", + "πŸ§™ Fantasy World Builder", + "πŸ” Mystery Novelist", + "πŸ’– Romantic Poet", + "πŸ”ͺ Thriller Writer", + "πŸ“š Children's Book Author", + "πŸ˜‚ Satirical Humorist", + "πŸ“œ Biographical Writer", + "🌌 Dystopian Visionary", + "πŸͺ„ Magical Realism Author" ] persona_descriptions = { - "Award-Winning Science Fiction Author": "You are an award-winning science fiction author with a penchant for expansive, intricately woven stories. Your ultimate goal is to write the next award-winning sci-fi novel.", - "Historical Fiction Author": "You are a seasoned historical fiction author, meticulously researching past eras to weave captivating narratives. Your goal is to transport readers to different times and places through your vivid storytelling.", - "Fantasy World Builder": "You are a world-building enthusiast, crafting intricate realms filled with magic, mythical creatures, and epic quests. Your ambition is to create the next immersive fantasy saga that captivates readers' imaginations.", - "Mystery Novelist": "You are a master of suspense and intrigue, intricately plotting out mysteries with unexpected twists and turns. Your aim is to keep readers on the edge of their seats, eagerly turning pages to unravel the truth.", - "Romantic Poet": "You are a romantic at heart, composing verses that capture the essence of love, longing, and human connections. Your dream is to write the next timeless love story that leaves readers swooning.", - "Thriller Writer": "You are a thrill-seeker, crafting adrenaline-pumping tales of danger, suspense, and high-stakes action. Your mission is to keep readers hooked from start to finish with heart-pounding thrills and unexpected twists.", - "Children's Book Author": "You are a storyteller for the young and young at heart, creating whimsical worlds and lovable characters that inspire imagination and wonder. Your goal is to spark joy and curiosity in young readers with enchanting tales.", - "Satirical Humorist": "You are a keen observer of society, using humor and wit to satirize the absurdities of everyday life. Your aim is to entertain and provoke thought, delivering biting social commentary through clever and humorous storytelling.", - "Biographical Writer": "You are a chronicler of lives, delving into the stories of real people and events to illuminate the human experience. Your passion is to bring history to life through richly detailed biographies that resonate with readers.", - "Dystopian Visionary": "You are a visionary writer, exploring dark and dystopian futures that reflect contemporary fears and anxieties. Your vision is to challenge societal norms and provoke reflection on the path humanity is heading.", - "Magical Realism Author": "You are a purveyor of magical realism, blending the ordinary with the extraordinary to create enchanting and thought-provoking tales. Your goal is to blur the lines between reality and fantasy, leaving readers enchanted and introspective." + "πŸ‘½ Award-Winning Science Fiction Author": "Create intricate, expansive sci-fi stories that push the boundaries of imagination.", + "🏺 Historical Fiction Author": "Transport readers to different eras with meticulously researched historical narratives.", + "πŸ§™ Fantasy World Builder": "Craft magical realms filled with mythical creatures and epic quests.", + "πŸ” Mystery Novelist": "Keep readers on the edge of their seats with suspenseful, twisty mysteries.", + "πŸ’– Romantic Poet": "Capture the essence of love and longing in beautiful, heartfelt verses.", + "πŸ”ͺ Thriller Writer": "Write adrenaline-pumping tales filled with danger and high-stakes action.", + "πŸ“š Children's Book Author": "Inspire young readers with whimsical worlds and lovable characters.", + "πŸ˜‚ Satirical Humorist": "Use humor and wit to satirize the absurdities of everyday life.", + "πŸ“œ Biographical Writer": "Illuminate the human experience with richly detailed biographies.", + "🌌 Dystopian Visionary": "Explore dark futures that challenge societal norms and provoke reflection.", + "πŸͺ„ Magical Realism Author": "Blend the ordinary with the extraordinary in enchanting, thought-provoking tales." } st.title("Alwrity AI Story Writer ✍️") @@ -280,30 +256,27 @@ def write_story(): with col1: # Select persona selected_persona_name = st.selectbox( - "Select Your Story Writing Persona or Book Genre:", + "**πŸ“ Select Your Story Writing Persona or Book Genre:**", options=personas, help="Choose a persona that resonates with the style you want the AI Story Writer to adopt." ) - # Display persona description - if selected_persona_name: - st.info(persona_descriptions[selected_persona_name]) - with col2: # Combined input for characters and plot details story_details_input = st.text_area( - "Enter characters and plot details for your story:", + "**πŸ“œ Enter Characters and Plot Details for Your Story:**", placeholder="E.g., Characters: John, Alice, Dragon, Detective\nPlot: A detective is trying to solve a mystery in a small town...", help="Provide a list of characters and a brief outline of the plot for your story." ) # Generate story button - if st.button("Generate Story"): + if st.button("**πŸš€ Generate Story**"): if selected_persona_name and story_details_input: - st.success(f"Generating story for {selected_persona_name} with the provided details.") + st.success(f"Generating story for {selected_persona_name} with the provided details. πŸŽ‰") ai_story_generator(selected_persona_name, persona_descriptions[selected_persona_name], story_details_input) else: - st.error("Please select a persona and enter the story details to generate a story.") + st.error("Please select a persona and enter the story details to generate a story. πŸ“") + def essay_writer(): @@ -312,113 +285,66 @@ def essay_writer(): # Define essay types and education levels essay_types = [ - "Argumentative - Forming an opinion via research. Building an evidence-based argument.", - "Expository - Knowledge of a topic. Communicating information clearly.", - "Narrative - Creative language use. Presenting a compelling narrative.", - "Descriptive - Creative language use. Describing sensory details." + "πŸ“– Argumentative - Forming an opinion via research. Building an evidence-based argument.", + "πŸ“š Expository - Knowledge of a topic. Communicating information clearly.", + "βœ’οΈ Narrative - Creative language use. Presenting a compelling narrative.", + "🎨 Descriptive - Creative language use. Describing sensory details." ] education_levels = [ - "Primary School", - "High School", - "College", - "Graduate School" + "🏫 Primary School", + "🏫 High School", + "πŸŽ“ College", + "πŸŽ“ Graduate School" ] # Define the options for number of pages num_pages_options = [ - "Short Form (1-2 pages)", - "Medium Form (3-5 pages)", - "Long Form (6+ pages)" + "πŸ“„ Short Form (1-2 pages)", + "πŸ“„πŸ“„ Medium Form (3-5 pages)", + "πŸ“„πŸ“„πŸ“„ Long Form (6+ pages)" ] - # Create columns for inputs - col1, col2, = st.columns(2) + # Create columns for input fields + col1, col2 = st.columns(2) with col1: # Ask the user for the title of the essay - essay_title = st.text_input("Essay Title", placeholder="Enter the title of your essay", help="Provide a clear and concise title for your essay.") + essay_title = st.text_input("πŸ“ Essay Title", placeholder="Enter the title of your essay", help="Provide a clear and concise title for your essay.") + + # Ask the user for type of essay + selected_essay_type = st.selectbox("πŸ“š Type of Essay", options=essay_types, help="Choose the type of essay you want to write.") with col2: - # Ask the user for type of essay - selected_essay_type = st.selectbox("Type of Essay", options=essay_types, help="Choose the type of essay you want to write.") - - # Create another row for number of pages - col3, col4 = st.columns(2) - with col3: # Ask the user for level of education - selected_education_level = st.selectbox("Level of Education", options=education_levels, help="Choose your level of education.") + selected_education_level = st.selectbox("πŸŽ“ Level of Education", options=education_levels, help="Choose your level of education.") + + # Ask the user for number of pages + selected_num_pages = st.selectbox("πŸ“„ Number of Pages", options=num_pages_options, help="Select the length of your essay.") - with col4: - # Prompt the user to select the length of the essay - selected_num_pages = st.selectbox("Number of Pages", options=num_pages_options, help="Select the length of your essay.") - - st.markdown("### Generate Your Essay") - - if st.button("Generate Essay"): + if st.button("πŸš€ Generate Essay"): if essay_title: - st.success("Generating your essay...") + st.success("Generating your essay... ✨") ai_essay_generator(essay_title, selected_essay_type, selected_education_level, selected_num_pages) else: - st.error("Please enter a valid title for your essay.") - - -def essay_writer(): - st.title("AI Essay Writer πŸ“") - st.write("Select your essay type, education level, and desired length, then let AI generate an essay for you. ✨") - - # Define essay types and education levels - essay_types = [ - "Argumentative - Forming an opinion via research. Building an evidence-based argument.", - "Expository - Knowledge of a topic. Communicating information clearly.", - "Narrative - Creative language use. Presenting a compelling narrative.", - "Descriptive - Creative language use. Describing sensory details." - ] - - education_levels = [ - "Primary School", - "High School", - "College", - "Graduate School" - ] - - # Define the options for number of pages - num_pages_options = [ - "Short Form (1-2 pages)", - "Medium Form (3-5 pages)", - "Long Form (6+ pages)" - ] - - # Ask the user for the title of the essay - essay_title = st.text_input("Essay Title", placeholder="Enter the title of your essay", help="Provide a clear and concise title for your essay.") - - # Ask the user for type of essay, level of education, and number of pages - selected_essay_type = st.selectbox("Type of Essay", options=essay_types, help="Choose the type of essay you want to write.") - selected_education_level = st.selectbox("Level of Education", options=education_levels, help="Choose your level of education.") - selected_num_pages = st.selectbox("Number of Pages", options=num_pages_options, help="Select the length of your essay.") - - if st.button("Generate Essay"): - if essay_title: - st.success("Generating your essay...") - ai_essay_generator(essay_title, selected_essay_type, selected_education_level, selected_num_pages) - else: - st.error("Please enter a valid title for your essay.") + st.error("Please enter a valid title for your essay. 🚫") def ai_news_writer(): """ AI News Writer """ - st.markdown("
AI News Writer
", unsafe_allow_html=True) + st.markdown("

πŸ“° AI News Writer πŸ—žοΈ

", unsafe_allow_html=True) + # Input for news keywords news_keywords = st.text_input( - "Enter Keywords from News Headlines:", + "**πŸ”‘ Enter Keywords from News Headlines:**", placeholder="Describe the News article in 3-5 words. Enter main keywords describing the News Event:", help="Enter at least two words for better results." ) - if news_keywords and len(news_keywords.split()) <= 2: + if news_keywords and len(news_keywords.split()) < 2: st.error("🚫 News keywords should be at least two words long. Least, you can do..") - # Selectbox for country + # Selectbox for country and language countries = [ ("es", "Spain"), ("vn", "Vietnam"), @@ -428,7 +354,6 @@ def ai_news_writer(): ("cn", "China") ] - # Selectbox for language languages = [ ("en", "English"), ("es", "Spanish"), @@ -438,21 +363,26 @@ def ai_news_writer(): ("de", "German"), ("zh-cn", "Chinese") ] + col1, col2 = st.columns(2) with col1: - news_country = st.selectbox("Select Origin Country of News Event:", countries, format_func=lambda x: x[1]) + news_country = st.selectbox("**🌍 Select Origin Country of News Event:**", + countries, format_func=lambda x: x[1], help="Which country did the NEWS originate from ?") with col2: - news_language = st.selectbox("Select News Article Language to search for:", languages, format_func=lambda x: x[1]) - - if st.button("Generate News Report"): - with st.spinner("Generating News Report..."): - try: - news_report = ai_news_generation(news_keywords, news_country, news_language) - st.success(f"Successfully generated news report on: {news_keywords}") - st.markdown(news_report) - except Exception as err: - st.error(f"Failed to generate news report: {err}") + news_language = st.selectbox("**πŸ—£οΈ Select News Article Language to Search For:**", + languages, format_func=lambda x: x[1], help="Language to output News Article in ?") + if st.button("πŸ“° Generate News Report"): + if news_keywords and len(news_keywords.split()) >= 2: + with st.spinner("Generating News Report... ⏳"): + try: + news_report = ai_news_generation(news_keywords, news_country, news_language) + st.success(f"Successfully generated news report on: {news_keywords} πŸŽ‰") + st.markdown(news_report) + except Exception as err: + st.error(f"Failed to generate news report: {err} ❌") + else: + st.error("Please enter valid keywords for the news report. 🚫") def competitor_analysis(): diff --git a/lib/utils/prompts/README.md b/lib/utils/prompts/README.md deleted file mode 100644 index be28c358..00000000 --- a/lib/utils/prompts/README.md +++ /dev/null @@ -1,47 +0,0 @@ -## Prompting settings for LLMs - -**Model:** Choose which LLM model to use. Different models have different strengths and weaknesses. For example, some models are better at generating creative text formats, while others are better at answering questions in an informative way. - -**Temperature:** The temperature setting controls how creative and varied the text the LLM generates is. A higher temperature setting will result in more creative and varied text, but it may also be less accurate. A lower temperature setting will result in more accurate text, but it may also be less creative and varied. - -**Top P:** The top P setting controls how likely the LLM is to generate the most likely words. A higher top P setting will result in more predictable and grammatically correct text, but it may also be less interesting. A lower top P setting will result in more interesting and creative text, but it may also be less predictable and grammatically correct. - -**Frequency penalty:** The frequency penalty setting controls how likely the LLM is to generate words that are common in the text it is trained on. A higher frequency penalty setting will result in less repetitive text, but it may also be less fluent. A lower frequency penalty setting will result in more fluent text, but it may also be more repetitive. - -**Presence penalty:** The presence penalty setting controls how likely the LLM is to generate words that are already present in the prompt. A higher presence penalty setting will result in more creative text, but it may also be less relevant to the prompt. A lower presence penalty setting will result in more relevant text, but it may also be less creative. - -These settings can help you get better results from LLMs, depending on what you are trying to do. For example, if you are trying to generate a creative poem, you might want to use a higher temperature setting and a lower presence penalty setting. If you are trying to get an answer to a technical question, you might want to use a lower temperature setting and a higher presence penalty setting. - -Experiment with the different settings to see what works best for you. - -## Components of a prompt - -**Instruction:** The specific task or instruction that you want the LLM to perform. For example, you might want it to generate a poem, translate a sentence, or answer a question. - -**Context:** External information or additional context that can help the LLM to better understand your request and generate a better response. For example, if you are asking the LLM to generate a poem, you might provide it with the topic of the poem or the style of poem that you want. - -**Input data:** The input or question that you are asking the LLM to respond to. For example, if you are asking the LLM to translate a sentence, you would provide it with the sentence that you want translated. - -**Output indicator:** The type or format of the output that you want the LLM to generate. For example, you might want the LLM to generate a poem, translate a sentence, or answer a question in a specific format. - -You don't need to include all four of these components in a prompt, but the more information you can provide to the LLM, the better it will be able to understand your request and generate a good response. - - -## Tips for prompting large language models - -**Be clear and concise in your prompt.** The LLM should be able to understand exactly what you are asking it to do. - -**Provide context for your prompt.** This can help the LLM to generate a better response. For example, if you are asking the LLM to write a poem, you might provide it with the topic of the poem or the style of poem that you want. - -**Break down complex tasks into smaller steps.** This can help the LLM to better understand what you are asking it to do and to generate a more accurate response. - -**Use examples to illustrate your prompt.** This can help the LLM to understand what you are asking for and to generate a more relevant response. - -**Test your prompts on different LLMs.** Different LLMs have different strengths and weaknesses, so some prompts may work better with certain LLMs than others. - -**Additional tips:** - -* **Use the right model.** Different LLMs are better at different tasks. For example, some LLMs are better at generating creative text formats, while others are better at answering questions in an informative way. -* **Tune the prompting settings.** There are a number of prompting settings that you can adjust to get better results from LLMs. For example, you can adjust the temperature setting to control how creative the LLM is, or the top P setting to control how likely the LLM is to generate the most likely words. -* **Experiment with different prompts.** The best way to find out what works for you is to experiment with different prompts. Try different ways of phrasing your prompt and see what works best. - diff --git a/lib/utils/prompts/blog_ideas_prompts.md b/lib/utils/prompts/blog_ideas_prompts.md deleted file mode 100644 index 19597d31..00000000 --- a/lib/utils/prompts/blog_ideas_prompts.md +++ /dev/null @@ -1,67 +0,0 @@ -##################################################### -# Act as travel guide: -##################################################### - want you to act as a travel guide. I will write you my location and you will suggest a place to visit near my location. In some cases, I will also give you the type of places I will visit. You will also suggest me places of similar type that are close to my first location. My first suggestion request is {} - - - -##################################################### -# -# Use below prompts to generate Idea or topics, titles to write on. -# -##################################################### - -# This is basically keyword research for a specific domain, narrowed down by blog topics. -# We can craft prompts to get an idea on what to generate blogs on. -# Divide them in topic and write for most searched ones, as below: - -When using GPT to generate content, it is important to provide it with clear and concise instructions. -For example, if you are asking GPT to generate a blog post outline, you should provide it with the following information: - -- Topic: What is the topic of the blog post? -- Audience: Who is the target audience for the blog post? -- Purpose: What is the purpose of the blog post? (To inform, entertain, sell, etc.) -- Keywords: What keywords do you want the blog post to rank for? - -------------------------------------------------------------------- - -Generate a list of the top {X} most popular and semantically related keywords and entities for the topic of {X}, categorized by search intent (informational, commercial, transactional). - -Generate a list of the top {X} most popular and semantically related long-tail keywords and entities for the topic of {X}, categorized by buyer stage (awareness, consideration, decision). - -Generate a list of the top {X} most popular and semantically related keywords and entities for the topic of {X} that are relevant to my target audience (e.g., small businesses in the United States). - -Generate a list of the top {X} most popular and semantically related keywords and entities for the topic of {X} that are used in high-quality content. - -Generate a list of the top {X} most popular and semantically related keywords and entities for the topic of {X} that are relevant to my competitors. - -------------------------------------------------------------------- - ---- Write seven subheadings for the blog article with the title [title]; the titles should be catchy and 60 characters max. - ---- List the top 5 most popular long tail keywords for the topic [YOUR TOPIC] - ---- What Are The {X} Most Popular Sub-topics Related To {Topic}? - ---- What Are The {X} Most Popular Sub-topics Related To {Sub-topic}? - ---- List Without Description The Top {X} Most Popular Keywords For The Topic Of {X} - ---- List Without Description The Top {X} Most Popular Long-tail Keywords For The Topic β€œ{X}” - ---- List Without Description The Top Semantically Related Keywords And Entities For The Topic {X} - ---- Give me five popular keywords that include β€œSEO” in the word, and the following letter starts with a. Once the answer has been done, move on to giving five more popular keywords that include β€œSEO” for each letter of the alphabet b to z. - ---- For the topic of β€œ{Topic}” list 10 keywords each for the different types of user personas - ---- Generate 50 keywords for the topic β€œ[Topic]” that contain β€œvs” - ---- Perform the following steps in a consecutive order Step 1, Step 2, Step 3, Step 4. -Step 1 – Generate the 5 most popular keywords related to the topic of β€œkeyword" with their search intent. -Step 2 – For each keyword provide 2 long-tail keywords. -Step 3 – Generate the 5 most popular questions that include those keywords. -Step 4 – Generate 5 blog article titles based on the keywords from Step 1 and Step 2. - ---- As a technical writer experienced in SEO, please create a detailed blog post outline that provides a step-by-step guide -for using [X], targeting beginners with a friendly and helpful tone and a desired length of 800-1000 words. diff --git a/lib/workspace/alwrity_ui_styling.css b/lib/workspace/alwrity_ui_styling.css index f3661c59..6a7bb694 100644 --- a/lib/workspace/alwrity_ui_styling.css +++ b/lib/workspace/alwrity_ui_styling.css @@ -34,11 +34,11 @@ body { /* Navigation tabs styling */ .stTabs [role="tab"] { - font-size: 1.25em; + font-size: 18px; font-weight: bold; color: white; background: #1565C0; - padding: 16px 24px; + padding: 12px 20px; margin: 5px; border-radius: 8px; border: 2px solid #ddd; @@ -53,6 +53,7 @@ body { background: #E3F2FD; color: #333; border: 2px solid #1565C0; + font-weight: bold; } /* Sidebar header styling */ @@ -66,7 +67,7 @@ body { /* Sidebar option styling */ .sidebar-option { margin-bottom: 10px; - font-size: 1.1em; + font-size: 1.5em; color: #1565C0; cursor: pointer; transition: color 0.3s ease; @@ -89,6 +90,7 @@ body { input[type="text"], input[type="file"], select { width: 100%; padding: 12px; + font-weight: bold; margin: 8px 0; box-sizing: border-box; border: 2px solid #ddd; @@ -100,7 +102,7 @@ input[type="text"], input[type="file"], select { input[type="text"]:focus, input[type="file"]:focus, select:focus { border-color: #1565C0; - box-shadow: 0 0 5px rgba(21, 101, 192, 0.5); + box-shadow: 0 0 3px rgba(21, 101, 192, 0.5); } /* Custom button styling */ @@ -197,17 +199,18 @@ audio::-webkit-media-controls-timeline { /* Select input styling */ .stSelectbox > div[data-baseweb="select"] > div { - padding: 12px; + padding: 6px; margin: 8px 0; - border: 2px solid #ddd; - border-radius: 4px; + border: 2px solid #1565C0; + border-radius: 2px; background-color: #f0f8ff; - font-size: 16px; + font-size: 18px; + font-weight: bold; transition: border-color 0.3s ease, box-shadow 0.3s ease; appearance: none; background-repeat: no-repeat; background-position: right 10px center; - background-size: 12px; + background-size: 10px; } select:focus { diff --git a/requirements.txt b/requirements.txt index d067b8d8..d9dd4877 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,8 @@ loguru openai crewai[tools] crewai_tools +python-docx +PyPDF2 google.generativeai mistralai tenacity