Pass image as additional Insight context
This commit is contained in:
@@ -14,6 +14,10 @@ pub struct GeneratePhotoInsightRequest {
|
||||
pub file_path: String,
|
||||
#[serde(default)]
|
||||
pub model: Option<String>,
|
||||
#[serde(default)]
|
||||
pub system_prompt: Option<String>,
|
||||
#[serde(default)]
|
||||
pub num_ctx: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
@@ -63,16 +67,30 @@ pub async fn generate_insight_handler(
|
||||
if let Some(ref model) = request.model {
|
||||
span.set_attribute(KeyValue::new("model", model.clone()));
|
||||
}
|
||||
if let Some(ref prompt) = request.system_prompt {
|
||||
span.set_attribute(KeyValue::new("has_custom_prompt", true));
|
||||
span.set_attribute(KeyValue::new("prompt_length", prompt.len() as i64));
|
||||
}
|
||||
if let Some(ctx) = request.num_ctx {
|
||||
span.set_attribute(KeyValue::new("num_ctx", ctx as i64));
|
||||
}
|
||||
|
||||
log::info!(
|
||||
"Manual insight generation triggered for photo: {} with model: {:?}",
|
||||
"Manual insight generation triggered for photo: {} with model: {:?}, custom_prompt: {}, num_ctx: {:?}",
|
||||
normalized_path,
|
||||
request.model
|
||||
request.model,
|
||||
request.system_prompt.is_some(),
|
||||
request.num_ctx
|
||||
);
|
||||
|
||||
// Generate insight with optional custom model
|
||||
// Generate insight with optional custom model, system prompt, and context size
|
||||
let result = insight_generator
|
||||
.generate_insight_for_photo_with_model(&normalized_path, request.model.clone())
|
||||
.generate_insight_for_photo_with_config(
|
||||
&normalized_path,
|
||||
request.model.clone(),
|
||||
request.system_prompt.clone(),
|
||||
request.num_ctx,
|
||||
)
|
||||
.await;
|
||||
|
||||
match result {
|
||||
|
||||
Reference in New Issue
Block a user