We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to use nio.process.run to run a curl command and read the output of curl from stdout.
nio.process.run
The code to read stdout is:
while true do print("enter loop") local chunk = response.stdout.read(1024) print("get chunk from response") end
I added logs before and after it
my test code:
local nio = require("nio") local messages = { { role = "user", content = "hello" }, } local body = { stream = true, max_tokens = 512, messages = messages, } local ACCOUNT = os.getenv("ACCOUNT") local KEY = os.getenv("KEY") local MODEL = "@cf/google/gemma-7b-it-lora" nio.run(function() local response = nio.process.run({ cmd = "curl", args = { string.format("https://api.cloudflare.com/client/v4/accounts/%s/ai/run/%s", ACCOUNT, MODEL), "-N", "-X", "POST", "-H", "Content-Type: application/json", "-H", "Authorization: Bearer " .. KEY, "-d", vim.fn.json_encode(body), }, }) while true do print("enter loop") local chunk = response.stdout.read(1024) print("get chunk from response") if not chunk then print("chunk is nil") break end print(chunk) end end)
my output:
enter loop
Why does my program get stuck at local chunk = response.stdout.read(1024)
local chunk = response.stdout.read(1024)
This shell command is correct.
curl "https://api.cloudflare.com/client/v4/accounts/${ACCOUNT}/ai/run/@cf/google/gemma-7b-it-lora" \ -N \ -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $KEY" \ -d '{"messages": [{"role": "user", "content": "hello"}], "max_tokens": 512, "stream": true}'
env:
NVIM v0.10.1 Build type: Release LuaJIT 2.1.1720049189
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm trying to use
nio.process.run
to run a curl command and read the output of curl from stdout.The code to read stdout is:
I added logs before and after it
my test code:
my output:
Why does my program get stuck at
local chunk = response.stdout.read(1024)
This shell command is correct.
env:
The text was updated successfully, but these errors were encountered: