Skip to content

Commit 4311483

Browse files
authored
fix: allow field headers and content on same line in parser (#7955)
1 parent fe8c5b7 commit 4311483

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dspy/adapters/chat_adapter.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ def parse(self, signature: Type[Signature], completion: str) -> dict[str, Any]:
8686
for line in completion.splitlines():
8787
match = field_header_pattern.match(line.strip())
8888
if match:
89-
sections.append((match.group(1), []))
89+
# If the header pattern is found, split the rest of the line as content
90+
header = match.group(1)
91+
remaining_content = line[match.end():].strip()
92+
sections.append((header, [remaining_content] if remaining_content else []))
9093
else:
9194
sections[-1][1].append(line)
9295

0 commit comments

Comments
 (0)