{"id":13901301,"url":"https://github.com/PAIR-code/wordcraft","last_synced_at":"2025-07-17T21:32:56.133Z","repository":{"id":163609594,"uuid":"636307780","full_name":"PAIR-code/wordcraft","owner":"PAIR-code","description":"✨✍️ Wordcraft is an AI-powered text editor with an emphasis on short story writing","archived":false,"fork":false,"pushed_at":"2024-07-15T05:22:37.000Z","size":1057,"stargazers_count":236,"open_issues_count":12,"forks_count":49,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-08-07T21:45:18.467Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PAIR-code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-05-04T14:53:08.000Z","updated_at":"2024-08-06T13:38:51.000Z","dependencies_parsed_at":"2024-01-16T22:22:15.628Z","dependency_job_id":"9f5d3b8c-0dd6-4efc-a10b-8f0b173a0a44","html_url":"https://github.com/PAIR-code/wordcraft","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PAIR-code%2Fwordcraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PAIR-code%2Fwordcraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PAIR-code%2Fwordcraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PAIR-code%2Fwordcraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PAIR-code","download_url":"https://codeload.github.com/PAIR-code/wordcraft/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226305303,"owners_count":17603789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T21:01:09.959Z","updated_at":"2024-11-25T09:31:10.249Z","avatar_url":"https://github.com/PAIR-code.png","language":"TypeScript","readme":"# ✨✍️ Wordcraft\n\nWordcraft is an LLM-powered text editor with an emphasis on short story writing.\n\n[g.co/research/wordcraft](http://g.co/research/wordcraft)\n\nWordcraft is a tool built by researchers at Google\n[PAIR](https://pair.withgoogle.com/) for writing stories with AI. The\napplication is powered by generative models such as\n[Gemini](https://ai.google.dev/docs/).\nAt its core, generative models are simple machines — it's trained to\npredict the most likely next word given a textual prompt. But because the model\nis so large and has been trained on a massive amount of text, it's able to learn\nhigher-level concepts. It also demonstrates a fascinating emergent capability\noften referred to as\n[_in-context learning_](https://huggingface.co/blog/few-shot-learning-gpt-neo-and-inference-api).\nBy carefully designing input prompts, the model can be instructed to perform an\nincredibly wide range of tasks.\n\nHowever this process (often referred to as _prompt engineering_) is finicky and\ndifficult even for experienced practitioners. We built Wordcraft with the goal\nof exploring how far we could push this technique through a carefully crafted\nuser interface, and to empower writers by giving them access to these\nstate-of-the-art tools.\n\n# 👷‍♂️ Build\n\n```bash\nnpm i\nnpm run dev\n```\n\n# ☁️ API\n\nIn order to run Wordcraft, you'll need a Gemini API key. Please follow the\ninstructions at\n[ai.google.dev/tutorials/setup](https://ai.google.dev/tutorials/setup).\nOnce you have your API key, create a .env file and add the key!\n\n```bash\ntouch .env\necho \"API_KEY=\\\"\u003cINSERT_API_KEY\u003e\\\"\" \u003e .env\n```\n\nRemember, use your API keys securely. Do not share them with others, or embed\nthem directly in code that's exposed to the public! This application\nstores/loads API keys on the client for ease of development, but these should be\nremoved in all production apps!\n\nYou can find more information about the Gemini API at\n[ai.google.dev/docs/](https://ai.google.dev/docs/)\n\n# 🤖 App\n\nWordcraft can be customized by adding additional models or adding\noperations/controls. The basic architecture allows for a great deal of\nflexibility in the\n\n### `/app/context`\n\nDefines the underlying data/examples that will be used to construct few-shot\ninstructions to the underlying language model. This example data can be\ncustomized to fit a particular style or genre.\n\n### `/app/core/operations`\n\nDefines how the user's intent is combined with the document state, manages\nupdating the text editor, and handles user choices.\n\n### `/app/models`\n\nDefines how the data from the `Context` is combined with an `Operation` state to\nconstruct text that will be sent to a mode, and parses model output.\n\n## Customizing context\n\nThe Wordcraft application uses few-shot examples for constructing prompts to\nsend to the model. The style of the generated text is influenced by these\nexamples, and you can customize Wordcraft's style or genre by editing these\nexamples. These examples are found in `/app/context/json`, and follow a schema\ndefined in `/app/context/schema`.\n\n## Adding new controls\n\nTo add a new custom control (e.g. a button that translates into pig latin):\n\n- Create a new `pigLatinSchema` in `/app/context/schema.ts`\n- Create a new `pig_latin_examples.json` in `/app/context/json/`\n- Register the examples int the `WordCraftContext` constructor\n  (`/app/context/index.ts`)\n- Create a corresponding prompt handler in `/app/models/gemini/prompts`\n- Register that prompt handler with the underlying `Model` class in\n  `/app/models/gemini/index.ts`\n- Create a new `PigLatinOperation` in `/app/core/operations`\n- Register the operation in `main.ts`\n\n\u003chr /\u003e\n\n**This is not an officially supported Google product**\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPAIR-code%2Fwordcraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPAIR-code%2Fwordcraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPAIR-code%2Fwordcraft/lists"}