ultralytics-actions 0.0.49__tar.gz → 0.0.51__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.
Files changed (21) hide show
  1. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/PKG-INFO +1 -1
  2. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/actions/__init__.py +1 -1
  3. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/actions/first_interaction.py +1 -1
  4. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/actions/summarize_pr.py +2 -2
  5. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/actions/summarize_release.py +1 -1
  6. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/actions/utils/common_utils.py +29 -22
  7. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/actions/utils/openai_utils.py +7 -1
  8. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/ultralytics_actions.egg-info/PKG-INFO +1 -1
  9. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/LICENSE +0 -0
  10. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/README.md +0 -0
  11. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/actions/update_markdown_code_blocks.py +0 -0
  12. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/actions/utils/__init__.py +0 -0
  13. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/actions/utils/github_utils.py +0 -0
  14. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/pyproject.toml +0 -0
  15. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/setup.cfg +0 -0
  16. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/tests/test_urls.py +0 -0
  17. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/ultralytics_actions.egg-info/SOURCES.txt +0 -0
  18. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/ultralytics_actions.egg-info/dependency_links.txt +0 -0
  19. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/ultralytics_actions.egg-info/entry_points.txt +0 -0
  20. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/ultralytics_actions.egg-info/requires.txt +0 -0
  21. {ultralytics_actions-0.0.49 → ultralytics_actions-0.0.51}/ultralytics_actions.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ultralytics-actions
3
- Version: 0.0.49
3
+ Version: 0.0.51
4
4
  Summary: Ultralytics Actions for GitHub automation and PR management.
5
5
  Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>
6
6
  Maintainer-email: Ultralytics <hello@ultralytics.com>
@@ -22,4 +22,4 @@
22
22
  # ├── test_summarize_pr.py
23
23
  # └── ...
24
24
 
25
- __version__ = "0.0.49"
25
+ __version__ = "0.0.51"
@@ -177,7 +177,7 @@ YOUR RESPONSE (label names only):
177
177
  },
178
178
  {"role": "user", "content": prompt},
179
179
  ]
180
- suggested_labels = get_completion(messages)
180
+ suggested_labels = get_completion(messages, temperature=0.2)
181
181
  if "none" in suggested_labels.lower():
182
182
  return []
183
183
 
@@ -26,7 +26,7 @@ def generate_merge_message(pr_summary=None, pr_credit=None, pr_url=None):
26
26
  {
27
27
  "role": "user",
28
28
  "content": (
29
- f"Write a warm thank-you comment for the merged PR {pr_url} by {pr_credit}."
29
+ f"Write a warm thank-you comment for the merged PR {pr_url} by {pr_credit}. "
30
30
  f"Context:\n{pr_summary}\n\n"
31
31
  f"Start with an enthusiastic note about the merge, incorporate a relevant inspirational quote from a historical "
32
32
  f"figure, and connect it to the PR’s impact. Keep it concise yet meaningful, ensuring contributors feel valued."
@@ -88,7 +88,7 @@ def generate_pr_summary(repository, diff_text):
88
88
  f"\n\nHere's the PR diff:\n\n{diff_text[:limit]}",
89
89
  },
90
90
  ]
91
- reply = get_completion(messages)
91
+ reply = get_completion(messages, temperature=0.2)
92
92
  if len(diff_text) > limit:
93
93
  reply = "**WARNING ⚠️** this PR is very large, summary may not cover all changes.\n\n" + reply
94
94
  return SUMMARY_START + reply
@@ -134,7 +134,7 @@ def generate_release_summary(
134
134
  },
135
135
  ]
136
136
  print(messages[-1]["content"]) # for debug
137
- return get_completion(messages) + release_suffix
137
+ return get_completion(messages, temperature=0.2) + release_suffix
138
138
 
139
139
 
140
140
  def create_github_release(repo_name: str, tag_name: str, name: str, body: str, headers: dict) -> int:
@@ -34,27 +34,24 @@ BAD_HTTP_CODES = frozenset(
34
34
  504, # Gateway Timeout - upstream server didn't respond in time
35
35
  }
36
36
  )
37
- URL_IGNORE_LIST = frozenset(
38
- {
39
- "localhost",
40
- "127.0.0",
41
- ":5000",
42
- ":3000",
43
- ":8000",
44
- ":8080",
45
- ":6006",
46
- "MODEL_ID",
47
- "API_KEY",
48
- "url",
49
- "example",
50
- "mailto:",
51
- "github.com", # ignore GitHub links that may be private repos
52
- "linkedin.com",
53
- "twitter.com",
54
- "x.com",
55
- "storage.googleapis.com", # private GCS buckets
56
- }
57
- )
37
+ URL_IGNORE_LIST = { # use a set (not frozenset) to update with possible private GitHub repos
38
+ "localhost",
39
+ "127.0.0",
40
+ ":5000",
41
+ ":3000",
42
+ ":8000",
43
+ ":8080",
44
+ ":6006",
45
+ "MODEL_ID",
46
+ "API_KEY",
47
+ "url",
48
+ "example",
49
+ "mailto:",
50
+ "linkedin.com",
51
+ "twitter.com",
52
+ "x.com",
53
+ "storage.googleapis.com", # private GCS buckets
54
+ }
58
55
  URL_PATTERN = re.compile(
59
56
  r"\[([^]]+)]\(([^)]+)\)" # Matches Markdown links [text](url)
60
57
  r"|"
@@ -81,7 +78,7 @@ def clean_url(url):
81
78
 
82
79
 
83
80
  def is_url(url, session=None, check=True, max_attempts=3, timeout=2):
84
- """Check if string is URL and optionally verify it exists."""
81
+ """Check if string is URL and optionally verify it exists, with fallback for GitHub repos."""
85
82
  try:
86
83
  # Check allow list
87
84
  if any(x in url for x in URL_IGNORE_LIST):
@@ -105,6 +102,16 @@ def is_url(url, session=None, check=True, max_attempts=3, timeout=2):
105
102
  for method in (requester.head, requester.get):
106
103
  if method(url, stream=method == requester.get, **kwargs).status_code not in BAD_HTTP_CODES:
107
104
  return True
105
+
106
+ # If GitHub and check fails (repo might be private), add the base GitHub URL to ignore list
107
+ if result.hostname == "github.com":
108
+ parts = result.path.strip("/").split("/")
109
+ if len(parts) >= 2:
110
+ base_url = f"https://github.com/{parts[0]}/{parts[1]}" # https://github.com/org/repo
111
+ if requester.head(base_url, **kwargs).status_code == 404:
112
+ URL_IGNORE_LIST.add(base_url)
113
+ return True
114
+
108
115
  return False
109
116
  except Exception:
110
117
  if attempt == max_attempts - 1: # last attempt
@@ -16,6 +16,7 @@ def get_completion(
16
16
  messages: List[Dict[str, str]],
17
17
  check_links: bool = True,
18
18
  remove: List[str] = (" @giscus[bot]",), # strings to remove from response
19
+ temperature: float = 0.7, # default temperature value
19
20
  ) -> str:
20
21
  """Generates a completion using OpenAI's API based on input messages."""
21
22
  assert OPENAI_API_KEY, "OpenAI API key is required."
@@ -25,7 +26,12 @@ def get_completion(
25
26
  content = ""
26
27
  max_retries = 2
27
28
  for attempt in range(max_retries + 2): # attempt = [0, 1, 2, 3], 2 random retries before asking for no links
28
- data = {"model": OPENAI_MODEL, "messages": messages, "seed": int(time.time() * 1000)}
29
+ data = {
30
+ "model": OPENAI_MODEL,
31
+ "messages": messages,
32
+ "seed": int(time.time() * 1000),
33
+ "temperature": temperature,
34
+ }
29
35
 
30
36
  r = requests.post(url, headers=headers, json=data)
31
37
  r.raise_for_status()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ultralytics-actions
3
- Version: 0.0.49
3
+ Version: 0.0.51
4
4
  Summary: Ultralytics Actions for GitHub automation and PR management.
5
5
  Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>
6
6
  Maintainer-email: Ultralytics <hello@ultralytics.com>