Skip to content

Instantly share code, notes, and snippets.

@JosePedroDias
Last active March 21, 2025 00:31
Show Gist options
  • Save JosePedroDias/0ab18da1602969d4c0c6b849fa5cb849 to your computer and use it in GitHub Desktop.
Save JosePedroDias/0ab18da1602969d4c0c6b849fa5cb849 to your computer and use it in GitHub Desktop.

based on the keynote
The past, present, and future of AI for application developers
by Steve Sanderson
at NDC London 2025

https://youtu.be/awztkr8n0AA?si=_fmkumuKlAGU_14M&t=1357

Reference API

set up the local LLM:

brew install ollama
ollama serve &
ollama run deepseek-r1:8b
/bye

the web server is still working, serving at http://localhost:11434/

completions in CURL

curl --request POST \
  --url http://localhost:11434/api/generate \
  --header 'content-type: application/json' \
  --data '{
  "model": "deepseek-r1",
  "prompt": "the weather in London is",
  "raw": true,
  "stream": false,
  "options": {
    "temperature": 0.1,
    "num_predict": 40
  }
}'
curl --request POST \
  --url http://localhost:11434/api/generate \
  --header 'content-type: application/json' \
  --data '{
  "model": "deepseek-r1",
  "prompt": "A: Albert; B: Bryan; C: Carl; D:",
  "raw": true,
  "stream": false,
  "options": {
    "temperature": 0.1,
    "num_predict": 40
  }
}'
curl --request POST \
  --url http://localhost:11434/api/generate \
  --header 'content-type: application/json' \
  --data '{
  "model": "deepseek-r1",
  "prompt": "This is the transcript of a conversation between a human user and a super-intelligent AI.\nIt answers in exactly 3 words.\n[USER]What can you do?[/USER]\n[AI]Answer any question[/AI]\n[USER]What is 1+1?[/USER]\n[AI]It is 2[/AI]\n[USER]What'\''s the capital of Sweden?[/USER]\n[AI]It is Stockholm[/AI]\n[USER]What is plastic made from?[/USER]\n[AI]",
  "raw": true,
  "stream": false,
  "options": {
    "temperature": 0.1,
    "num_predict": 40,
    "stop": ["[/AI]"]
  }
}'
curl --request POST \
  --url http://localhost:11434/api/generate \
  --header 'content-type: application/json' \
  --data '{
  "model": "deepseek-r1",
  "prompt": "This is the transcript of a conversation between a human user and a super-intelligent AI.\nIf the AI needs to look up weather information, it emits the syntax [WEATHER]location[/WEATHER]\n[USER]What can you do?[/USER]\n[AI]Answer any question and look up weather information[/AI]\n[USER]What is 1+1?[/USER]\n[AI]It is 2[/AI]\n[USER]What'\''s the weather in Lisbon?[/USER]\n[WEATHER]Lisbon[/WEATHER]\n[ANSWER]Rainy[/ANSWER]\n[AI]It'\''s rainy in Lisbon[/AI]\n[USER]What'\''s the weather in Seattle?[/USER]\n",
  "raw": true,
  "stream": false,
  "options": {
    "temperature": 0.1,
    "num_predict": 40,
    "stop": ["[/AI]", "[ANSWER]"]
  }
}'
curl --request POST \
  --url http://localhost:11434/api/generate \
  --header 'content-type: application/json' \
  --data '{
  "model": "deepseek-r1",
  "prompt": "This is the transcript of a conversation between a human user and a super-intelligent AI.\nIf the AI needs to look up weather information, it emits the syntax [WEATHER]location[/WEATHER]\n[USER]What can you do?[/USER]\n[AI]Answer any question and look up weather information[/AI]\n[USER]What is 1+1?[/USER]\n[AI]It is 2[/AI]\n[USER]What'\''s the weather in Lisbon?[/USER]\n[WEATHER]Lisbon[/WEATHER]\n[ANSWER]Rainy[/ANSWER]\n[AI]It'\''s rainy in Lisbon[/AI]\n[USER]What'\''s the weather in Seattle?[/USER]\n[ANSWER]Sunny[/ANSWER]\n[AI]",
  "raw": true,
  "stream": false,
  "options": {
    "temperature": 0.1,
    "num_predict": 40,
    "stop": ["[/AI]", "[ANSWER]"]
  }
}'

Completions via a Bruno Collection

You can also import this collection of requests file into Bruno if you find that more convenient.

{
"name": "llm completion ollama",
"version": "1",
"items": [
{
"type": "http",
"name": "comp 1: weather phrase",
"filename": "comp 1- weather phrase.bru",
"seq": 3,
"request": {
"url": "http://localhost:11434/api/generate",
"method": "POST",
"headers": [],
"params": [],
"body": {
"mode": "json",
"json": "{\n \"model\": \"deepseek-r1\",\n \"prompt\": \"the weather in London is\",\n \"raw\": true,\n \"stream\": false,\n \"options\": {\n \"temperature\": 0.1,\n \"num_predict\": 40\n }\n}",
"formUrlEncoded": [],
"multipartForm": [],
"file": []
},
"script": {},
"vars": {},
"assertions": [],
"tests": "",
"docs": "[docs](https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-completion)\n[docs2](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values)\n\ntested using ollama with `deepseek-r1`",
"auth": {
"mode": "inherit"
}
}
},
{
"type": "http",
"name": "comp 2: enumeration",
"filename": "comp 2- enumeration.bru",
"seq": 4,
"request": {
"url": "http://localhost:11434/api/generate",
"method": "POST",
"headers": [],
"params": [],
"body": {
"mode": "json",
"json": "{\n \"model\": \"deepseek-r1\",\n \"prompt\": \"A: Albert; B: Bryan; C: Carl; D:\",\n \"raw\": true,\n \"stream\": false,\n \"options\": {\n \"temperature\": 0.1,\n \"num_predict\": 40\n }\n}",
"formUrlEncoded": [],
"multipartForm": [],
"file": []
},
"script": {},
"vars": {},
"assertions": [],
"tests": "",
"docs": "[docs](https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-completion)\n[docs2](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values)\n\ntested using ollama with `deepseek-r1`",
"auth": {
"mode": "inherit"
}
}
},
{
"type": "http",
"name": "comp 3: make it answer something",
"filename": "comp 3- make it answer something.bru",
"seq": 5,
"request": {
"url": "http://localhost:11434/api/generate",
"method": "POST",
"headers": [],
"params": [],
"body": {
"mode": "json",
"json": "{\n \"model\": \"deepseek-r1\",\n \"prompt\": \"This is the transcript of a conversation between a human user and a super-intelligent AI.\\nIt answers in exactly 3 words.\\n[USER]What can you do?[/USER]\\n[AI]Answer any question[/AI]\\n[USER]What is 1+1?[/USER]\\n[AI]It is 2[/AI]\\n[USER]What's the capital of Sweden?[/USER]\\n[AI]It is Stockholm[/AI]\\n[USER]What is plastic made from?[/USER]\\n[AI]\",\n \"raw\": true,\n \"stream\": false,\n \"options\": {\n \"temperature\": 0.1,\n \"num_predict\": 40,\n \"stop\": [\"[/AI]\"]\n }\n}",
"formUrlEncoded": [],
"multipartForm": [],
"file": []
},
"script": {},
"vars": {},
"assertions": [],
"tests": "",
"docs": "[docs](https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-completion)\n[docs2](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values)\n\ntested using ollama with `deepseek-r1`",
"auth": {
"mode": "inherit"
}
}
},
{
"type": "http",
"name": "comp 4a: make it trigger weather lookup",
"filename": "comp 4a- make it trigger weather lookup.bru",
"seq": 6,
"request": {
"url": "http://localhost:11434/api/generate",
"method": "POST",
"headers": [],
"params": [],
"body": {
"mode": "json",
"json": "{\n \"model\": \"deepseek-r1\",\n \"prompt\": \"This is the transcript of a conversation between a human user and a super-intelligent AI.\\nIf the AI needs to look up weather information, it emits the syntax [WEATHER]location[/WEATHER]\\n[USER]What can you do?[/USER]\\n[AI]Answer any question and look up weather information[/AI]\\n[USER]What is 1+1?[/USER]\\n[AI]It is 2[/AI]\\n[USER]What's the weather in Lisbon?[/USER]\\n[WEATHER]Lisbon[/WEATHER]\\n[ANSWER]Rainy[/ANSWER]\\n[AI]It's rainy in Lisbon[/AI]\\n[USER]What's the weather in Seattle?[/USER]\\n\",\n \"raw\": true,\n \"stream\": false,\n \"options\": {\n \"temperature\": 0.1,\n \"num_predict\": 40,\n \"stop\": [\"[/AI]\", \"[ANSWER]\"]\n }\n}",
"formUrlEncoded": [],
"multipartForm": [],
"file": []
},
"script": {},
"vars": {},
"assertions": [],
"tests": "",
"docs": "[docs](https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-completion)\n[docs2](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values)\n\ntested using ollama with `deepseek-r1`",
"auth": {
"mode": "inherit"
}
}
},
{
"type": "http",
"name": "comp 4b: resume conversation after lookup answer fetched",
"filename": "comp 4b- resume conversation after lookup answer fetched.bru",
"seq": 7,
"request": {
"url": "http://localhost:11434/api/generate",
"method": "POST",
"headers": [],
"params": [],
"body": {
"mode": "json",
"json": "{\n \"model\": \"deepseek-r1\",\n \"prompt\": \"This is the transcript of a conversation between a human user and a super-intelligent AI.\\nIf the AI needs to look up weather information, it emits the syntax [WEATHER]location[/WEATHER]\\n[USER]What can you do?[/USER]\\n[AI]Answer any question and look up weather information[/AI]\\n[USER]What is 1+1?[/USER]\\n[AI]It is 2[/AI]\\n[USER]What's the weather in Lisbon?[/USER]\\n[WEATHER]Lisbon[/WEATHER]\\n[ANSWER]Rainy[/ANSWER]\\n[AI]It's rainy in Lisbon[/AI]\\n[USER]What's the weather in Seattle?[/USER]\\n[ANSWER]Sunny[/ANSWER]\\n[AI]\",\n \"raw\": true,\n \"stream\": false,\n \"options\": {\n \"temperature\": 0.1,\n \"num_predict\": 40,\n \"stop\": [\"[/AI]\", \"[ANSWER]\"]\n }\n}",
"formUrlEncoded": [],
"multipartForm": [],
"file": []
},
"script": {},
"vars": {},
"assertions": [],
"tests": "",
"docs": "[docs](https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-completion)\n[docs2](https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values)\n\ntested using ollama with `deepseek-r1`",
"auth": {
"mode": "inherit"
}
}
}
],
"environments": [],
"brunoConfig": {
"version": "1",
"name": "llm completion ollama",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment