03-01 ollama serve

01 - Test with direct api curl request in terminal

Open terminal, type or paste

curl http://localhost:11434/api/generate -d "{\"model\": \"llama3\",\"prompt\": \"why is the sky blue?\", \"stream\": false}"
  • curl is used to send data to server and the post request
  • the url is
  • the -d means your sending data (the object {}) with request

In the request object{} you see the

  • model: llama3
  • prompt: the question ... "Why is sky blue?"
  • stream: false means it will output all at once

This will return json payload (idk if thats what it's called)? with the response

02 - the server api

This MATTERS, because the api allows other programs and software to talk to your ai model

type in the address and you should see Ollama is running