Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Doc: Cannot set descriptions from global string

Kilian Lieret51c8dd077fb9
diff --git a/sweagent/environment/config/problem_statement.py b/sweagent/environment/config/problem_statement.py
index 00995f59..897d7724 100644
--- a/sweagent/environment/config/problem_statement.py
+++ b/sweagent/environment/config/problem_statement.py
@@ -36,15 +36,13 @@ class EmptyProblemStatement(BaseModel):
return {}
-_EXTRA_FIELDS_DOC = """Any additional data to be added to the instance.
-This data will be available when formatting prompt templates.
-"""
-
-
class TextProblemStatement(BaseModel):
text: str
- extra_fields: dict[str, Any] = Field(default_factory=dict, description=_EXTRA_FIELDS_DOC)
+ extra_fields: dict[str, Any] = Field(default_factory=dict)
+ """Any additional data to be added to the instance.
+ This data will be available when formatting prompt templates.
+ """
type: Literal["text"] = "text"
"""Discriminator for (de)serialization/CLI. Do not change."""
@@ -74,7 +72,10 @@ class TextProblemStatement(BaseModel):
class FileProblemStatement(BaseModel):
path: Path
- extra_fields: dict[str, Any] = Field(default_factory=dict, description=_EXTRA_FIELDS_DOC)
+ extra_fields: dict[str, Any] = Field(default_factory=dict)
+ """Any additional data to be added to the instance.
+ This data will be available when formatting prompt templates.
+ """
type: Literal["text_file"] = "text_file"
"""Discriminator for (de)serialization/CLI. Do not change."""
@@ -98,7 +99,10 @@ class FileProblemStatement(BaseModel):
class GithubIssue(BaseModel):
github_url: str
- extra_fields: dict[str, Any] = Field(default_factory=dict, description=_EXTRA_FIELDS_DOC)
+ extra_fields: dict[str, Any] = Field(default_factory=dict)
+ """Any additional data to be added to the instance.
+ This data will be available when formatting prompt templates.
+ """
type: Literal["github"] = "github"
"""Discriminator for (de)serialization/CLI. Do not change."""
diff --git a/sweagent/environment/config/repo.py b/sweagent/environment/config/repo.py
index 4784b7ea..2834f64d 100644
--- a/sweagent/environment/config/repo.py
+++ b/sweagent/environment/config/repo.py
@@ -17,13 +17,6 @@ from sweagent.utils.log import get_logger
logger = get_logger("swea-config", emoji="🔧")
-_BASE_COMMIT_DOC = """The commit to reset the repository to. The default is HEAD,
-i.e., the latest commit. You can also set this to a branch name (e.g., `dev`),
-a tag (e.g., `v0.1.0`), or a commit hash (e.g., `a4464baca1f`).
-SWE-agent will then start from this commit when trying to solve the problem.
-"""
-
-
class Repo(Protocol):
"""Protocol for repository configurations."""
@@ -42,8 +35,12 @@ class PreExistingRepo(BaseModel):
repo_name: str
"""The repo name (the repository must be located at the root of the deployment)."""
- base_commit: str = Field(default="HEAD", description=_BASE_COMMIT_DOC)
- """Used to reset repo."""
+ base_commit: str = Field(default="HEAD")
+ """The commit to reset the repository to. The default is HEAD,
+ i.e., the latest commit. You can also set this to a branch name (e.g., `dev`),
+ a tag (e.g., `v0.1.0`), or a commit hash (e.g., `a4464baca1f`).
+ SWE-agent will then start from this commit when trying to solve the problem.
+ """
type: Literal["preexisting"] = "preexisting"
"""Discriminator for (de)serialization/CLI. Do not change."""
@@ -55,7 +52,12 @@ class PreExistingRepo(BaseModel):
class LocalRepoConfig(BaseModel):
path: Path
- base_commit: str = Field(default="HEAD", description=_BASE_COMMIT_DOC)
+ base_commit: str = Field(default="HEAD")
+ """The commit to reset the repository to. The default is HEAD,
+ i.e., the latest commit. You can also set this to a branch name (e.g., `dev`),
+ a tag (e.g., `v0.1.0`), or a commit hash (e.g., `a4464baca1f`).
+ SWE-agent will then start from this commit when trying to solve the problem.
+ """
type: Literal["local"] = "local"
"""Discriminator for (de)serialization/CLI. Do not change."""
@@ -89,7 +91,12 @@ class LocalRepoConfig(BaseModel):
class GithubRepoConfig(BaseModel):
github_url: str = ""
- base_commit: str = Field(default="HEAD", description=_BASE_COMMIT_DOC)
+ base_commit: str = Field(default="HEAD")
+ """The commit to reset the repository to. The default is HEAD,
+ i.e., the latest commit. You can also set this to a branch name (e.g., `dev`),
+ a tag (e.g., `v0.1.0`), or a commit hash (e.g., `a4464baca1f`).
+ SWE-agent will then start from this commit when trying to solve the problem.
+ """
clone_timeout: float = 500
"""Timeout for git clone operation."""