Skip to content

Commit cfbf597

Browse files
Zeeeeparushilpatel0
andcommitted
Apply changes from commit 046b238
Original commit by Tawsif Kamal: Revert "Revert "Adding Schema for Tool Outputs"" (codegen-sh#894) Reverts codegen-sh#892 --------- Co-authored-by: Rushil Patel <[email protected]> Co-authored-by: rushilpatel0 <[email protected]>
1 parent 8471f52 commit cfbf597

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/codegen/extensions/tools/relace_edit.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import difflib
44
import os
5-
from typing import TYPE_CHECKING, ClassVar
5+
from typing import TYPE_CHECKING, ClassVar, Optional
66

77
import requests
88
from langchain_core.messages import ToolMessage
@@ -23,15 +23,15 @@ class RelaceEditObservation(Observation):
2323
filepath: str = Field(
2424
description="Path to the edited file",
2525
)
26-
diff: str | None = Field(
26+
diff: Optional[str] = Field(
2727
default=None,
2828
description="Unified diff showing the changes made",
2929
)
30-
new_content: str | None = Field(
30+
new_content: Optional[str] = Field(
3131
default=None,
3232
description="New content with line numbers",
3333
)
34-
line_count: int | None = Field(
34+
line_count: Optional[int] = Field(
3535
default=None,
3636
description="Total number of lines in file",
3737
)
@@ -135,7 +135,7 @@ def apply_relace_edit(api_key: str, initial_code: str, edit_snippet: str, stream
135135
raise Exception(msg)
136136

137137

138-
def relace_edit(codebase: Codebase, filepath: str, edit_snippet: str, api_key: str | None = None) -> RelaceEditObservation:
138+
def relace_edit(codebase: Codebase, filepath: str, edit_snippet: str, api_key: Optional[str] = None) -> RelaceEditObservation:
139139
"""Edit a file using the Relace Instant Apply API.
140140
141141
Args:
@@ -176,8 +176,6 @@ def relace_edit(codebase: Codebase, filepath: str, edit_snippet: str, api_key: s
176176
# Apply the edit using Relace API
177177
try:
178178
merged_code = apply_relace_edit(api_key, original_content, edit_snippet)
179-
if original_content.endswith("\n") and not merged_code.endswith("\n"):
180-
merged_code += "\n"
181179
except Exception as e:
182180
return RelaceEditObservation(
183181
status="error",

src/codegen/extensions/tools/view_file.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ def view_file(
133133
Ensure that this is indeed the correct filepath, else keep searching to find the correct fullpath.""",
134134
filepath=filepath,
135135
content="",
136-
raw_content="",
137136
line_count=0,
138137
start_line=start_line,
139138
end_line=end_line,

0 commit comments

Comments
 (0)