{"id":39900756,"url":"https://github.com/joshembling/laragenie","last_synced_at":"2026-01-18T15:30:31.579Z","repository":{"id":212974125,"uuid":"726804844","full_name":"joshembling/laragenie","owner":"joshembling","description":"🤖 An AI bot made for the command line that can read and understand any codebase from your Laravel app.","archived":false,"fork":false,"pushed_at":"2024-08-05T13:16:03.000Z","size":2570,"stargazers_count":151,"open_issues_count":1,"forks_count":10,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-13T05:52:25.924Z","etag":null,"topics":["ai","laragenie","laravel","openai","openai-api","php","pinecone","pineconedb"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/joshembling.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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-12-03T13:06:28.000Z","updated_at":"2025-05-31T03:04:13.000Z","dependencies_parsed_at":"2024-01-11T20:51:55.090Z","dependency_job_id":"71eaf416-239a-4276-ac9a-d3e7878323e9","html_url":"https://github.com/joshembling/laragenie","commit_stats":null,"previous_names":["joshembling/laragenie"],"tags_count":12,"template":false,"template_full_name":"spatie/package-skeleton-laravel","purl":"pkg:github/joshembling/laragenie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshembling%2Flaragenie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshembling%2Flaragenie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshembling%2Flaragenie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshembling%2Flaragenie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshembling","download_url":"https://codeload.github.com/joshembling/laragenie/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshembling%2Flaragenie/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28539228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T14:59:57.589Z","status":"ssl_error","status_checked_at":"2026-01-18T14:59:46.540Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","laragenie","laravel","openai","openai-api","php","pinecone","pineconedb"],"created_at":"2026-01-18T15:30:26.175Z","updated_at":"2026-01-18T15:30:31.565Z","avatar_url":"https://github.com/joshembling.png","language":"PHP","funding_links":[],"categories":["Tools \u0026 Utilities","PHP","Command Line Tools"],"sub_categories":["Tokenizers \u0026 Prompt Utilities","Utilities \u0026 Tools"],"readme":"# Laragenie - AI built to understand your codebases\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/joshembling/laragenie.svg?style=flat-square)](https://packagist.org/packages/joshembling/laragenie)\n[![Total Downloads](https://img.shields.io/packagist/dt/joshembling/laragenie.svg?style=flat-square)](https://packagist.org/packages/joshembling/laragenie)\n\nLaragenie is an AI chatbot that runs on the command line from your Laravel app. It will be able to read and understand any of your codebases following a few simple steps:\n\n1. Set up your env variables [OpenAI and Pinecone](#openai-and-pinecone)\n2. Publish and update the Laragenie config\n3. Index your files and/or full directories\n4. Ask your questions\n\nIt's as simple as that! Accelerate your workflow instantly and collaborate seamlessly with the quickest and most knowledgeable 'colleague' you've ever had.\n\nThis is a particularly useful CLI bot that can be used to:\n\n-   Onboard developer's to new projects.\n-   Assist both junior and senior developers in understanding a codebase, offering a cost-effective alternative to multiple one-on-one sessions with other developers.\n-   Provide convenient and readily available support on a daily basis as needed.\n\nYou are not limited to indexing files based in your Laravel project. You can use this for monorepo's, or indeed any repo in any language. You can of course use this tool to index files that are not code-related also.\n\nAll you need to do is run this CLI tool from the Laravel directory. Simple, right?! 🎉\n\n![Demo](resources/images/laragenie.gif)\n\n\u003e [!NOTE]  \n\u003e If you are upgrading from a Laragenie version `^1.0.63 \u003e 1.1`, there is a change to Pinecone environment variables. Please see [OpenAI and Pinecone](#openai-and-pinecone).\n\n## Contents\n\n-   [Requirements](#requirements)\n-   [Installation](#installation)\n-   [Useage](#usage)\n    -   [OpenAI and Pinecone](#openai-and-pinecone)\n        - [OpenAI](#openai)\n        - [Pinecone](#pinecone)\n            - [Legacy Pinecone](#legacy-pinecone)\n    -   [Running Laragenie on the command line](#running-laragenie-on-the-command-line)\n    -   [Ask a question](#ask-a-question)\n        - [Force AI](#force-ai)\n    -   [Index files](#index-files)\n        - [Indexing files outside of your Laravel project](#indexing-files-outside-of-your-laravel-project)\n    -   [Remove indexed files](#remove-indexed-files)\n    -   [Stopping Laragenie](#stopping-laragenie)\n-   [Debugging](#debugging)\n    -   [API Keys](#api-keys)\n-   [Changelog](#changelog)\n-   [Contributing](#contributing)\n-   [Security Vulnerabilities](#security-vulnerabilities)\n-   [Credits](#credits)\n-   [Licence](#license)\n\n## Minimum Requirements\n\nFor specific versions that match your PHP, Laravel and Laragenie versions please see the table below:\n\n| PHP | Laravel version | Laragenie version |\n| ----- | ----- | ----- |\n| ^8.1 | ^10.0 | \u003e=1.0 \u003c1.2 |\n| ^8.2 | ^10.0, ^11.0 | ^1.2.0 |\n\nThis package uses [Laravel Prompts](https://laravel.com/docs/10.x/prompts#fallbacks) which supports macOS, Linux, and Windows with WSL. Due to limitations in the Windows version of PHP, it is not currently possible to use Laravel Prompts on Windows outside of WSL.\n\nFor this reason, Laravel Prompts supports falling back to an alternative implementation such as the Symfony Console Question Helper.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require joshembling/laragenie\n```\n\nYou can publish and run the migrations with:\n\n```bash\nphp artisan vendor:publish --tag=\"laragenie-migrations\"\nphp artisan migrate\n```\n\nIf you don't want to publish migrations, you must toggle the database credentials in your Laragenie config to false. (See config file details below).\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"laragenie-config\"\n```\n\nThis is the contents of the published config file:\n\n```php\nreturn [\n    'bot' =\u003e [\n        'name' =\u003e 'Laragenie', // The name of your chatbot\n        'welcome' =\u003e 'Hello, I am Laragenie, how may I assist you today?', // Your welcome message\n        'instructions' =\u003e 'Write in markdown format. Try to only use factual data that can be pulled from indexed chunks.', // The chatbot instructions\n    ],\n\n    'chunks' =\u003e [\n        'size' =\u003e 1000, // Maximum number of characters to separate chunks\n    ],\n\n    'database' =\u003e [\n        'fetch' =\u003e true, // Fetch saved answers from previous questions\n        'save' =\u003e true, // Save answers to the database\n    ],\n\n    'extensions' =\u003e [ // The file types you want to index\n        'php',\n        'blade.php',\n        'js',\n    ],\n\n    'indexes' =\u003e [\n        'directories' =\u003e [], // The directores you want to index e.g. ['app/Models', 'app/Http/Controllers', '../frontend/src']\n        'files' =\u003e [], // The files you want to index e.g. ['tests/Feature/MyTest.php']\n        'removal' =\u003e [\n            'strict' =\u003e true, // User prompt on deletion requests of indexes\n        ],\n    ],\n\n    'openai' =\u003e [\n        'embedding' =\u003e [\n            'model' =\u003e 'text-embedding-3-small', // Text embedding model \n            'max_tokens' =\u003e 5, // Maximum tokens to use when embedding\n        ],\n        'chat' =\u003e [\n            'model' =\u003e 'gpt-4-turbo-preview', // Your OpenAI GPT model\n            'temperature' =\u003e 0.1, // Set temperature between 0 and 1 (lower values will have less irrelevance)\n        ],\n    ],\n\n    'pinecone' =\u003e [\n        'topK' =\u003e 2, // Pinecone indexes to fetch\n    ],\n];\n```\n\n## Usage\n\n### OpenAI and Pinecone\n\n#### OpenAI\n\nThis package uses [OpenAI](https://openai.com/) to process and generate responses and [Pinecone](https://www.pinecone.io/) to index your data.\n\nYou will need to create an OpenAI account with credits, generate an API key and add it to your `.env` file:\n\n```\nOPENAI_API_KEY=your-open-ai-key\n```\n\n\u003chr\u003e\n\n#### Pinecone\n\n\u003e [!IMPORTANT]  \n\u003e If you are using a Laragenie version prior to 1.1 and do not want to upgrade, go straight to [Legacy Pinecone](#legacy-pinecone).\n\nYou will need to create a Pinecone account. There are two diferent types of account you can set up: \n\n1. Serverless\n2. Pod-based index \n\nAs of early 2024, Pinecone recommend you start with a serverless account. You can optionally set up an account with a payment method attached to get $100 in free credits, however, a free account allows up to 100,000 indexes - likely more than enough for any small-medium sized application.\n\nCreate an index with 1536 dimensions and the metric as 'cosine'. Then generate an api key and add these details to your `.env` file:\n\n```\nPINECONE_API_KEY=an-example-pinecone-api-key\nPINECONE_INDEX_HOST='https://an-example-url.aaa.gcp-starter.pinecone.io'\n```\n\n*Your host can be seen in the information box on your index page, alongside the metric, dimensions, pod type, cloud, region and environment.*\n\n\u003chr\u003e\n\n\u003e [!TIP]  \n\u003e If you are upgrading to Laragenie ^1.1, you can safely remove the legacy environment variables: `PINECONE_ENVIRONMENT` and `PINECONE_INDEX`.\n\n##### Legacy Pinecone\n\n**Important: If you are using Laragenie 1.0.63 or prior, you must use a regular Pinecone account and NOT a serverless account. When you are hinted to select an option on account creation, ensure you select 'Continue with pod-based index'.**\n\nCreate an environment with 1536 dimensions and name it, generate an api key and add these details to your `.env` file:\n\n```\nPINECONE_API_KEY=your-pinecone-api-key\nPINECONE_ENVIRONMENT=gcp-starter\nPINECONE_INDEX=your-index\n```\n\n### Running Laragenie on the command line\n\nOnce these are setup you will be able to run the following command from your root directory:\n\n```bash\nphp artisan laragenie\n```\n\nYou will get 4 options:\n\n1. Ask a question\n2. Index files\n3. Remove indexed files\n4. Something else\n\nUse the **arrow keys** to toggle through the options and **enter** to select the command.\n\n### Ask a question\n\n\u003cimg src='resources/images/question.png' width='700'\u003e\n\n**Note: you can only run this action once you have files indexed in your Pinecone vector database (skip to the ‘Index Files’ section if you wish to find out how to start indexing).**\n\nWhen your vector database has indexes you’ll be able to ask any questions relating to your codebase.\n\nAnswers can be generated in markdown format with code examples, or any format of your choosing. Use the `bot.instructions` config to write AI instructions as detailed as you need to. \n\nBeneath each response you will see the generated cost (in US dollars), which will help keep close track of the expense. Cost of the response is added to your database, if migrations are enabled.\n\n*Costs can vary, but small responses will be less than $0.01. Much larger responses can be between $0.02–0.05.*\n\n#### Force AI \n\nAs previously mentioned, when you have migrations enabled your questions will save to your database.\n\nHowever, you may want to force AI usage (prevent fetching from the database) if you are unsatisfied with the initial answer. This will overwrite the answer already saved to the database.\n\nTo force an AI response, you will need to end all questions with an `--ai` flag e.g.\n\n`Tell me how users are saved to the database --ai`.\n\nThis will ensure the AI model will re-assess your request, and outputs another answer (this could be the same answer depending on the GPT model you are using).\n\n### Index files\n\n\u003cimg src='resources/images/index-3.png' width='700'\u003e\n\nThe quickest way to index files is to pass in singular values to the `directories` or `files` array in the Laragenie config. When you run the 'Index Files' command you will always have the option to reindex these files. This will help in keeping your Laragenie bot up to date.\n\nSelect 'yes', when prompted with `Do you want to index your directories and files saved in your config?`\n\n```php \n'indexes' =\u003e [\n    'directories' =\u003e ['app/Models', 'app/Http/Controllers'],\n    'files' =\u003e ['tests/Feature/MyTest.php'],\n    'removal' =\u003e [\n        'strict' =\u003e true,\n    ],\n],\n```\n\nIf you select 'no', you can also index files in the following ways: \n \n- Inputting a file name with it's namespace e.g. `app/Models/User.php`\n- Inputting a full directory, e.g. `App`\n    - If you pass in a directory, Laragenie can only index files within this directory, and not its subdirectories. \n    - To index subdirectories you must explicitly pass the path e.g. `app/Models` to index all of your models\n- Inputting multiple files or directories in a comma separated list e.g. `app/Models, tests/Feature, app/Http/Controllers/Controller.php`\n- Inputting multiple directories with wildcards e.g. `app/Models/*.php`\n    - Please note that the wildcards must still match the file extensions in your `laragenie` config file.\n\n#### Indexing files outside of your Laravel project\n\nYou may use Laragenie in any way that you wish; you are not limited to just indexing Laravel based files. \n\nFor example, your Laravel project may live in a monorepo with two root entries such as `frontend` and `backend`. In this instance, you could move up one level to index more directories and files e.g. `../frontend/src/` or `../frontend/components/Component.js`.\n\nYou can add these to your `directories` and `files` in the Laragenie config:\n\n```php \n'indexes' =\u003e [\n    'directories' =\u003e ['app/Models', 'app/Http/Controllers', '../frontend/src/'],\n    'files' =\u003e ['tests/Feature/MyTest.php', '../frontend/components/Component.js'],\n    'removal' =\u003e [\n        'strict' =\u003e true,\n    ],\n],\n```\n\nUsing this same method, you could technically index any files or directories you have access to on your server or local machine.\n\n**Ensure your extensions in your Laragenie config match all the file types that you want to index.**\n\n```php\n'extensions' =\u003e [\n    'php', 'blade.php', 'js', 'jsx', 'ts', 'tsx', // etc...\n],\n```\n\n*Note: if your directories, paths or file names change, Laragenie will not be able to find the index if you decide to update/remove it later on (unless you truncate your entire vector database, or go into Pinecone and delete them manually).*\n\n### Removing indexed files\n\n\u003cimg src='resources/images/rm-index.png' width='700'\u003e\n\nYou can remove indexed files using the same methods listed above, except from using your `directories` or `files` array in the Laragenie config - this is currently for indexing purposes only. \n\nIf you want to remove all files you may do so by selecting `Remove all chunked data`. **Be warned that this will truncate your entire vector database and cannot be reversed.**\n\n\u003cimg src='resources/images/truncate.png' width='700'\u003e\n\nTo remove a comma separated list of files/directories, select the `Remove data associated with a directory or specific file` prompt as an option.\n\nStrict removal, i.e. warning messages before files are removed, can be turned on/off by changing the 'strict' attribute to false in your config.\n\n```php\n'indexes' =\u003e [\n    'removal' =\u003e [\n        'strict' =\u003e true,\n    ],\n],\n```\n\n### Stopping Laragenie\n\nYou can stop Laragenie using the following methods:\n\n-   `ctrl + c` (Linux/Mac)\n-   Selecting `No thanks, goodbye` in the user menu after at least 1 prompt has run.\n\nHave fun using Laragenie! 🤖\n\n## Debugging\n\n### API Keys\n- If you have correctly added the required `.env` variables, but get an error such as \"You didn't provide an API key\", you may need to clear your cache and config:\n\n```bash\nphp artisan config:clear\nphp artisan cache:clear\n```\n\n- Likewise, if you get a 404 response and a Saloon exception when trying any of the four options, it's likely you do not have a non-serverless Pinecone database set up and are using a Laragenie version prior to 1.1. Please see [OpenAI and Pinecone](#openai-and-pinecone).\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n-   [Josh Embling](https://github.com/joshembling)\n-   [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshembling%2Flaragenie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshembling%2Flaragenie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshembling%2Flaragenie/lists"}