forked from Mirror/ollama4j
		
	Add minp option and ability to set custom options
This commit is contained in:
		@@ -207,6 +207,33 @@ public class OptionsBuilder {
 | 
			
		||||
    return this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Alternative to the top_p, and aims to ensure a balance of qualityand variety. The parameter p
 | 
			
		||||
   * represents the minimum probability for a token to be considered, relative to the probability
 | 
			
		||||
   * of the most likely token. For example, with p=0.05 and the most likely token having a
 | 
			
		||||
   * probability of 0.9, logits with a value less than 0.045 are filtered out. (Default: 0.0)
 | 
			
		||||
   */
 | 
			
		||||
  public OptionsBuilder setMinP(float value) {
 | 
			
		||||
    options.getOptionsMap().put("min_p", value);
 | 
			
		||||
    return this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Allows passing an option not formally supported by the library
 | 
			
		||||
   * @param name The option name for the parameter.
 | 
			
		||||
   * @param value The value for the "{name}" parameter.
 | 
			
		||||
   * @return The updated OptionsBuilder.
 | 
			
		||||
   */
 | 
			
		||||
  public OptionsBuilder setCustomOption(String name, Object value) throws IllegalArgumentException {
 | 
			
		||||
    if (!(value instanceof Integer || value instanceof Float || value instanceof String)) {
 | 
			
		||||
      throw new IllegalArgumentException("Invalid type for parameter. Allowed types are: Integer, Float, or String.");
 | 
			
		||||
    }
 | 
			
		||||
    options.getOptionsMap().put(name, value);
 | 
			
		||||
    return this;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Builds the options map.
 | 
			
		||||
   *
 | 
			
		||||
@@ -215,4 +242,6 @@ public class OptionsBuilder {
 | 
			
		||||
  public Options build() {
 | 
			
		||||
    return options;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user