Comparing version 0.5.6 to 0.5.7
@@ -1,1 +0,1 @@ | ||
export { d as ChatRequest, j as ChatResponse, a as Config, g as CopyRequest, C as CreateRequest, D as DeleteRequest, E as EmbedRequest, k as EmbedResponse, h as EmbeddingsRequest, l as EmbeddingsResponse, p as ErrorResponse, F as Fetch, G as GenerateRequest, i as GenerateResponse, L as ListResponse, M as Message, n as ModelDetails, m as ModelResponse, O as Ollama, b as Options, P as ProgressResponse, e as PullRequest, f as PushRequest, S as ShowRequest, o as ShowResponse, q as StatusResponse, c as Tool, T as ToolCall, _ as default } from './shared/ollama.1164e541.js'; | ||
export { d as ChatRequest, j as ChatResponse, a as Config, g as CopyRequest, C as CreateRequest, D as DeleteRequest, E as EmbedRequest, k as EmbedResponse, h as EmbeddingsRequest, l as EmbeddingsResponse, p as ErrorResponse, F as Fetch, G as GenerateRequest, i as GenerateResponse, L as ListResponse, M as Message, n as ModelDetails, m as ModelResponse, O as Ollama, b as Options, P as ProgressResponse, e as PullRequest, f as PushRequest, S as ShowRequest, o as ShowResponse, q as StatusResponse, c as Tool, T as ToolCall, _ as default } from './shared/ollama.accb8380.js'; |
@@ -1,3 +0,3 @@ | ||
import { O as Ollama$1, C as CreateRequest, A as AbortableAsyncIterator, P as ProgressResponse } from './shared/ollama.1164e541.js'; | ||
export { d as ChatRequest, j as ChatResponse, a as Config, g as CopyRequest, D as DeleteRequest, E as EmbedRequest, k as EmbedResponse, h as EmbeddingsRequest, l as EmbeddingsResponse, p as ErrorResponse, F as Fetch, G as GenerateRequest, i as GenerateResponse, L as ListResponse, M as Message, n as ModelDetails, m as ModelResponse, b as Options, e as PullRequest, f as PushRequest, S as ShowRequest, o as ShowResponse, q as StatusResponse, c as Tool, T as ToolCall } from './shared/ollama.1164e541.js'; | ||
import { O as Ollama$1, C as CreateRequest, A as AbortableAsyncIterator, P as ProgressResponse } from './shared/ollama.accb8380.js'; | ||
export { d as ChatRequest, j as ChatResponse, a as Config, g as CopyRequest, D as DeleteRequest, E as EmbedRequest, k as EmbedResponse, h as EmbeddingsRequest, l as EmbeddingsResponse, p as ErrorResponse, F as Fetch, G as GenerateRequest, i as GenerateResponse, L as ListResponse, M as Message, n as ModelDetails, m as ModelResponse, b as Options, e as PullRequest, f as PushRequest, S as ShowRequest, o as ShowResponse, q as StatusResponse, c as Tool, T as ToolCall } from './shared/ollama.accb8380.js'; | ||
@@ -4,0 +4,0 @@ declare class Ollama extends Ollama$1 { |
{ | ||
"name": "ollama", | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"description": "Ollama Javascript library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs", |
@@ -17,3 +17,3 @@ # Ollama JavaScript Library | ||
const response = await ollama.chat({ | ||
model: 'llama2', | ||
model: 'llama3.1', | ||
messages: [{ role: 'user', content: 'Why is the sky blue?' }], | ||
@@ -38,3 +38,3 @@ }) | ||
const message = { role: 'user', content: 'Why is the sky blue?' } | ||
const response = await ollama.chat({ model: 'llama2', messages: [message], stream: true }) | ||
const response = await ollama.chat({ model: 'llama3.1', messages: [message], stream: true }) | ||
for await (const part of response) { | ||
@@ -51,3 +51,3 @@ process.stdout.write(part.message.content) | ||
const modelfile = ` | ||
FROM llama2 | ||
FROM llama3.1 | ||
SYSTEM "You are mario from super mario bros." | ||
@@ -78,2 +78,3 @@ ` | ||
- `keep_alive` `<string | number>`: (Optional) How long to keep the model loaded. | ||
- `tools` `<Tool[]>`: (Optional) A list of tool calls the model may make. | ||
- `options` `<Options>`: (Optional) Options to configure the runtime. | ||
@@ -216,3 +217,3 @@ | ||
const response = await ollama.chat({ | ||
model: 'llama2', | ||
model: 'llama3.1', | ||
messages: [{ role: 'user', content: 'Why is the sky blue?' }], | ||
@@ -219,0 +220,0 @@ }) |
import * as utils from './utils.js' | ||
import { AbortableAsyncIterator, parseJSON, post } from './utils.js' | ||
import 'whatwg-fetch' | ||
@@ -42,6 +41,21 @@ import type { | ||
this.fetch = fetch | ||
if (config?.fetch != null) { | ||
this.fetch = config.fetch | ||
this.fetch = config?.fetch || this.getFetch(); | ||
} | ||
private getFetch(): Fetch { | ||
if (typeof window !== 'undefined' && window.fetch) { | ||
return window.fetch.bind(window); | ||
} | ||
if (typeof global !== 'undefined' && global.fetch) { | ||
return global.fetch; | ||
} | ||
try { | ||
// Use dynamic import for Node.js environments | ||
return require('node-fetch'); | ||
} catch (error) { | ||
console.error('Failed to import node-fetch:', error); | ||
throw new Error('Fetch is not available. Please provide a fetch implementation in the config.'); | ||
} | ||
} | ||
@@ -48,0 +62,0 @@ |
@@ -269,3 +269,3 @@ import { version } from './version.js' | ||
host = `http://127.0.0.1${host}` | ||
isExplicitProtocol = false | ||
isExplicitProtocol = true | ||
} | ||
@@ -272,0 +272,0 @@ |
@@ -1,1 +0,1 @@ | ||
export const version = '0.5.6'; | ||
export const version = '0.5.7'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2425
225
10
113655
23