@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.
- package/.rush/temp/b70e5f6b6ada97ea70c5583027ea2b58b27bef46.tar.log +54 -0
- package/.rush/temp/chunked-rush-logs/ts-extras-ollama.build.chunks.jsonl +9 -0
- package/.rush/temp/operation/build/all.log +9 -0
- package/.rush/temp/operation/build/log-chunks.jsonl +9 -0
- package/.rush/temp/operation/build/state.json +3 -0
- package/.rush/temp/shrinkwrap-deps.json +681 -0
- package/CHANGELOG.json +4 -0
- package/README.md +105 -0
- package/config/api-extractor.json +38 -0
- package/config/jest.config.json +13 -0
- package/config/rig.json +6 -0
- package/dist/index.js +388 -0
- package/dist/index.js.map +1 -0
- package/dist/test/unit/chatStructured.test.js +287 -0
- package/dist/test/unit/chatStructured.test.js.map +1 -0
- package/dist/test/unit/fixtures/wireFixtures.js +90 -0
- package/dist/test/unit/fixtures/wireFixtures.js.map +1 -0
- package/dist/test/unit/modelManagement.test.js +118 -0
- package/dist/test/unit/modelManagement.test.js.map +1 -0
- package/dist/test/unit/ollamaClient.test.js +38 -0
- package/dist/test/unit/ollamaClient.test.js.map +1 -0
- package/dist/test/unit/pullModel.test.js +202 -0
- package/dist/test/unit/pullModel.test.js.map +1 -0
- package/dist/ts-extras-ollama.d.ts +365 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/eslint.config.js +15 -0
- package/etc/ts-extras-ollama.api.md +139 -0
- package/lib/index.d.ts +341 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +397 -0
- package/lib/index.js.map +1 -0
- package/lib/test/unit/chatStructured.test.d.ts +2 -0
- package/lib/test/unit/chatStructured.test.d.ts.map +1 -0
- package/lib/test/unit/chatStructured.test.js +289 -0
- package/lib/test/unit/chatStructured.test.js.map +1 -0
- package/lib/test/unit/fixtures/wireFixtures.d.ts +19 -0
- package/lib/test/unit/fixtures/wireFixtures.d.ts.map +1 -0
- package/lib/test/unit/fixtures/wireFixtures.js +93 -0
- package/lib/test/unit/fixtures/wireFixtures.js.map +1 -0
- package/lib/test/unit/modelManagement.test.d.ts +2 -0
- package/lib/test/unit/modelManagement.test.d.ts.map +1 -0
- package/lib/test/unit/modelManagement.test.js +120 -0
- package/lib/test/unit/modelManagement.test.js.map +1 -0
- package/lib/test/unit/ollamaClient.test.d.ts +2 -0
- package/lib/test/unit/ollamaClient.test.d.ts.map +1 -0
- package/lib/test/unit/ollamaClient.test.js +40 -0
- package/lib/test/unit/ollamaClient.test.js.map +1 -0
- package/lib/test/unit/pullModel.test.d.ts +2 -0
- package/lib/test/unit/pullModel.test.d.ts.map +1 -0
- package/lib/test/unit/pullModel.test.js +204 -0
- package/lib/test/unit/pullModel.test.js.map +1 -0
- package/package.json +83 -0
- package/rush-logs/ts-extras-ollama.build.cache.log +3 -0
- package/rush-logs/ts-extras-ollama.build.log +9 -0
- package/src/index.ts +655 -0
- package/src/test/unit/chatStructured.test.ts +330 -0
- package/src/test/unit/fixtures/wireFixtures.ts +95 -0
- package/src/test/unit/modelManagement.test.ts +128 -0
- package/src/test/unit/ollamaClient.test.ts +44 -0
- package/src/test/unit/pullModel.test.ts +220 -0
- package/temp/build/lint/_eslint-5eVG3S6w.json +30 -0
- package/temp/build/typescript/ts_8nwakTlr.json +1 -0
- package/temp/ts-extras-ollama.api.json +2528 -0
- package/temp/ts-extras-ollama.api.md +139 -0
- 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
|
+
```
|