Giter VIP home page Giter VIP logo

cody's Introduction

๐Ÿค– Cody - Your AI Coding Assistant

Welcome to Cody! An AI assistant designed to let you interactively query your codebase using natural language. By utilizing vector embeddings, chunking, and OpenAI's language models, Cody can help you navigate through your code in an efficient and intuitive manner. ๐Ÿ’ป

image

LINK

https://www.loom.com/share/eba1d0dcee20430fbd412580d1c0ea0e?sid=4998cf6f-45b4-480d-b742-6f22f3a49dc3

Cody continuously updates its knowledge base every time you save a file, ensuring you have the most up-to-date information. You can customize your setup by specifying directories to ignore in the ignore_list.

๐Ÿš€ Getting Started

  1. Clone the repo
  2. (Optionally) Setup virtual environment by running pip install -m venv .venv and then pip install -r requirements.txt in terminal from the root of your directory
  3. Rename the .local.env file to .env`` and replace YOUR_API_KEY_HERE` with your OpenAI API Key.
  4. Modify the IGNORE_THESE global var at the top of the script to specify directories and files you wish to exclude from monitoring. (You should comment out any large files like a virtual environment, cache, js libraries you have downloaded, etc...)
  5. Run the script using Python: python cody.py and follow terminal for setup. It will prompt you for if you want to use text chat (terminal) or conversational (speech i/o). It will also warn you if you remove .env from the ignore list.

๐ŸŽฏ Features

  • File Monitoring: Real-time monitoring of all files in your project's directory and subdirectories. ๐Ÿ‘€
  • Embedding-based Knowledge Base: Create a knowledge base using OpenAI Embeddings. Cody collects the contents of all text and JSON files and adds them to this knowledge base. ๐Ÿ“š
  • Interactive Q&A: Listen to user inputs. Ask questions, and Cody will generate a response using the knowledge base. ๐Ÿง 
  • Customizable: Easily specify files or directories to ignore during monitoring.

๐Ÿ›  Dependencies

  • dotenv: Load variables from a .env file into the environment.
  • langchain-community: A language processing library used for embeddings and vector storage. Previously langchain.
  • langchain_openai: Provides the OpenAIEmbeddings functionality, integrating OpenAI models directly with langchain's architecture.
  • litellm: Call all LLM APIs using the OpenAI format (https://github.com/BerriAI/litellm)
  • watchdog: Monitor filesystem events in real-time.
  • openai: Generate smart responses using OpenAI's language model.
  • speech_recognition: Convert speech to text for voice interaction.
  • gtts: Google Text-to-Speech library for generating audio from text.
  • pygame: Library to play audio files.

๐Ÿ’ก Usage

  • To stop the script, type 'exit' or speak the word 'exit' and press enter. Cody will gracefully terminate the program.

Configuring the Ignore List

Cody allows you to specify which files and directories should be ignored during file monitoring. This is particularly useful for excluding files that change frequently, are not relevant to your queries, or could contain sensitive information.

To customize your ignore_list, add patterns matching the files or directories you wish to exclude. Cody supports simple wildcard patterns for flexibility. Here are some examples to guide you:

Examples

  • Ignoring Specific Files: If you want to ignore all .env files, you can add *.env to the ignore list.

    IGNORE_THESE = ['*.env']
  • Ignoring Directories: To ignore an entire directory, such as node_modules or a virtual environment directory like .venv, simply add the directory name.

    IGNORE_THESE = ['node_modules', '.venv']
  • Ignoring File Extensions: To ignore all files with a specific extension, such as .log or .tmp, use the wildcard pattern *.

    IGNORE_THESE = ['*.log', '*.tmp']
  • Complex Patterns: You can combine directory names and wildcards to ignore specific types of files within certain directories. For example, to ignore all .md files in the docs directory:

    IGNORE_THESE = ['docs/*.md']

Tips for Configuring Your Ignore List

  • Review Regularly: As your project evolves, so too may the files and directories you need to ignore. Regularly reviewing and updating your ignore_list can help ensure Cody's performance remains optimal.

  • Use Wildcards Wisely: While wildcards offer powerful flexibility, they can also lead to unintentionally ignoring important files. Be specific in your patterns to avoid such issues.

  • Test Changes: After updating your ignore_list, perform a few tests to ensure that the changes behave as expected, especially if using complex patterns.

By carefully configuring your ignore_list, you can tailor Cody to better suit your project's needs, enhancing both its efficiency and relevance to your coding tasks.

โš ๏ธ Notes & Tips

  • Cody uses the FAISS library for efficient similarity search in storing vectors. Please ensure you have sufficient memory available, especially when monitoring a large number of files.
  • Additionally, be sure to monitor your OpenAI api usage. A helpful tip is to set a monthly spend limit inside of your OpenAI account to prevent anything crazy from happening. As an additional helper, it prints the number of tokens used in each call you make.
  • "LIVE" coding questions. To use to it's full potential. I recommend opening a seperate terminal or even command prompt cd'ing into your project directory, and then launching python cody.py. Then place it split screen with your code in a small viewing window on the far left or right. This way, you can use a seperate terminal for actually running your code without worrying about Cody or having to run him (er... it) each time! This will still continue to update with each file save you do on any file so it always is using the latest data.

Contributing

Contributions are welcome. Please submit a pull request or open an issue for any bugs or feature requests.

Happy Coding with Cody! ๐Ÿ’ก๐Ÿš€๐ŸŽ‰

cody's People

Contributors

ajhous44 avatar krrishdholakia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cody's Issues

Refactor....

For starters...

self.embeddings = {} self.knowledge_base = {} self.embeddings = OpenAIEmbeddings(openai_api_key=OPENAI_API_KEY)

We do not need the first self.embeddings...

Implement conversational flow

Users should be able to converse with Cody without the need to type or look at the terminal for their response. Make Cody talk back!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.