Talk to your code
Project description
GrePT
Talk to your code
Getting Started
- Download:
pip install GrePT
orgit clone https://github.com/jackbarry24/GrePT
thenpip install -e .
- Set your OpenAI API key
Get an OpenAI key. Add the API key to env:
export OPENAI_API_KEY=<key>
and consider adding it to your.bashrc
so it remains between sessions.
Usage
GrePT comes with two command line tools out of the box:
grept-embed
: used to calculate embeddings for files within the fsgrept
: used to query the filesystem or a pre-existing embedding using ChatGPT
grept-embed
Uses chromadb to store embeddings. Pass in a list of files+directory paths and it embeds the file contents in each to a parquet. You can then use these embeddings with the grept
command. It defaults to storing embeddings in the .chromadb
directory.
Optional Flags:
-p
: path to store embeddings-l
: recursive depth for file system crawling-x
: list of file suffixes to filter by
Examples:
grept-embed src/ test/ -l 2
: Embed all files in src/
and test/
directories and next subdirectory layer, save in the .chromadb/
folder.
grept
The main chat interface for working with files and embeddings. If chat mode is specified it parses the inputted files, passing them in as chat entries to the API. This is preferable when working with small codebases but when the codebase + chat history exceeds the token limit (4096 for gpt-3.5-turbo) performance degrades. In this case it is best to embed a bunch of files using grept-embed
.
Required Flags:
-c
: chat mode, pass in each specified file as a chat (mutex with-e
)-e
: embedding mode, pass in a preexisting embedding (mutex with-c
)Optional Flags:
-l
: recursive depth for file system crawling-x
: list of file suffixes to filter by-t
: max response tokens-p
: path to load embeddings from if using-e
Examples:
grept src/ -c
: Pass in all files in the src/
directory as chats to the API.
grept -e -p embedding1/
: Load the embeddings from the embedding1/
directory and query them.
grept ./ -l 3 -x .py -c
: Query all python files in 3 layers of subdirectories from the ./
directory in chat mode.
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
Built Distribution
File details
Details for the file GrePT-1.2.0.tar.gz
.
File metadata
- Download URL: GrePT-1.2.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 882857199e67b0cd56aac67119731f3c586aae7381ad6eb846a51b7350eddca5 |
|
MD5 | dff72c261a3f664432c197b97ebdcd00 |
|
BLAKE2b-256 | c8e0e532c1e34af5baa3ee1c3d9e81ad5a85afeb2902bb52e9353968eeac29e3 |
File details
Details for the file GrePT-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: GrePT-1.2.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48d59b9517901754a6fe25d06f7c1ff1aa7f24e62c3bec99ee171a3ed6102cbd |
|
MD5 | 5a7b7c1312550a04d5aa58ef78ee77d4 |
|
BLAKE2b-256 | eac808ae8aaf6c513350d0fe70c83ec6eeb632cfe53244297c4ac6f385c8edcb |