Sunlight is an open-source tool for analyzing written content on the internet using large language models (LLMs).
The first release of Sunlight is designed to analyze writing for bias. When you're writing a blog post, article, report, etc, you can use Sunlight for a second opinion to ensure fairness and a balanced perspective. (It just has to be hosted somewhere on the internet.)
☀️ Live demo here! ☀️
If you input a public URL, Sunlight will generate:
- A list of factual claims in the linked content
- A critique of the bias, if any, in the content
- A pithy label for the perspective shown
This currently uses GPT-4, so it makes a lot of mistakes. The prompts are all included in this repo, and we'd love help from the community improving them. Ways you can contribute include:
- Improve the prompts and submit a PR!
- Log examples of bad analysis as Issues, including the original link and explanation of what Sunlight got wrong
- Add new functionality (e.g. a text box to analyze draft content)
- Fork this repo to build other types of writing analysis apps
Getting started with Sunlight is very easy, thanks to containerization. Follow these simple steps to install and run Sunlight on your system:
Before proceeding, ensure you have a recent version of Docker installed. If you need to install Docker, please follow the instructions on the Docker installation page.
-
Clone this repository and navigate to the resulting directory.
-
Edit the
service.cfg
file with your API credentials for Diffbot and OpenAI. Include Telnyx credentials if you wish to enable the SMS integration. -
Execute
run.sh
. This will:- Load the environment variables from
service.cfg
. - Build a Docker image with all necessary dependencies.
- Run the Docker image, which includes the backend API server along with a demo web UI.
- Load the environment variables from
git clone https://github.com/a16z-infra/sunlight
vi service.cfg
. run.sh
After executing run.sh
, Sunlight will be operational. Access the demo web UI by visiting:
http://localhost:8888/static/index.html
Follow the on-page instructions to configure the target document and model version.
Sunlight runs a simple backend service that interfaces with LLMs for the interesting semantic analysis. You can check this repository for implementation details, but here's a basic overview of what happens under the hood:
- Input: Users submit a link to their writing via SMS or the web UI.
- Pre-processing: The API server fetches page tags and then calls out to Diffbot for structured metadata, including the title and body text, upon job submission.
- Processing: Text is passed through a short cascade of parameterized prompts for semantic analysis.
- Evaluation: Suggestions for improvement are passed back to the user.
Sunlight uses a series of carefully crafted prompts to guide the LLMs in assessing your writing. You can find the current versions here. Here’s how it works:
- Fact extraction: identify, condense, and reorder claims made in your writing
- Bias analysis: assess your piece's underlying perspective in a brief report
- Slant tagging: using the bias report, assign a short label for categorization
Please read our Terms of Service and Privacy Policy before using Sunlight.
Sunlight may produce inaccurate information. This demo utilizes experimental large language model technology to generate its outputs, and we make no guarantees or promises regarding the accuracy or suitability of its analysis. This demo makes no claim to correct factual errors in the underlying source content.
It is incapable of providing investment advice, legal advice or marketing financial advisory advice, or soliciting investors or clients (and it is not intended to be utilized by investors); therefore its output should not be used as such.
Thanks for checking out our tool and reading this far. We hope Sunlight is useful to you. Community contributions, feedback, and insights are what make open-source projects successful; please reach out with any comments or suggestions.