gac 1.5.0__py3-none-any.whl → 1.5.1__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__ = "1.5.0"
3
+ __version__ = "1.5.1"
gac/providers/gemini.py CHANGED
@@ -16,30 +16,51 @@ def call_gemini_api(model: str, messages: list[dict[str, Any]], temperature: flo
16
16
 
17
17
  url = f"https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent"
18
18
 
19
- system_content = ""
20
- user_content = ""
19
+ # Build contents array following 2025 Gemini API format
20
+ contents = []
21
21
 
22
+ # Add system instruction as first content with role "system" (2025 format)
22
23
  for msg in messages:
23
24
  if msg["role"] == "system":
24
- system_content = msg["content"]
25
- elif msg["role"] == "user":
26
- user_content = msg["content"]
25
+ contents.append({"role": "system", "parts": [{"text": msg["content"]}]})
26
+ break
27
+
28
+ # Add user and assistant messages
29
+ for msg in messages:
30
+ if msg["role"] == "user":
31
+ contents.append({"role": "user", "parts": [{"text": msg["content"]}]})
32
+ elif msg["role"] == "assistant":
33
+ contents.append(
34
+ {
35
+ "role": "model", # Gemini uses "model" instead of "assistant"
36
+ "parts": [{"text": msg["content"]}],
37
+ }
38
+ )
27
39
 
28
40
  payload: dict[str, Any] = {
29
- "contents": [{"role": "user", "parts": [{"text": user_content}]}],
41
+ "contents": contents,
30
42
  "generationConfig": {"temperature": temperature, "maxOutputTokens": max_tokens},
31
43
  }
32
44
 
33
- if system_content:
34
- payload["systemInstruction"] = {"parts": [{"text": system_content}]}
45
+ headers = {"x-goog-api-key": api_key, "Content-Type": "application/json"}
35
46
 
36
47
  try:
37
- response = httpx.post(url, params={"key": api_key}, json=payload, timeout=120)
48
+ response = httpx.post(url, headers=headers, json=payload, timeout=120)
38
49
  response.raise_for_status()
39
50
  response_data = response.json()
40
- content = response_data["candidates"][0]["content"]["parts"][0]["text"]
51
+
52
+ # Check for candidates and proper response structure
53
+ if not response_data.get("candidates"):
54
+ raise AIError.model_error("Gemini API response missing candidates")
55
+
56
+ candidate = response_data["candidates"][0]
57
+ if "content" not in candidate or "parts" not in candidate["content"] or not candidate["content"]["parts"]:
58
+ raise AIError.model_error("Gemini API response has invalid content structure")
59
+
60
+ content = candidate["content"]["parts"][0].get("text")
41
61
  if content is None or content == "":
42
62
  raise AIError.model_error("Gemini API response missing text content")
63
+
43
64
  return content
44
65
  except AIError:
45
66
  raise
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gac
3
- Version: 1.5.0
3
+ Version: 1.5.1
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,5 +1,5 @@
1
1
  gac/__init__.py,sha256=HFWgSVNbTAFhgetCRWI1WrtyE7zC7IHvoBOrfDGUurM,989
2
- gac/__version__.py,sha256=Ue8VG8e2B9_ewogxBj0UZBel472-fW7y4nIoSz1wyTw,66
2
+ gac/__version__.py,sha256=jqo2PBOQzwZYj1cBEdd7cR5I7BpjI5t9dhuiXIVR5hA,66
3
3
  gac/ai.py,sha256=iOxHt1HHmTfut6pQ5Iy0jr0LnxOlaDVKKDVt3_1Yhg0,3323
4
4
  gac/ai_utils.py,sha256=8PczY1uq9N9LnvLPjLeMsWEFDfBsZQkPUpmcBxJdifs,7209
5
5
  gac/cli.py,sha256=nvz6l-wctfo3SMpC-zqtXyHMg8rtdzxw9cllbVMXJ0w,4872
@@ -18,15 +18,15 @@ gac/utils.py,sha256=W3ladtmsH01MNLdckQYTzYrYbTGEdzCKI36he9C-y_E,3945
18
18
  gac/providers/__init__.py,sha256=3mFyeXIfNWTRYr7QbMv-L5PNBWRzQRfHXdXVM1GJY3s,678
19
19
  gac/providers/anthropic.py,sha256=U9gz1Qy7uH1FwG4zSGHSYhVQzL2NFCbkmJM8NmupSkw,1749
20
20
  gac/providers/cerebras.py,sha256=XrpgVYzkmQXnK4Jjct_HeXa906m61we45oSiI5l7idw,1363
21
- gac/providers/gemini.py,sha256=M3-AWM-ciooY3Oas0AnEutTGUURatF78xIyWRtJ3arc,1737
21
+ gac/providers/gemini.py,sha256=FgXU_ne8G0DobZPkfLTLmr-qexvsSFVee4ZILPjw_RY,2628
22
22
  gac/providers/groq.py,sha256=ILe1Qo8tK0mZ_b-fCPq25j76HfI9KcPnUi2Dginw0Ys,2529
23
23
  gac/providers/lmstudio.py,sha256=TwAMFmz5b4zMzZb-trAOhHiLUWRZJl9XS9Rv9x9v7jI,1868
24
24
  gac/providers/ollama.py,sha256=E89fY_jj8TBoRdWniCXcXrm0ZURnL-Gz4vuQI1mpE9U,1823
25
25
  gac/providers/openai.py,sha256=p4Mox372Ketm3s4Iik_WXxW6wbTS28CC4G7Mtojfo8U,1349
26
26
  gac/providers/openrouter.py,sha256=3ZsxL1n6Xi1Ylu8DH3z4JI9FBM4RvMg-asQ-xPciWtQ,2065
27
27
  gac/providers/zai.py,sha256=J9SogoU-K-Gl3jgyWWJtVqqoUDXMUNodolf7Qrx3CBY,2450
28
- gac-1.5.0.dist-info/METADATA,sha256=uRukmko2pOx_evXg82gUuPL-SmvxG4hGmOaCGUhw218,9518
29
- gac-1.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
- gac-1.5.0.dist-info/entry_points.txt,sha256=tdjN-XMmcWfL92swuRAjT62bFLOAwk9bTMRLGP5Z4aI,36
31
- gac-1.5.0.dist-info/licenses/LICENSE,sha256=vOab37NouL1PNs5BswnPayrMCqaN2sqLfMQfqPDrpZg,1103
32
- gac-1.5.0.dist-info/RECORD,,
28
+ gac-1.5.1.dist-info/METADATA,sha256=8WnjncUwyO4pllItkiAjjzcIiEfqoytwKEFiGlpcT4A,9518
29
+ gac-1.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
+ gac-1.5.1.dist-info/entry_points.txt,sha256=tdjN-XMmcWfL92swuRAjT62bFLOAwk9bTMRLGP5Z4aI,36
31
+ gac-1.5.1.dist-info/licenses/LICENSE,sha256=vOab37NouL1PNs5BswnPayrMCqaN2sqLfMQfqPDrpZg,1103
32
+ gac-1.5.1.dist-info/RECORD,,
File without changes