Ollama is an open-source project that allows users to run large language models (LLMs) on their local devices. It aims to make LLMs more accessible and affordable by providing a user-friendly interface and removing the need for expensive cloud computing resources. Ollama supports various models and offers features like model downloading, running, and fine-tuning, enabling users to customize and experiment with LLMs for a variety of applications.
ollama
const { LLMInterface } = require('llm-interface');
LLMInterface.setApiKey({'ollama': process.env.OLLAMA_API_KEY});
async function main() {
try {
const response = await LLMInterface.sendMessage('ollama', 'Explain the importance of low latency LLMs.');
console.log(response.results);
} catch (error) {
console.error(error);
throw error;
}
}
main();
The following model aliases are provided for this provider.
default
: llama3large
: llama3small
: llama3
default
: all-minilmlarge
: all-minilmsmall
: all-minilm
The following parameters can be passed through options
.
format
: Details not available, please refer to the LLM provider documentation.keep_alive
: Details not available, please refer to the LLM provider documentation.options
: Details not available, please refer to the LLM provider documentation.stream
: If set, partial message deltas will be sent, similar to ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
- Native JSON Mode
- Streaming
- Embeddings
No API Key (Local URL): This is not a traditional API so no API key is required. However, a URL(s) is required to use this service. (Ensure you have the matching models installed locally)
To get an API key, first create an Ollama account, then visit the link below.
Ollama documentation is available here.