Skip to content

Bundle changes and restructure#12

Open
wincent wants to merge 25 commits intowolffiex:mainfrom
wincent:wincent
Open

Bundle changes and restructure#12
wincent wants to merge 25 commits intowolffiex:mainfrom
wincent:wincent

Conversation

@wincent
Copy link
Contributor

@wincent wincent commented Oct 11, 2024

This is a combination of the commits in existing PRs:

Plus a few extra commits:

  • d98d049 chore: try GPT-4o
  • d95b524 refactor: move Neovim files into lua/ subdirectory
  • 0682fbd feat: add syntax file
  • 3201989 feat: add :ChatGPT command (later renamed to :Shellbot)
  • a089bc6 docs: add instructions for installation
  • 0809fdb feat: add an ftplugin file
  • a24dafd refactor: move settings from module into ftplugin
  • 321ea3e refactor: replace deprecated nvim_buf_set_option() call
  • c934b21 refactor: move mappings into ftplugin
  • 7a92356 feat: add ability to set model at runtime via env var
  • f848d28 fix: suppress system prompt for "o1-preview" and "o1-mini" models
  • f63da96 refactor!: rename :ChatGPT to :Shellbot
  • c9f2d71 chore: default Anthropic to "claude-3-5-sonnet-20241022"
  • eb6d184 docs: document new environment variables
  • 78a6114 chore: bump default Anthropic model to claude-3-7-sonnet-20250219
  • 4f06149 feat: teach chatbot() to take an env table
  • 84b1c35 chore: bump OpenAI model to GPT-4.1
  • f8470e5 chore: bump models to latest

Basically, moved a bunch a stuff of around to make the repo follow the standard directory layout for Vim plugins, which means that we can ship a syntax file, set up the :ChatGPT :Shellbot command for users automatically etc, as discussed in #10. I normally wouldn't bundle all this stuff into a single PR, but GitHub doesn't support stacked PRs, and the file moves will otherwise be in conflict with the previous PRs. I'm going to close those ones.

wincent and others added 15 commits July 19, 2024 09:23
Despite the newline in the source, GitHub renders each
of these numbered list items all on one line.

User markup to make the separation obvious.
These cause the prompt file contents to show up in the editor, which
isn't desirable.
In ef73bd4 we added a support for
a command-line argument that can be used to override the default
prompt, but actually supplying an arguments means that the old
`vim.fn.executable` check won't work.

The simplest fix is to just split on whitespace and check the first
item to see if it's executable. This isn't perfect, because if
somebody installed the executable at a path like `/My/Path With
Spaces/bin/shellbot`, then we'd test `/My/Path` and report a false
negative. But for the common case, this is still an improvement.
On my machine:

- ◭ ("Up-pointing triangle with left half black")
- ◮ ("Up-pointing triangle with right half black")

look pretty bad in the terminal, so swap them for something else.
Trying to distinguish from "normal" lines a little more explicitly.
Module was renamed in 919a924, so these
instructions are wrong now.
Difference as per docs:

- https://platform.openai.com/docs/models

> GPT-4o
>
> Our high-intelligence flagship model for complex, multi‑step tasks
>
> Text and image input, text output
> 128k context length
> Input: $5 | Output: $15*
> (* prices per 1M tokens)
>
> # GPT-4o: https://platform.openai.com/docs/models/gpt-4o
>
> GPT-4o (“o” for “omni”) is our most advanced model. It is
> multimodal (accepting text or image inputs and outputting text),
> and it has the same high intelligence as GPT-4 Turbo but is much
> more efficient—it generates text 2x faster and is 50% cheaper.
> Additionally, GPT-4o has the best vision and performance across
> non-English languages of any of our models. GPT-4o is available in the
> OpenAI API to paying customers.
>
> # GPT-4 Turbo and GPT-4: https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4
>
> GPT-4 is a large multimodal model (accepting text or image inputs
> and outputting text) that can solve difficult problems with greater
> accuracy than any of our previous models, thanks to its broader
> general knowledge and advanced reasoning capabilities. GPT-4 is
> available in the OpenAI API to paying customers. Like gpt-3.5-turbo,
> GPT-4 is optimized for chat but works well for traditional completions
> tasks using the Chat Completions API.
As noted in:

- wolffiex#10

This allows the repo to be installed directly as a Neovim plugin without
having to copy files around, and opens the door to us shipping a syntax
file, which I'll do in the next commit.
So the user doesn't need to set it up manually.
This gives us a place to put settings. I'll move the existing settings
from the plugin into here in the next commit.
@wincent
Copy link
Contributor Author

wincent commented Oct 11, 2024

Whoops. Accidentally closed this right after opening it. Reopening.

@wincent wincent reopened this Oct 11, 2024
wincent added a commit to wincent/wincent that referenced this pull request Nov 20, 2024
Because I am interested in testing out some new ChatGPT models:

> The o1 series of large language models are trained with reinforcement
> learning to perform complex reasoning. o1 models think before they
> answer, producing a long internal chain of thought before responding
> to the user.
>
> There are two model types available today:
>
> - o1-preview: reasoning model designed to solve hard problems across
>   domains.
> - o1-mini: faster and cheaper reasoning model particularly good at
>   coding, math, and science.

- https://platform.openai.com/docs/models#o1

See also:

- https://openai.com/index/introducing-openai-o1-preview/

Doing this on the `wincent-next` branch because I have an upstream PR
already open for `wincent` and I don't want to mess with it:

- wolffiex/shellbot#12

The ability to pass in a model via an environment variable seems clearly
useful, but this is the bit I'm not sure about sending upstream yet:

- wincent/shellbot#1

* aspects/nvim/files/.config/nvim/pack/bundle/opt/shellbot c934b21...f848d28 (2):
  > fix: suppress system prompt for "o1-preview" and "o1-mini" models
  > feat: add ability to set model at runtime via env var
Seeing as ChatGPT isn't even the default LLM (Anthropic is used
preferentially).
Model is faster and cheaper. If Opus ends up getting bumped to 3.5 it
may be worth updating the default to that later on.
wincent and others added 5 commits February 24, 2025 21:57
This allows you to easily set up multiple commands that can be used to
interact with different models/APIs. For example, I have something like
this in my dotfiles, setting up `:ChatGPT`, `:Claude`, `:Opus` etc:

```lua
local has_shellbot, shellbot = pcall(require, 'chatbot')
if has_shellbot then
  -- Set up wrapper commands for specifically targetting ChatGPT, Claude (etc).
  local function get_executable()
    local executable = vim.fn.split((vim.env['SHELLBOT'] or '/dev/null'), ' ')[1]
    if executable and vim.fn.executable(executable) == 1 then
      return executable
    else
      vim.api.nvim_echo(
        { {
          'error: $SHELLBOT does not appear to be executable',
          'ErrorMsg',
        } },
        true,
        {}
      )
    end
  end

  vim.api.nvim_create_user_command('ChatGPT', function()
    local executable = get_executable()
    if executable then
      shellbot.chatbot({
        OPENAI_API_KEY = vim.env.OPENAI_API_KEY,
      })
    end
  end, {})

  vim.api.nvim_create_user_command('ChatGPTX', function()
    local executable = get_executable()
    if executable then
      shellbot.chatbot({
        OPENAI_API_KEY = vim.env.OPENAI_API_KEY,
        OPENAI_MODEL = 'o1-mini',
      })
    end
  end, {})

  vim.api.nvim_create_user_command('Claude', function()
    local executable = get_executable()
    if executable then
      shellbot.chatbot({
        ANTHROPIC_API_KEY = vim.env.ANTHROPIC_API_KEY,
      })
    end
  end, {})

  vim.api.nvim_create_user_command('Opus', function()
    local executable = get_executable()
    if executable then
      shellbot.chatbot({
        ANTHROPIC_API_KEY = vim.env.ANTHROPIC_API_KEY,
        ANTHROPIC_MODEL = 'claude-3-opus-20240229',
      })
    end
  end, {})
end
```
> GPT-4.1 is our flagship model for complex tasks. It is well suited for
> problem solving across domains.

https://platform.openai.com/docs/models/gpt-4.1

Marketing spiel:

> Alongside 4.1 mini and 4.1 nano, it makes up our latest flagship GPT
> family, specifically trained for developer use-cases like coding,
> instruction-following, and function-calling.
>
> GPT-4.1 represents a significant upgrade over GPT-4o, particularly for
> real-world software engineering tasks—it achieves 55% on SWE-bench
> Verified, compared to GPT-4o’s 33%. It’s notably more skilled at
> frontend coding, providing clean diffs, structured responses, reliable
> tool usage, and more.
>
> Get started with GPT-4.1
>
> • Largest context window: GPT-4.1 offers the largest context window
>   of our models—supporting over 1 million tokens—and is able to
>   better use that context with improved long-context comprehension.
> • Lower costs and latency: GPT-4.1 pushes model performance
>   forward at every point on the latency curve. These new models are
>   26% cheaper than GPT-4o on median queries, and nano is our fastest
>   and cheapest model ever. And, there's no extra charge for using long
>   context—it’s just the normal token prices.
> • Instruction following: GPT-4.1 follows instructions more
>   reliably. On internal evals, GPT-4.1 outranks GPT-4o on tasks like
>   format adherence, complying with negative instructions, and ordering.
>
> Thomson Reuters tested GPT‑4.1 with CoCounsel, their
> professional-grade AI assistant for legal work. They reported a
> 17% improvement in multi-document review accuracy compared to
> GPT‑4o on internal long-context benchmarks. Carlyle used GPT‑4.1
> to accurately extract granular financial data from multiple,
> lengthy documents—including PDFs, Excel files, and other complex
> formats—achieving a 50% improvement on retrieval tasks involving
> large, data-dense documents.
>
> I’ve seen many developers adopt GPT-4.1 recently and recognize its
> coding capabilities, instruction-following, speed, and price, so I
> hope’ll you get a chance to try them out too! And as always, please
> let us know what you think.
Anthropic goes to claude-sonnet-4-5-20250929.

OpenAI goes to gpt-5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant