@agentic-kit/ollama 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -77,6 +77,40 @@ interface GenerateInput {
77
77
 
78
78
  Please open issues or pull requests on [GitHub](https://github.com/hyperweb-io/agentic-kit).
79
79
 
80
+ ## API Response Format
81
+
82
+ The Ollama `/api/tags` endpoint returns the following JSON structure:
83
+
84
+ ```json
85
+ {
86
+ "models": [
87
+ {
88
+ "name": "mistral:latest",
89
+ "model": "mistral:latest",
90
+ "modified_at": "2025-06-09T04:48:21.588888008Z",
91
+ "size": 4113301824,
92
+ "digest": "...",
93
+ "details": {
94
+ "parent_model": "",
95
+ "format": "gguf",
96
+ "family": "llama",
97
+ "families": ["llama"],
98
+ "parameter_size": "7.2B",
99
+ "quantization_level": "Q4_0"
100
+ }
101
+ }
102
+ ]
103
+ }
104
+ ```
105
+
106
+ The `listModels()` method extracts and returns just the model names:
107
+
108
+ ```ts
109
+ const client = new OllamaClient('http://localhost:11434');
110
+ const models = await client.listModels();
111
+ console.log(models); // ["mistral:latest", "llama2:latest", ...]
112
+ ```
113
+
80
114
  ---
81
115
 
82
116
  © Hyperweb (formerly Cosmology). See LICENSE for full licensing and disclaimer.
package/esm/index.js CHANGED
@@ -10,7 +10,15 @@ export default class OllamaClient {
10
10
  throw new Error(`Failed to list models: ${response.status} ${response.statusText}`);
11
11
  }
12
12
  const data = await response.json();
13
- return data.tags;
13
+ // Handle actual API response format (models array)
14
+ if (data.models && Array.isArray(data.models)) {
15
+ return data.models.map(model => model.name);
16
+ }
17
+ // Fallback to documented format (tags array) for backwards compatibility
18
+ if (data.tags && Array.isArray(data.tags)) {
19
+ return data.tags;
20
+ }
21
+ return [];
14
22
  }
15
23
  async generate(input, onChunk) {
16
24
  if (input.stream && onChunk) {
package/index.js CHANGED
@@ -15,7 +15,15 @@ class OllamaClient {
15
15
  throw new Error(`Failed to list models: ${response.status} ${response.statusText}`);
16
16
  }
17
17
  const data = await response.json();
18
- return data.tags;
18
+ // Handle actual API response format (models array)
19
+ if (data.models && Array.isArray(data.models)) {
20
+ return data.models.map(model => model.name);
21
+ }
22
+ // Fallback to documented format (tags array) for backwards compatibility
23
+ if (data.tags && Array.isArray(data.tags)) {
24
+ return data.tags;
25
+ }
26
+ return [];
19
27
  }
20
28
  async generate(input, onChunk) {
21
29
  if (input.stream && onChunk) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentic-kit/ollama",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "author": "Dan Lynch <pyramation@gmail.com>",
5
5
  "description": "Ollama",
6
6
  "main": "index.js",
@@ -33,5 +33,5 @@
33
33
  "dependencies": {
34
34
  "cross-fetch": "^4.1.0"
35
35
  },
36
- "gitHead": "0204aa87ae43833af29965684146ff22ebf77564"
36
+ "gitHead": "957a378bb3b08f3be63cce7b72d741f1f044ae95"
37
37
  }