{"id":30684226,"url":"https://github.com/manav54321/models","last_synced_at":"2026-05-03T23:31:37.479Z","repository":{"id":302610080,"uuid":"1008949915","full_name":"Manav54321/Models","owner":"Manav54321","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-03T09:51:42.000Z","size":14964,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-01T20:20:47.368Z","etag":null,"topics":["chatmodel","cosine-similarity","embedding-models","langchain","llms","streamlit","transformers"],"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/Manav54321.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-06-26T10:44:10.000Z","updated_at":"2025-07-03T09:51:45.000Z","dependencies_parsed_at":"2025-07-03T09:51:07.253Z","dependency_job_id":null,"html_url":"https://github.com/Manav54321/Models","commit_stats":null,"previous_names":["manav54321/langchain_models"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Manav54321/Models","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manav54321%2FModels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manav54321%2FModels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manav54321%2FModels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manav54321%2FModels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Manav54321","download_url":"https://codeload.github.com/Manav54321/Models/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manav54321%2FModels/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32589013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["chatmodel","cosine-similarity","embedding-models","langchain","llms","streamlit","transformers"],"created_at":"2025-09-01T20:14:59.385Z","updated_at":"2026-05-03T23:31:37.463Z","avatar_url":"https://github.com/Manav54321.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Document Similarity Search with Sentence Transformers\n\nThis repository presents a minimal and effective implementation of semantic document retrieval using vector embeddings and cosine similarity. The system is designed to identify the document that best matches the meaning of a user's input query.\n\n---\n\n## Overview\n\nTraditional search methods rely on keyword overlap. This method improves upon that by leveraging **pretrained transformer-based sentence embeddings**, allowing retrieval based on *semantic similarity* rather than lexical similarity.\n\nThe process involves:\n\n* Embedding each document and query into a high-dimensional space.\n* Computing cosine similarity between the query vector and document vectors.\n* Returning the document with the highest semantic alignment.\n\n---\n\n## Mathematical Foundation\n\n### 1. Vector Representation\n\nEach document `d_i` and query `q` is passed through a transformer model `f`, which encodes the text into an embedding vector:\n\n    d_i = f(d_i),   q = f(q)\n\nWhere `f` maps raw text to ℝ^384 using a pre-trained model.\n\n---\n\n### 2. Cosine Similarity\n\nSimilarity between query and document embeddings is calculated as:\n\n    cos_sim(q, d_i) = (q · d_i) / (||q|| * ||d_i||)\n\nThis metric reflects the angle between vectors. Higher values indicate greater similarity in meaning.\n\n### 3. Ranking Mechanism\n\nAll cosine scores are computed, sorted, and the top document is returned:\n\n```python\nsorted_scores = sorted(enumerate(scores), key=lambda x: x[1])\ndocument_index, score = sorted_scores[-1]\n```\n\n---\n\n## Embedding Model\n\n* **Model Name**: `sentence-transformers/all-MiniLM-L6-v2`\n* **Architecture**: Distilled bi-encoder (Transformer-based)\n* **Embedding Dimension**: 384\n* **Provider**: HuggingFace Model Hub\n\n---\n\n## Example Run\n\n```python\nquery = \"Kylie\"\n```\n\nReturns:\n\n```\nquery: Kylie\nbest_match: Kylie Jenner commands attention with her signature style, glamorous beauty, and trendsetting influence on social media.\nsimilarity_score: 0.7823\n```\n![Screenshot 2025-07-03 at 3 18 51 PM](https://github.com/user-attachments/assets/0c48f091-cf57-44b9-800c-9b3f757cb3c2)\n\n---\n\n## Dependencies\n\nInstall required libraries:\n\n```bash\npip install -r requirements.txt\n```\n\n---\n\n## Run the Script\n\n```bash\npython /Users/manavdesai/Desktop/GitHub/Langchain_Models/document_search_app.py.py\n```\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanav54321%2Fmodels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanav54321%2Fmodels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanav54321%2Fmodels/lists"}