003-knowledge-memory #55
@@ -249,7 +249,7 @@ pub async fn generate_agentic_insight_handler(
|
|||||||
let max_iterations: usize = std::env::var("AGENTIC_MAX_ITERATIONS")
|
let max_iterations: usize = std::env::var("AGENTIC_MAX_ITERATIONS")
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|v| v.parse().ok())
|
.and_then(|v| v.parse().ok())
|
||||||
.unwrap_or(10);
|
.unwrap_or(12);
|
||||||
|
|
||||||
span.set_attribute(KeyValue::new("max_iterations", max_iterations as i64));
|
span.set_attribute(KeyValue::new("max_iterations", max_iterations as i64));
|
||||||
|
|
||||||
|
|||||||
@@ -2482,17 +2482,16 @@ Return ONLY the summary, nothing else."#,
|
|||||||
None => String::new(),
|
None => String::new(),
|
||||||
};
|
};
|
||||||
let base_system = format!(
|
let base_system = format!(
|
||||||
"You are a personal photo memory assistant helping to reconstruct a memory from a photo. \
|
"You are a personal photo memory assistant helping to reconstruct a memory from a photo.{cameron_id_note}\n\n\
|
||||||
You are writing from the perspective of Cameron, the owner of this photo collection.{cameron_id_note}\n\n\
|
|
||||||
IMPORTANT INSTRUCTIONS:\n\
|
IMPORTANT INSTRUCTIONS:\n\
|
||||||
1. You MUST call multiple tools to gather context BEFORE writing any final insight. Do not produce a final answer after only one or two tool calls.\n\
|
1. You MUST call multiple tools to gather context BEFORE writing any final insight. Do not produce a final answer after only one or two tool calls.\n\
|
||||||
2. Always call ALL of the following tools that are relevant: search_rag (search conversation summaries), get_sms_messages (fetch nearby messages), get_calendar_events (check what was happening that day), get_location_history (find where this was taken), get_file_tags (retrieve tags).\n\
|
2. Always call ALL of the following tools that are relevant: search_rag (search conversation summaries), get_sms_messages (fetch nearby messages), get_calendar_events (check what was happening that day), get_location_history (find where this was taken), get_file_tags (retrieve tags).\n\
|
||||||
3. Use recall_facts_for_photo to load any previously stored knowledge about subjects in this photo.\n\
|
3. When calling get_sms_messages and search_rag, always make at least one call WITHOUT a contact filter to capture what else was happening in Cameron's life around this date — other conversations, events, and activities provide important wider context even when a specific contact is known.\n\
|
||||||
4. Use recall_entities to look up known people, places, or things that appear in this photo.\n\
|
4. Use recall_facts_for_photo to load any previously stored knowledge about subjects in this photo.\n\
|
||||||
5. When you identify people, places, events, or notable things in this photo: use store_entity to record them and store_fact to record key facts (relationships, roles, attributes). This builds a persistent memory for future insights.\n\
|
5. Use recall_entities to look up known people, places, or things that appear in this photo.\n\
|
||||||
6. Only produce your final insight AFTER you have gathered context from at least 3-4 tools.\n\
|
6. When you identify people, places, events, or notable things in this photo: use store_entity to record them and store_fact to record key facts (relationships, roles, attributes). This builds a persistent memory for future insights.\n\
|
||||||
7. If a tool returns no results, that is useful information — continue calling the remaining tools anyway.\n\
|
7. Only produce your final insight AFTER you have gathered context from at least 3-4 tools.\n\
|
||||||
8. Your final insight must be written in first person as Cameron, in a journal/memoir style.",
|
8. If a tool returns no results, that is useful information — continue calling the remaining tools anyway.",
|
||||||
cameron_id_note = cameron_id_note
|
cameron_id_note = cameron_id_note
|
||||||
);
|
);
|
||||||
let system_content = if let Some(ref custom) = custom_system_prompt {
|
let system_content = if let Some(ref custom) = custom_system_prompt {
|
||||||
@@ -2525,14 +2524,14 @@ Return ONLY the summary, nothing else."#,
|
|||||||
.unwrap_or_else(|| "Contact/Person: unknown".to_string());
|
.unwrap_or_else(|| "Contact/Person: unknown".to_string());
|
||||||
|
|
||||||
let user_content = format!(
|
let user_content = format!(
|
||||||
"Please analyze this photo and gather context to write a personal journal-style insight.\n\n\
|
"Please analyze this photo and gather context to write an insight.\n\n\
|
||||||
Photo file path: {}\n\
|
Photo file path: {}\n\
|
||||||
Date taken: {}\n\
|
Date taken: {}\n\
|
||||||
{}\n\
|
{}\n\
|
||||||
{}\n\
|
{}\n\
|
||||||
{}\n\n\
|
{}\n\n\
|
||||||
Use the available tools to gather more context about this moment (messages, calendar events, location history, etc.), \
|
Use the available tools to gather more context about this moment (messages, calendar events, location history, etc.), \
|
||||||
then write a detailed personal insight with a title and summary. Write in first person as Cameron.",
|
then write a detailed insight with a title and summary.",
|
||||||
file_path,
|
file_path,
|
||||||
date_taken.format("%B %d, %Y"),
|
date_taken.format("%B %d, %Y"),
|
||||||
contact_info,
|
contact_info,
|
||||||
|
|||||||
Reference in New Issue
Block a user