Prototyping language model interactions

Ft. Langchain and a toy text editor

I've been playing with a prototype (code here) of "writing daemons", riffing off of Maggie Appleton's amazing work. What does it feel like to write in the company of little spirits – not much unlike Clippy – who can jump in with suggestions and reactions?

Suggested writing improvements by the Editor Suggested writing improvements by the strict Editor

Suggested alternative ideas by the Devil's Advocate Some thoughts from the Devil's Advocate


A tiny technique aside

I used Langchain and OpenAI to prompt the daemon personalities. Each daemon option is set up with a prompt instruction (passed into a Langchain PromptTemplate) used to control the output. Beyond the current 3 options, I also had fun interactions with variations of "Concerned Parent" and "Supportive Friend". It turns out personality and style prompting is the real fun that I miss from GPT chatbots.

Daemon options
{
    title: "Editor",
    subtitle: "Suggested edits",
    prompt: "As a strict writing editor, suggest a weak line that can be improved for clarity, grammar, punctuation.",
    color: "47, 128, 237",
}, {
    title: "Researcher",
    subtitle: "Cite your sources",
    prompt: "As a scientific researcher, suggest a line that contains a fact and find an online source to support it.",
    color: "151, 81, 224",
}, {
    title: "Devil",
    subtitle: "What if...",
    prompt: "As a devil's advocate, find a line from the text and suggest how it might not be true.",
    color: "235, 87, 87",
}

With Langchain's StructuredOutputParser, a Zod schema, and this prompt template (where "prompt" is the daemon personality), I was able to coax gpt-3.5-turbo. It analyzes the text, selects a line, and provides a suggestion in the style of the selected daemon:

const prompt = new PromptTemplate({
  template:
    "{prompt}. Follow the format instructions, no matter what! \n{format_instructions}\n{text}",
  inputVariables: ["text", "prompt"],
  partialVariables: { format_instructions },
});

Towards a "tool"?

The spirit I built this with leaned towards cheeky novelty instead of usefulness. To extend it into something more pragmactic, there's some factors I would consider:

On visions for computing

Why am I drawn towards making "useless" things that feel joyful, sandbox-y, even juvenile? Besides my limited technical skills (but growing!) and attention span (not growing...), it's a reaction to the ethos of superintelligence posed to process information at the scale of humanity . When zoomed into one person's experience with their computer, I'm not sure if an all-knowing computer agent is the most compelling vision. At least not austere, computer-knows-best, or even the Samantha-from-Her embodiments.

Instead of superintelligent agents and automation and single answers, I want to feel a sense of agency and exploration and possibility. And maybe an AI spiritual successor to Clippy can help with that, sometimes. I hope to get closer to communicating my understanding of the computer feeling through making these prototypes.

Down the rabbit hole