···2323logger = logging.getLogger("void_bot")
242425252626-# Create a client
2626+# Create a client with extended timeout for LLM operations
2727CLIENT= Letta(
2828- token=os.environ["LETTA_API_KEY"]
2828+ token=os.environ["LETTA_API_KEY"],
2929+ timeout=300 # 5 minutes timeout for API calls
2930)
30313132# Use the "Bluesky" project
···110111 # Get thread context as YAML string
111112 thread_context = thread_to_yaml_string(thread)
112113114114+ print(thread_context)
115115+113116 # Create a prompt for the Letta agent with thread context
114117 prompt = f"""You received a mention on Bluesky from @{author_handle} ({author_name or author_handle}).
115118···183186 logger.error(f"Failed to send reply to @{author_handle}")
184187 return False
185188 else:
186186- logger.warning(f"No reply generated for mention from @{author_handle}")
187187- return False
189189+ logger.warning(f"No reply generated for mention from @{author_handle}, removing notification from queue")
190190+ return True
188191189192 except Exception as e:
190193 logger.error(f"Error processing mention: {e}")
+8-7
bsky_utils.py
···3333 "tags",
3434 "associated",
3535 "thread_context",
3636- "image",
3736 "aspect_ratio",
3837 "thumb",
3938 "fullsize",
···5958 "muted",
6059 "muted_by_list",
6160 "root_author_like",
6262- "embed",
6361 "entities",
6262+ "ref",
6363+ "mime_type",
6464+ "size",
6465]
6566def convert_to_basic_types(obj):
6667 """Convert complex Python objects to basic types for JSON/YAML serialization."""
···116117def thread_to_yaml_string(thread, strip_metadata=True):
117118 """
118119 Convert thread data to a YAML-formatted string for LLM parsing.
119119-120120+120121 Args:
121122 thread: The thread data from get_post_thread
122123 strip_metadata: Whether to strip metadata fields for cleaner output
123123-124124+124125 Returns:
125126 YAML-formatted string representation of the thread
126127 """
127128 # First convert complex objects to basic types
128129 basic_thread = convert_to_basic_types(thread)
129129-130130+130131 if strip_metadata:
131132 # Create a copy and strip unwanted fields
132133 cleaned_thread = strip_fields(basic_thread, STRIP_FIELDS)
133134 else:
134135 cleaned_thread = basic_thread
135135-136136+136137 return yaml.dump(cleaned_thread, indent=2, allow_unicode=True, default_flow_style=False)
137138138139···279280 else:
280281 post_uri = None
281282 post_cid = None
282282-283283+283284 if not post_uri or not post_cid:
284285 logger.error("Notification doesn't have required uri/cid fields")
285286 return None