Ok, well, that got out of hand (#3718)
Co-authored-by: Douwe Osinga <douwe@squareup.com> Co-authored-by: Michael Neale <michael.neale@gmail.com>
This commit is contained in:
@@ -367,7 +367,7 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
|
||||
let spin = spinner();
|
||||
spin.start("Attempting to fetch supported models...");
|
||||
let models_res = {
|
||||
let temp_model_config = goose::model::ModelConfig::new(provider_meta.default_model.clone());
|
||||
let temp_model_config = goose::model::ModelConfig::new(&provider_meta.default_model)?;
|
||||
let temp_provider = create(provider_name, temp_model_config)?;
|
||||
temp_provider.fetch_supported_models_async().await
|
||||
};
|
||||
@@ -408,7 +408,7 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
|
||||
.map(|val| val == "1" || val.to_lowercase() == "true")
|
||||
.unwrap_or(false);
|
||||
|
||||
let model_config = goose::model::ModelConfig::new(model.clone())
|
||||
let model_config = goose::model::ModelConfig::new(&model)?
|
||||
.with_max_tokens(Some(50))
|
||||
.with_toolshim(toolshim_enabled)
|
||||
.with_toolshim_model(std::env::var("GOOSE_TOOLSHIM_OLLAMA_MODEL").ok());
|
||||
@@ -1266,7 +1266,7 @@ pub async fn configure_tool_permissions_dialog() -> Result<(), Box<dyn Error>> {
|
||||
let model: String = config
|
||||
.get_param("GOOSE_MODEL")
|
||||
.expect("No model configured. Please set model first");
|
||||
let model_config = goose::model::ModelConfig::new(model.clone());
|
||||
let model_config = goose::model::ModelConfig::new(&model)?;
|
||||
|
||||
// Create the agent
|
||||
let agent = Agent::new();
|
||||
|
||||
@@ -99,7 +99,7 @@ pub async fn handle_web(port: u16, host: String, open: bool) -> Result<()> {
|
||||
}
|
||||
};
|
||||
|
||||
let model_config = goose::model::ModelConfig::new(model.clone());
|
||||
let model_config = goose::model::ModelConfig::new(&model)?;
|
||||
|
||||
// Create the agent
|
||||
let agent = Agent::new();
|
||||
|
||||
@@ -176,10 +176,7 @@ where
|
||||
|
||||
let original_env = setup_environment(config)?;
|
||||
|
||||
let inner_provider = create(
|
||||
&factory_name,
|
||||
ModelConfig::new(config.model_name.to_string()),
|
||||
)?;
|
||||
let inner_provider = create(&factory_name, ModelConfig::new(&config.model_name)?)?;
|
||||
|
||||
let test_provider = Arc::new(TestProvider::new_recording(inner_provider, &file_path));
|
||||
(
|
||||
|
||||
@@ -202,8 +202,12 @@ pub async fn build_session(session_config: SessionBuilderConfig) -> Session {
|
||||
|
||||
let temperature = session_config.settings.as_ref().and_then(|s| s.temperature);
|
||||
|
||||
let model_config =
|
||||
goose::model::ModelConfig::new(model_name.clone()).with_temperature(temperature);
|
||||
let model_config = goose::model::ModelConfig::new(&model_name)
|
||||
.unwrap_or_else(|e| {
|
||||
output::render_error(&format!("Failed to create model configuration: {}", e));
|
||||
process::exit(1);
|
||||
})
|
||||
.with_temperature(temperature);
|
||||
|
||||
// Create the agent
|
||||
let agent: Agent = Agent::new();
|
||||
|
||||
@@ -1572,7 +1572,7 @@ fn get_reasoner() -> Result<Arc<dyn Provider>, anyhow::Error> {
|
||||
};
|
||||
|
||||
let model_config =
|
||||
ModelConfig::new_with_context_env(model, Some("GOOSE_PLANNER_CONTEXT_LIMIT"));
|
||||
ModelConfig::new_with_context_env(model, Some("GOOSE_PLANNER_CONTEXT_LIMIT"))?;
|
||||
let reasoner = create(&provider, model_config)?;
|
||||
|
||||
Ok(reasoner)
|
||||
|
||||
Reference in New Issue
Block a user