Sponsored by Deepsite.site

File Search Assistant with LLM Integration

Created By
Code-Trees7 months ago
Learn how to: ✅ Build a file-search AI using natural language queries ✅ Create embeddings from local Linux files using Hugging Face models ✅ Integrate Gemini API (Google AI Studio) into your local apps ✅ Use MCP to control multiple agents with server-client architecture ✅ Apply cosine similarity, asyncio Python, and more!
Content

File Search Assistant with LLM Integration

This project combines semantic search capabilities with Large Language Models (LLM) to provide intelligent file search functionality in Linux systems.

Features

  • Natural language file search queries
  • Semantic search using BERT embeddings
  • File system integration with MCP server
  • Gemini LLM integration for query understanding
  • Automatic file extension inference

Prerequisites

  • Python 3.8 or higher
  • CUDA-compatible GPU (optional, for faster processing)
  • Linux operating system

Installation

  1. Clone the repository:
git clone <repository-url>
cd LLm_To_agent/data_dir
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment variables:
    • Create a .env file in the project root
    • Add your Gemini API key:
    GEMINI_API_KEY="your-api-key-here"
    

Project Structure

data_dir/
├── main.py              # Main application entry point
├── tools/
│   └── file_finder.py   # File search implementation
├── utils/
│   └── doc_Search.py    # Document search utilities
├── llm/
│   └── gemini_client.py # LLM integration
├── .env                 # Environment variables
└── OSData_store.pth     # Embedded data storage

Usage

  1. Start the application:
python main.py
  1. Enter your search query when prompted:
What file are you looking for?
> "find a python script that handles file operations"
  1. The system will:
    • Extract the relevant filename using LLM
    • Search the file system using semantic search
    • Display matching file locations

Features in Detail

  • LLM Integration: Uses Google's Gemini for natural language understanding
  • Semantic Search: Employs BERT embeddings for context-aware file matching
  • MCP Server: Handles file system operations efficiently
  • Extensible Architecture: Easy to add new search capabilities

Troubleshooting

If you encounter the error "Embeddings file not found", run:

cd ~ && find / -type f 2>/dev/null >> Desktop/LLm_To_agent

License

[Your chosen license]

Contributing

[Your contribution guidelines]

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Amap Maps高德地图官方 MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Tavily Mcp
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
WindsurfThe new purpose-built IDE to harness magic
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Playwright McpPlaywright MCP server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
DeepChatYour AI Partner on Desktop
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Serper MCP ServerA Serper MCP Server
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
CursorThe AI Code Editor
ChatWiseThe second fastest AI chatbot™