Strip trailing whitespaces in agent's stop sequences (#1566)

Fixes #1489
This commit is contained in:
Ryan Dao
2023-03-09 16:36:15 -08:00
committed by GitHub
parent 30383abb12
commit a950287206

View File

@@ -47,7 +47,10 @@ class Agent(BaseModel):
@property
def _stop(self) -> List[str]:
return [f"\n{self.observation_prefix}", f"\n\t{self.observation_prefix}"]
return [
f"\n{self.observation_prefix.rstrip()}",
f"\n\t{self.observation_prefix.rstrip()}",
]
def _construct_scratchpad(
self, intermediate_steps: List[Tuple[AgentAction, str]]