@agentic-kit/ollama 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +76 -6
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,12 +1,82 @@
1
- # Ollama
1
+ # Ollama Client
2
2
 
3
- ## Credits
3
+ A JavaScript/TypeScript client for the Ollama LLM server, supporting model listing, text generation, streaming responses, embeddings, and model management.
4
4
 
5
- 🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io)
5
+ ## Installation
6
6
 
7
+ ```bash
8
+ npm install @agentic-kit/ollama
9
+ # or
10
+ yarn add @agentic-kit/ollama
11
+ ```
7
12
 
8
- ## Disclaimer
13
+ ## Usage
9
14
 
10
- AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
15
+ ```typescript
16
+ import OllamaClient, { GenerateInput } from '@agentic-kit/ollama';
11
17
 
12
- No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
18
+ // Create a client (default port 11434)
19
+ const client = new OllamaClient('http://localhost:11434');
20
+
21
+ // List available models
22
+ const models = await client.listModels();
23
+ console.log('Available models:', models);
24
+
25
+ // Non-streaming text generation
26
+ const output = await client.generate({ model: 'mistral', prompt: 'Hello, Ollama!' });
27
+ console.log(output);
28
+
29
+ // Streaming generation
30
+ await client.generate(
31
+ { model: 'mistral', prompt: 'Hello, streaming!', stream: true },
32
+ (chunk) => {
33
+ console.log('Received chunk:', chunk);
34
+ }
35
+ );
36
+
37
+ // Pull a model to local cache
38
+ await client.pullModel('mistral');
39
+
40
+ // Generate embeddings
41
+ const embedding = await client.generateEmbedding('Compute embeddings');
42
+ console.log('Embedding vector length:', embedding.length);
43
+
44
+ // Generate a conversational response with context
45
+ const response = await client.generateResponse(
46
+ 'What is the capital of France?',
47
+ 'Geography trivia'
48
+ );
49
+ console.log(response);
50
+
51
+ // Delete a pulled model when done
52
+ await client.deleteModel('mistral');
53
+ ```
54
+
55
+ ## API Reference
56
+
57
+ - `new OllamaClient(baseUrl?: string)` – defaults to `http://localhost:11434`
58
+ - `.listModels(): Promise<string[]>`
59
+ - `.generate(input: GenerateInput, onChunk?: (chunk: string) => void): Promise<string | void>`
60
+ - `.generateStreamingResponse(prompt: string, onChunk: (chunk: string) => void, context?: string): Promise<void>`
61
+ - `.generateEmbedding(text: string): Promise<number[]>`
62
+ - `.generateResponse(prompt: string, context?: string): Promise<string>`
63
+ - `.pullModel(model: string): Promise<void>`
64
+ - `.deleteModel(model: string): Promise<void>`
65
+
66
+ ## GenerateInput type
67
+
68
+ ```ts
69
+ interface GenerateInput {
70
+ model: string;
71
+ prompt: string;
72
+ stream?: boolean;
73
+ }
74
+ ```
75
+
76
+ ## Contributing
77
+
78
+ Please open issues or pull requests on [GitHub](https://github.com/hyperweb-io/agentic-kit).
79
+
80
+ ---
81
+
82
+ © Hyperweb (formerly Cosmology). See LICENSE for full licensing and disclaimer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentic-kit/ollama",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
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": "429d3cbe616b763f2e1e8b2a35738b3f9a600c57"
36
+ "gitHead": "0204aa87ae43833af29965684146ff22ebf77564"
37
37
  }