willthereader avatar
ReadmeWriter
@willthereader
Script
Val Town AI Readme Writer This val provides a class ReadmeWriter for generating readmes for vals with OpenAI. It can both draft readmes and update them directly PRs welcome! See Todos below for some ideas I have. Usage To draft a readme for a given code, use the draftReadme method: import { ReadmeWriter } from "https://esm.town/v/nbbaier/readmeGPT"; const readmeWriter = new ReadmeWriter({}); const val = "https://www.val.town/v/:username/:valname"; const generatedReadme = await readmeWriter.draftReadme(val); To write and update a readme for a given code, use the writeReadme method: import { ReadmeWriter } from "https://esm.town/v/nbbaier/readmeGPT"; const readmeWriter = new ReadmeWriter({}); const val = "https://www.val.town/v/:username/:valname"; const successMessage = await readmeWriter.writeReadme(val); API Reference Class: ReadmeWriter The ReadmeWriter class represents a utility for generating and updating README files. Constructor Creates an instance of the ReadmeWriter class. Parameters: model (optional): The model to be used for generating the readme. Defaults to "gpt-3.5-turbo". apiKey (optional): An OpenAI API key. Defaults to Deno.env.get("OPENAI_API_KEY") . Methods draftReadme(val: string): Promise<string> : Generates a readme for the given val. Parameters: val : URL of the code repository. Returns: A promise that resolves to the generated readme. writeReadme(val: string): Promise<string> : Generates and updates a readme for the given val. Parameters: val : URL of the code repository. Returns: A promise that resolves to a success message if the update is successful. Todos [ ] Additional options to pass to the OpenAI model [ ] Ability to pass more instructions to the prompt to modify how the readme is constructed
nbbaier avatar
draftReadme
@nbbaier
Script
Code Documentation Assistant The Code Documentation Assistant is an AI-powered tool that helps generate documentation for code. It uses the OpenAI GPT-3.5 Turbo model to generate readme files in GitHub-flavored markdown based on the provided code. Usage Importing the Code Documentation Assistant import { draftReadme, writeReadme } from "code-doc-assistant"; Function: draftReadme async function draftReadme(options: WriterOptions): Promise<string> The draftReadme function generates a readme file based on the provided options. Parameters options (required): An object containing the following properties: username (string): The username of the code owner. valName (string): The name of the Val containing the code. model (optional, default: "gpt-3.5-turbo"): The OpenAI model to use for generating the readme. userPrompt (optional): Additional prompt to include in the documentation. Return Value A promise that resolves to a string representing the generated readme file. Function: writeReadme async function writeReadme(options: WriterOptions): Promise<string> The writeReadme function generates a readme file and updates the readme of the corresponding Val with the generated content. Parameters options (required): An object containing the following properties: username (string): The username of the code owner. valName (string): The name of the Val containing the code. model (optional, default: "gpt-3.5-turbo"): The OpenAI model to use for generating the readme. userPrompt (optional): Additional prompt to include in the documentation. Return Value A promise that resolves to a string indicating the success of the readme update. Example import { draftReadme, writeReadme } from "code-doc-assistant"; const options = { username: "your-username", valName: "your-val-name", }; const generatedReadme = await draftReadme(options); console.log(generatedReadme); const successMessage = await writeReadme(options); console.log(successMessage); License This project is licensed under the MIT License .
1
Next
v75
January 22, 2024