feat: Add LanceDB support for similar_issue tool and refactor SOC2 compliance feature name

This commit is contained in:
mrT23
2024-01-24 19:40:58 +02:00
parent 9986f5307c
commit f4037e0dfa
4 changed files with 7 additions and 4 deletions

View File

@ -50,6 +50,9 @@ pr_commands = [
Meaning that by default, for each PR the `describe`, `review`, and `improve` tools will be triggered automatically, and the `improve` tool will present the suggestions in a single comment. Meaning that by default, for each PR the `describe`, `review`, and `improve` tools will be triggered automatically, and the `improve` tool will present the suggestions in a single comment.
You can of course overwrite these defaults by adding a `.pr_agent.toml` file to your repo. See [here](https://github.com/Codium-ai/pr-agent/blob/main/Usage.md#working-with-github-app). You can of course overwrite these defaults by adding a `.pr_agent.toml` file to your repo. See [here](https://github.com/Codium-ai/pr-agent/blob/main/Usage.md#working-with-github-app).
### Jan 10, 2024
[LanceDB](https://lancedb.com/) is now supported as a locally hosted VectorDB for the `similar_issue` tool. See [here](./docs/SIMILAR_ISSUE.md) for more details.
## Overview ## Overview
<div style="text-align:left;"> <div style="text-align:left;">

View File

@ -45,7 +45,7 @@ To edit [configurations](./../pr_agent/settings/configuration.toml#L19) related
- `require_estimate_effort_to_review`: if set to true, the tool will add a section that estimates thed effort needed to review the PR. Default is true. - `require_estimate_effort_to_review`: if set to true, the tool will add a section that estimates thed effort needed to review the PR. Default is true.
#### SOC2 ticket compliance 💎 #### SOC2 ticket compliance 💎
This sub-tool checks if the PR description properly contains a ticket to a project management system (e.g., Jira, Asana, Trello, etc.), as required by SOC2 compliance. If not, it will add a label to the PR: "Missing SOC2 ticket". This sub-tool checks if the PR description properly contains a ticket to a project management system (e.g., Jira, Asana, Trello, etc.), as required by SOC2 compliance. If not, it will add a label to the PR: "Missing SOC2 ticket".
- `require_soc2_review`: If set to true, the SOC2 ticket checker sub-tool will be enabled. Default is false. - `require_soc2_ticket`: If set to true, the SOC2 ticket checker sub-tool will be enabled. Default is false.
- `soc2_ticket_prompt`: The prompt for the SOC2 ticket review. Default is: `Does the PR description include a link to ticket in a project management system (e.g., Jira, Asana, Trello, etc.) ?`. Edit this field if your compliance requirements are different. - `soc2_ticket_prompt`: The prompt for the SOC2 ticket review. Default is: `Does the PR description include a link to ticket in a project management system (e.g., Jira, Asana, Trello, etc.) ?`. Edit this field if your compliance requirements are different.
#### Adding PR labels #### Adding PR labels
- `enable_review_labels_security`: if set to true, the tool will publish a 'possible security issue' label if it detects a security issue. Default is true. - `enable_review_labels_security`: if set to true, the tool will publish a 'possible security issue' label if it detects a security issue. Default is true.
@ -103,7 +103,7 @@ The `review` tool provides a collection of possible feedbacks about a PR.
It is recommended to review the [Configuration options](#configuration-options) section, and choose the relevant options for your use case. It is recommended to review the [Configuration options](#configuration-options) section, and choose the relevant options for your use case.
Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example: Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
`require_score_review`, `require_soc2_review`, `enable_review_labels_effort`, and more. `require_score_review`, `require_soc2_ticket`, `enable_review_labels_effort`, and more.
On the other hand, if you find one of the enabled features to be irrelevant for your use case, disable it. No default configuration can fit all use cases. On the other hand, if you find one of the enabled features to be irrelevant for your use case, disable it. No default configuration can fit all use cases.

View File

@ -95,7 +95,7 @@ The `review` tool can auto-generate two specific types of labels for a PR:
The `review` tool provides a collection of possible feedbacks about a PR. The `review` tool provides a collection of possible feedbacks about a PR.
It is recommended to review the [possible options](https://github.com/Codium-ai/pr-agent/blob/main/docs/REVIEW.md#enabledisable-features), and choose the ones relevant for your use case. It is recommended to review the [possible options](https://github.com/Codium-ai/pr-agent/blob/main/docs/REVIEW.md#enabledisable-features), and choose the ones relevant for your use case.
Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example: Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
`require_score_review`, `require_soc2_review`, `enable_review_labels_effort`, and more. `require_score_review`, `require_soc2_ticket`, `enable_review_labels_effort`, and more.
""" """
output += "\n\n</details></td></tr>\n\n" output += "\n\n</details></td></tr>\n\n"

View File

@ -5,7 +5,6 @@ from typing import List
import openai import openai
import pandas as pd import pandas as pd
import pinecone import pinecone
import lancedb
from pinecone_datasets import Dataset, DatasetMetadata from pinecone_datasets import Dataset, DatasetMetadata
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
@ -108,6 +107,7 @@ class PRSimilarIssue:
get_logger().info('No new issues to update') get_logger().info('No new issues to update')
elif get_settings().pr_similar_issue.vectordb == "lancedb": elif get_settings().pr_similar_issue.vectordb == "lancedb":
import lancedb # import lancedb only if needed
self.db = lancedb.connect(get_settings().lancedb.uri) self.db = lancedb.connect(get_settings().lancedb.uri)
self.table = None self.table = None