feat(OllamaProvider): add model options, streaming support, and thinking tokens

- Add IOllamaModelOptions interface for runtime options (num_ctx, temperature, etc.)
- Extend IOllamaProviderOptions with defaultOptions and defaultTimeout
- Add IOllamaChatOptions for per-request overrides
- Add IOllamaStreamChunk and IOllamaChatResponse interfaces
- Add chatStreamResponse() for async iteration with options
- Add collectStreamResponse() for streaming with progress callback
- Add chatWithOptions() for non-streaming with full options
- Update chat() to use defaultOptions and defaultTimeout
This commit is contained in:
2026-01-20 00:02:45 +00:00
parent a556053510
commit 126e9b239b
12 changed files with 320 additions and 74 deletions

106
pnpm-lock.yaml generated
View File

@@ -12,14 +12,14 @@ importers:
specifier: ^0.71.2
version: 0.71.2(zod@3.25.76)
'@mistralai/mistralai':
specifier: ^1.11.0
version: 1.11.0
specifier: ^1.12.0
version: 1.12.0
'@push.rocks/smartarray':
specifier: ^1.1.0
version: 1.1.0
'@push.rocks/smartfile':
specifier: ^11.2.7
version: 11.2.7
'@push.rocks/smartfs':
specifier: ^1.3.1
version: 1.3.1
'@push.rocks/smartpath':
specifier: ^6.0.0
version: 6.0.0
@@ -36,8 +36,8 @@ importers:
specifier: ^1.0.10
version: 1.0.10
openai:
specifier: ^5.12.2
version: 5.12.2(ws@8.18.3)(zod@3.25.76)
specifier: ^6.16.0
version: 6.16.0(ws@8.18.3)(zod@3.25.76)
devDependencies:
'@git.zone/tsbuild':
specifier: ^4.1.2
@@ -49,14 +49,14 @@ importers:
specifier: ^2.0.1
version: 2.0.1
'@git.zone/tstest':
specifier: ^3.1.4
version: 3.1.4(@aws-sdk/credential-providers@3.808.0)(socks@2.8.4)(typescript@5.9.3)
specifier: ^3.1.6
version: 3.1.6(@aws-sdk/credential-providers@3.808.0)(socks@2.8.4)(typescript@5.9.3)
'@push.rocks/qenv':
specifier: ^6.1.3
version: 6.1.3
'@types/node':
specifier: ^22.15.17
version: 22.15.17
specifier: ^25.0.9
version: 25.0.9
typescript:
specifier: ^5.9.3
version: 5.9.3
@@ -816,8 +816,8 @@ packages:
resolution: {integrity: sha512-NEcnsjvlC1o3Z6SS3VhKCf6Ev+Sh4EAinmggslrIR/ppMrvjDbXNFXoyr3PB+GLeSAR0JRZ1fGvVYjpEzjBdIg==}
hasBin: true
'@git.zone/tstest@3.1.4':
resolution: {integrity: sha512-S7kubbb0yLYOh/QAzFsjG6a20lZiyNKo4pt0yK1yvd9I7X8Rw6/mCT/BicLkan7G7Nk7scUfxaK9+aFsHmdQdw==}
'@git.zone/tstest@3.1.6':
resolution: {integrity: sha512-xRGc6wO4rJ6mohPCMIBDRH+oNjiIvX6Jeo8v/Y5o5VyKSHFmqol7FCKSBrojMcqgBpESnLHFPJAAOmT9W3JV8Q==}
hasBin: true
'@happy-dom/global-registrator@15.11.7':
@@ -1135,8 +1135,8 @@ packages:
'@lit/reactive-element@2.1.1':
resolution: {integrity: sha512-N+dm5PAYdQ8e6UlywyyrgI2t++wFGXfHx+dSJ1oBrg6FAxUj40jId++EaRm80MKX5JnlH1sBsyZ5h0bcZKemCg==}
'@mistralai/mistralai@1.11.0':
resolution: {integrity: sha512-6/BVj2mcaggYbpMzNSxtqtM2Tv/Jb5845XFd2CMYFO+O5VBkX70iLjtkBBTI4JFhh1l9vTCIMYXBVOjLoBVHGQ==}
'@mistralai/mistralai@1.12.0':
resolution: {integrity: sha512-oDr1hcS3wsIT/QupBG93TNiA5kilwBYoAIyl5BNYqMM2Ix/xsNq+wT8b++uhp/GTUMx44n+8Bn1mkATbwxe6bQ==}
'@mixmark-io/domino@2.2.0':
resolution: {integrity: sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==}
@@ -2497,8 +2497,11 @@ packages:
'@types/node@16.9.1':
resolution: {integrity: sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==}
'@types/node@22.15.17':
resolution: {integrity: sha512-wIX2aSZL5FE+MR0JlvF87BNVrtFWf6AE6rxSE9X7OwnVvoyCQjpzSRJ+M87se/4QCkCiebQAqrJ0y6fwIyi7nw==}
'@types/node@22.19.7':
resolution: {integrity: sha512-MciR4AKGHWl7xwxkBa6xUGxQJ4VBOmPTF7sL+iGzuahOFaO0jHCsuEfS80pan1ef4gWId1oWOweIhrDEYLuaOw==}
'@types/node@25.0.9':
resolution: {integrity: sha512-/rpCXHlCWeqClNBwUhDcusJxXYDjZTyE8v5oTO7WbL8eij2nKhUeU89/6xgjU7N4/Vh3He0BtyhJdQbDyhiXAw==}
'@types/ping@0.4.4':
resolution: {integrity: sha512-ifvo6w2f5eJYlXm+HiVx67iJe8WZp87sfa683nlqED5Vnt9Z93onkokNoWqOG21EaE8fMxyKPobE+mkPEyxsdw==}
@@ -4025,12 +4028,12 @@ packages:
resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==}
engines: {node: '>=12'}
openai@5.12.2:
resolution: {integrity: sha512-xqzHHQch5Tws5PcKR2xsZGX9xtch+JQFz5zb14dGqlshmmDAFBFEWmeIpf7wVqWV+w7Emj7jRgkNJakyKE0tYQ==}
openai@6.16.0:
resolution: {integrity: sha512-fZ1uBqjFUjXzbGc35fFtYKEOxd20kd9fDpFeqWtsOZWiubY8CZ1NAlXHW3iathaFvqmNtCWMIsosCuyeI7Joxg==}
hasBin: true
peerDependencies:
ws: ^8.18.0
zod: ^3.23.8
zod: ^3.25 || ^4.0
peerDependenciesMeta:
ws:
optional: true
@@ -4721,6 +4724,9 @@ packages:
undici-types@6.21.0:
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
undici-types@7.16.0:
resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==}
unified@11.0.5:
resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==}
@@ -6917,7 +6923,7 @@ snapshots:
'@push.rocks/smartshell': 3.3.0
tsx: 4.21.0
'@git.zone/tstest@3.1.4(@aws-sdk/credential-providers@3.808.0)(socks@2.8.4)(typescript@5.9.3)':
'@git.zone/tstest@3.1.6(@aws-sdk/credential-providers@3.808.0)(socks@2.8.4)(typescript@5.9.3)':
dependencies:
'@api.global/typedserver': 3.0.80
'@git.zone/tsbundle': 2.8.1
@@ -7071,7 +7077,7 @@ snapshots:
'@inquirer/figures': 1.0.15
'@inquirer/type': 2.0.0
'@types/mute-stream': 0.0.4
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/wrap-ansi': 3.0.0
ansi-escapes: 4.3.2
cli-width: 4.1.0
@@ -7361,7 +7367,7 @@ snapshots:
dependencies:
'@lit-labs/ssr-dom-shim': 1.4.0
'@mistralai/mistralai@1.11.0':
'@mistralai/mistralai@1.12.0':
dependencies:
zod: 3.25.76
zod-to-json-schema: 3.25.1(zod@3.25.76)
@@ -9651,27 +9657,27 @@ snapshots:
'@types/bn.js@5.2.0':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/body-parser@1.19.6':
dependencies:
'@types/connect': 3.4.38
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/buffer-json@2.0.3': {}
'@types/clean-css@4.2.11':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
source-map: 0.6.1
'@types/connect@3.4.38':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/cors@2.8.19':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/debug@4.1.12':
dependencies:
@@ -9681,7 +9687,7 @@ snapshots:
'@types/dns-packet@5.6.5':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/elliptic@6.4.18':
dependencies:
@@ -9689,7 +9695,7 @@ snapshots:
'@types/express-serve-static-core@5.0.7':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/qs': 6.14.0
'@types/range-parser': 1.2.7
'@types/send': 0.17.5
@@ -9713,16 +9719,16 @@ snapshots:
'@types/fs-extra@11.0.4':
dependencies:
'@types/jsonfile': 6.1.4
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/fs-extra@9.0.13':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/glob@7.2.0':
dependencies:
'@types/minimatch': 5.1.2
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/hast@3.0.4':
dependencies:
@@ -9744,7 +9750,7 @@ snapshots:
'@types/jsonfile@6.1.4':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/mdast@4.0.4':
dependencies:
@@ -9762,18 +9768,22 @@ snapshots:
'@types/mute-stream@0.0.4':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/node-forge@1.3.11':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/node@16.9.1': {}
'@types/node@22.15.17':
'@types/node@22.19.7':
dependencies:
undici-types: 6.21.0
'@types/node@25.0.9':
dependencies:
undici-types: 7.16.0
'@types/ping@0.4.4': {}
'@types/qs@6.14.0': {}
@@ -9789,28 +9799,28 @@ snapshots:
'@types/send@0.17.5':
dependencies:
'@types/mime': 1.3.5
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/serve-static@1.15.8':
dependencies:
'@types/http-errors': 2.0.5
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/send': 0.17.5
'@types/serve-static@2.2.0':
dependencies:
'@types/http-errors': 2.0.5
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/symbol-tree@3.2.5': {}
'@types/tar-stream@3.1.4':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/through2@2.0.41':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/trusted-types@2.0.7': {}
@@ -9832,7 +9842,7 @@ snapshots:
'@types/whatwg-url@8.2.2':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/webidl-conversions': 7.0.3
'@types/which@3.0.4': {}
@@ -9841,11 +9851,11 @@ snapshots:
'@types/ws@8.18.1':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
'@types/yauzl@2.10.3':
dependencies:
'@types/node': 22.15.17
'@types/node': 22.19.7
optional: true
'@ungap/structured-clone@1.3.0': {}
@@ -10305,7 +10315,7 @@ snapshots:
engine.io@6.6.4:
dependencies:
'@types/cors': 2.8.19
'@types/node': 22.15.17
'@types/node': 22.19.7
accepts: 1.3.8
base64id: 2.0.0
cookie: 0.7.2
@@ -11572,7 +11582,7 @@ snapshots:
is-docker: 2.2.1
is-wsl: 2.2.0
openai@5.12.2(ws@8.18.3)(zod@3.25.76):
openai@6.16.0(ws@8.18.3)(zod@3.25.76):
optionalDependencies:
ws: 8.18.3
zod: 3.25.76
@@ -12367,6 +12377,8 @@ snapshots:
undici-types@6.21.0: {}
undici-types@7.16.0: {}
unified@11.0.5:
dependencies:
'@types/unist': 3.0.3