Skip to main content

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.

Release files for lfind 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lfind 0.1.1
File Size Uploaded
lfind-0.1.1.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lfind 0.1.1
File Interpreter ABI Platform
lfind-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.3 kB

Release files / lfind-0.1.1.tar.gz

Download URL lfind-0.1.1.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b692e706ffe41f10db106b415a11184db7f57eee4f0b78271f62f0f7ab287bc7
BLAKE2b-256 checksum
How to use checksums
1ff829624d7bb8f7bb4f152de0f533cd2c12adc411ab885becf46154e238fac3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release files / lfind-0.1.1-py3-none-any.whl

Download URL lfind-0.1.1-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3b8e484b041914c90ba04f4ded1526bcc1950ad3d631302c05b1ab96a8ee593
BLAKE2b-256 checksum
How to use checksums
3e39e091c79a2d59a34e941bec9c221190b715b17757b1634c2866149644a6e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page