OllamaRequest
Defined in: adapters/ollama.ts:55
Ollama API request structure for local models.
Ollama provides a local server for running LLMs. Parameters are nested
in an options object, and uses num_predict instead of max_tokens.
- OllamaMessage
- OllamaResponse
- https://github.com/ollama/ollama/blob/main/docs/api.md
Example
Section titled “Example”const request: OllamaRequest = { model: 'llama2', messages: [{ role: 'user', content: 'Hello!' }], options: { temperature: 0.7, num_predict: 100 }};Properties
Section titled “Properties”messages
Section titled “messages”messages:
OllamaMessage[]
Defined in: adapters/ollama.ts:60
Conversation messages
model:
string
Defined in: adapters/ollama.ts:57
Local model name (e.g., ‘llama2’, ‘mistral’, ‘codellama’)
options?
Section titled “options?”
optionaloptions:object
Defined in: adapters/ollama.ts:63
Model parameters nested in options object
num_predict?
Section titled “num_predict?”
optionalnum_predict:number
Maximum tokens to predict (Ollama uses ‘predict’ not ‘tokens’)
optionalstop:string[]
Stop sequences
temperature?
Section titled “temperature?”
optionaltemperature:number
Sampling temperature
top_k?
Section titled “top_k?”
optionaltop_k:number
Top-K sampling
top_p?
Section titled “top_p?”
optionaltop_p:number
Nucleus sampling
stream?
Section titled “stream?”
optionalstream:boolean
Defined in: adapters/ollama.ts:81
Enable streaming responses