Source URL: https://simonwillison.net/2024/Aug/28/system-prompt-for-townie/#atom-everything
Source: Simon Willison’s Weblog
Title: System prompt for val.town/townie
Feedly Summary: System prompt for val.town/townie
Val Town (previously) provides hosting and a web-based coding environment for Vals – snippets of JavaScript/TypeScript that can run server-side as scripts, on a schedule or hosting a web service.
Townie is Val’s new AI bot, providing a conversational chat interface for creating fullstack web apps (with blob or SQLite persistence) as Vals.
In the most recent release of Townie Val added the ability to inspect and edit its system prompt!
I’ve archived a copy in this Gist, as a snapshot of how Townie works today. It’s surprisingly short, relying heavily on the model’s existing knowledge of Deno and TypeScript.
I enjoyed the use of “tastefully" in this bit:
Tastefully add a view source link back to the user’s val if there’s a natural spot for it and it fits in the context of what they’re building. You can generate the val source url via import.meta.url.replace("esm.town", "val.town").
The prompt includes a few code samples, like this one demonstrating how to use Val’s SQLite package:
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
let KEY = new URL(import.meta.url).pathname.split("/").at(-1);
(await sqlite.execute(`select * from ${KEY}_users where id = ?`, [1])).rows[0].id
It also reveals the existence of Val’s very own delightfully simple image generation endpoint Val, currently powered by Stable Diffusion XL Lightning on fal.ai.
If you want an AI generated image, use https://maxm-imggenurl.web.val.run/the-description-of-your-image to dynamically generate one.
Here’s a fun colorful raccoon with a wildly inappropriate hat.
Val are also running their own gpt-4o-mini proxy, free to users of their platform:
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: "Say hello in a creative way" },
],
model: "gpt-4o-mini",
max_tokens: 30,
});
Val developer JP Posma wrote a lot more about Townie in How we built Townie – an app that generates fullstack apps, describing their prototyping process and revealing that the current model it’s using is Claude 3.5 Sonnet.
Their current system prompt was refined over many different versions – initially they were including 50 example Vals at quite a high token cost, but they were able to reduce that down to the linked system prompt which includes condensed documentation and just one templated example.
Via @stevekrouse
Tags: claude-3-5-sonnet, deno, sqlite, anthropic, claude, typescript, ai, llms, prompt-engineering, ai-assisted-programming, javascript, generative-ai, val-town
AI Summary and Description: Yes
Summary: The text discusses Val Town’s AI bot, Townie, which assists users in creating full-stack web applications through a conversational interface. Key features include a simple prompt-editing functionality, integration with SQLite for data persistence, and the ability to generate images using AI. This highlights trends in AI-assisted programming and the usability enhancements offered by generative AI in application development.
Detailed Description: The content elaborates on the following significant aspects of Val Town and its new AI bot, Townie:
– **AI-assisted Application Development**: Townie provides users with a conversational interface to generate full-stack web applications (referred to as Vals) using JavaScript/TypeScript, streamlining the development process.
– **Prompt Customization**: The recent update allows users to inspect and edit the system prompt of Townie, enhancing the bot’s adaptability and interaction quality. The system prompt is notably concise, leveraging existing knowledge from Deno and TypeScript.
– **Sample Code and SQL Integration**:
– Usage of SQLite for data management is illustrated through a provided code snippet, showcasing how users can easily manipulate database entries in their applications.
– **Image Generation Feature**: Val Town hosts an image generation endpoint powered by Stable Diffusion XL Lightning, enabling users to create images based on descriptions, promoting creative content generation.
– **AI Model Integration**: Townie utilizes the “gpt-4o-mini” model for natural language processing capabilities within the application development process, also illustrating the increased accessibility of advanced AI tools for developers.
– **Continuous Improvement and Research**: The refinement of Townie’s system prompt over various iterations indicates an ongoing commitment to improving functionality while managing token usage efficiently.
Overall, this text exemplifies the current trends in generative AI security as it relates to AI tools enhancing programming capabilities, the significance of prompt engineering, and the innovative integration of AI models in application development environments. Security professionals should consider the implications of using AI in code generation and the necessity for oversight and compliance with software best practices in such evolving landscapes.