Skip to content

Commit 4fdf370

Browse files
authored
feat(tools)!: move to function calling (#1141)
1 parent 96bda85 commit 4fdf370

File tree

121 files changed

+5657
-2695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+5657
-2695
lines changed

README.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ Thank you to the following people:
2929
- :speech_balloon: [Copilot Chat](https://github.com/features/copilot) meets [Zed AI](https://zed.dev/blog/zed-ai), in Neovim
3030
- :electric_plug: Support for Anthropic, Copilot, GitHub Models, DeepSeek, Gemini, Mistral AI, Novita, Ollama, OpenAI, Azure OpenAI, HuggingFace and xAI LLMs (or [bring your own](https://codecompanion.olimorris.dev/extending/adapters.html))
3131
- :heart_hands: User contributed and supported [adapters](https://codecompanion.olimorris.dev/configuration/adapters#community-adapters)
32-
- :rocket: Inline transformations, code creation and refactoring
33-
- :robot: Variables, Slash Commands, Agents/Tools and Workflows to improve LLM output
34-
- :sparkles: Built in prompt library for common tasks like advice on LSP errors and code explanations
35-
- :building_construction: Create your own custom prompts, Variables and Slash Commands
36-
- :books: Have multiple chats open at the same time
32+
- :rocket: [Inline transformations](https://codecompanion.olimorris.dev/usage/inline-assistant.html), code creation and refactoring
33+
- :robot: [Variables](https://codecompanion.olimorris.dev/usage/chat-buffer/variables.html), [Slash Commands](https://codecompanion.olimorris.dev/usage/chat-buffer/slash-commands.html), [Agents/Tools](https://codecompanion.olimorris.dev/usage/chat-buffer/agents.html) and [Workflows](https://codecompanion.olimorris.dev/usage/workflows.html) to improve LLM output
34+
- :sparkles: Built in [prompt library](https://codecompanion.olimorris.dev/usage/action-palette.html) for common tasks like advice on LSP errors and code explanations
35+
- :building_construction: Create your own [custom prompts](https://codecompanion.olimorris.dev/extending/prompts.html), Variables and Slash Commands
36+
- :books: Have [multiple chats](https://codecompanion.olimorris.dev/usage/introduction.html#quickly-accessing-a-chat-buffer) open at the same time
3737
- :muscle: Async execution for fast performance
3838

3939
<!-- panvimdoc-ignore-start -->
@@ -42,19 +42,15 @@ Thank you to the following people:
4242

4343
<div align="center">
4444
<p>
45-
<h3>The Chat Buffer</h3>
45+
<h3>The Chat Buffer</h3> - <a href="https://github.com/user-attachments/assets/aa109f1d-0ec9-4f08-bd9a-df99da03b9a4">Link</a>
4646
<video controls muted src="https://github.com/user-attachments/assets/aa109f1d-0ec9-4f08-bd9a-df99da03b9a4"></video>
4747
</p>
4848
<p>
49-
<h3>Using Agents and Tools</h3>
50-
<video controls muted src="https://github.com/user-attachments/assets/16bd6c17-bd70-41a1-83aa-7af45c166ae9"></video>
49+
<h3>Tools + Agentic Workflows</h3> - <a href="https://github.com/user-attachments/assets/362b7cfd-e794-4d9c-9a74-90d5e2a87a32">Link</a>
50+
<video controls muted src="https://github.com/user-attachments/assets/362b7cfd-e794-4d9c-9a74-90d5e2a87a32"></video>
5151
</p>
5252
<p>
53-
<h3>Agentic Workflows</h3>
54-
<video controls muted src="https://github.com/user-attachments/assets/31bae248-ae70-4395-9df1-67fc252475ca"></video>
55-
</p>
56-
<p>
57-
<h3>Inline Assistant</h3>
53+
<h3>Inline Assistant</h3> - <a href="https://github.com/user-attachments/assets/dcddcb85-cba0-4017-9723-6e6b7f080fee">Link</a>
5854
<video controls muted src="https://github.com/user-attachments/assets/dcddcb85-cba0-4017-9723-6e6b7f080fee"></video>
5955
</p>
6056
</div>
@@ -63,7 +59,7 @@ Thank you to the following people:
6359

6460
## :rocket: Getting Started
6561

66-
Please visit the [docs](https://codecompanion.olimorris.dev) for information on installation, configuration and usage.
62+
Everything you need to know about CodeCompanion (installation, configuration and usage) is within the [docs](https://codecompanion.olimorris.dev).
6763

6864
## :toolbox: Troubleshooting
6965

@@ -102,15 +98,14 @@ I am open to contributions but they will be implemented at my discretion. Feel f
10298
## :clap: Acknowledgements
10399

104100
- [Steven Arcangeli](https://github.com/stevearc) for his genius creation of the chat buffer and his feedback early on
105-
- [Manoel Campos](https://github.com/manoelcampos) for the [xml2lua](https://github.com/manoelcampos/xml2lua) library that's used in the tools implementation
101+
- [Manoel Campos](https://github.com/manoelcampos) for the [xml2lua](https://github.com/manoelcampos/xml2lua) library that's used in the inline assistant implementation
106102
- [Dante.nvim](https://github.com/S1M0N38/dante.nvim) for the beautifully simple diff implementation
107103
- [Wtf.nvim](https://github.com/piersolenski/wtf.nvim) for the LSP assistant action
108104
- [CopilotChat.nvim](https://github.com/CopilotC-Nvim/CopilotChat.nvim) for the rendering and usability of the chat
109105
buffer
110106
- [Aerial.nvim](https://github.com/stevearc/aerial.nvim) for the Tree-sitter parsing which inspired the symbols Slash
111107
Command
112-
- [Saghen](https://github.com/Saghen) for the fantastic docs inspiration from [blink.cmp](https://github.com/Saghen/blink.cmp)
113-
- [Catwell](https://github.com/catwell) for the [queue](https://github.com/catwell/cw-lua/blob/master/deque/deque.lua)
114-
inspiration that I use to stack agents and tools
115-
108+
- [Saghen](https://github.com/Saghen) for the fantastic docs inspiration from [blink.cmp](https://github.com/Saghen/blink.cmp) and continued PRs to the project
109+
- [Catwell](https://github.com/catwell) for the [queue](https://github.com/catwell/cw-lua/blob/master/deque/deque.lua) inspiration that I use to stack agents and tools
110+
- [ravitemer](https://github.com/ravitemer) for the fantastic extensions API
116111
<!-- panvimdoc-ignore-end -->

codecompanion-workspace.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
},
5858
{
5959
"name": "Tools",
60-
"system_prompt": "In the CodeCompanion plugin, tools can be leveraged by an LLM to execute lua functions or shell commands on the users machine. By responding with XML, CodeCompanion will pass the response, call the corresponding tool. This feature has been implemented via the agent/init.lua file, which passes all of the tools and adds them to a queue. Then those tools are run consecutively by the executor/init.lua file.",
60+
"system_prompt": "In the CodeCompanion plugin, tools can be leveraged by an LLM to execute lua functions or shell commands on the users machine. CodeCompanion uses an LLM's native function calling to receive a response in JSON, parse the response and call the corresponding tool. This feature has been implemented via the agent/init.lua file, which passes all of the tools and adds them to a queue. Then those tools are run consecutively by the executor/init.lua file.",
6161
"opts": {
6262
"remove_config_system_prompt": true
6363
},
@@ -102,6 +102,11 @@
102102
"path": "lua/codecompanion/strategies/chat/init.lua",
103103
"description": "The `${filename}` file is the entry point for the chat strategy, which is called the `chat buffer`. All methods directly relating to the chat buffer reside here."
104104
},
105+
"chat-messages": {
106+
"type": "file",
107+
"path": "tests/stubs/messages.lua",
108+
"description": "This is an example of what the messages table looks like. This is the table which contains all of the user and LLM messages that are sent to the LLM. It also includes output from the tools that the LLM has requested to run. The role is the person that has sent the message. Content is the message itself. Cycle is a way of grouping messages together in a turn where a turn is defined as a user message and a LLM message (sometimes a tool message too"
109+
},
105110
"workflow-example": {
106111
"type": "file",
107112
"path": "tests/stubs/workflow.lua",
@@ -167,7 +172,7 @@
167172
"agents-init": {
168173
"type": "file",
169174
"path": "lua/codecompanion/strategies/chat/agents/init.lua",
170-
"description": "This is the entry point for the agent. If XML is detected in an LLM's response then this file is triggered which in turns add tools to a queue before calling the executor"
175+
"description": "This is the entry point for the agent. If an LLM's response includes a function call (or tool call) then this file is triggered which in turns add tools to a queue before calling the executor"
171176
},
172177
"executor-init": {
173178
"type": "file",

doc/.vitepress/theme/vaporwave.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
var(--vw-green) 25%,
7070
var(--vw-base-bg)
7171
);
72+
73+
/* even‑row stripes */
74+
--vp-c-bg-soft: color-mix(in srgb, var(--vw-blue) 5%, var(--vp-c-bg));
7275
}
7376

7477
.dark {
@@ -90,6 +93,12 @@
9093

9194
/* Override base background for dark mode */
9295
--vw-base-bg-mixer: 20%;
96+
97+
.vp-doc table th,
98+
.vp-doc table td {
99+
border: 1px solid color-mix(in srgb, var(--vw-green) 40%, var(--vp-c-bg)) !important;
100+
}
101+
--vp-c-bg-soft: color-mix(in srgb, var(--vp-c-bg-alt) 80%, var(--vp-c-bg));
93102
}
94103

95104
/* Mermaid */

0 commit comments

Comments
 (0)