Class GenerateRequest
- Namespace
- OllamaSharp.Models
- Assembly
- OllamaSharp.dll
Generate a response for a given prompt with a provided model. This is a streaming endpoint, so there will be a series of responses. The final response object will include statistics and additional data from the request.
public class GenerateRequest : OllamaRequest
- Inheritance
-
GenerateRequest
- Inherited Members
Properties
Context
The context parameter returned from a previous request to /generate, this can be used to keep a short conversational memory
[JsonPropertyName("context")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public long[]? Context { get; set; }
Property Value
- long[]
Format
Gets or sets the format to return a response in. Currently accepts "json" or JsonSchema or null.
[JsonPropertyName("format")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public object? Format { get; set; }
Property Value
Images
Base64-encoded images (for multimodal models such as llava)
[JsonPropertyName("images")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[]? Images { get; set; }
Property Value
- string[]
KeepAlive
Gets or sets the KeepAlive property, which decides how long a given model should stay loaded.
[JsonPropertyName("keep_alive")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? KeepAlive { get; set; }
Property Value
Model
The model name (required)
[JsonPropertyName("model")]
public string Model { get; set; }
Property Value
Options
Additional model parameters listed in the documentation for the Modelfile such as temperature
[JsonPropertyName("options")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public RequestOptions? Options { get; set; }
Property Value
Prompt
The prompt to generate a response for
[JsonPropertyName("prompt")]
public string Prompt { get; set; }
Property Value
Raw
In some cases you may wish to bypass the templating system and provide a full prompt. In this case, you can use the raw parameter to disable formatting.
[JsonPropertyName("raw")]
public bool Raw { get; set; }
Property Value
Stream
If false the response will be returned as a single response object, rather than a stream of objects
[JsonPropertyName("stream")]
public bool Stream { get; set; }
Property Value
Suffix
Suffix for Fill-In-the-Middle generate
[JsonPropertyName("suffix")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string Suffix { get; set; }
Property Value
System
System prompt to (overrides what is defined in the Modelfile)
[JsonPropertyName("system")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? System { get; set; }
Property Value
Template
The full prompt or prompt template (overrides what is defined in the Modelfile)
[JsonPropertyName("template")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Template { get; set; }