fix: functions are missing from parse_schema's return#1263
Closed
xavierchanth wants to merge 2 commits intoCopilotC-Nvim:mainfrom
Closed
fix: functions are missing from parse_schema's return#1263xavierchanth wants to merge 2 commits intoCopilotC-Nvim:mainfrom
xavierchanth wants to merge 2 commits intoCopilotC-Nvim:mainfrom
Conversation
I'll use the `file` function's schema as an example of the problem:
```lua
schema = {
type = 'object',
required = { 'path' },
properties = {
path = {
type = 'string',
description = 'Path to file to include in chat context.',
enum = function(source)
local glob = utils.glob(source.cwd(), {
max_count = 0,
})
return glob
end,
},
},
}
```
At the end of `parse_schema`, the schema is filtered:
```lua
if schema then
schema = filter_schema(schema, true)
end
return schema
```
This change leaves functions as is in the results table.
Prior to this, completing `#file:` in the picker would give me an input field to type my file path. This restores the behavior visible in the demo in the README where that file can be picked using `vim.ui.select`.
deathbeam
added a commit
to deathbeam/CopilotChat.nvim
that referenced
this pull request
Aug 3, 2025
It still need to be filtered when preparing tool use as we cant send json functions to API. Closes CopilotC-Nvim#1263 Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
deathbeam
added a commit
that referenced
this pull request
Aug 3, 2025
It still need to be filtered when preparing tool use as we cant send json functions to API. Closes #1263 Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
Collaborator
|
Good catch thanks. I fixed it myself because if I did this, the enum function would also be sent to the copilot API, and serializing functions as json is not pretty and it can break the API for some models, so the fix needed to be done only for when the input is being entered. |
Author
Np, I had a feeling what I did wasn’t correct, but at least raising the PR identifies the issue. Thanks for the quick response! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'll use the
filefunction's schema as an example of the problem:At the end of
parse_schema, the schema is filtered. After this gets called, onlytypeanddescriptionare in the returned schema, butenumshould be in there too.Prior to this, completing
#file:in the picker would give me an input field to type my file path:This change restores the behavior visible in the demo in the README where that file can be picked using
vim.ui.select: