We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 694d7c5 commit 6196e2dCopy full SHA for 6196e2d
dataherald/sql_generator/__init__.py
@@ -127,14 +127,18 @@ def construct_intermediate_steps(
127
thought=str(step[0].log).split("Action:")[0],
128
action=step[0].tool,
129
action_input=step[0].tool_input,
130
- observation=step[1],
+ observation=self.truncate_observations(step[1]),
131
)
132
133
formatted_intermediate_steps[0].thought = suffix.split("Thought: ")[1].split(
134
"{agent_scratchpad}"
135
)[0]
136
return formatted_intermediate_steps
137
138
+ def truncate_observations(self, obervarion: str, max_length: int = 2000) -> str:
139
+ """Truncate the tool input."""
140
+ return obervarion[:max_length] + "... (truncated)" if len(obervarion) > max_length else obervarion
141
+
142
@abstractmethod
143
def generate_response(
144
self,
0 commit comments