Skip to main content

A natural language file finder using LLMs

Project description

lfind

A natural language file finder using LLMs. This tool allows you to search for files using natural language queries, powered by large language models. Simply describe what you're looking for, and lfind will help you locate the relevant files.

Installation

pip install lfind

Configuration

lfind uses a configuration file to manage its settings. The default configuration is installed with the package, and a user-specific configuration is automatically created on first run at:

  • Windows: %APPDATA%\lfind\config.json
  • Unix/Linux: ~/.config/lfind/config.json

Default Configuration

{
    "max_entries": 100,
    "ignore_patterns": [
        ".*"
    ],
    "include_empty_dirs": false,
    "cache_dir": ".lfind_cache",
    "meta_cache": "meta_cache.json",
    "cache_validity_days": 7,
    "llm_default": {
        "provider": "ollama",
        "model": "qwen2.5:14b-instruct-q6_K",
        "api_base": "http://localhost:11434/v1"
    },
    "llm_hard": {
        "provider": "openai",
        "model": "gpt-4o",
        "api_base": null
    }
}

Environment Variables

If you're using OpenAI models (default for the "hard" mode), you need to set your OpenAI API key:

export OPENAI_API_KEY=your_api_key_here  # Unix/Linux
setx OPENAI_API_KEY your_api_key_here     # Windows

Usage

# Basic search in current directory
lfind "First invoice of 2025"

# Search with specific file extensions
lfind "presentation on attention mechanisms" -e pdf docx

# Search in specific directory
lfind "log files from last week" -d /path/to/dir

# Use more powerful LLM model (e.g., GPT-4o)
lfind "files related to database migrations" -H

# Ignore default ignore patterns (ommiting . (dot) files)
lfind "configuration files" --ignore-defaults

# Add custom ignore patterns
lfind "important documents" -i "*.tmp" "*.bak"

Additional Options

  • --empty keep/ignore: Override empty directories behavior
  • --max N: Set maximum entries per directory
  • -r, --refresh-cache: Force rebuild the cache
  • --config: Set custom configuration file
  • -v, --version: Show version information

Caching

lfind maintains a cache of the directory structure to improve performance. The cache is automatically created and updated as needed, with a default validity period of 7 days. You can force a cache refresh using the -r flag.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Requirements

  • Python ≥ 3.8
  • openai ≥ 1.61.1
  • python-dotenv ≥ 1.0.1

Note

When using OpenAI models (default for hard mode), ensure you have set your OPENAI_API_KEY environment variable. For local models like Ollama, ensure the service is running and accessible at the configured API base URL.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lfind-0.1.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lfind-0.1.1-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file lfind-0.1.1.tar.gz.

File metadata

  • Download URL: lfind-0.1.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for lfind-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b692e706ffe41f10db106b415a11184db7f57eee4f0b78271f62f0f7ab287bc7
MD5 1bcc4ec02ee9fcc606df57c1a5a0e47c
BLAKE2b-256 1ff829624d7bb8f7bb4f152de0f533cd2c12adc411ab885becf46154e238fac3

See more details on using hashes here.

File details

Details for the file lfind-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lfind-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for lfind-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3b8e484b041914c90ba04f4ded1526bcc1950ad3d631302c05b1ab96a8ee593
MD5 67a592ca2c241e799c125c33f6096287
BLAKE2b-256 3e39e091c79a2d59a34e941bec9c221190b715b17757b1634c2866149644a6e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page