Skip to content

Commit 1db713a

Browse files
committed
refactor(agent): add default values to field extraction
1 parent a5e4c40 commit 1db713a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

codetide/agents/tide/agent.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -663,9 +663,9 @@ async def extract_operation_mode(
663663
)
664664

665665
# Extract fields from response
666-
operation_mode = self._extract_field(response, "OPERATION_MODE")
667-
sufficient_context = self._extract_field(response, "SUFFICIENT_CONTEXT")
668-
history_count = self._extract_field(response, "HISTORY_COUNT")
666+
operation_mode = self._extract_field(response, "OPERATION_MODE", "STANDARD")
667+
sufficient_context = self._extract_field(response, "SUFFICIENT_CONTEXT", "FALSE")
668+
history_count = self._extract_field(response, "HISTORY_COUNT", "2")
669669
is_new_topic = self._extract_field(response, "IS_NEW_TOPIC")
670670
topic_title = self._extract_field(response, "TOPIC_TITLE")
671671
search_query = self._extract_field(response, "SEARCH_QUERY")
@@ -700,11 +700,11 @@ async def extract_operation_mode(
700700
)
701701

702702
@staticmethod
703-
def _extract_field(text: str, field_name: str) -> Optional[str]:
703+
def _extract_field(text: str, field_name: str, default :Optional[str]=None) -> Optional[str]:
704704
"""Extract a field value from response text."""
705705
pattern = rf'{field_name}:\s*\[?([^\]]+?)\]?(?:\n|$)'
706706
match = re.search(pattern, text)
707-
return match.group(1) if match else None
707+
return match.group(1) if match else default
708708

709709
@staticmethod
710710
def _extract_search_query(response: str) -> Optional[str]:

0 commit comments

Comments
 (0)