gac 0.17.5__py3-none-any.whl → 0.17.7__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.

Potentially problematic release.


This version of gac might be problematic. Click here for more details.

gac/__version__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Version information for gac package."""
2
2
 
3
- __version__ = "0.17.5"
3
+ __version__ = "0.17.7"
gac/ai.py CHANGED
@@ -28,7 +28,19 @@ def count_tokens(content: str | list[dict[str, str]] | dict[str, Any], model: st
28
28
  if model.startswith("anthropic"):
29
29
  import anthropic
30
30
 
31
- return anthropic.Client().count_tokens(text)
31
+ try:
32
+ client = anthropic.Anthropic()
33
+ # Extract the actual model name after the provider prefix
34
+ model_name = model.split(":", 1)[1] if ":" in model else "claude-3-5-haiku-latest"
35
+
36
+ # Use the beta messages.count_tokens API for accurate counting
37
+ response = client.messages.count_tokens(
38
+ model=model_name, messages=[{"role": "user", "content": text}], betas=["token-counting-2024-11-01"]
39
+ )
40
+ return response.input_tokens
41
+ except Exception:
42
+ # Fallback to simple estimation for Anthropic models
43
+ return len(text) // 4
32
44
 
33
45
  try:
34
46
  encoding = get_encoding(model)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gac
3
- Version: 0.17.5
3
+ Version: 0.17.7
4
4
  Summary: AI-powered Git commit message generator with multi-provider support
5
5
  Project-URL: Homepage, https://github.com/cellwebb/gac
6
6
  Project-URL: Documentation, https://github.com/cellwebb/gac#readme
@@ -1,6 +1,6 @@
1
1
  gac/__init__.py,sha256=z9yGInqtycFIT3g1ca24r-A3699hKVaRqGUI79wsmMc,415
2
- gac/__version__.py,sha256=lrX6NfheZ1twSfkD-6KMG2Oab-CVBnAP8BWTTTk1yWQ,67
3
- gac/ai.py,sha256=hkOhBmN1XBJ2ZswsnBvckuov9D7FDOL9vm_A4atuoGs,5905
2
+ gac/__version__.py,sha256=qxSKc0LY86AnPlLZUd4nru_QidvMTN0Rp7YUgpJEcxs,67
3
+ gac/ai.py,sha256=-oficz6RrkPbCRB2C1Sr7JIY4WW03gGVuSAujOCJasc,6498
4
4
  gac/cli.py,sha256=KsagQerqcf2uqGS4HjV_U1AUBtY3DPmYLsTj08riZmE,4545
5
5
  gac/config.py,sha256=wSgEDjtis7Vk1pv5VPvYmJyD9-tymDS6GiUHjnCMbIM,1486
6
6
  gac/config_cli.py,sha256=v9nFHZO1RvK9fzHyuUS6SG-BCLHMsdOMDwWamBhVVh4,1608
@@ -13,8 +13,8 @@ gac/main.py,sha256=IlT6iOsdwb0uSJJ1A69FaBrq-gFGpnhCcAjJLdHp20w,11962
13
13
  gac/preprocess.py,sha256=4igtZ9OTHgTpqwlJmbcGaqzmdD0HHCZJwsZ9eG118Gk,15360
14
14
  gac/prompt.py,sha256=Wd-CguIQnVNj_49dXz0Da2Osxx8sfTzRypx_rq2rFWk,20052
15
15
  gac/utils.py,sha256=W3ladtmsH01MNLdckQYTzYrYbTGEdzCKI36he9C-y_E,3945
16
- gac-0.17.5.dist-info/METADATA,sha256=cRISRlS6GIEds8wW6K15pjzUiAe_GCmwMS7MnWQhN4E,8448
17
- gac-0.17.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
- gac-0.17.5.dist-info/entry_points.txt,sha256=tdjN-XMmcWfL92swuRAjT62bFLOAwk9bTMRLGP5Z4aI,36
19
- gac-0.17.5.dist-info/licenses/LICENSE,sha256=s11puNmYfzwoSwG96nhOJe268Y1QFckr8-Hmzo3_eJE,1087
20
- gac-0.17.5.dist-info/RECORD,,
16
+ gac-0.17.7.dist-info/METADATA,sha256=y6g4vfzo6uRjkkzzHI5f5dMWXtbBiax6nW-A47GmKzc,8448
17
+ gac-0.17.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
+ gac-0.17.7.dist-info/entry_points.txt,sha256=tdjN-XMmcWfL92swuRAjT62bFLOAwk9bTMRLGP5Z4aI,36
19
+ gac-0.17.7.dist-info/licenses/LICENSE,sha256=s11puNmYfzwoSwG96nhOJe268Y1QFckr8-Hmzo3_eJE,1087
20
+ gac-0.17.7.dist-info/RECORD,,
File without changes