Skip to content

Add fixes to GithubAgent and fix types for some other steps #1574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions patchwork/steps/AgenticLLMV2/AgenticLLMV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ def __init__(self, inputs):
base_path = str(Path.cwd())
self.conversation_limit = int(inputs.get("max_agent_calls", 1))
self.agentic_strategy = AgenticStrategyV2(
model="claude-3-5-sonnet-latest",
model=inputs.get("strategy_model", "claude-3-5-sonnet-latest"),
llm_client=AioLlmClient.create_aio_client(inputs),
template_data=inputs.get("prompt_value", {}),
system_prompt_template=inputs.get("system_prompt", "Summarise from our previous conversation"),
user_prompt_template=inputs.get("user_prompt"),
agent_configs=[
AgentConfig(
name="Assistant",
model="claude-3-7-sonnet-latest",
model=inputs.get("agent_model", "claude-3-7-sonnet-latest"),
tool_set=Tool.get_tools(path=base_path),
system_prompt=inputs.get("agent_system_prompt"),
)
Expand Down
25 changes: 24 additions & 1 deletion patchwork/steps/AgenticLLMV2/typed.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,32 @@ class AgenticLLMV2Inputs(TypedDict, total=False):
system_prompt: str
user_prompt: str
max_agent_calls: Annotated[int, StepTypeConfig(is_config=True)]
anthropic_api_key: str
strategy_model: str
agent_model: str
agent_system_prompt: str
example_json: str
openai_api_key: Annotated[
str,
StepTypeConfig(
is_config=True, or_op=["patched_api_key", "google_api_key", "client_is_gcp", "anthropic_api_key"]
),
]
anthropic_api_key: Annotated[
str,
StepTypeConfig(is_config=True, or_op=["patched_api_key", "google_api_key", "client_is_gcp", "openai_api_key"]),
]
google_api_key: Annotated[
str,
StepTypeConfig(
is_config=True, or_op=["patched_api_key", "openai_api_key", "client_is_gcp", "anthropic_api_key"]
),
]
client_is_gcp: Annotated[
str,
StepTypeConfig(
is_config=True, or_op=["patched_api_key", "openai_api_key", "anthropic_api_key", "google_api_key"]
),
]


class AgenticLLMV2Outputs(TypedDict):
Expand Down
12 changes: 7 additions & 5 deletions patchwork/steps/GitHubAgent/GitHubAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, inputs):
model="claude-3-5-sonnet-latest",
llm_client=AioLlmClient.create_aio_client(inputs),
template_data=dict(),
system_prompt_template=f"""\
system_prompt_template="""\
Please summarise the conversation given and provide the result in the structure that is asked of you.
""",
user_prompt_template=f"""\
Expand All @@ -34,15 +34,17 @@ def __init__(self, inputs):
AgentConfig(
name="Assistant",
model="gemini-2.0-flash",
tool_set=dict(github_tool=GitHubTool(base_path, inputs["github_api_token"])),
tool_set=dict(github_tool=GitHubTool(base_path, inputs["github_api_key"])),
system_prompt="""\
You are a senior software developer helping the program manager to obtain some data from GitHub.
You can access github through the `gh` CLI app.
You are a senior software developer helping the program manager to obtain some data from GitHub.
You can access github through the `gh` CLI app.
Your `gh` app has already been authenticated.
""",
)
],
example_json=inputs.get("example_json"),
example_json=inputs.get(
"example_json", '{"summary_of_actions": "1. Retrieved the list of repositories. 2. ..."}'
),
)

def run(self) -> dict:
Expand Down
4 changes: 3 additions & 1 deletion patchwork/steps/GitHubAgent/typed.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
from typing_extensions import Annotated, Any, Dict, TypedDict
from typing_extensions import Annotated, Any, Dict, Optional, TypedDict

from patchwork.common.utils.step_typing import StepTypeConfig


class __GitHubAgentRequiredInputs(TypedDict):
github_api_key: str
task: str


class GitHubAgentInputs(__GitHubAgentRequiredInputs, total=False):
base_path: str
prompt_value: Dict[str, Any]
max_llm_calls: Annotated[int, StepTypeConfig(is_config=True)]
example_json: str
openai_api_key: Annotated[
str,
StepTypeConfig(
Expand Down
50 changes: 25 additions & 25 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "patchwork-cli"
version = "0.0.121"
version = "0.0.122"
description = ""
authors = ["patched.codes"]
license = "AGPL"
Expand Down
Loading