Skip to content

get_file_contents tool should have non-base64 option #372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ashwin-ant opened this issue May 4, 2025 · 3 comments
Open

get_file_contents tool should have non-base64 option #372

ashwin-ant opened this issue May 4, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@ashwin-ant
Copy link
Contributor

Describe the feature or problem you’d like to solve

The get_file_contents tool currently returns file contents in base64. This matches the backing API, but it'd be nice to have a non-base64 option for this. The corresponding create_or_update_file tool accept plaintext, even though the backing API only allows base64.

Proposed solution

This would create interface consistency and probably lead to better model performance with the tool.

Additional context

I'm happy to send a PR for this if there's a recommended approach I should take!

@ashwin-ant ashwin-ant added the enhancement New feature or request label May 4, 2025
@bratorange
Copy link

+1

@ConnorChristie
Copy link

I seriously thought I was going crazy when gpt-4o-mini was making up example code after knowingly reading the file contents and I explicitly instructed it to reference code from the repo. Turns out this was the problem. Made a fix locally and it works as expected now.

For reference, I changed the following:

var result interface{}
if fileContent != nil {
result = fileContent
} else {
result = dirContent
}

to:

var result interface{}
if fileContent != nil {
    result, err = fileContent.GetContent()
    if err != nil {
        return nil, fmt.Errorf("failed to get file content: %w", err)
    }
} else {
    result = dirContent
}

@dijonkitchen
Copy link

Does having it in base64 also increase the token usage?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants