@@ -57,6 +57,8 @@ OllamaWingman::~OllamaWingman()
57
57
/* *
58
58
* OpenAI cURL GET request.
59
59
*
60
+ * @see https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-completion
61
+ * @see https://github.com/ollama/ollama/blob/main/docs/api.md#list-local-models
60
62
* @see https://ollama.com/library/llama2
61
63
* @see https://json.nlohmann.me/
62
64
*/
@@ -70,11 +72,12 @@ void OllamaWingman::curlGet(CommandWingmanChat& command) {
70
72
replaceAll (" \" " , " \\\" " , escapedPrompt);
71
73
72
74
/*
73
- ollama API JSon request example (see unit test) :
75
+ ollama API JSon request example - chat vs. generate answer :
74
76
75
77
curl -X POST http://localhost:11434/api/generate -d '{
76
78
"model": "llama2",
77
- "prompt":"Why is the sky blue?"
79
+ "prompt":"Why is the sky blue?",
80
+ "stream": false
78
81
}'
79
82
80
83
*/
@@ -212,30 +215,22 @@ void OllamaWingman::curlGet(CommandWingmanChat& command) {
212
215
213
216
// parse JSon
214
217
/*
215
- OpenAI API JSon response example:
218
+ ollama API JSon response example:
219
+
216
220
{
217
- "id": "chatcmpl-8gspbsufrxF42A6JfaiwuxoitQ1fT",
218
- "object": "chat.completion",
219
- "created": 1705231239,
220
- "model": "gpt-3.5-turbo-0613",
221
- "choices": [
222
- {
223
- "index": 0,
224
- "message": {
225
- "role": "assistant",
226
- "content": "...LLM answer...",
227
- },
228
- "logprobs": null,
229
- "finish_reason": "stop"
230
- }
231
- ],
232
- "usage": {
233
- "prompt_tokens": 26,
234
- "completion_tokens": 491,
235
- "total_tokens": 517
236
- },
237
- "system_fingerprint": null
221
+ "model": "llama2",
222
+ "created_at": "2023-08-04T19:22:45.499127Z",
223
+ "response": "The sky is blue because it is the color of the sky.",
224
+ "done": true,
225
+ "context": [1, 2, 3],
226
+ "total_duration": 5043500667,
227
+ "load_duration": 5025959,
228
+ "prompt_eval_count": 26,
229
+ "prompt_eval_duration": 325953000,
230
+ "eval_count": 290,
231
+ "eval_duration": 4709213000
238
232
}
233
+
239
234
*/
240
235
241
236
// parse response string to JSon object
0 commit comments