https://github.com/Krisseck/php-rag Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} Krisseck / php-rag Public * Notifications * Fork 1 * Star 9 An AI assistant built with PHP, Solr and LLM backend of choice. Proof of concept mostly. License MIT license 9 stars 1 fork Activity Star Notifications * Code * Issues 1 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights Krisseck/php-rag This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/K] Use Git or checkout with SVN using the web URL. [gh repo clone Krisse] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @Krisseck Krisseck Update README.md ... 6b4297a Nov 5, 2023 Update README.md 6b4297a Git stats * 13 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .ddev Change solr add-on November 2, 2023 16:02 .idea OpenAI support November 5, 2023 14:20 examples Fix OpenAI support November 5, 2023 14:34 src Fix OpenAI support November 5, 2023 14:34 .gitignore Create example query November 3, 2023 15:13 LICENSE Initial commit November 2, 2023 15:19 README.md Update README.md November 5, 2023 15:06 composer.json OpenAI support November 5, 2023 14:20 composer.lock OpenAI support November 5, 2023 14:20 env.example OpenAI support November 5, 2023 14:20 View code PHP-RAG Idea Installation Configuration Backend (database) LLM Demo README.md PHP-RAG An AI assistant ("chatbot") built with PHP, Solr (or other DB backend) and LLM of choice. Proof of concept mostly. Idea What is retrieval-augmented generation? | IBM Diagram of RAG process Installation This project uses DDEV to manage the environment. After installing DDEV, run: ddev start ddev composer i cp env.example .env If you are not using DDEV, you will need: * PHP 8.1 with at least curl extension * Composer * Solr server * Access to a LLM service Configuration .env / env.example has the following configuration options: * SOLR_HOST - Hostname of Solr server * SOLR_PORT - Port of Solr server * SOLR_CORE - Name of the core of the Solr server * ELASTIC_HOST - Hostname and port of Elastic server * ELASTIC_API_KEY - API key of Elastic server * ELASTIC_INDEX - Name of the index of the Elastic server * CONTEXT_TOKEN_COUNT - Maximum token count to be included in LLM context * REPLICATE_API_KEY - Replicate API key (if using Replicate LLM) * REPLICATE_MODEL_VERSION - Hash of the model version used in Replicate (if using Replicate LLM) * KOBOLDAI_HORDE_API_KEY - KoboldAI Horde API key (if using KoboldAI Horde LLM) * OPENAI_API_KEY - OpenAI API key * OPENAI_MODEL - Name of the model used in OpenAI query Backend (database) * Solr * ElasticSearch More backends (like MySQL or Sqlite) can be done easily, just implement the Krisseck\PhpRag\Backend\BackendInterface. LLM * OpenAI * Replicate * KoboldAI Horde Replicate is the easiest to use, you can get a free API key on https: //replicate.com/. For Replicate, you need to provide the hash of the model version you will be using. You can get the hash from "Versions" tab on a model's page. Demo There's an example script in examples folder. To run it with DDEV: ddev start ddev ssh cd examples php chicago-prompt.php Note that fetching the output can take a while on free APIs, so be patient. About An AI assistant built with PHP, Solr and LLM backend of choice. Proof of concept mostly. Topics php elasticsearch ai solr openai rag llm Resources Readme License MIT license Activity Stars 9 stars Watchers 1 watching Forks 1 fork Report repository Releases No releases published Packages 0 No packages published Languages * PHP 97.2% * Shell 2.8% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time.