{"id":15688326,"url":"https://github.com/riccardobl/chat-jme","last_synced_at":"2025-05-07T21:02:40.396Z","repository":{"id":83709928,"uuid":"596275932","full_name":"riccardobl/chat-jme","owner":"riccardobl","description":"An AI assistant for jMonkeyEngine and related projects.","archived":false,"fork":false,"pushed_at":"2023-02-10T15:01:34.000Z","size":180632,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T14:06:15.196Z","etag":null,"topics":["ai","gpt","gpt3","jmonkeyengine","langchain","openai"],"latest_commit_sha":null,"homepage":"https://chat-jme.frk.wf","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riccardobl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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,"publiccode":null,"codemeta":null},"funding":{"github":["riccardobl"],"custom":["https://getalby.com/p/rblb"]}},"created_at":"2023-02-01T20:48:26.000Z","updated_at":"2023-11-25T07:10:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"519babea-d625-4f64-8b43-e48f45ab9cf0","html_url":"https://github.com/riccardobl/chat-jme","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riccardobl%2Fchat-jme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riccardobl%2Fchat-jme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riccardobl%2Fchat-jme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riccardobl%2Fchat-jme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riccardobl","download_url":"https://codeload.github.com/riccardobl/chat-jme/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252954376,"owners_count":21830902,"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":["ai","gpt","gpt3","jmonkeyengine","langchain","openai"],"created_at":"2024-10-03T17:57:57.907Z","updated_at":"2025-05-07T21:02:39.992Z","avatar_url":"https://github.com/riccardobl.png","language":"Python","funding_links":["https://github.com/sponsors/riccardobl","https://getalby.com/p/rblb"],"categories":["Getting Started"],"sub_categories":[],"readme":"# CHAT-JME\n\n\n![chat-jme](media/sc1.png)\n\nAn AI assistant for jMonkeyEngine and related projects.\n\nIt knows :\n- all the main documentation of jMonkeyEngine and some prominent projects\n- the entire source code of the jMonkeyEngine main repo\n- how to search the forum for basic queries\n\nFor more details, check the [knowledge base](#knowledge-base) section.\n\n\n\n## Technologies\nTo provide the functionality of the bot, the following libraries are used:\n\n- [🦜🔗 LangChain](https://github.com/hwchase17/langchain): to interface with GPT-3\n- [🤗 HuggingFace](https://huggingface.co/): inference libraries and models\n- [OpenAI apis](https://openai.com/api/): LLM for text generation\n- [~~MiniLM L6 v2~~](https://huggingface.co/sentence-transformers/paraphrase-MiniLM-L6-v2): ~~fast embeddings~~\n- [all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2): embeddings \n- [Flan-t5-base-samsum](https://huggingface.co/philschmid/flan-t5-base-samsum): Summarization \n- [Sumy](https://github.com/miso-belica/sumy): Alternative summarization \n- [Yake](https://pypi.org/project/yake/): keywords extraction \n- [LibreTranslate](https://libretranslate.com/): Multi language support and detection\n- and more .. Check the [requirements.txt](requirements.txt) and [environment.yml](environment.yml) for the full list.\n\n## Knowledge base\nThe bot extends the knowledge of GPT-3 by embedding pieces of information from the following sources:\n\n### Static embeddings\nStatic embeddings are updated periodically and stored in the [embeddings/](embeddings/) folder in this repo.\n\n- [x] [jmonkeyengine.org](https://jmonkeyengine.org) (partial)\n- [x] [jMonkeyEngine Wiki](wiki.jmonkeyengine.org) \n- [x] [jMonkeyEngine source code](https://github.com/jMonkeyEngine/jmonkeyengine/) \n- [x] [Minie Wiki](https://stephengold.github.io/Minie/minie) \n- [ ] [Minie source code]() \n- [x] [Lemur Wiki](https://github.com/jMonkeyEngine-Contributions/Lemur/wiki)\n- [ ] [Lemur source code]()\n- [x] [Zay-ES wiki](https://github.com/jMonkeyEngine-Contributions/zay-es/wiki)\n- [ ] [Zay-ES source code]()\n- [x] [Monkey-Droid/jme3-Simple-Examples](https://github.com/Monkey-Droid/jme3-Simple-Examples)\n\n### Dynamic embeddings\nDynamic embeddings are generated on the fly for the requested information.\n\n- [x] [jMonkeyEngine Hub](https://hub.jmonkeyengine.org/) (simple search queries based on keywords, cut off: 2023-02-03 )\n\n\n## Run without docker\n\n\n1. Install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) or [Anaconda](https://www.anaconda.com/products/individual)\n2. Clone this repo and cd into it\n3. Create the environment\n```bash\nconda env create  -f environment.yml\n```\n4. Activate the environment\n```bash\nconda activate jmebot\n```\n5. Install extra dependencies\n```bash\npip install -r requirements.txt\n```\n5b. If you want to run it on a GPU and you have a CUDA compatible GPU, make sure to have a recent version of [CUDA](https://developer.nvidia.com/cuda-downloads) installed and then install the required dependencies \n```bash\n# For Ubuntu\nsudo apt-get install  build-essential cmake swig libopenblas-dev libpcre3-dev\nbash installForCuda.sh # Install the required dependencies (note: this builds faiss-gpu from source, so it will take a while)\n```\n6. Export your OpenAI API key\n```bash\nexport OPENAI_API_KEY=\"XXXXX\"\n```\n7. Tweak the config.json file, if you want to run it on a CPU you should change DEVICE to \"cpu\" and USE_SUMY to true)\n8. Run the bot\n```bash\nbash bot.sh\n```\nor regenerate the embeddings\n```bash\nbash bot.sh ingest\n```\n\n\n\n## Usage with Docker\n\nIn a docker host\n\n\n### Build (optional)\nThe snippets below show how to use the prebuild images on github registry,\nIf you want to build your own image:\n```bash\n# For cpu\ndocker build -t chat-jme .\n\n# For cuda\ndocker build -t chat-jme:cuda . -f Dockerfile.cuda\n```\n\n### Run\n```bash\nmkdir -p /srv/chat-jme/cache\nchown -Rf 1000:1000 /srv/chat-jme/cache \n\n# For CPU\ndocker run -d --restart=always \\\n-eOPENAI_API_KEY=\"XXXXXXXX\" \\\n-v/srv/chat-jme/cache:/home/nonroot/.cache \\\n-p8080:8080 \\\n--name=\"chat-jme\" \\\nghcr.io/riccardobl/chat-jme/chat-jme:snapshot bot\n\n# For Cuda (recommended)\nGPUID=\"device=GPU-XXXXX\"\ndocker run -d --restart=always \\\n-eOPENAI_API_KEY=\"XXXXXXXX\" \\\n-v/srv/chat-jme/cache:/home/nonroot/.cache \\\n-p8080:8080 \\\n--gpus $GPUID\n--name=\"chat-jme\" \\\n ghcr.io/riccardobl/chat-jme/chat-jme:cuda-snapshot bot\n```\n\n*NOTE: To use custom static embeddings specify the INDEX_PATH environment variable*\n\n*NOTE2: the first run might take some time since it has to download the models.*\n\n*NOTE3: If you use the cpu you might need to add --security-opt seccomp=unconfined to the docker command if performances are bad (note that this is not recommended)*\n\n\n\n\n### Rebuild/update static embeddings\n```bash\nmkdir -p /srv/chat-jme/cache\nchown -Rf 1000:1000 /srv/chat-jme/cache \n\nmkdir -p /srv/chat-jme/embeddings\nchown -Rf 1000:1000 /srv/chat-jme/embeddings\n\ndocker run -d --restart=always \\\n-eOPENAI_API_KEY=\"XXXXXXXX\" \\\n-eINDEX_PATH=\"/embeddings\" \\\n-v/srv/chat-jme/cache:/home/nonroot/.cache \\\n-v/srv/chat-jme/embeddings:/embeddings \\\n--name=\"chat-jme\" \\\nghcr.io/riccardobl/chat-jme/chat-jme:snapshot ingest\n```\n\n\n\n## API\n\n\n### Create maintain a session (should be called periodically)\n**POST** /session\n\nREQUEST\n```json\n{\n    \"sessionSecret\":\"\", // sessionSecret of the session to maintain or nothing to create a new one\n    \"lang\":\"en\" // || \"it\" || etc... || \"auto\",    \n}\n```\nRESPONSE\n```json\n{\n    \"sessionSecret\":\"XYZ\", // sessionSecret of the session\n    \"helloText\":\"???\", // Text that can be used to initiate a conversation with the bot (in the chosen language)\n    \"welcomeText\": \"...\" // Hardcoded welcome text in the specified language\n}\n```\n\n### Ask something\n**POST** /query\n\nREQUEST\n```json\n{\n    \"sessionSecret\":\"\",\n    \"lang\":\"en\",// || \"it\" || etc... || \"auto\",\n    \"question\":\"Your question\"\n}\n\n```\nRESPONSE\n```json\n{\n    \"output_text\":\"???\" // Answer to the question\n}\n```\n\n### List all supported languages\n**GET** /lang\n\nRESPONSE\n```json\n[\n    {\n        \"name\":\"English\",\n        \"code\":\"en\"\n    },\n    {\n        \"name\":\"Italian\",\n        \"code\":\"it\"\n    },\n    ...\n]\n```\n\n\n## Frontend usage and configuration\n\nThe frontend is server on the 8080 port by default.\nIt supports some configuration parameters that can be passed as document hash parameters.\nMultiple parameters can be concatenated with the `\u0026` character.\n\n- **lang** the language for questions and answers. (default: en, use auto to get the bot to detect the language automatically)\n- **compact** if true, the bot will be displayed in a compact mode, good for embedding (default: false)\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friccardobl%2Fchat-jme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friccardobl%2Fchat-jme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friccardobl%2Fchat-jme/lists"}