Skip to content
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

curl parameters size limit #608

Open
rakotomandimby opened this issue Jul 27, 2024 · 0 comments
Open

curl parameters size limit #608

rakotomandimby opened this issue Jul 27, 2024 · 0 comments

Comments

@rakotomandimby
Copy link

rakotomandimby commented Jul 27, 2024

Hello,

With the below code, If the body is very big, I get a "value too large" error.
After having put logging everywhere, I found that the error is thrown at the curl.post line, when the body is past to plenary.curl.
I think that there is a size limit for the body, but I don't know how where is that limit set.
What is exactly the limit?

local curl = require('plenary.curl')
local query = {}

function query.askCallback(res, opts)
  -- Process res and opts
end

function query.ask(instruction, prompt, opts, api_key)
  local url = 'https://generativelanguage.googleapis.com'
  local path = '/v1beta/models/gemini-1.5-pro-latest:generateContent'
  curl.post(url .. path,
    {
      headers = {
        ['Content-type'] = 'application/json',
        ['x-goog-api-key'] = api_key
      },
      body = json.encode(
        {
          -- Big, very big body
        }),
      callback = function(res)
        vim.schedule(function() query.askCallback(res, opts) end)
      end
    })
end

return query
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

No branches or pull requests

1 participant