{"id":15282041,"url":"https://github.com/deadbits/wikipedia-chat","last_synced_at":"2025-04-12T21:27:57.161Z","repository":{"id":207222392,"uuid":"718702621","full_name":"deadbits/wikipedia-chat","owner":"deadbits","description":"Chat with local Wikipedia embeddings 📚","archived":false,"fork":false,"pushed_at":"2023-11-14T19:20:43.000Z","size":66,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T15:42:59.713Z","etag":null,"topics":["chainlit","cohere","embeddings","llm","openai","retrieval-augmented-generation","wikipedia","wikipedia-dump"],"latest_commit_sha":null,"homepage":"","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/deadbits.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}},"created_at":"2023-11-14T16:17:57.000Z","updated_at":"2024-10-02T18:10:24.000Z","dependencies_parsed_at":"2023-11-14T18:44:17.198Z","dependency_job_id":"9e075f13-aca6-42db-b880-409d43dff450","html_url":"https://github.com/deadbits/wikipedia-chat","commit_stats":null,"previous_names":["deadbits/wikipedia-chat"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadbits%2Fwikipedia-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadbits%2Fwikipedia-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadbits%2Fwikipedia-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deadbits%2Fwikipedia-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deadbits","download_url":"https://codeload.github.com/deadbits/wikipedia-chat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248633844,"owners_count":21136922,"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":["chainlit","cohere","embeddings","llm","openai","retrieval-augmented-generation","wikipedia","wikipedia-dump"],"created_at":"2024-09-30T14:15:54.166Z","updated_at":"2025-04-12T21:27:57.141Z","avatar_url":"https://github.com/deadbits.png","language":"Python","readme":"# 📚 wikichat \n\n## 🌟 Overview\n\n`wikichat` ingests [Cohere's multilingual Wikipedia embeddings](https://txt.cohere.com/embedding-archives-wikipedia/) into a Chroma vector database and provides a Chainlit web interface for retrieval-augmented-generation against the data using `gpt-4-1106-preview`.\n\nI wanted to explore the idea of maintaining a local copy of Wikipedia, and this seemed like a good entry point. Down the road I might update this code to regularly pull the [full Wikipedia dump](https://dumps.wikimedia.org/) and create the embeddings, instead of relying on Cohere's prebuilt embeddings. I went this route as a proof of concept, and as an excuse to try out [Chainlit](https://docs.chainlit.io/get-started/overview).\n\nBased on [Wikipedia_Semantic_Search_With_Cohere_Embeddings_Archives.ipynb](https://github.com/cohere-ai/notebooks/blob/main/notebooks/Wikipedia_Semantic_Search_With_Cohere_Embeddings_Archives.ipynb)\n\n## 🛠 Installation\n\n1. **Clone the Repository:**\n   ```bash\n   git clone https://github.com/deadbits/wikipedia-chat.git\n   cd wikipedia-chat\n   ```\n\n2. **Setup Python virtual environment:**\n   ```bash\n   python3 -m venv venv\n   source venv/bin/activate\n   ```\n\n3. **Install Dependencies:**\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n## 📖 Usage\n\n**Set Cohere and OpenAI API keys**\n```bash\nexport OPENAI_API_KEY=\"....\"\nexport COHERE_API_KEY=\"...\"\n```\n\n### Ingest Data\n\n* **Dataset:** [Cohere/wikipedia-22-12-simple-embeddings](https://huggingface.co/datasets/Cohere/wikipedia-22-12-simple-embeddings)\n* **Rows:** `485,859`\n* **Size:** `1.63` GB\n\nRun `ingest.py` to download the Wikipedia embeddings dataset and load into ChromaDB:\n\n```python\npython ingest.py\n```\n\nThe script adds records in batches of 100, but this will still take some time. The batch size could probably be increased.\n\n### Web Interface\n\nTo initiate the web interface, run the `chainlit_ui.py` script with the Chainlit library:\n\n```python\nchainlit run chainlit_ui.py\n```\n\n**Chainlit interface**\n\n![Chainlit UI](data/chainlit.png)\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadbits%2Fwikipedia-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeadbits%2Fwikipedia-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeadbits%2Fwikipedia-chat/lists"}