[core, langchain] modelio code improvements (#15277)

This commit is contained in:
Harrison Chase
2023-12-28 12:56:20 -08:00
committed by GitHub
parent 694bbb14cd
commit b86803153e
7 changed files with 52 additions and 7 deletions

View File

@@ -39,8 +39,12 @@ class DatetimeOutputParser(BaseOutputParser[datetime]):
def get_format_instructions(self) -> str:
examples = comma_list(_generate_random_datetime_strings(self.format))
return f"""Write a datetime string that matches the
following pattern: "{self.format}". Examples: {examples}"""
return (
f"Write a datetime string that matches the "
f"following pattern: '{self.format}'.\n\n"
f"Examples: {examples}\n\n"
f"Return ONLY this string, no other words!"
)
def parse(self, response: str) -> datetime:
try: