mini-swe-agent 1.13.0__py3-none-any.whl → 1.13.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mini-swe-agent
3
- Version: 1.13.0
3
+ Version: 1.13.2
4
4
  Summary: Nano SWE Agent - A simple AI software engineering agent
5
5
  Author-email: Kilian Lieret <kilian.lieret@posteo.de>, "Carlos E. Jimenez" <carlosej@princeton.edu>
6
6
  License: MIT License
@@ -65,6 +65,7 @@ Requires-Dist: mkdocstrings[python]>=0.18; extra == "dev"
65
65
  Requires-Dist: mike; extra == "dev"
66
66
  Requires-Dist: mkdocs-material; extra == "dev"
67
67
  Requires-Dist: mkdocs-glightbox; extra == "dev"
68
+ Requires-Dist: mkdocs-redirects; extra == "dev"
68
69
  Dynamic: license-file
69
70
 
70
71
  <div align="center">
@@ -1,5 +1,5 @@
1
- mini_swe_agent-1.13.0.dist-info/licenses/LICENSE.md,sha256=D3luWPkdHAe7LBsdD4vzqDAXw6Xewb3G-uczss0uh1s,1094
2
- minisweagent/__init__.py,sha256=AV8y_FPibz99WsO-rGjKRkyf0gJhEx5RGP6IBamLGG0,2016
1
+ mini_swe_agent-1.13.2.dist-info/licenses/LICENSE.md,sha256=D3luWPkdHAe7LBsdD4vzqDAXw6Xewb3G-uczss0uh1s,1094
2
+ minisweagent/__init__.py,sha256=L9h6Hj8V819V2RbABXFOcXgPTwCdTacsJfSAG5X7tNE,2016
3
3
  minisweagent/__main__.py,sha256=FIyAOiw--c3FQ2g240FOM1FdL0lk_PxSpixu0pQ7WFo,194
4
4
  minisweagent/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  minisweagent/agents/__init__.py,sha256=cpjJLzg1IGxLM-tZpoMJV9S33ye13XtdBO0x7DU_Lrk,48
@@ -27,7 +27,7 @@ minisweagent/models/__init__.py,sha256=hMRTK5yfn2vymiXecZsSAGusxsTvrnQQVm8ih0y_P
27
27
  minisweagent/models/anthropic.py,sha256=D8nHvvbgzPjla0He8p0O9kaXASPWg1Sai0pHsAj_Yn8,855
28
28
  minisweagent/models/litellm_model.py,sha256=RSvNzK6ksOOcTEY-kM36KJql9-iSH29kq0cKYXj2mxE,3034
29
29
  minisweagent/models/openrouter_model.py,sha256=ugI3322pyUQ8wBOuMysPoKlp0oRAmR38a6GcdjE6qHI,3748
30
- minisweagent/models/portkey_model.py,sha256=hsaZJhQvzGSM88BJqTEZGvR7G_wczdKayhbtC5jex44,3814
30
+ minisweagent/models/portkey_model.py,sha256=IcFNz33AYeYgj0N9PGWV7QCn1fT8MfMWZx_OEzLaPsc,4548
31
31
  minisweagent/models/test_models.py,sha256=ItCA6ddntzkYA7dzSuUEaLMV-AE8TBuXBFP8CzpiO3U,1351
32
32
  minisweagent/models/extra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  minisweagent/models/extra/roulette.py,sha256=SqLj_wz9Vkbxou7i9Ef4Uzmg_eheDouNySkkV7pm2Ys,2093
@@ -50,8 +50,8 @@ minisweagent/run/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
50
50
  minisweagent/run/utils/save.py,sha256=2xd-UnUzI7Fr_AUZ5KEJ53Aa4kpuuGYxkLwyUcvqyMM,2503
51
51
  minisweagent/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
52
  minisweagent/utils/log.py,sha256=ruDMNKMrVC9NPvCeHwO3QYz5jsVNUGQB2dRAEAPAWp8,996
53
- mini_swe_agent-1.13.0.dist-info/METADATA,sha256=Orz3vqB1mYJeHD0WXH4-IWS3GQkHKaFsd8rAxLKDItU,14102
54
- mini_swe_agent-1.13.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
- mini_swe_agent-1.13.0.dist-info/entry_points.txt,sha256=d1_yRbTaGjs1UXHa6JQK0sKDGBIVGm8oeW0k2kfbJgQ,182
56
- mini_swe_agent-1.13.0.dist-info/top_level.txt,sha256=zKF4t8bFpV87fdVABZt2Da-vnb4Vkh_CxkwQx5YT4Ew,13
57
- mini_swe_agent-1.13.0.dist-info/RECORD,,
53
+ mini_swe_agent-1.13.2.dist-info/METADATA,sha256=9kkyymOo_pfywhGT-wYZ0jeU84Hn8DBmwWTOjkgbdGw,14150
54
+ mini_swe_agent-1.13.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
+ mini_swe_agent-1.13.2.dist-info/entry_points.txt,sha256=d1_yRbTaGjs1UXHa6JQK0sKDGBIVGm8oeW0k2kfbJgQ,182
56
+ mini_swe_agent-1.13.2.dist-info/top_level.txt,sha256=zKF4t8bFpV87fdVABZt2Da-vnb4Vkh_CxkwQx5YT4Ew,13
57
+ mini_swe_agent-1.13.2.dist-info/RECORD,,
minisweagent/__init__.py CHANGED
@@ -8,7 +8,7 @@ This file provides:
8
8
  unless you want the static type checking.
9
9
  """
10
10
 
11
- __version__ = "1.13.0"
11
+ __version__ = "1.13.2"
12
12
 
13
13
  import os
14
14
  from pathlib import Path
@@ -30,7 +30,12 @@ class PortkeyModelConfig:
30
30
  model_kwargs: dict[str, Any] = field(default_factory=dict)
31
31
  litellm_model_registry: Path | str | None = os.getenv("LITELLM_MODEL_REGISTRY_PATH")
32
32
  """We currently use litellm to calculate costs. Here you can register additional models to litellm's model registry.
33
- Note that this might change if we get better support for Portkey.
33
+ Note that this might change if we get better support for Portkey and change how we calculate costs.
34
+ """
35
+ litellm_model_name_override: str = ""
36
+ """We currently use litellm to calculate costs. Here you can override the model name to use for litellm in case it
37
+ doesn't match the Portkey model name.
38
+ Note that this might change if we get better support for Portkey and change how we calculate costs.
34
39
  """
35
40
 
36
41
 
@@ -81,11 +86,17 @@ class PortkeyModel:
81
86
 
82
87
  def query(self, messages: list[dict[str, str]], **kwargs) -> dict:
83
88
  response = self._query(messages, **kwargs)
89
+ response_for_cost_calc = response.model_copy()
90
+ if self.config.litellm_model_name_override:
91
+ if response_for_cost_calc.model:
92
+ response_for_cost_calc.model = self.config.litellm_model_name_override
84
93
  try:
85
- cost = litellm.cost_calculator.completion_cost(response)
94
+ cost = litellm.cost_calculator.completion_cost(
95
+ response_for_cost_calc, model=self.config.litellm_model_name_override or None
96
+ )
86
97
  except Exception as e:
87
98
  logger.critical(
88
- f"Error calculating cost for model {self.config.model_name}: {e}. "
99
+ f"Error calculating cost for model {self.config.model_name} based on {response_for_cost_calc.model_dump()}: {e}. "
89
100
  "Please check the 'Updating the model registry' section in the documentation at "
90
101
  "https://klieret.short.gy/litellm-model-registry Still stuck? Please open a github issue for help!"
91
102
  )