{"id":23085031,"url":"https://github.com/promptlycode/rag-code-sorting-search","last_synced_at":"2025-09-04T18:04:39.505Z","repository":{"id":261354540,"uuid":"105734513","full_name":"PromptlyCode/rag-code-sorting-search","owner":"PromptlyCode","description":"RAG code sorting search, RAG knowledge organization","archived":false,"fork":false,"pushed_at":"2024-11-19T16:11:18.000Z","size":37,"stargazers_count":15,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-19T16:43:50.232Z","etag":null,"topics":["codesearch","embeddings","gpt","graph","llm","rag"],"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/PromptlyCode.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}},"created_at":"2017-10-04T05:24:46.000Z","updated_at":"2024-11-19T16:11:25.000Z","dependencies_parsed_at":"2024-11-06T06:43:23.054Z","dependency_job_id":null,"html_url":"https://github.com/PromptlyCode/rag-code-sorting-search","commit_stats":null,"previous_names":["promptlycode/xunfei-asr-hmm-dnn","promptlycode/rag-code-sorting-search"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PromptlyCode%2Frag-code-sorting-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PromptlyCode%2Frag-code-sorting-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PromptlyCode%2Frag-code-sorting-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PromptlyCode%2Frag-code-sorting-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PromptlyCode","download_url":"https://codeload.github.com/PromptlyCode/rag-code-sorting-search/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230004214,"owners_count":18158252,"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":["codesearch","embeddings","gpt","graph","llm","rag"],"created_at":"2024-12-16T17:48:40.162Z","updated_at":"2024-12-16T17:48:40.926Z","avatar_url":"https://github.com/PromptlyCode.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RAG code sorting search\n\n## RAG First Principles\n\n* The essence of rag is knowledge organization, which is convenient for accurate search again. If there is not enough context, it should be completed in the rag knowledge organization process, such as using tree_sitter in the code to complete the problem of insufficient keywords for insufficient types.\n\n## Init\n\n* Setup python env\n```sh\nconda create -n rag-code-sorting-search python=3.11\nconda activate rag-code-sorting-search\npoetry install\n```\n* [Ollama](https://ollama.com/) run embed model\n```sh\nollama run nomic-embed-text\n```\n\n## Usage\n\n* index\n```sh\n$ poetry run python rag_search_code.py build /Users/clojure/Desktop/rag-code-sorting-search\n\n$ ls .promptlycode/code_search_index/\ncode.index   metadata.pkl\n\n```\n\n* search \n```sh\n$ poetry run python  rag_search_code.py search /Users/clojure/Desktop/rag-code-sorting-search \"search code\"\n\nRank: 1\nScore: 0.0037\nFile: /Users/clojure/Desktop/1112AIlearn-interview/rag-code-sorting-search/rag_search_code.py\nFunction: search_code (lines 118-161)\n\nCode with context:\n 115 |         'context_end_line': context_end\n 116 |     }\n 117 |\n 118 | def search_code(query, top_k=5):\n 119 |     \"\"\"Search for similar code using the built index.\"\"\"\n 120 |     try:\n 121 |         # Load index and metadata\n 122 |         index = faiss.read_index('code_search_index/code.index')\n 123 |         with open('code_search_index/metadata.pkl', 'rb') as f:\n 159 |\n...\n 160 |     except FileNotFoundError:\n 161 |         return \"Index not found. Please build the index first using the build command.\"\n 162 |\n 163 | def main():\n 164 |     parser = argparse.ArgumentParser(description='Code Search Tool')\n--------------------------------------------------------------------------------\n...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpromptlycode%2Frag-code-sorting-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpromptlycode%2Frag-code-sorting-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpromptlycode%2Frag-code-sorting-search/lists"}