Skip to content

Commit 7cf2278

Browse files
densumeshskeptrunedev
authored andcommitted
feature: add back clickhouse and other create message settings to agentic search
1 parent 7fbffe1 commit 7cf2278

File tree

3 files changed

+698
-157
lines changed

3 files changed

+698
-157
lines changed

server/src/data/models.rs

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,7 @@ pub struct DatasetConfiguration {
27082708
pub DISABLE_ANALYTICS: bool,
27092709
pub PAGEFIND_ENABLED: bool,
27102710
pub AIMON_RERANKER_TASK_DEFINITION: String,
2711+
pub TOOL_CONFIGURATION: ToolConfiguration,
27112712
}
27122713

27132714
#[derive(Debug, Serialize, Deserialize, Clone, ToSchema)]
@@ -2822,10 +2823,25 @@ pub struct DatasetConfigurationDTO {
28222823
pub DISABLE_ANALYTICS: Option<bool>,
28232824
/// Whether to enable pagefind indexing
28242825
pub PAGEFIND_ENABLED: Option<bool>,
2825-
2826+
/// The tool configuration to use for the dataset
2827+
pub TOOL_CONFIGURATION: Option<ToolConfiguration>,
28262828
pub AIMON_RERANKER_TASK_DEFINITION: Option<String>,
28272829
}
28282830

2831+
#[derive(Debug, Serialize, Deserialize, Clone, ToSchema)]
2832+
pub struct QueryToolOptions {
2833+
pub tool_description: Option<String>,
2834+
pub query_parameter_description: Option<String>,
2835+
pub price_filter_description: Option<String>,
2836+
pub max_price_option_description: Option<String>,
2837+
pub min_price_option_description: Option<String>,
2838+
}
2839+
2840+
#[derive(Debug, Serialize, Deserialize, Clone, ToSchema)]
2841+
pub struct ToolConfiguration {
2842+
pub query_tool_options: Option<QueryToolOptions>,
2843+
}
2844+
28292845
impl From<DatasetConfigurationDTO> for DatasetConfiguration {
28302846
fn from(dto: DatasetConfigurationDTO) -> Self {
28312847
DatasetConfiguration {
@@ -2882,6 +2898,15 @@ impl From<DatasetConfigurationDTO> for DatasetConfiguration {
28822898
DISABLE_ANALYTICS: dto.DISABLE_ANALYTICS.unwrap_or(false),
28832899
PAGEFIND_ENABLED: dto.PAGEFIND_ENABLED.unwrap_or(false),
28842900
AIMON_RERANKER_TASK_DEFINITION: dto.AIMON_RERANKER_TASK_DEFINITION.unwrap_or("Your task is to grade the relevance of context document(s) against the specified user query.".to_string()),
2901+
TOOL_CONFIGURATION: dto.TOOL_CONFIGURATION.unwrap_or(ToolConfiguration {
2902+
query_tool_options: Some(QueryToolOptions {
2903+
tool_description: Some("Search for relevant information in the knowledge base. You can use this tool multiple times if the information you need is not found in the first search.".to_string()),
2904+
query_parameter_description: Some("The search query to find relevant information".to_string()),
2905+
price_filter_description: Some("The price filter to use for the search".to_string()),
2906+
max_price_option_description: Some("The maximum price to filter by".to_string()),
2907+
min_price_option_description: Some("The minimum price to filter by".to_string()),
2908+
}),
2909+
}),
28852910
}
28862911
}
28872912
}
@@ -2933,6 +2958,7 @@ impl From<DatasetConfiguration> for DatasetConfigurationDTO {
29332958
DISABLE_ANALYTICS: Some(config.DISABLE_ANALYTICS),
29342959
PAGEFIND_ENABLED: Some(config.PAGEFIND_ENABLED),
29352960
AIMON_RERANKER_TASK_DEFINITION: Some(config.AIMON_RERANKER_TASK_DEFINITION),
2961+
TOOL_CONFIGURATION: Some(config.TOOL_CONFIGURATION),
29362962
}
29372963
}
29382964
}
@@ -2979,7 +3005,16 @@ impl Default for DatasetConfiguration {
29793005
DISABLE_ANALYTICS: false,
29803006
PAGEFIND_ENABLED: false,
29813007
AIMON_RERANKER_TASK_DEFINITION: "Your task is to grade the relevance of context document(s) against the specified user query.".to_string(),
2982-
}
3008+
TOOL_CONFIGURATION: ToolConfiguration {
3009+
query_tool_options: Some(QueryToolOptions {
3010+
tool_description: Some("Search for relevant information in the knowledge base. You can use this tool multiple times if the information you need is not found in the first search.".to_string()),
3011+
query_parameter_description: Some("The search query to find relevant information".to_string()),
3012+
price_filter_description: Some("The price filter to use for the search".to_string()),
3013+
max_price_option_description: Some("The maximum price to filter by".to_string()),
3014+
min_price_option_description: Some("The minimum price to filter by".to_string()),
3015+
}),
3016+
},
3017+
}
29833018
}
29843019
}
29853020

@@ -3281,6 +3316,36 @@ impl DatasetConfiguration {
32813316
s.to_string()
32823317
}
32833318
}).unwrap_or("Your task is to grade the relevance of context document(s) against the specified user query.".to_string()),
3319+
TOOL_CONFIGURATION: configuration
3320+
.get("TOOL_CONFIGURATION")
3321+
.unwrap_or(&json!(ToolConfiguration {
3322+
query_tool_options: Some(QueryToolOptions {
3323+
tool_description: Some("Search for relevant information in the knowledge base. You can use this tool multiple times if the information you need is not found in the first search.".to_string()),
3324+
query_parameter_description: Some("The search query to find relevant information".to_string()),
3325+
price_filter_description: Some("The price filter to use for the search".to_string()),
3326+
max_price_option_description: Some("The maximum price to filter by".to_string()),
3327+
min_price_option_description: Some("The minimum price to filter by".to_string()),
3328+
}),
3329+
}))
3330+
.as_object()
3331+
.map(|o| ToolConfiguration {
3332+
query_tool_options: o.get("query_tool_options").unwrap_or(&json!(None::<serde_json::Value>)).as_object().map(|o| QueryToolOptions {
3333+
tool_description: o.get("tool_description").unwrap_or(&json!(None::<serde_json::Value>)).as_str().map(|s| s.to_string()),
3334+
query_parameter_description: o.get("query_parameter_description").unwrap_or(&json!(None::<serde_json::Value>)).as_str().map(|s| s.to_string()),
3335+
price_filter_description: o.get("price_filter_description").unwrap_or(&json!(None::<serde_json::Value>)).as_str().map(|s| s.to_string()),
3336+
max_price_option_description: o.get("max_price_option_description").unwrap_or(&json!(None::<serde_json::Value>)).as_str().map(|s| s.to_string()),
3337+
min_price_option_description: o.get("min_price_option_description").unwrap_or(&json!(None::<serde_json::Value>)).as_str().map(|s| s.to_string()),
3338+
}),
3339+
})
3340+
.unwrap_or(ToolConfiguration {
3341+
query_tool_options: Some(QueryToolOptions {
3342+
tool_description: Some("Search for relevant information in the knowledge base. You can use this tool multiple times if the information you need is not found in the first search.".to_string()),
3343+
query_parameter_description: Some("The search query to find relevant information".to_string()),
3344+
price_filter_description: Some("The price filter to use for the search".to_string()),
3345+
max_price_option_description: Some("The maximum price to filter by".to_string()),
3346+
min_price_option_description: Some("The minimum price to filter by".to_string()),
3347+
}),
3348+
}),
32843349
}
32853350
}
32863351

@@ -3326,6 +3391,7 @@ impl DatasetConfiguration {
33263391
"DISABLE_ANALYTICS": self.DISABLE_ANALYTICS,
33273392
"PAGEFIND_ENABLED": self.PAGEFIND_ENABLED,
33283393
"AIMON_RERANKER_TASK_DEFINITION": self.AIMON_RERANKER_TASK_DEFINITION,
3394+
"TOOL_CONFIGURATION": self.TOOL_CONFIGURATION,
33293395
})
33303396
}
33313397
}
@@ -3649,6 +3715,10 @@ impl DatasetConfigurationDTO {
36493715
.AIMON_RERANKER_TASK_DEFINITION
36503716
.clone()
36513717
.unwrap_or(curr_dataset_config.AIMON_RERANKER_TASK_DEFINITION),
3718+
TOOL_CONFIGURATION: self
3719+
.TOOL_CONFIGURATION
3720+
.clone()
3721+
.unwrap_or(curr_dataset_config.TOOL_CONFIGURATION),
36523722
}
36533723
}
36543724
}

server/src/handlers/message_handler.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ pub async fn create_message(
289289
redis_pool,
290290
dataset_config,
291291
create_message_data,
292+
event_queue,
292293
#[cfg(feature = "hallucination-detection")]
293294
hallucination_detector,
294295
)
@@ -706,6 +707,7 @@ pub async fn regenerate_message_patch(
706707
redis_pool,
707708
dataset_config,
708709
create_message_data,
710+
event_queue,
709711
#[cfg(feature = "hallucination-detection")]
710712
hallucination_detector,
711713
)
@@ -796,6 +798,7 @@ pub async fn regenerate_message_patch(
796798
redis_pool,
797799
dataset_config,
798800
create_message_data,
801+
event_queue,
799802
#[cfg(feature = "hallucination-detection")]
800803
hallucination_detector,
801804
)

0 commit comments

Comments
 (0)