Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Creator Agent Workflow #1614

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

Itz-Antaripa
Copy link

@Itz-Antaripa Itz-Antaripa commented Dec 19, 2024

Description

This PR introduces the ContentPlanningWorkflow, which automates the creation, planning, and scheduling of social media content based on blog posts. This is an example use-case of workflow agents.

Type of change

Please check the options that are relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Model update
  • Infrastructure change

Checklist

  • My code follows Phidata's style guidelines and best practices
  • I have performed a self-review of my code
  • I have added docstrings and comments for complex logic
  • My changes generate no new warnings or errors
  • I have added cookbook examples for my new addition (if needed)
  • I have updated requirements.txt/pyproject.toml (if needed)
  • I have verified my changes in a clean environment

Represents a LinkedIn post.
"""
content: str
media_url: Optional[str] = None # Optional media attachment URL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't attach multiple media to LinkedIn post?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't test it for multiple media

Comment on lines 120 to 140
def generate_plan(self, blog_content: str, post_type: PostType) -> dict:
plan_response: RunResponse = RunResponse(content=None)
if post_type == PostType.TWITTER:
logger.info(f"Generating post plan for {post_type}")
plan_response = self.twitter_thread_planner.run(blog_content)
elif post_type == PostType.LINKEDIN:
logger.info(f"Generating post plan for {post_type}")
plan_response = self.linkedin_post_planner.run(blog_content)
else:
raise ValueError(f"Unsupported post type: {post_type}")

if plan_response.content_type == "Thread" or plan_response.content_type == LinkedInPost:
return plan_response.content
elif plan_response.content_type == "application/json":
data = json.loads(plan_response.content)
if post_type == PostType.TWITTER:
return Thread(**data)
else:
return LinkedInPost(**data)
else:
raise ValueError("Unexpected content type received from planner.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic will need a revisit as it's not clean. Look at line 131.
Also the return type is dict but you are returning 3 completely different types at line 132, 136, and 138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants