Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Interface with an ollama instance over HTTP.
npm i ollama
import { Ollama } from "ollama";
const ollama = new Ollama();
for await (const token of ollama.generate("llama2", "What is a llama?")) {
process.stdout.write(token);
}
The API aims to mirror the HTTP API for Ollama.
new Ollama(config);
config
<Object>
The configuration object for Ollama.
address
<string>
The Ollama API address. Default: "http://localhost:11434"
.Create a new API handler for ollama.
ollama.generate(model, prompt);
model
<string>
The name of the model to use for the prompt.prompt
<string>
The prompt to give the model.<AsyncGenerator<string, GenerateResult>>
A generator that outputs the tokens as strings.Generate a response for a given prompt with a provided model. The final response object will include statistics and additional data from the request.
ollama.create(name, path);
name
<string>
The name of the model.path
<string>
The path to the Modelfile.AsyncGenerator<CreateStatus>
A generator that outputs the status of creation.Create a model from a Modelfile.
ollama.tags();
Promise<Tag[]>
A list of tags.List models that are available locally.
ollama.copy(source, destination);
source
<string>
The name of the model to copy.destination
<string>
The name of copied model.Promise<void>
Copy a model. Creates a model with another name from an existing model.
ollama.delete(model);
model
<string>
The name of the model to delete.Promise<void>
Delete a model and its data.
ollama.pull(name);
name
<string>
The name of the model to download.AsyncGenerator<PullResult>
A generator that outputs the status of the download.Download a model from a the model registry. Cancelled pulls are resumed from where they left off, and multiple calls to will share the same download progress.
ollama.embeddings(model, prompt);
model
<string>
The name of the model to generate embeddings for.prompt
<string>
The prompt to generate embeddings with.Promise<number[]>
The embeddings.Generate embeddings from a model.
To build the project files run:
npm run build
To lint files:
npm run lint
FAQs
Ollama Javascript library
The npm package ollama receives a total of 88,758 weekly downloads. As such, ollama popularity was classified as popular.
We found that ollama demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.