mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-19 23:24:23 +01:00
feat: lancedb vector tool selection (#2654)
Co-authored-by: Wendy Tang <wendytang@squareup.com> Co-authored-by: Alice Hau <ahau@squareup.com>
This commit is contained in:
@@ -824,6 +824,11 @@ pub fn remove_extension_dialog() -> Result<(), Box<dyn Error>> {
|
||||
pub async fn configure_settings_dialog() -> Result<(), Box<dyn Error>> {
|
||||
let setting_type = cliclack::select("What setting would you like to configure?")
|
||||
.item("goose_mode", "Goose Mode", "Configure Goose mode")
|
||||
.item(
|
||||
"goose_router_strategy",
|
||||
"Router Tool Selection Strategy",
|
||||
"Configure the strategy for selecting tools to use",
|
||||
)
|
||||
.item(
|
||||
"tool_permission",
|
||||
"Tool Permission",
|
||||
@@ -850,6 +855,9 @@ pub async fn configure_settings_dialog() -> Result<(), Box<dyn Error>> {
|
||||
"goose_mode" => {
|
||||
configure_goose_mode_dialog()?;
|
||||
}
|
||||
"goose_router_strategy" => {
|
||||
configure_goose_router_strategy_dialog()?;
|
||||
}
|
||||
"tool_permission" => {
|
||||
configure_tool_permissions_dialog().await.and(Ok(()))?;
|
||||
}
|
||||
@@ -921,6 +929,49 @@ pub fn configure_goose_mode_dialog() -> Result<(), Box<dyn Error>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn configure_goose_router_strategy_dialog() -> Result<(), Box<dyn Error>> {
|
||||
let config = Config::global();
|
||||
|
||||
// Check if GOOSE_ROUTER_STRATEGY is set as an environment variable
|
||||
if std::env::var("GOOSE_ROUTER_TOOL_SELECTION_STRATEGY").is_ok() {
|
||||
let _ = cliclack::log::info("Notice: GOOSE_ROUTER_TOOL_SELECTION_STRATEGY environment variable is set. Configuration will override this.");
|
||||
}
|
||||
|
||||
let strategy = cliclack::select("Which router strategy would you like to use?")
|
||||
.item(
|
||||
"vector",
|
||||
"Vector Strategy",
|
||||
"Use vector-based similarity to select tools",
|
||||
)
|
||||
.item(
|
||||
"default",
|
||||
"Default Strategy",
|
||||
"Use the default tool selection strategy",
|
||||
)
|
||||
.interact()?;
|
||||
|
||||
match strategy {
|
||||
"vector" => {
|
||||
config.set_param(
|
||||
"GOOSE_ROUTER_TOOL_SELECTION_STRATEGY",
|
||||
Value::String("vector".to_string()),
|
||||
)?;
|
||||
cliclack::outro(
|
||||
"Set to Vector Strategy - using vector-based similarity for tool selection",
|
||||
)?;
|
||||
}
|
||||
"default" => {
|
||||
config.set_param(
|
||||
"GOOSE_ROUTER_TOOL_SELECTION_STRATEGY",
|
||||
Value::String("default".to_string()),
|
||||
)?;
|
||||
cliclack::outro("Set to Default Strategy - using default tool selection")?;
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn configure_tool_output_dialog() -> Result<(), Box<dyn Error>> {
|
||||
let config = Config::global();
|
||||
// Check if GOOSE_CLI_MIN_PRIORITY is set as an environment variable
|
||||
|
||||
Reference in New Issue
Block a user