{"id":30127670,"url":"https://github.com/moeki0/promptest","last_synced_at":"2026-05-06T22:02:52.682Z","repository":{"id":176961316,"uuid":"659787873","full_name":"moeki0/promptest","owner":"moeki0","description":"The Prompt testing library for LLM that allows comparing patterns of prompts.","archived":false,"fork":false,"pushed_at":"2023-06-28T23:30:17.000Z","size":236,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-29T08:45:34.242Z","etag":null,"topics":["ai","llm","npm","prompt","prompt-engineering","test"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/promptest","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moeki0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-28T14:59:39.000Z","updated_at":"2023-06-28T15:23:28.000Z","dependencies_parsed_at":"2023-10-04T09:07:42.553Z","dependency_job_id":null,"html_url":"https://github.com/moeki0/promptest","commit_stats":null,"previous_names":["moekidev/promptest","kawakamimoeki/promptest","kawakamidev/promptest","moekiorg/promptest"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/moeki0/promptest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moeki0%2Fpromptest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moeki0%2Fpromptest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moeki0%2Fpromptest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moeki0%2Fpromptest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moeki0","download_url":"https://codeload.github.com/moeki0/promptest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moeki0%2Fpromptest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269756394,"owners_count":24470566,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ai","llm","npm","prompt","prompt-engineering","test"],"created_at":"2025-08-10T17:09:02.131Z","updated_at":"2026-05-06T22:02:47.307Z","avatar_url":"https://github.com/moeki0.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PrompTest\n\n![v](https://badgen.net/npm/v/promptest)\n![license](https://badgen.net/github/license/moekidev/promptest)\n\nThe Prompt testing library for LLM that allows comparing patterns of prompts.\n\n## Installation\n\n    $ npm i --save-dev promptest\n\n## Usage\n\n```ts\n// prompt.test.js\nconst { Configuration, OpenAIApi } = require(\"openai\")\nconst { variable, promptest } = require('promptest')\n\nconst configuration = new Configuration({\n  apiKey: process.env.OPENAI_API_KEY,\n})\nconst openai = new OpenAIApi(configuration)\n\nvariable(\"name\", [\"John\", \"Jane\"])\nvariable(\"age\", [\"20\", \"30\"])\n\npromptest(\n  \"Your name is {{name}}, and you are {{age}} years old.\",\n  \"Hello!\",\n  async (subject, input) =\u003e {\n    const chatCompletion = await openai.createChatCompletion({\n      model: \"gpt-3.5-turbo\",\n      messages: [\n        { role: \"system\", content: subject },\n        { role: \"user\", content: input },\n      ],\n    })\n    return chatCompletion.data.choices[0].message.content\n  }\n).then(console.log).catch(console.error)\n```\n\n```bash\nnpx node prompt.test.js\n```\n\n### Variable\n\n```ts\nvariable(\"name\", [\"John\", \"Jane\"])\n```\n\n`variable` is called with variable name and patterns.\n\n### Subject\n\nThe subject prompt template is defined with `{{name}}`.\n\n```ts\npromptest(\n  \"Your name is {{name}}, and you are {{age}} years old.\",\n  // ...\n)\n```\n\n### Input\n\nInput is ordinary user prompt for testing.\n\n```ts\npromptest(\n  // ..\n  \"Hello!\"\n  // ..\n)\n```\n\n### Callback\n\nThe callback is test function. The arguments are subject prompt and input prompt.\n\n```ts\npromptest(\n  // ...\n  async (subject: string, input: string) =\u003e {\n    const chatCompletion = await openai.createChatCompletion({\n      model: \"gpt-3.5-turbo\",\n      messages: [\n        { role: \"system\", content: subject },\n        { role: \"user\", content: input },\n      ],\n    })\n    return chatCompletion.data.choices[0].message.content\n  }\n)\n```\n\n### Result\n\nThe result is JSON.\n\n```json\n{\n  \"input\": \"Hello!\",\n  \"results\": [\n    {\n      \"subject\": \"Your name is John, and you are 20 years old\",\n      \"output\": \"Hello! How can I assist you today?\"\n    },\n    {\n      \"subject\": \"Your name is Jane, and you are 20 years old\",\n      \"output\": \"Hello! How can I assist you today?\"\n    },\n    {\n      \"subject\": \"Your name is John, and you are 30 years old\",\n      \"output\": \"Hello! How can I help you today?\"\n    },\n    {\n      \"subject\": \"Your name is Jane, and you are 30 years old\",\n      \"output\": \"Hello! How can I assist you today?\"\n    },\n  ]\n}\n```\n\n## Development\n\nAfter checking out the repo, run `npm i` to install dependencies. Then, run `npm run test` to run the tests.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/moekidev/promptest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/moekidev/promptest/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Promptest project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/moekidev/promptest/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoeki0%2Fpromptest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoeki0%2Fpromptest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoeki0%2Fpromptest/lists"}