{"id":13995854,"url":"https://github.com/githubnext/gpt4-with-calc","last_synced_at":"2025-10-26T21:30:46.791Z","repository":{"id":166554945,"uuid":"630162935","full_name":"githubnext/gpt4-with-calc","owner":"githubnext","description":"GPT-4 Equipped with Numeric Calculation","archived":false,"fork":false,"pushed_at":"2024-08-15T08:35:18.000Z","size":1196,"stargazers_count":172,"open_issues_count":2,"forks_count":18,"subscribers_count":82,"default_branch":"main","last_synced_at":"2025-02-04T12:56:53.119Z","etag":null,"topics":["calculation","code-generation","gpt-4","numeric"],"latest_commit_sha":null,"homepage":"https://github.com/githubnext/gpt4-with-calc","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/githubnext.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-19T19:56:28.000Z","updated_at":"2025-02-03T01:56:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0e8d687-6151-410e-bc84-c37859e21a9c","html_url":"https://github.com/githubnext/gpt4-with-calc","commit_stats":null,"previous_names":["githubnext/gpt4-with-calc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubnext%2Fgpt4-with-calc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubnext%2Fgpt4-with-calc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubnext%2Fgpt4-with-calc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/githubnext%2Fgpt4-with-calc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/githubnext","download_url":"https://codeload.github.com/githubnext/gpt4-with-calc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238400120,"owners_count":19465600,"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":["calculation","code-generation","gpt-4","numeric"],"created_at":"2024-08-09T14:03:37.304Z","updated_at":"2025-10-26T21:30:39.636Z","avatar_url":"https://github.com/githubnext.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# GPT-4 Equipped with Numeric Calculation\n\nGPT-4 has trouble with calculating with numbers. We look at a technique to fix that.\n\n[**Read the report - GPT-4 Equipped with Numeric Calculation**](docs/report.md)\n\n[**Read the evaluation**](docs/eval.md)\n\nCode is a stripped and repurposed version of \"prbot\" by @dsyme, @acr31, @wunderalbert, @max-schaefer, @mattrothenberg, @drifkin.\n\n\n\u003e NOTE: The default model used when running this code is OpenAI's **`text-davinci-003`** and not GPT-4. The code can be adjusted to run against any completion API by changing the settings in [`src/engine/options.ts`](src/engine/options.ts) and [`src/engine/settings.ts`](src/engine/settings.ts).\n\u003e\n\u003e When writing this report, we evaluated the technique using the completion API of a private release of GPT-4. The public release of GPT-4 currently only provides a \"chat\" API. As a result some aspects of the technique described may need to be reworked because of this, however we are providing the code and our investigation for reference. We believe the evaluation results remain valid although some variation in numbers is to be expected.\n\n## Requirements\n\n```sh\nsudo apt-get install npm\nnpm install\nnpm run build\n```\n\n## Examples\n\nDefine an API key:\n\n```bash\nexport OPENAI_API_KEY=...\n```\n\nTry your own question:\n\n```bash\n./gpte ask --question \"What is sin(13.31) where the input is in degrees?\"\n./gpte ask --question \"What is sin(13.31) where the input is in degrees?\" --arith\n\n./gpte ask --questionfile test/samples/number-years-grow-30.txt\n./gpte ask --questionfile test/samples/number-years-grow-30.txt --arith\n```\n\nThese examples require GPT-4 token window size, code generation and reasoning:\n\n```bash\n./gpte ask --questionfile test/samples/msft-report-snippet.txt\n./gpte ask --questionfile test/samples/msft-report-snippet.txt --arith\n\n./gpte ask --questionfile test/samples/msft-goog-report-snippets-compared.txt\n./gpte ask --questionfile test/samples/msft-goog-report-snippets-compared.txt --arith\n\n./gpte ask --questionfile test/samples/gap-lulemon-financial-reports-compared.txt\n./gpte ask --questionfile test/samples/gap-lulemon-financial-reports-compared.txt --arith\n```\n\nWith an appropriate model, entire problem sets can be evaluated using `./gpte eval`.\n\n## License\n\nThis project is licensed under the terms of the MIT open source license. Please refer to [MIT](./LICENSE.txt) for the full terms.\n\n## Maintainers\n\nMaintainers: @dsyme, @wunderalbert, @johanrosenkilde\n\n## Support\n\nThis project is a concluded technical investigation by GitHub Next. It is provided for reference.\n\n## Acknowledgement\n\nThis project includes a modified version of the [`ASDiv.xml` dataset](https://github.com/chaochun/nlu-asdiv-dataset/blob/master/dataset/ASDiv.xml) for numeric calculation problems, adapted primarily to clarify the precisions and formats required in answers, see the [evaluation](docs/eval.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithubnext%2Fgpt4-with-calc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithubnext%2Fgpt4-with-calc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithubnext%2Fgpt4-with-calc/lists"}