GithubHelp home page GithubHelp logo

vimiq's Introduction

vimiq

A Neovim plugin for interacting with language models

This is a work-in progress, and may have bugs. But I didn't love the existing options, so i wrote an llm extension for myself. it aims to be extremely simple and easy to modify. you can see the demo here:

setup

  1. clone/move the repo to .config/nvim/lua/vimiq (or wherever you nvim plugin lua lives)
  2. if you want to use anthropic or openai, then:
    pip install anthropic openai
    
  3. also set your api keys in your shell:
    export ANTHROPIC_API_KEY="your_anthropic_api_key"
    export OPENAI_API_KEY="your_openai_api_key"
    
  4. in your init.lua
     require('vimiq').setup({
         python_path = "/path/to/your/python/installation/or/virtualenv"
     })
  5. on a per-project basis, you can create a .vimiq.json file to put context into your chats
    {
        "model": ["default"],
        "system": "You are a helpful assistant.",
        "includes": ["./backend.py", "./init.lua"]
    }
  6. you can edit backend.py to include your own llm implemenations:
    LLM_IMPLS = {
        "default": llm_anthropic,
        "anthropic": llm_anthropic,
        "openai": llm_openai,
        "claude": llm_anthropic,        # example alias
        "chat": llm_openai              # example alias
    }

usage

commands:

  • :InitBuffer: start new llm buffer
  • :InitBufferWithLSPError: start buffer with current line and lsp errors
  • :EvalBuffer: send buffer to llm
  • :StopStreaming: stop current stream

structure

  • init.lua: handles neovim stuff (buffers, commands, data passing)
  • backend.py: llm logic (message formatting, api calls, response streaming)

separated like this so you can modify llm logic without touching neovim code.

customization

  • edit backend.py to change llm providers, message formatting, etc.
  • update init.lua if you need new commands or data passing changes
  • use .vimiq.json in project root for custom prompts or context files

TODO

  • add custom filetype syntax
  • add locallama support

vimiq's People

Contributors

p33m5t3r avatar

Stargazers

Parsa avatar char avatar

Watchers

 avatar Kostas Georgiou avatar

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.