Skip to content

curl parameters size limit #608

Open

Description

@rakotomandimby

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions