Skip to main content

Talk to your code

Project description

GrePT

Talk to your code

Getting Started

  1. Download:

pip install GrePT or git clone https://github.com/jackbarry24/GrePT then pip install -e .

  1. 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 fs
  • grept: 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

GrePT-1.3.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

GrePT-1.3.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file GrePT-1.3.0.tar.gz.

File metadata

  • Download URL: GrePT-1.3.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for GrePT-1.3.0.tar.gz
Algorithm Hash digest
SHA256 08ea773696c71b194b4309225440d75775139289ad532d2f9a16351547425c61
MD5 0e362c355c0acb0bf380257b157d45fa
BLAKE2b-256 51ba7c4689698df5db657e618f8c2386a63096188264cd2f13c167377b55be72

See more details on using hashes here.

File details

Details for the file GrePT-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: GrePT-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for GrePT-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ba2ad6ece34ecd3df1cec8f0ac0b0bb5e2b44a18f976e5dea2726945faeda36
MD5 081434bf9da140fc65afa1ad7cab38e1
BLAKE2b-256 085cf5a77ec6b27257fb1efac902ba3a99b1ac9ded1ae14d34ce19c249df510f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page