Skip to content

Commit

Permalink
AI agents team, research report
Browse files Browse the repository at this point in the history
  • Loading branch information
AJaySi committed May 8, 2024
1 parent 6f88f9b commit f9b9204
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 25 deletions.
6 changes: 3 additions & 3 deletions alwrity.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ def write_blog():
if blog_type:
if blog_type == 'Keywords':
blog_from_keyword()
elif mode == 'AI Story Writer':
elif blog_type == 'AI Story Writer':
write_story()
elif mode == 'AI Essay Writer':
elif blog_type == 'AI Essay Writer':
essay_writer()
elif blog_type == 'Audio To Blog':
blog_from_audio()
Expand All @@ -179,7 +179,7 @@ def write_blog():
github = prompt("Enter GitHub URL, CSV file, or topic:")
print(f"Write blog based on GitHub: {github}")
elif blog_type == 'Scholar':
scholar = prompt("Enter research papers keywords:")
scholar = prompt("Enter research papers keywords Or URL:")
print(f"Write blog based on scholar: {scholar}")
elif blog_type == 'Quit':
typer.echo("Exiting, Getting Lost..")
Expand Down
31 changes: 13 additions & 18 deletions lib/ai_writers/long_form_ai_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,12 @@ def long_form_generator(content_keywords):
7). Use simple {content_language} words, to appeal to all readers.
7). Your content must be well formatted using {output_format} language.
8). Do not use words like: Unleash, ultimate, Uncover, Discover, Elevate, Revolutionizing, Unveiling, Harnessing, Dive, Delve into, Embrace.
9). Important: Ensure that content is not repeated, each section is unique and distinct.
Remember, your main goal is to write as much as you can. If you get through the content too fast, that is bad.
Expand, never summarize.
'''

remove_ai_words = f'''\
As an expert content writer and editor, I will provide you with my 'blog content' and 'Exception-list'.
Your task is to replace all occurances of words from 'Exception-list' from given 'blog content'.
Before generating any text, examine the Exception-list and avoid all cases of these words and phrases.
These instructions are critical and require absolute adherence!
\n\nException-list: ["realm", "navigating", "beacon", "bustling", "treasure trove", "landscape", "tailored", "tailor", “roadmap” , "tailoring", "delving", “streamlining” "dynamic", "robust", "stay tuned", "in conclusion", "seamless", "bustling", “not just a”, “cornerstone”, “paramount” ,“diving into”, “delve into”, “pivotal”, “navigating”,“dive deep”, journey”, “maze”, “puzzle”, “overwhelmed” 'Tapestry', 'Bustling', 'In summary', 'In conclusion', 'Unleash', 'Unveiling', 'ever-evolving', 'Remember that', 'Take a dive into', 'Navigating', 'Navigating the landscape', 'Navigating the complexities of', 'Landscape', 'The landscape of', 'Testament', 'a testament to', 'In the world of', 'Realm', 'Embark', 'virtuoso', 'Let's explore', 'symphony', 'game changing', 'ever-changing', 'Embrace', 'Embracing', 'game-changing', 'ever-evolving']
\n\nBlog Content: '{{blog_content}}'
'''

# Generate prompts
content_title = f'''\
Expand Down Expand Up @@ -121,7 +112,7 @@ def long_form_generator(content_keywords):
{{web_research_result}}
Write an outline for the content title using web research results.
Write an outline of a content using above web research results.
'''

Expand All @@ -140,7 +131,6 @@ def long_form_generator(content_keywords):
Start to write the very beginning of the content. You are not expected to finish the whole content now.
Your writing should be detailed enough that you are only scratching the surface of the first bullet of your outline.
Try to write AT MINIMUM 600 WORDS.
Pay special attention to orignality, formatting and readibility of your content.
{writing_guidelines}
'''
Expand All @@ -162,20 +152,20 @@ def long_form_generator(content_keywords):
============\n
You've begun to write the essay and continue to do so.
You've begun to write the content and continue to do so.
Here's what you've written so far:
{{content_text}}
=====
First, silently review the outline and essay so far.
First, silently review the outline and content written so far.
Identify what the single next part of your outline you should write.
Your task is to continue where you left off and write the next part of the Essay.
You are not expected to finish the whole essay now. Your writing should be
Your task is to continue where you left off and write only the next parts of given outline.
You are not expected to finish the whole content now. Your writing should be
detailed enough that you are only scratching the surface of the next part of
your outline. Try to write AT MINIMUM 600 WORDS. However, only once the essay
your outline. Try to write AT MINIMUM 600 WORDS. However, only once the content
is COMPLETELY finished, write IAMDONE. Remember, do NOT write a whole chapter
right now.
Expand All @@ -198,7 +188,7 @@ def long_form_generator(content_keywords):
except Exception as err:
logger.error(f"Content title Generation Error: {err}")
return

try:
content_outline = generate_with_retry(model,
content_outline.format(content_title=content_title, web_research_result=web_research_result)).text
Expand All @@ -212,6 +202,8 @@ def long_form_generator(content_keywords):
except Exception as err:
logger.error(f"Failed to Generate Starting draft: {err}")
return

print(starting_draft)

try:
draft = starting_draft
Expand All @@ -221,11 +213,14 @@ def long_form_generator(content_keywords):
except Exception as err:
logger.error(f"Failed to write the initial draft: {err}")

print(continuation)
# Add the continuation to the initial draft, keep building the story until we see 'IAMDONE'
try:
draft += '\n\n' + continuation
except Exception as err:
logger.error(f"Failed as: {err} and {continuation}")

print(draft)

try:
# Do Metaphor/Exa AI search.
Expand Down
1 change: 0 additions & 1 deletion lib/gpt_providers/text_generation/ai_essay_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def ai_essay_generator(essay_title, selected_essay_type, selected_education_leve
1). You specialize in {selected_essay_type} essay writing.
2). Your target audiences include readers from {selected_education_level} level.
3). The title of the essay is {essay_title}.
4). I will provide you with web research for essay title.
5). The final essay should of {selected_num_pages} words/pages.
3). Plant the seeds of subplots or potential character arc shifts that can be expanded later.
Expand Down
4 changes: 1 addition & 3 deletions lib/gpt_providers/text_generation/ai_story_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def ai_story_generator(persona, story_genre, characters):
try:
starting_draft = generate_with_retry(model,
starting_prompt.format(premise=premise, outline=outline)).text
pprint(starting_draft)
except Exception as err:
print(f"Failed to Generate Story draft: {err}")
return
Expand All @@ -164,7 +163,6 @@ def ai_story_generator(persona, story_genre, characters):
draft = starting_draft
continuation = generate_with_retry(model,
continuation_prompt.format(premise=premise, outline=outline, story_text=draft)).text
pprint(continuation)
except Exception as err:
print(f"Failed to write the initial draft: {err}")

Expand All @@ -184,7 +182,7 @@ def ai_story_generator(persona, story_genre, characters):

# Remove 'IAMDONE' and print the final story
final = draft.replace('IAMDONE', '').strip()
pprint(final)
print(final)

except Exception as e:
print(f"Main Story writing: An error occurred: {e}")

0 comments on commit f9b9204

Please sign in to comment.