I am currently trying to write a console application for ‘Ollama’. Ollama is a server to run large language models locally. The server has a REST API that can be used to access the chat function, among other things.
I have managed to establish a connection to the server, ask my question and get an answer back. But I have to wait until I have received the full answer.
local ollamaserver = net.Http("http://localhost:11434")
local postrequest = ollamaserver:post("/api/generate", json.encode("{
"model": "llama3.2",
"prompt": "Why is the sky blue?"
}"))
With Ollama and ChatGTP, however, writing from word to word starts immediately.
Can I achieve this with HTTP at all? Or can this be achieved via SOCKET? Has anyone already done something similar? I have tried to work with SOCKET, but can't get a connection to the server.