{"id":49016368,"url":"https://github.com/daslearning-org/ai-indian-law","last_synced_at":"2026-04-19T02:17:36.392Z","repository":{"id":295611538,"uuid":"990638104","full_name":"daslearning-org/ai-indian-law","owner":"daslearning-org","description":"This AI ChatBot is designed to be private and can answer your queries on Indian Constitution \u0026 Indian Penal Code (IPC). This app is using Google ADK for the frontend \u0026 LiteLlm wrapper which is build with Ollama LLMs which are namely llama3.2 \u0026 mxbai-embed-large.","archived":false,"fork":false,"pushed_at":"2025-05-26T12:15:40.000Z","size":310,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-26T13:30:02.204Z","etag":null,"topics":[],"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/daslearning-org.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,"zenodo":null}},"created_at":"2025-05-26T12:12:00.000Z","updated_at":"2025-05-26T12:15:44.000Z","dependencies_parsed_at":"2025-05-26T13:30:50.238Z","dependency_job_id":"552f386a-9b2e-406b-aa5f-9862a14b37a8","html_url":"https://github.com/daslearning-org/ai-indian-law","commit_stats":null,"previous_names":["daslearning-org/ai-indian-law"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/daslearning-org/ai-indian-law","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daslearning-org%2Fai-indian-law","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daslearning-org%2Fai-indian-law/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daslearning-org%2Fai-indian-law/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daslearning-org%2Fai-indian-law/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daslearning-org","download_url":"https://codeload.github.com/daslearning-org/ai-indian-law/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daslearning-org%2Fai-indian-law/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31991750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-04-19T02:17:35.706Z","updated_at":"2026-04-19T02:17:36.383Z","avatar_url":"https://github.com/daslearning-org.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⚖️ Indian LAW AI-Agent\nThis AI ChatBot is designed to be **private** and can answer your queries on Indian Constitution \u0026 Indian Penal Code (IPC). This app is using Google ADK for the frontend \u0026 [LiteLlm](./backend/markDownRAG/) wrapper which is build with `Ollama` LLMs which are namely `llama3.2` \u0026 `mxbai-embed-large`.\n\n## 📽️ Demo\nYou can click on the below Image or this [Youtube Link](https://www.youtube.com/watch?v=gjEXywPBC0Q) to see the demo. Please let me know in the comments, how do you feel about this App.\n[![AI-LAW-Chatbot](https://img.youtube.com/vi/gjEXywPBC0Q/sddefault.jpg)](https://www.youtube.com/watch?v=gjEXywPBC0Q)\n\n## ⚠️ Disclaimer\nThis AI application is creating its own `RAG` database based on two markdown files: `Indian Constitution` \u0026 `Bharatiya Nyaya Sanhita (IPC)` locaded [here](./backend/markDownRAG/markdown_files/). This markdown files were generated using the [docling project](https://github.com/docling-project/docling) from the PDF files which are publicly available. The author is not responsible for any wrong information given by this AI Agent.\n\n------------------\n\n## 📦 Quickstart Guide\nYou can run it on [Google Colab](https://colab.research.google.com/) and you can run it on a `Free` GPU machine with the available [code](./colab/ai_law_ollama.ipynb). If you want to deploy this complete application on the Container World like Docker, Kubernetes etc. you may follow the next steps.\n\n### 🚀 Run it on Google Colab\nYou can access [Google Colab](https://colab.research.google.com/) for free if you have a Google/Gmail account. \u003cbr\u003e\nYou can download the [code](./colab/ai_law_ollama.ipynb) \u0026 run it or you can directly open it with below option. \u003cbr\u003e\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/daslearning-org/ai-indian-law/blob/main/colab/ai_law_ollama.ipynb)\n\n### ☸️ Run it on Kubernetes (example is on GKE)\nThe example is on GKE, but you can replicate it on any K8S environment. You need to change (or remove) some parameters `tolerations`, `gke-accelerator`, `gke-spot` etc. in the YML files in [k8s](./k8s/) directory.\n\n1. Get the `kubectl` setup for your GKE cluster (only for GKE)\n```bash\n# get the cluster context (only for GKE)\ngcloud container clusters get-credentials ai-gke --region=asia-south1 --project=dl-k8s-dev1cade # update with your gke \u0026 project details\n```\n\n2. Run the `Ollama` backend\n```bash\nkubectl apply -f ./k8s/ollama-app.yml\n```\n\n3. Run `litellm` app\n```bash\nkubectl apply -f ./k8s/litellm-app.yml\n```\n\n4. Deploy the UI on K8S\n```bash\n# create namespace for adk (need to add the secret before we can deploy the yml)\nkubectl create namespace \"adk\"\n\n# create k8s secret for litellm api key\nkubectl create secret generic litellm-api-key --from-literal=daslearning=\"YOUR_API_KEY\" -n adk\n\n# deploy the UI\nkubectl apply -f ./k8s/adk-app.yml\n```\n\n5. **Then get your Load balancer IP address \u0026 access it from your browser.** Optionally you can map it with your domain.\n\n\n### 🐋 Run using docker\n\n1. Run the `Ollama` backend on a container and make sure [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installation) is installed if you have Nvidia GPU. The below image will automatically download the required models during startup which may take some time to be ready, depending on internet speed.\n```bash\ndocker pull sdas92/ollama-llama3.2-mxbai-embed:v1 # check for the latest version at docker hub\n# for GPU machines\ndocker run -d --gpus=all -p 11434:11434 --name ollama sdas92/ollama-llama3.2-mxbai-embed:v1\n# for CPU only machines\ndocker run -d -p 11434:11434 --name ollama sdas92/ollama-llama3.2-mxbai-embed:v1\n```\n\n2. Run the `LiteLlm` backend (which can also be accessed via API calls). In the Ollama URL, use the container IP, do not use `localhost` as it will try access the ollama within litellm container\n```bash\ndocker pull sdas92/law-litellm:v1\ndocker run -d -p 4000:4000 -e OLLAMA_API_BASE=\"http://your-ollama-host:11434\" --name litellm-rag sdas92/law-litellm:v1 # use the container IP\n\n# You can test or use the API direcly with your application, sample format\ncurl -X POST http://localhost:4000/chat/completions -H 'Content-Type: application/json' -H 'Authorization: Bearer sk-1234' -d '{\"model\": \"indian-law-llm\", \"messages\": [{\"role\": \"user\", \"content\": \"Punishment for money fraud?\"}]}'\n```\n\n3. Run the UI \u0026 again use the contair IP `litellm-rag` in the OpenAI host URL insread of `localhost`\n```bash\ndocker pull sdas92/law-ai-adk:v2\n\ndocker run -d -p 8000:8000 -e OPENAI_BASE_URL=\"http://your-litellm-host:4000\" -e OPENAI_API_KEY=\"sk-1234\" --name law-ui sdas92/law-ai-adk:v2 # use litellm container IP in the URL\n```\n\n4. Open your browser \u0026 type `http://localhost:8000` to chat with the AI Model.\n\n------------------\n\n## ⚒️ Manual execution on local system or Development / Update\n\n### Prerequisites\n\n#### Run Ollama Backend\n1. Install Ollama on your system from the [official website](https://ollama.com/download)\n2. Then Pull the required models\n```bash\nollama pull llama3.2\nollama pull mxbai-embed-large\n# Check the models\nollama list\n```\n\n### Backend Service\nUse the backend service in separate terminal than the frontend\n\n#### Set ENV vars\n```bash\nexport OLLAMA_API_BASE=\"http://localhost:11434\"\n```\n\n#### Run the backend service in separate terminal\n```bash\ncd ./backend/markDownRAG/\npython -m venv .venv\nsource .venv/bin/activate # use .\\venv\\Scripts\\activate on windows\npip install -r requirements.txt\n# run the litellm service\nlitellm --config config.yaml\n```\n\n### Frontend Service\nRun frontend in another terminal\n\n#### Set ENV vars\n```bash\nexport OPENAI_API_KEY=\"your-key\" # create your key from litellm or use  default 'sk-1234'\nexport OPENAI_BASE_URL=\"http://localhost:4000\"\n```\n\n#### Run the frontend service\n```bash\ncd ./frontned\npython -m venv .venv\nsource .venv/bin/activate # use .\\venv\\Scripts\\activate on windows\npip install -r requirements.txt\n# run the uvicorn service for ADK\nsh -c \"uvicorn main:app --host 0.0.0.0 --port 8000\" # access the UI at localhost:8000\n```\n\n### Access the UI\nOpen browser \u0026 type `http://localhost:8000`\n\n---------------------\n\n## 🐋 Building the docker images \u0026 push\nYou may create your own images \u0026 store in your repo\n\n### Ollama backend\n```bash\ncd ./backend/ollama/\nexport APP_VERSION=\"v1\"\nexport IMAGE_URI=\"sdas92/ollama-llama3.2-mxbai-embed:${APP_VERSION}\" # change to your repo URI\ndocker build -t ${IMAGE_URI} .\ndocker push \"${IMAGE_URI}\"\n```\n\n### LiteLlm backend\n```bash\ncd ./backend/markDownRAG/\nexport APP_VERSION=\"v1\"\nexport IMAGE_URI=\"sdas92/law-litellm:${APP_VERSION}\" # change to your repo URI\ndocker build -t ${IMAGE_URI} .\ndocker push \"${IMAGE_URI}\"\n```\n\n### Frontend UI\n```bash\ncd ./frontend/\nexport APP_VERSION=\"v1\"\nexport IMAGE_URI=\"sdas92/law-ai-adk:${APP_VERSION}\" # change to your repo name\ndocker build -t ${IMAGE_URI} .\ndocker push \"${IMAGE_URI}\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaslearning-org%2Fai-indian-law","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaslearning-org%2Fai-indian-law","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaslearning-org%2Fai-indian-law/lists"}