{"id":31644525,"url":"https://github.com/mistersoandso/llm-based-rag-translator","last_synced_at":"2026-05-04T13:34:43.863Z","repository":{"id":316854848,"uuid":"1064218253","full_name":"MisterSoandSo/LLM-based-RAG-Translator","owner":"MisterSoandSo","description":"A prototype LLM-based RAG translator designed for a privacy-focused client base","archived":false,"fork":false,"pushed_at":"2025-10-06T18:59:12.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-06T20:46:45.893Z","etag":null,"topics":["fastapi","ollama","python","rag-chatbot"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/MisterSoandSo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-25T17:57:39.000Z","updated_at":"2025-09-25T22:23:18.000Z","dependencies_parsed_at":"2025-09-27T06:21:21.573Z","dependency_job_id":"404201e3-349f-465b-b716-8ea40702ca72","html_url":"https://github.com/MisterSoandSo/LLM-based-RAG-Translator","commit_stats":null,"previous_names":["mistersoandso/llm-based-rag-translator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MisterSoandSo/LLM-based-RAG-Translator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterSoandSo%2FLLM-based-RAG-Translator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterSoandSo%2FLLM-based-RAG-Translator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterSoandSo%2FLLM-based-RAG-Translator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterSoandSo%2FLLM-based-RAG-Translator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MisterSoandSo","download_url":"https://codeload.github.com/MisterSoandSo/LLM-based-RAG-Translator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterSoandSo%2FLLM-based-RAG-Translator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278722768,"owners_count":26034461,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"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":["fastapi","ollama","python","rag-chatbot"],"created_at":"2025-10-07T04:53:42.715Z","updated_at":"2025-10-07T04:53:45.603Z","avatar_url":"https://github.com/MisterSoandSo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM-based RAG Translator\n\nProblem Statement\nA local translation assistant that integrates the **Ollama engine** with a **glossary database** (SQLite by default) to ensure **privacy-preserving translations**.\n\nThe client requires that all translation data and glossary terms remain **offline** and **self-contained** — no cloud API calls or third-party data sharing.\n\n## Scope\nThe system allows a user to:\n\n- **Translate** passages via Ollama with glossary-aware context\n    - User input → server\n    - Server checks for matching glossary terms\n    - System prompt generated with glossary dictionary + base prompt\n    - Returns translated text and (optionally) glossary prompt for debugging\n        \n-  **Manage glossary terms**\n    - Add, edit, delete, and search terms\n    - Pagination and fuzzy search supported\n    - Notes field for internal use (not shared with the LLM)\n## System Overview\nThe backend acts as a mediator between the user and Ollama:\n- Extracts glossary terms from user input\n- Builds a translation prompt enriched with definitions\n- Sends prompt to the local Ollama model\n- Returns the translation response\n\n## API Endpoints\n\n### Chat Route\n#### `POST /chat/translate`\n\n- Input: text passage\n- Output: translated text + glossary context (if debug mode)\n- Logic:\n    - Parse user input\n    - Match glossary terms (`LIKE` or fuzzy search)\n    - Generate system prompt including matched terms\n    - Query Ollama locally\n    - Return response\n\n#### `POST /chat/grammarly`\n\n- Input: text passage\n- Output: corrected text\n- Logic:\n    - Parse user input\n    - Match glossary terms (`LIKE` or fuzzy search)\n    - Generate system prompt including matched terms\n    - Query Ollama locally\n    - Return response\n\n\n| Method|Endpoint|Description|\n| --- | --- | --- |\n|`GET`|`/chat`| Get the Chat UI|\n| `POST`| `/chat/translate`| Submit message for translation|\n| `POST`| `/chat/grammarly`| Submit message for grammar fluency|\n\n\n### Glossary Route\n|Method|Endpoint|Description|\n|---|---|---|\n|`GET`|`/glossary`|View or search glossary terms. Query params: `?search=\u003cterm\u003e\u0026page=\u003cn\u003e\u0026limit=\u003cm\u003e`|\n|`POST`|`/glossary`|Add a new glossary term|\n|`PATCH`|`/glossary/{term_id}`|Edit existing term|\n|`DELETE`|`/glossary/{term_id}`|Delete term by ID|\n|`GET`|`/glossary/export` _(optional)_|Export glossary as JSON or CSV|\n\n\n## Data Model\n\n|Field|Type|Description|\n|---|---|---|\n|`id`|INTEGER (PK, AUTOINCREMENT)|Unique term identifier|\n|`chinese`|TEXT|Source term (unique with English)|\n|`english`|TEXT|Target term (unique with Chinese)|\n|`notes`|TEXT (optional)|Internal notes, not used in LLM prompt|\n|`created_at`|DATETIME|Auto-generated timestamp|\n|`updated_at`|DATETIME|Auto-updated on edit|\n\n\n\n## Requirements\n - [Python 3.10+](https://www.python.org/downloads/)\n - [Ollama (local LLM engine)](https://ollama.com)\n\n**Recommended: virtual environment (e.g. venv or conda)**\n\n1. Follow the official instructions on the Ollama website.\n2. Verify you have installed Ollama with the command `ollama --version`\n3. Pull a model with `ollama pull deepseek-v2:16b` or [any other model](https://ollama.com/search)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmistersoandso%2Fllm-based-rag-translator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmistersoandso%2Fllm-based-rag-translator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmistersoandso%2Fllm-based-rag-translator/lists"}