Skip to content

kaifkh20/ai-codesearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gemini_Generated_Image_yl00yuyl00yuyl00

πŸš€ AI Code Search

An AI-powered semantic and keyword code search engine that helps developers quickly find relevant functions, classes, and snippets across large codebases.


πŸ“– Overview

AI Code Search is designed to solve the problem of finding specific code without knowing the exact keywords.
By combining the power of semantic search with traditional lexical methods, it provides a highly accurate and flexible way to navigate complex projects and monorepos.


Important

Due to hardware compatibility there are small batches and usage of gemini and other small models + torch-cpu.

✨ Features (v1.0)

  • πŸ” Semantic Search: Uses FAISS and embeddings to understand the intent behind queries, retrieving code snippets even if wording doesn’t match exactly.
  • πŸ“ Query Rewriting (Gemini API): Automatically expands and clarifies natural language queries using the Gemini API for improved results.
  • πŸ“‚ Multi-Language Support: Parses and indexes code from Python, C, C++, Go, and Java with the fast Tree-sitter parsing library.
  • 🏷 Function & Class Extraction: Indexes functions and classes as discrete units for more precise results compared to file-level searches.
  • πŸ”‘ Lexical Search: Falls back to keyword-based matching when semantic results are weak.
  • 🐞 Basic Bug Search (Python): Includes regex-based detection for common Python issues and anti-patterns.
  • Incremental Indexing: Index once and query as long as it's not modified. Improving speed.

⚑ Quick Start

  1. Clone the repository and install dependencies.
    Make sure Python 3.9 is installed.

  2. Create a .env file with:

    GEMINI_API=YOUR_GEMINI_API_KEY
    
  3. Run the following:

    git clone https://github.com/kaifkh20/ai-codesearch.git
    cd ai-codesearch
    pip install -r req.txt

πŸ’‘ Usage

To index a codebase and begin searching, run:

# Example: Search for a function to "calculate the final price with tax"
python main.py -r "folder rep path" -q "function that calculate final price with tax"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages