Describe Package
The lampe.describe package provides LLM-powered workflows for generating structured descriptions.
Workflows
lampe.describe.workflows
PRDescriptionWorkflow(truncation_tokens=MAX_TOKENS, *args, **kwargs)
Bases: Workflow
A workflow that generates a PR description.
Based on the pull request's diff generate a clear, concise description explaining what are the changes being made and why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
truncation_tokens
|
Maximum number of tokens to use for the diff content, by default MAX_TOKENS |
MAX_TOKENS
|
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
47 48 49 50 51 | |
generate_description(ev: PRDescriptionPromptEvent) -> StopEvent
async
Generate a PR description.
This step generates a PR description using the LLM. It uses the truncated diff of all the changes between 2 commits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
required |
Returns:
| Type | Description |
|---|---|
StopEvent
|
The stop event containing the generated description. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
prepare_diff_and_prompt(ev: PRDescriptionStartEvent) -> PRDescriptionPromptEvent
async
Prepare the diff and prompt for the LLM.
This step prepares the diff and prompt for the LLM. It truncates the diff to the maximum number of tokens and formats the prompt. The diff is filtered using files_exclude_patterns, files_include_patterns and files_reinclude_patterns. The files_reinclude_patterns allow overriding files_exclude_patterns, which is useful for patterns like "!readme.txt" that should override "*.txt" exclusions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionStartEvent
|
The start event containing the PR details. |
required |
Returns:
| Type | Description |
|---|---|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
pr_description
PRDescriptionWorkflow(truncation_tokens=MAX_TOKENS, *args, **kwargs)
Bases: Workflow
A workflow that generates a PR description.
Based on the pull request's diff generate a clear, concise description explaining what are the changes being made and why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
truncation_tokens
|
Maximum number of tokens to use for the diff content, by default MAX_TOKENS |
MAX_TOKENS
|
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
47 48 49 50 51 | |
generate_description(ev: PRDescriptionPromptEvent) -> StopEvent
async
Generate a PR description.
This step generates a PR description using the LLM. It uses the truncated diff of all the changes between 2 commits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
required |
Returns:
| Type | Description |
|---|---|
StopEvent
|
The stop event containing the generated description. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
prepare_diff_and_prompt(ev: PRDescriptionStartEvent) -> PRDescriptionPromptEvent
async
Prepare the diff and prompt for the LLM.
This step prepares the diff and prompt for the LLM. It truncates the diff to the maximum number of tokens and formats the prompt. The diff is filtered using files_exclude_patterns, files_include_patterns and files_reinclude_patterns. The files_reinclude_patterns allow overriding files_exclude_patterns, which is useful for patterns like "!readme.txt" that should override "*.txt" exclusions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionStartEvent
|
The start event containing the PR details. |
required |
Returns:
| Type | Description |
|---|---|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
data_models
PRDescriptionInput
Bases: BaseModel
Input for PR description generation workflow.
generation
PRDescriptionWorkflow(truncation_tokens=MAX_TOKENS, *args, **kwargs)
Bases: Workflow
A workflow that generates a PR description.
Based on the pull request's diff generate a clear, concise description explaining what are the changes being made and why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
truncation_tokens
|
Maximum number of tokens to use for the diff content, by default MAX_TOKENS |
MAX_TOKENS
|
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
47 48 49 50 51 | |
generate_description(ev: PRDescriptionPromptEvent) -> StopEvent
async
Generate a PR description.
This step generates a PR description using the LLM. It uses the truncated diff of all the changes between 2 commits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
required |
Returns:
| Type | Description |
|---|---|
StopEvent
|
The stop event containing the generated description. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
prepare_diff_and_prompt(ev: PRDescriptionStartEvent) -> PRDescriptionPromptEvent
async
Prepare the diff and prompt for the LLM.
This step prepares the diff and prompt for the LLM. It truncates the diff to the maximum number of tokens and formats the prompt. The diff is filtered using files_exclude_patterns, files_include_patterns and files_reinclude_patterns. The files_reinclude_patterns allow overriding files_exclude_patterns, which is useful for patterns like "!readme.txt" that should override "*.txt" exclusions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ev
|
PRDescriptionStartEvent
|
The start event containing the PR details. |
required |
Returns:
| Type | Description |
|---|---|
PRDescriptionPromptEvent
|
The prompt event containing the prepared diff and prompt. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
generate_pr_description(repository: Repository, pull_request: PullRequest, files_exclude_patterns: list[str] | None = None, files_reinclude_patterns: list[str] | None = None, truncation_tokens: int = MAX_TOKENS, timeout: int | None = None, verbose: bool = False, metadata: dict | None = None) -> PRDescriptionOutput
async
Generate a PR description.
This function generates a PR description for a given pull request. It uses the PRDescriptionWorkflow to generate the description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repository
|
Repository
|
The repository to generate the PR description for. |
required |
pull_request
|
PullRequest
|
The pull request to generate the PR description for. |
required |
files_exclude_patterns
|
list[str] | None
|
The glob matching patterns to exclude from the diff, by default None |
None
|
files_reinclude_patterns
|
list[str] | None
|
The glob matching patterns to re-include in the diff, by default None |
None
|
truncation_tokens
|
int
|
The maximum number of tokens to use for the diff content, by default MAX_TOKENS |
MAX_TOKENS
|
timeout
|
int | None
|
The timeout for the workflow, by default None |
None
|
verbose
|
bool
|
Whether to print verbose output, by default False |
False
|
metadata
|
dict | None
|
The metadata to use for the workflow, by default None |
None
|
Returns:
| Type | Description |
|---|---|
PRDescriptionOutput
|
The output containing the generated description. |
Source code in packages/lampe-describe/src/lampe/describe/workflows/pr_description/generation.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |