nielsr HF Staff commited on
Commit
d3a7aa5
·
1 Parent(s): ca17e29

Update agent prompts

Browse files
agents/agent.py CHANGED
@@ -440,6 +440,7 @@ async def run_pr_agent(
440
  conference_name: str,
441
  verified_yaml: str,
442
  changes_summary: str,
 
443
  branch_name: str,
444
  ) -> tuple[dict, float]:
445
  """Run the PR agent to write YAML and create a pull request.
@@ -448,6 +449,7 @@ async def run_pr_agent(
448
  conference_name: Name of the conference.
449
  verified_yaml: The verified updated YAML content to write.
450
  changes_summary: Summary of what changed.
 
451
  branch_name: Git branch name to use for the PR.
452
 
453
  Returns:
@@ -455,6 +457,11 @@ async def run_pr_agent(
455
  """
456
  current_yaml = await load_conference_data(conference_name)
457
  git_remotes = await _get_git_remote_info()
 
 
 
 
 
458
 
459
  system_template = await read_prompt("prompts/pr_system_prompt.md")
460
  system_prompt = system_template.format(
@@ -468,6 +475,7 @@ async def run_pr_agent(
468
  conference_name=conference_name,
469
  updated_yaml=verified_yaml,
470
  changes_summary=changes_summary,
 
471
  current_yaml=current_yaml if current_yaml else "(file does not exist yet)",
472
  branch_name=branch_name,
473
  )
@@ -599,11 +607,12 @@ async def find_conference_deadlines(
599
 
600
  verified_yaml = aggregation_result.get("updated_yaml", "")
601
  changes_summary = aggregation_result.get("reasoning", "")
 
602
  branch_name = _generate_branch_name(conference_name)
603
  print(f" Branch: {branch_name}")
604
 
605
  pr_result, pr_cost = await run_pr_agent(
606
- conference_name, verified_yaml, changes_summary, branch_name
607
  )
608
  total_cost += pr_cost
609
  print(f" PR stage cost: ${pr_cost:.4f}")
 
440
  conference_name: str,
441
  verified_yaml: str,
442
  changes_summary: str,
443
+ source_urls: list[str],
444
  branch_name: str,
445
  ) -> tuple[dict, float]:
446
  """Run the PR agent to write YAML and create a pull request.
 
449
  conference_name: Name of the conference.
450
  verified_yaml: The verified updated YAML content to write.
451
  changes_summary: Summary of what changed.
452
+ source_urls: Source URLs supporting the update.
453
  branch_name: Git branch name to use for the PR.
454
 
455
  Returns:
 
457
  """
458
  current_yaml = await load_conference_data(conference_name)
459
  git_remotes = await _get_git_remote_info()
460
+ formatted_source_urls = (
461
+ "\n".join(f"- {url}" for url in source_urls)
462
+ if source_urls
463
+ else "- No source URLs were provided."
464
+ )
465
 
466
  system_template = await read_prompt("prompts/pr_system_prompt.md")
467
  system_prompt = system_template.format(
 
475
  conference_name=conference_name,
476
  updated_yaml=verified_yaml,
477
  changes_summary=changes_summary,
478
+ source_urls=formatted_source_urls,
479
  current_yaml=current_yaml if current_yaml else "(file does not exist yet)",
480
  branch_name=branch_name,
481
  )
 
607
 
608
  verified_yaml = aggregation_result.get("updated_yaml", "")
609
  changes_summary = aggregation_result.get("reasoning", "")
610
+ source_urls = aggregation_result.get("source_urls", [])
611
  branch_name = _generate_branch_name(conference_name)
612
  print(f" Branch: {branch_name}")
613
 
614
  pr_result, pr_cost = await run_pr_agent(
615
+ conference_name, verified_yaml, changes_summary, source_urls, branch_name
616
  )
617
  total_cost += pr_cost
618
  print(f" PR stage cost: ${pr_cost:.4f}")
agents/prompts/pr_system_prompt.md CHANGED
@@ -1,6 +1,6 @@
1
  You are an AI assistant responsible for writing updated conference data to a YAML file and creating a pull request on GitHub.
2
 
3
- You will receive the verified, updated YAML content for a conference along with the current file contents and a summary of changes. Your job is to:
4
 
5
  1. **Read** the target YAML file before writing to it (the current contents are provided in the user prompt for reference, but always read the file to satisfy the tool requirement).
6
  2. Write the updated YAML content to the correct file.
@@ -10,6 +10,8 @@ You will receive the verified, updated YAML content for a conference along with
10
 
11
  The data of each conference is stored as a YAML file at `src/data/conferences/` (relative to the repository root).
12
 
 
 
13
  ## Git remote layout
14
 
15
  The actual git remotes for this repository are shown below. **Use this output to determine the correct remote to push to** — do NOT assume remote names.
@@ -31,7 +33,39 @@ git checkout -b {branch_name}
31
  git add .
32
  git commit -m "your-message"
33
  git push <fork-remote> {branch_name}
34
- gh pr create --repo huggingface/ai-deadlines --head nielsrogge:{branch_name} --title "Update {conference_name} deadlines" --body "Updated conference data for {conference_name}."
 
 
 
 
 
 
 
 
 
 
35
  ```
36
 
37
  The `gh` CLI will authenticate using the `GH_TOKEN` environment variable which is set automatically.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  You are an AI assistant responsible for writing updated conference data to a YAML file and creating a pull request on GitHub.
2
 
3
+ You will receive the verified, updated YAML content for a conference along with the current file contents, a summary of changes, and supporting source URLs. Your job is to:
4
 
5
  1. **Read** the target YAML file before writing to it (the current contents are provided in the user prompt for reference, but always read the file to satisfy the tool requirement).
6
  2. Write the updated YAML content to the correct file.
 
10
 
11
  The data of each conference is stored as a YAML file at `src/data/conferences/` (relative to the repository root).
12
 
13
+ When writing YAML content, preserve the provided values exactly. If a deadline timezone refers to Anywhere on Earth, always use `AoE` and never `UTC-12`.
14
+
15
  ## Git remote layout
16
 
17
  The actual git remotes for this repository are shown below. **Use this output to determine the correct remote to push to** — do NOT assume remote names.
 
33
  git add .
34
  git commit -m "your-message"
35
  git push <fork-remote> {branch_name}
36
+ gh pr create --repo huggingface/ai-deadlines --head nielsrogge:{branch_name} --title "Update {conference_name} deadlines" --body "$(cat <<'EOF'
37
+ ## Summary
38
+ Update the {conference_name} conference data with the latest verified information.
39
+
40
+ ## Changes made
41
+ - <concise bullet describing a verified change>
42
+
43
+ ## Sources
44
+ - <source URL>
45
+ EOF
46
+ )"
47
  ```
48
 
49
  The `gh` CLI will authenticate using the `GH_TOKEN` environment variable which is set automatically.
50
+
51
+ ## Pull request body
52
+
53
+ Always use the exact section order and headings below in the pull request body:
54
+
55
+ ```markdown
56
+ ## Summary
57
+ <one or two sentences summarizing the purpose of the PR>
58
+
59
+ ## Changes made
60
+ - <bullet list of the concrete data changes that were written to the YAML file>
61
+
62
+ ## Sources
63
+ - <bullet list of source URLs supporting the update>
64
+ ```
65
+
66
+ Additional requirements:
67
+
68
+ - `Summary` should briefly describe the purpose of the update.
69
+ - `Changes made` should be a bullet list derived from the provided summary of changes and focus on the actual YAML updates.
70
+ - `Sources` should include the provided source URLs as markdown bullet points, preserving the URLs exactly.
71
+ - Do not omit any of the three sections, even if only one bullet is needed.
agents/prompts/pr_user_prompt.md CHANGED
@@ -24,6 +24,12 @@ Write the following content to `src/data/conferences/{conference_name}.yml`:
24
 
25
  {changes_summary}
26
 
 
 
 
 
 
 
27
  ## Branch name
28
 
29
  Use this branch name: `{branch_name}`
 
24
 
25
  {changes_summary}
26
 
27
+ ## Source URLs
28
+
29
+ Use the following URLs in the `Sources` section of the pull request body:
30
+
31
+ {source_urls}
32
+
33
  ## Branch name
34
 
35
  Use this branch name: `{branch_name}`