mirror of https://github.com/ollama/ollama.git
				
				
				
			Merge f580006d10 into 303be9304c
				
					
				
			This commit is contained in:
		
						commit
						e02c487dbb
					
				| 
						 | 
					@ -63,6 +63,15 @@ func shouldUseHarmony(model *Model) bool {
 | 
				
			||||||
	return false
 | 
						return false
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func shouldForceThinking(model *Model) bool {
 | 
				
			||||||
 | 
						if model.Config.ModelFamily == "qwen3" && strings.Contains(model.Name, "thinking-2507") {
 | 
				
			||||||
 | 
							// Force thinking mode for the newer qwen3 thinking models otherwise they end up
 | 
				
			||||||
 | 
							// leaving the thinking trace in the return content w/ unmatched <think></think> tags
 | 
				
			||||||
 | 
							return true
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func experimentEnabled(name string) bool {
 | 
					func experimentEnabled(name string) bool {
 | 
				
			||||||
	return slices.Contains(strings.Split(os.Getenv("OLLAMA_EXPERIMENT"), ","), name)
 | 
						return slices.Contains(strings.Split(os.Getenv("OLLAMA_EXPERIMENT"), ","), name)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -330,7 +339,10 @@ func (s *Server) GenerateHandler(c *gin.Context) {
 | 
				
			||||||
	if req.Suffix != "" {
 | 
						if req.Suffix != "" {
 | 
				
			||||||
		caps = append(caps, model.CapabilityInsert)
 | 
							caps = append(caps, model.CapabilityInsert)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if req.Think != nil && req.Think.Bool() {
 | 
						if req.Think == nil && shouldForceThinking(m) {
 | 
				
			||||||
 | 
							req.Think = &api.ThinkValue{Value: true}
 | 
				
			||||||
 | 
							caps = append(caps, model.CapabilityThinking)
 | 
				
			||||||
 | 
						} else if req.Think != nil && req.Think.Bool() {
 | 
				
			||||||
		caps = append(caps, model.CapabilityThinking)
 | 
							caps = append(caps, model.CapabilityThinking)
 | 
				
			||||||
		// TODO(drifkin): consider adding a warning if it's false and the model
 | 
							// TODO(drifkin): consider adding a warning if it's false and the model
 | 
				
			||||||
		// doesn't support thinking. It's not strictly required, but it can be a
 | 
							// doesn't support thinking. It's not strictly required, but it can be a
 | 
				
			||||||
| 
						 | 
					@ -1871,7 +1883,10 @@ func (s *Server) ChatHandler(c *gin.Context) {
 | 
				
			||||||
	if len(req.Tools) > 0 {
 | 
						if len(req.Tools) > 0 {
 | 
				
			||||||
		caps = append(caps, model.CapabilityTools)
 | 
							caps = append(caps, model.CapabilityTools)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if req.Think != nil && req.Think.Bool() {
 | 
						if req.Think == nil && shouldForceThinking(m) {
 | 
				
			||||||
 | 
							req.Think = &api.ThinkValue{Value: true}
 | 
				
			||||||
 | 
							caps = append(caps, model.CapabilityThinking)
 | 
				
			||||||
 | 
						} else if req.Think != nil && req.Think.Bool() {
 | 
				
			||||||
		caps = append(caps, model.CapabilityThinking)
 | 
							caps = append(caps, model.CapabilityThinking)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue