Pass temperature to Anthropic (#17509)

maan2003 and Marshall Bowers created

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>

Change summary

crates/assistant/src/inline_assistant.rs | 15 +--------------
crates/language_model/src/request.rs     |  2 +-
2 files changed, 2 insertions(+), 15 deletions(-)

Detailed changes

crates/assistant/src/inline_assistant.rs 🔗

@@ -2373,19 +2373,6 @@ impl Codegen {
             None
         };
 
-        // Higher Temperature increases the randomness of model outputs.
-        // If Markdown or No Language is Known, increase the randomness for more creative output
-        // If Code, decrease temperature to get more deterministic outputs
-        let temperature = if let Some(language) = language_name.clone() {
-            if language == "Markdown".into() {
-                1.0
-            } else {
-                0.5
-            }
-        } else {
-            1.0
-        };
-
         let language_name = language_name.as_ref();
         let start = buffer.point_to_buffer_offset(edit_range.start);
         let end = buffer.point_to_buffer_offset(edit_range.end);
@@ -2421,7 +2408,7 @@ impl Codegen {
             messages,
             tools: Vec::new(),
             stop: vec!["|END|>".to_string()],
-            temperature,
+            temperature: 1.,
         })
     }
 

crates/language_model/src/request.rs 🔗

@@ -399,7 +399,7 @@ impl LanguageModelRequest {
             tool_choice: None,
             metadata: None,
             stop_sequences: Vec::new(),
-            temperature: None,
+            temperature: Some(self.temperature),
             top_k: None,
             top_p: None,
         }