@fgv/ts-extras-ollama 5.1.0-34

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 (65) hide show
  1. package/.rush/temp/b70e5f6b6ada97ea70c5583027ea2b58b27bef46.tar.log +54 -0
  2. package/.rush/temp/chunked-rush-logs/ts-extras-ollama.build.chunks.jsonl +9 -0
  3. package/.rush/temp/operation/build/all.log +9 -0
  4. package/.rush/temp/operation/build/log-chunks.jsonl +9 -0
  5. package/.rush/temp/operation/build/state.json +3 -0
  6. package/.rush/temp/shrinkwrap-deps.json +681 -0
  7. package/CHANGELOG.json +4 -0
  8. package/README.md +105 -0
  9. package/config/api-extractor.json +38 -0
  10. package/config/jest.config.json +13 -0
  11. package/config/rig.json +6 -0
  12. package/dist/index.js +388 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/test/unit/chatStructured.test.js +287 -0
  15. package/dist/test/unit/chatStructured.test.js.map +1 -0
  16. package/dist/test/unit/fixtures/wireFixtures.js +90 -0
  17. package/dist/test/unit/fixtures/wireFixtures.js.map +1 -0
  18. package/dist/test/unit/modelManagement.test.js +118 -0
  19. package/dist/test/unit/modelManagement.test.js.map +1 -0
  20. package/dist/test/unit/ollamaClient.test.js +38 -0
  21. package/dist/test/unit/ollamaClient.test.js.map +1 -0
  22. package/dist/test/unit/pullModel.test.js +202 -0
  23. package/dist/test/unit/pullModel.test.js.map +1 -0
  24. package/dist/ts-extras-ollama.d.ts +365 -0
  25. package/dist/tsdoc-metadata.json +11 -0
  26. package/eslint.config.js +15 -0
  27. package/etc/ts-extras-ollama.api.md +139 -0
  28. package/lib/index.d.ts +341 -0
  29. package/lib/index.d.ts.map +1 -0
  30. package/lib/index.js +397 -0
  31. package/lib/index.js.map +1 -0
  32. package/lib/test/unit/chatStructured.test.d.ts +2 -0
  33. package/lib/test/unit/chatStructured.test.d.ts.map +1 -0
  34. package/lib/test/unit/chatStructured.test.js +289 -0
  35. package/lib/test/unit/chatStructured.test.js.map +1 -0
  36. package/lib/test/unit/fixtures/wireFixtures.d.ts +19 -0
  37. package/lib/test/unit/fixtures/wireFixtures.d.ts.map +1 -0
  38. package/lib/test/unit/fixtures/wireFixtures.js +93 -0
  39. package/lib/test/unit/fixtures/wireFixtures.js.map +1 -0
  40. package/lib/test/unit/modelManagement.test.d.ts +2 -0
  41. package/lib/test/unit/modelManagement.test.d.ts.map +1 -0
  42. package/lib/test/unit/modelManagement.test.js +120 -0
  43. package/lib/test/unit/modelManagement.test.js.map +1 -0
  44. package/lib/test/unit/ollamaClient.test.d.ts +2 -0
  45. package/lib/test/unit/ollamaClient.test.d.ts.map +1 -0
  46. package/lib/test/unit/ollamaClient.test.js +40 -0
  47. package/lib/test/unit/ollamaClient.test.js.map +1 -0
  48. package/lib/test/unit/pullModel.test.d.ts +2 -0
  49. package/lib/test/unit/pullModel.test.d.ts.map +1 -0
  50. package/lib/test/unit/pullModel.test.js +204 -0
  51. package/lib/test/unit/pullModel.test.js.map +1 -0
  52. package/package.json +83 -0
  53. package/rush-logs/ts-extras-ollama.build.cache.log +3 -0
  54. package/rush-logs/ts-extras-ollama.build.log +9 -0
  55. package/src/index.ts +655 -0
  56. package/src/test/unit/chatStructured.test.ts +330 -0
  57. package/src/test/unit/fixtures/wireFixtures.ts +95 -0
  58. package/src/test/unit/modelManagement.test.ts +128 -0
  59. package/src/test/unit/ollamaClient.test.ts +44 -0
  60. package/src/test/unit/pullModel.test.ts +220 -0
  61. package/temp/build/lint/_eslint-5eVG3S6w.json +30 -0
  62. package/temp/build/typescript/ts_8nwakTlr.json +1 -0
  63. package/temp/ts-extras-ollama.api.json +2528 -0
  64. package/temp/ts-extras-ollama.api.md +139 -0
  65. package/tsconfig.json +8 -0
@@ -0,0 +1,139 @@
1
+ ## API Report File for "@fgv/ts-extras-ollama"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { JsonSchema } from '@fgv/ts-json-base';
8
+ import { JsonValue } from '@fgv/ts-json-base';
9
+ import { Ollama } from 'ollama';
10
+ import { Result } from '@fgv/ts-utils';
11
+
12
+ // @public
13
+ export function chatStructured<T>(client: IOllamaClient, params: IChatStructuredParams<T>): Promise<Result<IOllamaChatStructuredResult<T>>>;
14
+
15
+ // @public
16
+ export function createOllamaClient(params?: ICreateOllamaClientParams): Result<IOllamaClient>;
17
+
18
+ // @public
19
+ export function deleteModel(client: IOllamaClient, model: string): Promise<Result<IOllamaDeleteResult>>;
20
+
21
+ // @public
22
+ export interface IChatStructuredParams<T> {
23
+ readonly keepAlive?: string | number;
24
+ readonly messages: ReadonlyArray<IOllamaChatMessage>;
25
+ readonly model: string;
26
+ readonly options?: Readonly<Record<string, JsonValue>>;
27
+ readonly schema: JsonSchema.ISchemaValidator<T>;
28
+ readonly signal?: AbortSignal;
29
+ }
30
+
31
+ // @public
32
+ export interface ICreateOllamaClientParams {
33
+ readonly fetch?: typeof fetch;
34
+ readonly headers?: Record<string, string>;
35
+ readonly host?: string;
36
+ }
37
+
38
+ // @public
39
+ export interface IOllamaChatMessage {
40
+ readonly content: string;
41
+ readonly images?: ReadonlyArray<string>;
42
+ readonly role: 'system' | 'user' | 'assistant' | 'tool';
43
+ }
44
+
45
+ // @public
46
+ export interface IOllamaChatStructuredResult<T> {
47
+ readonly doneReason?: string;
48
+ readonly model: string;
49
+ readonly raw: string;
50
+ readonly value: T;
51
+ }
52
+
53
+ // @public
54
+ export type IOllamaClient = Ollama;
55
+
56
+ // @public
57
+ export interface IOllamaDeleteResult {
58
+ readonly deleted: true;
59
+ readonly model: string;
60
+ }
61
+
62
+ // @public
63
+ export interface IOllamaModel extends IOllamaModelBase {
64
+ readonly modifiedAt: Date;
65
+ }
66
+
67
+ // @public
68
+ export interface IOllamaModelBase {
69
+ readonly details: IOllamaModelDetail;
70
+ readonly digest: string;
71
+ readonly model: string;
72
+ readonly name: string;
73
+ readonly size: number;
74
+ }
75
+
76
+ // @public
77
+ export interface IOllamaModelDetail {
78
+ readonly families?: ReadonlyArray<string>;
79
+ readonly family?: string;
80
+ readonly format?: string;
81
+ readonly parameterSize?: string;
82
+ readonly parentModel?: string;
83
+ readonly quantizationLevel?: string;
84
+ }
85
+
86
+ // @public
87
+ export interface IOllamaModelInfo {
88
+ readonly capabilities?: ReadonlyArray<string>;
89
+ readonly details: IOllamaModelDetail;
90
+ readonly modelfile?: string;
91
+ readonly modelInfo?: Readonly<Record<string, JsonValue>>;
92
+ readonly parameters?: string;
93
+ readonly template?: string;
94
+ }
95
+
96
+ // @public
97
+ export interface IOllamaPullProgress {
98
+ readonly completed?: number;
99
+ readonly digest?: string;
100
+ readonly status: string;
101
+ readonly total?: number;
102
+ }
103
+
104
+ // @public
105
+ export interface IOllamaPullResult {
106
+ readonly chunkCount: number;
107
+ readonly finalStatus: string;
108
+ readonly model: string;
109
+ }
110
+
111
+ // @public
112
+ export interface IOllamaRunningModel extends IOllamaModelBase {
113
+ readonly expiresAt: Date;
114
+ readonly sizeVram: number;
115
+ }
116
+
117
+ // @public
118
+ export interface IPullModelParams {
119
+ readonly insecure?: boolean;
120
+ readonly model: string;
121
+ readonly onProgress?: (progress: IOllamaPullProgress) => void;
122
+ readonly signal?: AbortSignal;
123
+ }
124
+
125
+ // @public
126
+ export function listModels(client: IOllamaClient): Promise<Result<ReadonlyArray<IOllamaModel>>>;
127
+
128
+ // @public
129
+ export function listRunning(client: IOllamaClient): Promise<Result<ReadonlyArray<IOllamaRunningModel>>>;
130
+
131
+ // @public
132
+ export function pullModel(client: IOllamaClient, params: IPullModelParams): Promise<Result<IOllamaPullResult>>;
133
+
134
+ // @public
135
+ export function showModel(client: IOllamaClient, model: string, options?: {
136
+ readonly verbose?: boolean;
137
+ }): Promise<Result<IOllamaModelInfo>>;
138
+
139
+ ```
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json",
3
+ "compilerOptions": {
4
+ "types": ["heft-jest", "node"],
5
+ "lib": ["es2018", "DOM"],
6
+ "skipLibCheck": true
7
+ }
8
+ }