:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
from typing import Any
from langchain_core.messages import AIMessage
def compressed_memory_parser(memory: str) -> str:
"""
Remove newlines between paragraphs.
"""
return memory.replace("\n\n", "\n")
def check_memory_collection_completed(response: Any) -> AIMessage | None:
if isinstance(response, AIMessage) and ("[Done]" in response.content or not response.tool_calls):
return None
return response