MCPcopy Create free account
hub / github.com/AI45Lab/Code / remember_failure

Method remember_failure

core/src/memory.rs:183–203  ·  view source on GitHub ↗

Remember a failure to avoid repeating

(
        &self,
        prompt: &str,
        error: &str,
        attempted_tools: &[String],
    )

Source from the content-addressed store, hash-verified

181
182 /// Remember a failure to avoid repeating
183 pub async fn remember_failure(
184 &self,
185 prompt: &str,
186 error: &str,
187 attempted_tools: &[String],
188 ) -> anyhow::Result<()> {
189 let content = format!(
190 "Failure: {}\nError: {}\nAttempted tools: {}",
191 prompt,
192 error,
193 attempted_tools.join(", ")
194 );
195 let item = MemoryItem::new(content)
196 .with_importance(0.9)
197 .with_tag("failure")
198 .with_tag("avoid")
199 .with_type(MemoryType::Episodic)
200 .with_metadata("prompt", prompt)
201 .with_metadata("error", error);
202 self.remember(item).await
203 }
204
205 /// Recall similar past experiences
206 pub async fn recall_similar(

Calls 2

rememberMethod · 0.80
with_metadataMethod · 0.45