gptdiff 0.1.6__py3-none-any.whl → 0.1.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gptdiff/gptdiff.py +6 -4
- {gptdiff-0.1.6.dist-info → gptdiff-0.1.8.dist-info}/METADATA +2 -2
- gptdiff-0.1.8.dist-info/RECORD +8 -0
- gptdiff-0.1.6.dist-info/RECORD +0 -8
- {gptdiff-0.1.6.dist-info → gptdiff-0.1.8.dist-info}/LICENSE.txt +0 -0
- {gptdiff-0.1.6.dist-info → gptdiff-0.1.8.dist-info}/WHEEL +0 -0
- {gptdiff-0.1.6.dist-info → gptdiff-0.1.8.dist-info}/entry_points.txt +0 -0
- {gptdiff-0.1.6.dist-info → gptdiff-0.1.8.dist-info}/top_level.txt +0 -0
gptdiff/gptdiff.py
CHANGED
@@ -165,7 +165,7 @@ def load_prepend_file(file):
|
|
165
165
|
return f.read()
|
166
166
|
|
167
167
|
# Function to call GPT-4 API and calculate the cost
|
168
|
-
def
|
168
|
+
def call_llm_for_diff(system_prompt, user_prompt, files_content, model, temperature=0.7, max_tokens=30000, api_key=None, base_url=None):
|
169
169
|
enc = tiktoken.get_encoding("o200k_base")
|
170
170
|
start_time = time.time()
|
171
171
|
|
@@ -243,7 +243,7 @@ def generate_diff(environment, goal, model=None, temperature=0.7, max_tokens=320
|
|
243
243
|
prepend = ""
|
244
244
|
|
245
245
|
system_prompt = prepend+f"Output a git diff into a <diff> block."
|
246
|
-
_, diff_text, _, _, _, _ =
|
246
|
+
_, diff_text, _, _, _, _ = call_llm_for_diff(
|
247
247
|
system_prompt,
|
248
248
|
goal,
|
249
249
|
environment,
|
@@ -337,6 +337,7 @@ def parse_arguments():
|
|
337
337
|
help='Call the GPT-4 API. Writes the full prompt to prompt.txt if not specified.')
|
338
338
|
parser.add_argument('files', nargs='*', default=[], help='Specify additional files or directories to include.')
|
339
339
|
parser.add_argument('--temperature', type=float, default=0.7, help='Temperature parameter for model creativity (0.0 to 2.0)')
|
340
|
+
parser.add_argument('--max_tokens', type=int, default=30000, help='Temperature parameter for model creativity (0.0 to 2.0)')
|
340
341
|
parser.add_argument('--model', type=str, default=None, help='Model to use for the API call.')
|
341
342
|
|
342
343
|
parser.add_argument('--nowarn', action='store_true', help='Disable large token warning')
|
@@ -589,10 +590,11 @@ def main():
|
|
589
590
|
if confirmation != 'y':
|
590
591
|
print("Request canceled")
|
591
592
|
sys.exit(0)
|
592
|
-
full_text, diff_text, prompt_tokens, completion_tokens, total_tokens, cost =
|
593
|
+
full_text, diff_text, prompt_tokens, completion_tokens, total_tokens, cost = call_llm_for_diff(system_prompt, user_prompt, files_content, args.model,
|
593
594
|
temperature=args.temperature,
|
594
595
|
api_key=os.getenv('GPTDIFF_LLM_API_KEY'),
|
595
|
-
base_url=os.getenv('GPTDIFF_LLM_BASE_URL', "https://nano-gpt.com/api/v1/")
|
596
|
+
base_url=os.getenv('GPTDIFF_LLM_BASE_URL', "https://nano-gpt.com/api/v1/"),
|
597
|
+
max_tokens=args.max_tokens
|
596
598
|
)
|
597
599
|
|
598
600
|
if(diff_text.strip() == ""):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: gptdiff
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.8
|
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
|
+
Requires-Dist: ai_agent_toolbox>=0.1.11
|
14
14
|
Provides-Extra: test
|
15
15
|
Requires-Dist: pytest; extra == "test"
|
16
16
|
Requires-Dist: pytest-mock; extra == "test"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
gptdiff/__init__.py,sha256=yGjgwv7tNvH1ZLPsQyoo1CxpTOl1iCAwwDBp-_17ksQ,89
|
2
|
+
gptdiff/gptdiff.py,sha256=kzLeNc5M3saCdqBOoE-OjkyHztGbQr39XPiVcFJ_pyY,25958
|
3
|
+
gptdiff-0.1.8.dist-info/LICENSE.txt,sha256=zCJk7yUYpMjFvlipi1dKtaljF8WdZ2NASndBYYbU8BY,1228
|
4
|
+
gptdiff-0.1.8.dist-info/METADATA,sha256=ErNMAtAqN7HDzarpVJi0IVA5i1pryUQwkjVjus9kjkM,7317
|
5
|
+
gptdiff-0.1.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
6
|
+
gptdiff-0.1.8.dist-info/entry_points.txt,sha256=0yvXYEVAZFI-p32kQ4-h3qKVWS0a86jsM9FAwF89t9w,49
|
7
|
+
gptdiff-0.1.8.dist-info/top_level.txt,sha256=XNkQkQGINaDndEwRxg8qToOrJ9coyfAb-EHrSUXzdCE,8
|
8
|
+
gptdiff-0.1.8.dist-info/RECORD,,
|
gptdiff-0.1.6.dist-info/RECORD
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
gptdiff/__init__.py,sha256=yGjgwv7tNvH1ZLPsQyoo1CxpTOl1iCAwwDBp-_17ksQ,89
|
2
|
-
gptdiff/gptdiff.py,sha256=VAbTBgxGYzxj2ZxRHCnZAneeFfZ8YAJ_qkB_9umnyjg,25689
|
3
|
-
gptdiff-0.1.6.dist-info/LICENSE.txt,sha256=zCJk7yUYpMjFvlipi1dKtaljF8WdZ2NASndBYYbU8BY,1228
|
4
|
-
gptdiff-0.1.6.dist-info/METADATA,sha256=hMEEWaG6TsauWVkDbtBD05uHtDjrBp3VaCmxXdh2QDk,7316
|
5
|
-
gptdiff-0.1.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
6
|
-
gptdiff-0.1.6.dist-info/entry_points.txt,sha256=0yvXYEVAZFI-p32kQ4-h3qKVWS0a86jsM9FAwF89t9w,49
|
7
|
-
gptdiff-0.1.6.dist-info/top_level.txt,sha256=XNkQkQGINaDndEwRxg8qToOrJ9coyfAb-EHrSUXzdCE,8
|
8
|
-
gptdiff-0.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|