code-puppy 0.0.57__tar.gz → 0.0.59__tar.gz
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.
- {code_puppy-0.0.57 → code_puppy-0.0.59}/PKG-INFO +1 -1
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/model_factory.py +12 -4
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/tools/common.py +1 -1
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/tools/file_modifications.py +32 -29
- {code_puppy-0.0.57 → code_puppy-0.0.59}/pyproject.toml +1 -1
- {code_puppy-0.0.57 → code_puppy-0.0.59}/.gitignore +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/LICENSE +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/README.md +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/__init__.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/agent.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/agent_prompts.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/command_line/__init__.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/command_line/file_path_completion.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/command_line/meta_command_handler.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/command_line/model_picker_completion.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/command_line/prompt_toolkit_completion.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/command_line/utils.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/config.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/main.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/models.json +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/session_memory.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/tools/__init__.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/tools/code_map.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/tools/command_runner.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/tools/file_operations.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/tools/web_search.py +0 -0
- {code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/version_checker.py +0 -0
|
@@ -181,12 +181,16 @@ class ModelFactory:
|
|
|
181
181
|
if model_type == "gemini":
|
|
182
182
|
provider = GoogleGLAProvider(api_key=os.environ.get("GEMINI_API_KEY", ""))
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
model = GeminiModel(model_name=model_config["name"], provider=provider)
|
|
185
|
+
setattr(model, "provider", provider)
|
|
186
|
+
return model
|
|
185
187
|
|
|
186
188
|
elif model_type == "openai":
|
|
187
189
|
provider = OpenAIProvider(api_key=os.environ.get("OPENAI_API_KEY", ""))
|
|
188
190
|
|
|
189
|
-
|
|
191
|
+
model = OpenAIModel(model_name=model_config["name"], provider=provider)
|
|
192
|
+
setattr(model, "provider", provider)
|
|
193
|
+
return model
|
|
190
194
|
|
|
191
195
|
elif model_type == "anthropic":
|
|
192
196
|
api_key = os.environ.get("ANTHROPIC_API_KEY", None)
|
|
@@ -259,7 +263,9 @@ class ModelFactory:
|
|
|
259
263
|
max_retries=azure_max_retries,
|
|
260
264
|
)
|
|
261
265
|
provider = OpenAIProvider(openai_client=azure_client)
|
|
262
|
-
|
|
266
|
+
model = OpenAIModel(model_name=model_config["name"], provider=provider)
|
|
267
|
+
setattr(model, "provider", provider)
|
|
268
|
+
return model
|
|
263
269
|
|
|
264
270
|
elif model_type == "custom_openai":
|
|
265
271
|
url, headers, ca_certs_path, api_key = get_custom_config(model_config)
|
|
@@ -272,7 +278,9 @@ class ModelFactory:
|
|
|
272
278
|
provider_args["api_key"] = api_key
|
|
273
279
|
provider = OpenAIProvider(**provider_args)
|
|
274
280
|
|
|
275
|
-
|
|
281
|
+
model = OpenAIModel(model_name=model_config["name"], provider=provider)
|
|
282
|
+
setattr(model, "provider", provider)
|
|
283
|
+
return model
|
|
276
284
|
|
|
277
285
|
else:
|
|
278
286
|
raise ValueError(f"Unsupported model type: {model_type}")
|
|
@@ -282,35 +282,38 @@ def register_file_modifications_tools(agent):
|
|
|
282
282
|
"changed": False,
|
|
283
283
|
"diff": "",
|
|
284
284
|
}
|
|
285
|
-
|
|
286
|
-
if
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
replacements
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
content
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
285
|
+
try:
|
|
286
|
+
if isinstance(parsed_payload, dict):
|
|
287
|
+
if "delete_snippet" in parsed_payload:
|
|
288
|
+
snippet = parsed_payload["delete_snippet"]
|
|
289
|
+
return delete_snippet_from_file(context, file_path, snippet)
|
|
290
|
+
if "replacements" in parsed_payload:
|
|
291
|
+
replacements = parsed_payload["replacements"]
|
|
292
|
+
return replace_in_file(context, file_path, replacements)
|
|
293
|
+
if "content" in parsed_payload:
|
|
294
|
+
content = parsed_payload["content"]
|
|
295
|
+
overwrite = bool(parsed_payload.get("overwrite", False))
|
|
296
|
+
file_exists = os.path.exists(file_path)
|
|
297
|
+
if file_exists and not overwrite:
|
|
298
|
+
return {
|
|
299
|
+
"success": False,
|
|
300
|
+
"path": file_path,
|
|
301
|
+
"message": f"File '{file_path}' exists. Set 'overwrite': true to replace.",
|
|
302
|
+
"changed": False,
|
|
303
|
+
}
|
|
304
|
+
return write_to_file(context, file_path, content, overwrite)
|
|
305
|
+
return write_to_file(context, file_path, diff, overwrite=False)
|
|
306
|
+
except Exception as e:
|
|
307
|
+
console.print(
|
|
308
|
+
"[bold red] Unable to route file modification tool call to sub-tool [/bold red]"
|
|
309
|
+
)
|
|
310
|
+
console.print(str(e))
|
|
311
|
+
return {
|
|
312
|
+
"success": False,
|
|
313
|
+
"path": file_path,
|
|
314
|
+
"message": f"Something went wrong in file editing: {str(e)}",
|
|
315
|
+
"changed": False,
|
|
316
|
+
}
|
|
314
317
|
|
|
315
318
|
@agent.tool
|
|
316
319
|
def delete_file(context: RunContext, file_path: str) -> Dict[str, Any]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{code_puppy-0.0.57 → code_puppy-0.0.59}/code_puppy/command_line/prompt_toolkit_completion.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|