Egregora uses Google's Gemini LLM with tool calling to generate blog posts. The AI has complete editorial freedom to decide what to write and how many posts to create.
graph TD
A[Conversation Period] --> B[RAG Query]
B --> C[Retrieve Context]
C --> D[Build Prompt]
D --> E[LLM with Tools]
E --> F{Tool Called?}
F -->|write_post| G[Create Post]
F -->|no_post| H[Skip Period]
F -->|multiple| I[Multiple Posts]
G --> J[Validate Output]
I --> J
J --> K[Save to docs/]
fromegregora.generationimportgenerate_postsposts=generate_posts(df=messages,# Conversation DataFrameclient=gemini_client,# Gemini API clientrag_store=store,# RAG retrievalperiod="weekly",# Group by weekmodel="models/gemini-2.0-flash-exp")
[{"title":"Weekly Recap: AI Safety Discussions","date":"2025-01-15","content":"...","frontmatter":{"tags":["ai-safety","ethics"],"authors":["a3f2b91c","b7e4d23a"]}},...]
defwrite_post(title:str,content:str,tags:List[str],summary:str)->None:"""Write a blog post from this conversation. Args: title: Post title content: Full markdown content tags: List of relevant tags summary: Brief summary (1-2 sentences) """
{"tool_call":"write_post","args":{"title":"Weekly AI Safety Discussion","content":"# Weekly AI Safety Discussion\n\nThis week...","tags":["ai-safety","ethics"],"summary":"The group discussed AI alignment and safety protocols."}}
You are a blog writer analyzing group conversations.
Your task:
-Read the conversation from the period
-Decide if it contains enough substance for a post
-If yes, write an engaging blog post
-If no, call no_post() with a reason
Guidelines:
-Write in a narrative style
-Preserve the group's voice and humor
-Use quotes from conversations
-Add context where needed
-Use proper markdown formatting
Available context:
-Anonymized messages (UUIDs instead of names)
-Enriched URLs/media (if enabled)
-Similar past posts (via RAG)
Period: 2025-01-08 to 2025-01-15
Conversation:
[2025-01-08 10:30] a3f2b91c: Has anyone read the new AI safety paper?
[2025-01-08 10:45] b7e4d23a: Yes! The alignment section is fascinating
...
Retrieved context (similar past posts):
1. "Previous AI Safety Discussion" (similarity: 0.89)
2. "Ethics in ML" (similarity: 0.76)
Generate a blog post if appropriate.
---title:Weekly AI Safety Discussiondate:2025-01-15tags:-ai-safety-ethicsauthors:-a3f2b91c-b7e4d23asummary:The group discussed AI alignment and safety protocols.---
> What would you like to change?
Make it more concise
[LLM edits post]
> Review changes:
- Removed 3 paragraphs
- Condensed intro
- Merged similar sections
> Approve? (y/n)
y
[Post saved]
# Switch cadenceegregoraprocessexport.zip--period=week
# Restrict to a specific windowegregoraprocessexport.zip--from-date=2025-01-01--to-date=2025-01-31
# Override timezone handlingegregoraprocessexport.zip--timezone="America/New_York"