Giter VIP home page Giter VIP logo

wordcraft's Introduction

✨✍️ Wordcraft

Wordcraft is an LLM-powered text editor with an emphasis on short story writing.

g.co/research/wordcraft

Wordcraft is a tool built by researchers at Google PAIR for writing stories with AI. The application is powered by LLMs such as PaLM, one of the latest generation of large language models. At its core, LLMs are simple machines — it's trained to predict the most likely next word given a textual prompt. But because the model is so large and has been trained on a massive amount of text, it's able to learn higher-level concepts. It also demonstrates a fascinating emergent capability often referred to as in-context learning. By carefully designing input prompts, the model can be instructed to perform an incredibly wide range of tasks.

However this process (often referred to as prompt engineering) is finicky and difficult even for experienced practitioners. We built Wordcraft with the goal of exploring how far we could push this technique through a carefully crafted user interface, and to empower writers by giving them access to these state-of-the-art tools.

👷‍♂️ Build

npm i
npm run dev

☁️ API

In order to run Wordcraft, you'll need a GenAI API key. Please follow the instructions at developers.generativeai.google/tutorials/setup. Once you have your API key, create a .env file and add the key!

touch .env
echo "API_KEY=\"<INSERT_GENAI_API_KEY>\"" > .env

Remember, use your API keys securely. Do not share them with others, or embed them directly in code that's exposed to the public! This application stores/loads API keys on the client for ease of development, but these should be removed in all production apps!

You can find more information about the PaLM 2 API at developers.generativeai.google

🤖 App

Wordcraft can be customized by adding additional models or adding operations/controls. The basic architecture allows for a great deal of flexibility in the

/app/context

Defines the underlying data/examples that will be used to construct few-shot instructions to the underlying language model. This example data can be customized to fit a particular style or genre.

/app/core/operations

Defines how the user's intent is combined with the document state, manages updating the text editor, and handles user choices.

/app/models

Defines how the data from the Context is combined with an Operation state to construct text that will be sent to a mode, and parses model output.

Adding new controls

To add a new custom control (e.g. a button that translates into pig latin):

  • Create a new PigLatinExamples in /app/context/examples
  • Create a corresponding prompt handler in /app/models/genai/prompts
  • Register that prompt handler with the underlying Model class in /app/models/genai/index.ts
  • Create a new PigLatinOperation in /app/core/operations
  • Register the operation in main.ts

This is not an officially supported Google product

wordcraft's People

Contributors

cannoneyed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.