Skip to main content

High performance code search for large codebases

Project description

Context extraction at scale

Tools like Aider and Cursor are great at editing code for you once you give them the right context. But finding that context automatically is largely an unsolved problem, especially in large codebases.

LLMap is a CLI code search tool designed to solve that problem by asking
DeepSeek-V3 and DeepSeek-R1 to evaluate the relevance of each source file in your codebase to your problem.

Until recently, this would be prohibitively expensive and slow. But DeepSeek-V3 is cheap, smart, fast, and most importantly, it allows multiple concurrent requests. LLMap performs its analysis (by default) 500 files at a time, so it's reasonably fast even for large codebases.

LLMap also structures its request to take advantage of DeepSeek's caching. This means that repeated searches against the same files will be faster and less expensive.

Finally, LLMap optimizes the problem by using a multi-stage analysis to avoid spending more time than necessary analyzing obviously irrelevant files. LLMap performs 3 stages of analysis:

  1. Coarse analysis using code skeletons [DeepSeek-V3]
  2. Full source analysis of potentially relevant files from (1) [DeepSeek-V3]
  3. Refine the output of (2) to only the most relevant snippets [DeepSeek-R1]

Limitations

Currently only Java and Python files are supported by the skeletonization pass.
LLMap will process other source files, but it will perform full source analysis on all of them, which will be slower.

Extending the parsing to other languages is straightforward; contributions are welcome.

Installation

pip install llmap-ai

Get a DeepSeek API key from platform.deepseek.com.

Usage

export DEEPSEEK_API_KEY=YYY

find src/ -name "*.java" | llmap "Where is the database connection configured?"

LLMs APIs are not super reliable, so LLMap caches LLM responses in ~/.cache/llmap so that you don't have to start over from scratch if you get rate limited or run into another hiccup. (This also means that if you want to check the raw, unrefined output [see below], you won't have to reprocess the search.)

Output

LLMap prints the most relevant context found to stdout. You can save this to a file and send it to Aider or attach it to a conversation with your favorite AI chat tool.

Errors are logged to stderr.

Didn't find what you were looking for?

First, try passing --no-refine. While the refine step is usually helpful in filtering out the noise (thus taking up less of your context window), sometimes it's too aggressive.

You can also try passing --no-skeletons in case DeepSeek was too conservative in its initial filtering.

Finally, try rephrasing your question with more clues for the LLM to latch onto. Like any information retrieval tool, sometimes the way you ask can make a big difference.

  • Worse: "How can I add a WITH clause to the CQL SELECT statement?"
  • Better: "How can I add a WITH clause to the CQL SELECT statement? It will be used for adding query planning hints like which index to use."

Options

Commandline parameters:

  --sample SAMPLE       Number of random files to sample from the input set
  --llm-concurrency LLM_CONCURRENCY
                        Maximum number of concurrent LLM requests
  --no-refine           Skip refinement and combination of analyses
  --no-skeletons        Skip skeleton analysis phase for all files

Environment variables:

  LLMAP_CACHE           none|read|write|read/write

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

llmap_ai-0.9.5.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

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

llmap_ai-0.9.5-py3-none-any.whl (2.0 MB view details)

Uploaded Python 3

File details

Details for the file llmap_ai-0.9.5.tar.gz.

File metadata

  • Download URL: llmap_ai-0.9.5.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for llmap_ai-0.9.5.tar.gz
Algorithm Hash digest
SHA256 b99beb15966ce636f73428c6cff6122113e97c6ebb2c80e72089aaee2a17ef01
MD5 5f2246f6f7a9e8d0e693a070f3f6d490
BLAKE2b-256 3da30718ca2e0f7fe701069004c1c963f34291093cacf91b23efb8a8f4308563

See more details on using hashes here.

File details

Details for the file llmap_ai-0.9.5-py3-none-any.whl.

File metadata

  • Download URL: llmap_ai-0.9.5-py3-none-any.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for llmap_ai-0.9.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a7e77657ce9780eaac159bfa675afcc3119e28d2895079c88a281c3fb77af530
MD5 78c8b4e3bb552851fe3d0a8a083c9537
BLAKE2b-256 957a49027c9ea72bfc7c306a8625fdeb8109531222424f732b271153ccda6d12

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