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 -e pdf docx "presentation on attention mechanisms"

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

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

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

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

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.0.tar.gz (11.1 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.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lfind-0.1.0.tar.gz
  • Upload date:
  • Size: 11.1 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.0.tar.gz
Algorithm Hash digest
SHA256 fbf383fa671e7e78b305e249fe805f85d4a541a7cbea1095fa166e91d3379244
MD5 9bc562d8abaa93603a0fec58850e0243
BLAKE2b-256 c34e4ad37349d8a5003775148dfe944d1c3f8b99856756d47e97fe24e84ef0cc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lfind-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e1cfdb10231fa3a41b889e95aaf5735f486151a40203bdc6fa9ef392a634847
MD5 7ebc8d99ee29a3718dc8dee26719b966
BLAKE2b-256 b68192c80dfe670f777151e0e05608e6b3e2d8e294d2dc26910c2425f796044c

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