Use this file to discover all available pages before exploring further.
This guide demonstrates how to leverage Mem0 to streamline content writing by applying your unique writing style and preferences using persistent memory.
import osfrom openai import OpenAIfrom mem0 import MemoryClientos.environ["MEM0_API_KEY"] = "your-mem0-api-key"os.environ["OPENAI_API_KEY"] = "your-openai-api-key"# Set up Mem0 and OpenAI clientclient = MemoryClient()openai = OpenAI()USER_ID = "content_writer"RUN_ID = "smart_editing_session"
Here we use Mem0 open source (Memory): all local, no API keys needed for memory. Vectors in Qdrant, LLM and embeddings via Ollama. The OpenAI Python SDK calls Ollama’s OpenAI-compatible/v1 endpoint for content rewriting.
docker run -d -p 6333:6333 qdrant/qdrantollama pull llama3.1:latestollama pull nomic-embed-text:latest
You can swap nomic-embed-text for any Ollama-supported embedding model (e.g., snowflake-arctic-embed, mxbai-embed-large). Just update the model in the embedder config and set embedding_model_dims in the Qdrant config to match the model’s output dimensions (768 for nomic-embed-text).
def content_writing_workflow(content): """Automated workflow for editing a document based on writing preferences.""" # Store writing preferences (if not already stored) store_writing_preferences() # Ideally done once, or with a conditional check # Edit the document with Mem0 preferences edited_content = apply_writing_style(content) if not edited_content: return "Failed to edit document." # Display results print("\n=== ORIGINAL DOCUMENT ===\n") print(content) print("\n=== EDITED DOCUMENT ===\n") print(edited_content) return edited_content
# Define your documentoriginal_content = """Project ProposalThe following proposal outlines our strategy for the Q3 marketing campaign.We believe this approach will significantly increase our market share.Increase brand awarenessBoost sales by 15%Expand our social media followingWe plan to launch the campaign in July and continue through September."""# Run the workflowresult = content_writing_workflow(original_content)
Project ProposalThe following proposal outlines our strategy for the Q3 marketing campaign.We believe this approach will significantly increase our market share.Increase brand awarenessBoost sales by 15%Expand our social media followingWe plan to launch the campaign in July and continue through September.
# Project Proposal## Q3 Marketing Campaign StrategyThis proposal outlines our strategy for the Q3 marketing campaign. We aim to significantly increase our market share with this approach.### Objectives- **Increase Brand Awareness**: Implement targeted advertising and community engagement to enhance visibility.- **Boost Sales by 15%**: Increase sales by 15% compared to Q2 figures.- **Expand Social Media Following**: Grow our social media audience by 20%.### Timeline- **Launch Date**: July- **Duration**: July – September### Key Actions- **Targeted Advertising**: Utilize platforms like Google Ads and Facebook to reach specific demographics.- **Community Engagement**: Host webinars and live Q&A sessions.- **Content Creation**: Produce engaging videos and infographics.### Supporting Data- **Previous Campaign Success**: Our Q2 campaign increased sales by 12%. We will refine similar strategies for Q3.- **Social Media Growth**: Last year, our Instagram followers grew by 25% during a similar campaign.### ConclusionWe believe this strategy will effectively increase our market share. To achieve these goals, we need your support and collaboration. Let's work together to make this campaign a success. Please review the proposal and provide your feedback by the end of the week.
Mem0 enables a seamless, intelligent content-writing workflow, perfect for content creators, marketers, and technical writers looking to scale their personal tone and structure across work.
Control Memory Ingestion
Filter and curate content examples to maintain consistent writing style.
Email Automation with Mem0
Automate email drafting with memory-powered context and tone matching.