  To help users do complex work, researchers have developed techniques to
integrate AI and human intelligence into user interfaces (UIs). With the recent
introduction of large language models (LLMs), which can generate text in
response to a natural language prompt, there are new opportunities to consider
how to integrate LLMs into UIs. We present Prompt Middleware, a framework for
generating prompts for LLMs based on UI affordances. These include prompts that
are predefined by experts (static prompts), generated from templates with
fill-in options in the UI (template-based prompts), or created from scratch
(free-form prompts). We demonstrate this framework with FeedbackBuffet, a
writing assistant that automatically generates feedback based on a user's text
input. Inspired by prior research showing how templates can help non-experts
perform more like experts, FeedbackBuffet leverages template-based prompt
middleware to enable feedback seekers to specify the types of feedback they
want to receive as options in a UI. These options are composed using a template
to form a feedback request prompt to GPT-3. We conclude with a discussion about
how Prompt Middleware can help developers integrate LLMs into UIs.
