You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check if the service is healthy and ollama is accessible:
202
+
203
+
```bash
204
+
curl http://localhost:8000/health
205
+
```
206
+
207
+
**Response (200 OK):**
208
+
```json
209
+
{
210
+
"status": "healthy",
211
+
"service": "ollama",
212
+
"active_model": "Qwen 2.5 Coder 32B",
213
+
"ollama_model": "qwen2.5-coder:32b"
214
+
}
215
+
```
216
+
217
+
**Response (503 Service Unavailable):**
218
+
```json
219
+
{
220
+
"detail": "Service unhealthy: ollama is not running or not accessible"
221
+
}
222
+
```
223
+
224
+
#### Generate Docstring
225
+
226
+
Generate a docstring for a Python function:
227
+
228
+
```bash
229
+
curl -X POST http://localhost:8000/generate \
230
+
-H "Content-Type: application/json" \
231
+
-d '{
232
+
"code": "def add(x, y):\n return x + y",
233
+
"max_new_tokens": 256
234
+
}'
235
+
```
236
+
237
+
**Request Body:**
238
+
-`code` (required): Python function code as a string
239
+
-`max_new_tokens` (optional): Maximum number of tokens to generate (uses model default if not specified)
240
+
-`model` (optional): Model key or Ollama model name to use for this request
241
+
242
+
**Response (200 OK):**
243
+
```json
244
+
{
245
+
"docstring": "\"\"\"Compute the sum of two numbers.\n\nParameters\n----------\nx : int\n First number.\ny : int\n Second number.\n\nReturns\n-------\nint\n Sum of x and y.\"\"\"",
246
+
"model": "qwen2.5-coder:32b"
247
+
}
248
+
```
249
+
250
+
**Response (500 Internal Server Error):**
251
+
```json
252
+
{
253
+
"detail": "Failed to generate docstring: <error message>"
254
+
}
255
+
```
256
+
257
+
#### List Models
258
+
259
+
Get available model configurations:
260
+
261
+
```bash
262
+
curl http://localhost:8000/models
263
+
```
264
+
265
+
**Response (200 OK):**
266
+
```json
267
+
{
268
+
"default": "qwen2.5-coder-32b",
269
+
"active": "qwen2.5-coder-32b",
270
+
"models": [
271
+
{
272
+
"key": "qwen2.5-coder-32b",
273
+
"name": "Qwen 2.5 Coder 32B",
274
+
"ollama_model": "qwen2.5-coder:32b",
275
+
"context_window": 32768,
276
+
"architecture": "dense",
277
+
"memory_q4": "~18GB",
278
+
"description": "Dense 32B model, good balance of quality and speed"
279
+
}
280
+
]
281
+
}
282
+
```
283
+
284
+
### CLI Tool
285
+
286
+
The CLI tool allows testing docstring generation directly:
287
+
288
+
```bash
289
+
# Use default model
290
+
python scripts/run_ollama.py --user "def add(x, y): return x + y"
0 commit comments