{"id":21901345,"url":"https://github.com/patw/externalbrain","last_synced_at":"2025-04-15T20:12:47.344Z","repository":{"id":215499297,"uuid":"739090664","full_name":"patw/ExternalBrain","owner":"patw","description":"Create an external brain for your facts, ask questions about it later","archived":false,"fork":false,"pushed_at":"2024-11-29T16:02:11.000Z","size":1009,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T20:12:39.618Z","etag":null,"topics":["flask","instructor-embeddings","llamacpp"],"latest_commit_sha":null,"homepage":"","language":"Python","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/patw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-01-04T18:45:55.000Z","updated_at":"2024-11-29T16:02:15.000Z","dependencies_parsed_at":"2024-04-27T12:44:01.890Z","dependency_job_id":null,"html_url":"https://github.com/patw/ExternalBrain","commit_stats":null,"previous_names":["patw/externalbrain"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patw%2FExternalBrain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patw%2FExternalBrain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patw%2FExternalBrain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patw%2FExternalBrain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patw","download_url":"https://codeload.github.com/patw/ExternalBrain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249145418,"owners_count":21219966,"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":["flask","instructor-embeddings","llamacpp"],"created_at":"2024-11-28T15:13:14.543Z","updated_at":"2025-04-15T20:12:47.338Z","avatar_url":"https://github.com/patw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# External Brain\n\nFacts are all you need (tm) ... and maybe an LLM, a text embedder, mongo and some python!\n\nExternal Brain is a tool for asserting facts or writing down your thoughts, storing them in a durable data store and giving you the ability to ask an LLM questions about them later.\n\n* Use the input tool to summarize whatever text you send it.  It will use the LLM to produce bullet point facts for all your data\n* Facts get grouped into fact chunks and vectorized by a text embedder\n* Questions to the External Brain will retrieve facts before answering, grouding the response with your own facts!\n\n## Compatibility\n\nExternal Brain's fact and chunk storage runs on MongDB Atlas, you can test it on a free tier (m0) account here:  https://www.mongodb.com/cloud/atlas/register\n\nExternal Brain was designed around using llama.cpp in server mode (or ollama server) for the LLM, however it can now be run with OpenAI or Mistral.ai keys! Check out the sample.env file for configuration options.\n\n[extBrain - Hackathon Video](https://youtu.be/JJk5hY6gI1w)\n\n![ExternalBrain UI Screenshot](images/question.png)\n![ExternalBrain Facts](images/facts.png)\n![ExternalBrain Search](images/search.png)\n\n## Basic Installation\n\nCreate a dedicated cluster on MongDB Atlas (7.x or higher), Under Database Access add a database user in Password mode, with the built in role of \"read/write any database\".  Click on Network Access and add your personal IP or 0.0.0.0 if you're comfortable with any IP connecting to this cluster.\n\nIf you don't plan on running in local mode (see instructions below), obtain an API key from OpenAI (https://platform.openai.com/signup) or MistralAI (https://console.mistral.ai/).\n\nRun the following in the ExternalBrain directory:\n\n```\npip install -r requirements.txt\n```\n\n## Docker Installation\n\n```\ngit pull https://github.com/patw/ExternalBrain.git\ncd ExternalBrain\n```\n\n* Follow the instructions below on configuring the .env, model and embedder configs\n\n```\ndocker build -t extbrain .\ndocker run -d -p 7861:5000 extbrain\n```\n\n## Configuration\n\nCopy the sample.env file to .env and edit this file.  This contains all the important configuration variables for the application to run.\n\n* MONGO_CON - This will be your srv style connection into Atlas Mongo, you can get this from the Atlas UI by selecting Connection and using python for the language\n* MONGO_DB - The database you want to connect to.  \"extbrain\" is default.\n* SECRET_KEY - This is the session key for Flask, it can be anything you want\n* USERS - This is a json doc of user/password keys, set this to something you remember so you can log into system\n* API_KEY - This is the key that the discord_bot, slack_Bot and web_bot need to connect to extBrain, set it to something strong and complex and use the same key in those tools\n* SERVICE - This can be \"local\" for llama.cpp in server mode + BreadVec,  \"mistral\" for Mistral.ai or \"openai\" for OpenAI\n* MODEL_NAME - This is the model name to use with each service.  Local doesn't use this but Mistral and OpenAI need this configured.\n* OPENAI_API_KEY - This is your OpenAI Key. You only need this configured if you are using OpenAI. \n* MISTRAL_API_KEY - This is your Mistral.ai Key. You only need this configured if you are using Mistral.ai.\n\n## Running extBrain\n\nAfter the application has been configured (.env is correct), you can start it with the script files and load the UI by going to:\n\nhttp://localhost:7861\n\n### Linux / MacOS \n\n```\n./extbrain.sh\n```\n\n### Windows \n\n```\nextbrain.bat\n```\n\n# Local Mode Configuration - Ignore if you use OpenAI or Mistral.ai\n\nIf you want to run extBrain entirely locally, without using any cloud provider you can! Follow the instructions below to install a vectorizer service and an LLM.  I highly recommend an M1/M2/M3 mac for this task or a PC with an nVidia graphics card and at least 8 gigs of VRAM.  It will run on CPU, but the experience is really poor compared to these accelerated plaforms.\n\n## Config files\n\nRename the model.json.sample to model.json.  This file is used to set the prompt format and ban tokens, the default is ChatML format so it should work with most recent models.  Set the llama_endpoint to point to your llama.cpp running in server mode.\n\nRename embedder.json.sample to embedder.json and point to the endpoint of your BreadVec service.\n\n## Setting up the Text Embedder\n\nInstall and configure https://github.com/patw/BreadVec\n\nDetailed instructions are in that repo.\n\n## Downloading an LLM model\n\nFollow instructions in ollama or llama.cpp for running server mode and downloading models.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatw%2Fexternalbrain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatw%2Fexternalbrain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatw%2Fexternalbrain/lists"}