gptdiff 0.1.20__py3-none-any.whl → 0.1.21__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
gptdiff/gptdiff.py CHANGED
@@ -985,17 +985,23 @@ def swallow_reasoning(full_response: str) -> (str, str):
985
985
  - reasoning: The extracted reasoning block, or an empty string if not found.
986
986
  """
987
987
  pattern = re.compile(
988
- r"(?P<reasoning>>\s*Reasoning.*?Reasoned for \d+\s*seconds)",
988
+ r"(?P<reasoning>>\s*Reasoning.*?Reasoned.*?seconds)",
989
989
  re.DOTALL
990
990
  )
991
991
  match = pattern.search(full_response)
992
992
  if match:
993
- reasoning = match.group("reasoning").strip()
994
- final_content = full_response.replace(reasoning, "").strip()
993
+ raw_reasoning = match.group("reasoning")
994
+ # Remove any leading '+' characters and extra whitespace from each line
995
+ reasoning_lines = [line.lstrip('+').strip() for line in raw_reasoning.splitlines()]
996
+ reasoning = "\n".join(reasoning_lines).strip()
997
+
998
+ # Remove the reasoning block from the response using its exact span
999
+ final_content = full_response[:match.start()] + full_response[match.end():]
1000
+ final_content = final_content.strip()
995
1001
  else:
996
1002
  reasoning = ""
997
1003
  final_content = full_response.strip()
998
1004
  return final_content, reasoning
999
1005
 
1000
1006
  if __name__ == "__main__":
1001
- main()
1007
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gptdiff
3
- Version: 0.1.20
3
+ Version: 0.1.21
4
4
  Summary: A tool to generate and apply git diffs using LLMs
5
5
  Author: 255labs
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -10,7 +10,7 @@ Description-Content-Type: text/markdown
10
10
  License-File: LICENSE.txt
11
11
  Requires-Dist: openai>=1.0.0
12
12
  Requires-Dist: tiktoken>=0.5.0
13
- Requires-Dist: ai_agent_toolbox>=0.1.13
13
+ Requires-Dist: ai-agent-toolbox>=0.1.15
14
14
  Provides-Extra: test
15
15
  Requires-Dist: pytest; extra == "test"
16
16
  Requires-Dist: pytest-mock; extra == "test"
@@ -0,0 +1,9 @@
1
+ gptdiff/__init__.py,sha256=o1hrK4GFvbfKcHPlLVArz4OunE3euIicEBYaLrdDo0k,198
2
+ gptdiff/gptdiff.py,sha256=kDp7gDgBydfKxNm73QIT54AKnv117cZdXhRYQnfJm6A,39426
3
+ gptdiff/gptpatch.py,sha256=Z8CWWIfIL2o7xPLVdhzN5GSyJq0vsK4XQRzu4hMWNQk,2194
4
+ gptdiff-0.1.21.dist-info/LICENSE.txt,sha256=zCJk7yUYpMjFvlipi1dKtaljF8WdZ2NASndBYYbU8BY,1228
5
+ gptdiff-0.1.21.dist-info/METADATA,sha256=Y5O4deytuqvxRV4WaK2vAw9jFuz0OdR3Rxm3lIBNxHk,8785
6
+ gptdiff-0.1.21.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
+ gptdiff-0.1.21.dist-info/entry_points.txt,sha256=0VlVNr-gc04a3SZD5_qKIBbtg_L5P2x3xlKE5ftcdkc,82
8
+ gptdiff-0.1.21.dist-info/top_level.txt,sha256=XNkQkQGINaDndEwRxg8qToOrJ9coyfAb-EHrSUXzdCE,8
9
+ gptdiff-0.1.21.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- gptdiff/__init__.py,sha256=o1hrK4GFvbfKcHPlLVArz4OunE3euIicEBYaLrdDo0k,198
2
- gptdiff/gptdiff.py,sha256=LKBq_E9GanyDv-2FBbbWvP7JUl2Ignb6zvkD2GqmdPo,39074
3
- gptdiff/gptpatch.py,sha256=Z8CWWIfIL2o7xPLVdhzN5GSyJq0vsK4XQRzu4hMWNQk,2194
4
- gptdiff-0.1.20.dist-info/LICENSE.txt,sha256=zCJk7yUYpMjFvlipi1dKtaljF8WdZ2NASndBYYbU8BY,1228
5
- gptdiff-0.1.20.dist-info/METADATA,sha256=v8-LTu-NVLikIexMY5RDEf2t2VTAh7t_3hch379VzFA,8785
6
- gptdiff-0.1.20.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
- gptdiff-0.1.20.dist-info/entry_points.txt,sha256=0VlVNr-gc04a3SZD5_qKIBbtg_L5P2x3xlKE5ftcdkc,82
8
- gptdiff-0.1.20.dist-info/top_level.txt,sha256=XNkQkQGINaDndEwRxg8qToOrJ9coyfAb-EHrSUXzdCE,8
9
- gptdiff-0.1.20.dist-info/RECORD,,