Open-source code search with OpenAI's function calling
We're excited to share a tool we've been working on called gpt-code-search. It allows you to search any codebase using natural language locally on your machine. We leverage OpenAI's GPT-4 and function calling to retrieve, search, and answer queries about your code. All you need to do is to install the package with `pip install gpt-code-search`, set up your `OPENAI_API_KEY` as an environment variable, and start asking questions with `gpt-code-search query `. E.g. You can ask questions like "How do I use the analytics module?" or "Document all the API routes related to authentication." This is…
In plain words
gpt-code-search is an open-source tool that lets developers search their codebases using natural language queries. It runs locally and uses OpenAI's GPT-4 with function calling to retrieve information and answer questions about code. Users install it via pip, set an API key, and ask questions like "How do I use the analytics module?" or "Document all API routes related to authentication." The tool handles function calling automatically without requiring manual implementation.
written from the facts on this page · September 2026
From the sources
In the maker’s words, at launch
We're excited to share a tool we've been working on called gpt-code-search. It allows you to search any codebase using natural language locally on your machine. We leverage OpenAI's GPT-4 and function calling to retrieve, search, and answer queries about your code. All you need to do is to install the package with `pip install gpt-code-search`, set up your `OPENAI_API_KEY` as an environment variable, and start asking questions with `gpt-code-search query <your question>`. E.g. You can ask questions like "How do I use the analytics module?" or "Document all the API routes related to authentication." This is still early and hacked together in the past week, but we wanted to get it out there and get feedback. We utilize OpenAI's function calling to let GPT-4 call certain predefined functions in our library. You do not need to implement any of these functions yourself. These functions are designed to interact with your codebase and return enough context for the LLM to perform code searches without pre-indexing it or uploading your repo to a third party other than OpenAI. So, you only need to run the tool from the directory you want to search. The functions currently available for the LLM to call are: `search_codebase` - searches the codebase using a TF-IDF vectorizer `get_file_tree` - provides the file tree of the codebase `get_file_contents` - provides the contents of a file These functions are implemented in `gpt-code-search` and are triggered by chat completions. The LLM is prompted to utilize the search_codebase and get_file_tree function as needed to find the necessary context to answer your query and then loops as needed to collect more context with the get_file_contents until the LLM responds. A couple of limitations of this approach, GPT cannot load context across multiple files in a single prompt since we are passing in the contents of a single file in each function call. So, GPT repeatedly calls the get_file_contents function to load context from multiple files. This increases the latency and cost of the tool. Another thing we realized as we were building is that the level of search and retrieval is limited by the context window, which refers to the scope of the search conducted by the tool, meaning that we can only search five levels deep in the file system and can only pass in the contents of one file at a time. So it would be best to run the tool from the package/directory closest to the code you want to search. We plan to add support for local vector embeddings to improve search and retrieval. Combining the vector embeddings with function calling should result in much faster and higher quality results. Also, support for other models, chat interactions in the command line, and generating code is already on our backlog! Please check out gpt-code-search and let me know your thoughts, feedback, or suggestions.
More ai this month
the category →
I trained a 125M-parameter transformer to autocomplete piano performances in real time (~108 notes/sec on an iPhone 15). The idea is basically GitHub Copilot or Tabnine, except instead of prompting it with code, you prompt it by playing a few notes on a MIDI piano. The model then continues what you played, entirely on-device. The app is free if anyone wants to try it. Happy to answer questions about the model, training, Core ML, or the many things that didn't work.
AI · 16d ago · simedw.com
Astute▲585Automate your B2B brand going viral, with new media creators
AI · 18d ago · company-app.joinastute.com


Hey HN, Henry from Cactus here! We previously released Cactus Needle, a 14MB agentic LLM for tool call, device use, and structured extraction for phones, wearables, smart homes, small robots and microcontrollers. We got really great feedback here, and have now incorporated the suggestions to release Needle 2. The whole model is a single 14MB binary that runs a full session in 28MB of RAM; 45m parameters at 2bit compression. Needle hits 500 tokens/sec decode speed on a Raspberry Pi 5, sits between 400-1,500 tokens/sec on VR devices like Meta Quest 3S and Apple Vision Pro, and ranges…
AI · 26d ago · cactuscompute.com


Launched alongside, June 2023
the whole month →- NI
Heya HN, I've been working on a reddit-like platform as my primary side project for the last few years. Doing a (very) soft launch today, mainly because I want to use it to encourage discussion of alternatives. How non.io works: 1. Free to browse, paid to interact. 2. Minimum subscription is $2 (though you can choose more). I take $1 to run the servers, everything left gets split evenly between everything you upvote that month. It's a simple model, but I hope it's a better one than the freemium model we've been relying on for the last few years. Fundamentally I feel like any ad-supported…
Commerce · 2023 · non.io

Typefully 2.0▲931Effortlessly publish on Twitter and LinkedIn, now with AI
Growth · 2023 · typefully.com

SlashPage▲760Create websites in seconds to build your first 1K community
Growth · 2023 · slashpage.com
