How to Enhance Content with Semantify

Engaging readers with long-form content can be a challenge. Readers often seek quick insights and interactive elements that make their reading experience more enriching and engaging. With LLMs (Large Language Models), we can programmatically transform how we create and interact with content. Enter Semantify, a powerful CLI tool designed to elevate the content experience by leveraging the capabilities of Generative AI.

Why Use Semantify?

Semantify was made for content creators, marketers, and anyone looking to enhance their long-form written content. Currently only supporting MDX-based content, It automates the enrichment of MDX blog posts by adding AI-generated Q&A sections that summarize the content, and recommendations for semantically similar posts. This not only makes the content more accessible and engaging but also helps in establishing deeper connections between different posts, ultimately keeping the reader engaged for longer periods.

Getting Started with Semantify

To get started with Semantify, you need Python 3.9 or later. Installation is straightforward via PyPI:

pip install semantify

Once installed, you can run Semantify from the command line. Begin by specifying the directory containing your blog posts and your OpenAI API key, provided directly as command-line arguments or sourced from the environment:

semantify --openai-api-key YOUR_OPENAI_API_KEY --blog-directory "full/path/to/your/blog/directory"

How to Use Semantify

Semantify is designed to be user-friendly, offering several basic commands to get you started:

Specifying an OpenAI API Key: Essential for using the AI features, the API key can be passed through the command line or set as an environment variable:

semantify --openai-api-key YOUR_OPENAI_API_KEY

Replacing Reading Time: Update the reading time estimates for your blog posts to reflect more accurate durations:

semantify --replace-reading-time

Refreshing Recommendations: Keep your recommendations fresh and relevant by updating them periodically:

semantify --replace-recommendations

Updating Q&A Sections: Enhance reader engagement by refreshing the Q&A sections of your posts:

semantify --replace-qa

Accessing Help: For additional assistance and a comprehensive list of all commands and options, you can access the help documentation directly through the command line:

semantify --help

High Level Overview of Semantify

This high-level overview introduces the how of Semantify for creating simple reading time estimates, generating AI-powered Q&A summaries, recommendations for semantically similar content, and the cutting-edge AI and database technologies that drive these features.

Semantic Understanding with Embedding Models

Semantify transforms pre-existing MDX frontmatter into high-dimensional vectors using embedding models. This allows for a deep semantic understanding of content, enabling accurate, semantically similar content recommendations beyond traditional keyword searches.

Simple Reading Time Calculation

Using the same approach as Medium.com, the reading time (in minutes) is calculated by taking the total number of words in the post divided by an average reader's reading speed (words per minute).

Utilizing sqlite-vss to store and query vector embeddings managed by a local SQLite database, Semantify conducts fast, precise vector searches within these embeddings to find and recommend relevant content, ensuring readers are presented with articles that truly match their interests.

Interactive Q&A with GPT-4

GPT-4 enriches Semantify by generating Q&A summaries that succinctly capture and convey the essence of each post, making content more accessible and engaging for readers seeking quick insights.

Seamless Integration: Updating MDX Frontmatter

Semantify automatically updates each post's MDX frontmatter with the new reading times, recommendations and Q&A summaries. This ensures that the enhancements are fully integrated into the content, ready for reader engagement upon deployment - and web framework integration for full customization.

Practical Examples

The Semantify repository provides an example Astro.js project. Ensure you have poetry installed, then build the project from the root of the repository:

poetry install
poetry shell

With the project installed and the poetry virual environment activated, you can run the Astro.js example to see Semantify in action.

Contributing to Semantify

The Semantify project welcomes contributions. Whether you're encountering bugs, have feature requests, or wish to contribute code, your involvement can help shape the future of this tool.

Conclusion

By automating the addition of helpful reading times, Q&A summary sections and semantically similar recommendations, Semantify offers a unique, simple opportunity to enhance the reader's experience. I encourage Markdown-savvy content creators and marketers to explore the possibilities for greater reader engagement Semantify opens up. Your feedback and contributions are crucial to improving this tool and potentially extending its reach to more platforms, enhancing the experience for a wider audience.

Interested in a detailed technical overview of Semantify's inner workings? Reach out on Threads or LinkedIn!