Skip to content
Snippets Groups Projects
Commit 8855aca3 authored by Tetiana Chupryna's avatar Tetiana Chupryna :sunflower: Committed by Alejandro Rodríguez
Browse files

chore: remove ai_commit_reader_for_chat flag

parent 258ce2fe
No related branches found
No related tags found
3 merge requests!42Main,!41Main,!40Main
......@@ -10,7 +10,6 @@ from ai_gateway.chat.tools.gitlab import (
MergeRequestReader,
SelfHostedGitlabDocumentation,
)
from ai_gateway.feature_flags import FeatureFlag, is_feature_enabled
__all__ = ["DuoChatToolsRegistry"]
......@@ -29,6 +28,7 @@ class DuoChatToolsRegistry(BaseToolsRegistry):
EpicReader(),
IssueReader(),
MergeRequestReader(),
CommitReader(),
]
if self.self_hosted_documentation_enabled:
......@@ -36,9 +36,6 @@ class DuoChatToolsRegistry(BaseToolsRegistry):
else:
tools.append(GitlabDocumentation())
if is_feature_enabled(FeatureFlag.AI_COMMIT_READER_FOR_CHAT):
tools.append(CommitReader())
return tools
def get_on_behalf(self, user: StarletteUser, gl_version: str) -> list[BaseTool]:
......
......@@ -9,7 +9,6 @@ from enum import StrEnum
class FeatureFlag(StrEnum):
# Definition: https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/feature_flags/ops/expanded_ai_logging.yml
EXPANDED_AI_LOGGING = "expanded_ai_logging"
AI_COMMIT_READER_FOR_CHAT = "ai_commit_reader_for_chat"
ENABLE_ANTHROPIC_PROMPT_CACHING = "enable_anthropic_prompt_caching"
......
......@@ -122,6 +122,7 @@ class TestGLAgentRemoteExecutor:
"epic_reader",
"issue_reader",
"merge_request_reader",
"commit_reader",
}
else:
assert context.get("duo_chat.agent_available_tools") == ["issue_reader"]
......
......@@ -15,7 +15,6 @@ from ai_gateway.chat.tools.gitlab import (
SelfHostedGitlabDocumentation,
)
from ai_gateway.chat.toolset import DuoChatToolsRegistry
from ai_gateway.feature_flags.context import current_feature_flag_context
class TestDuoChatToolRegistry:
......@@ -28,6 +27,7 @@ class TestDuoChatToolRegistry:
IssueReader,
MergeRequestReader,
GitlabDocumentation,
CommitReader,
}
],
)
......@@ -49,6 +49,7 @@ class TestDuoChatToolRegistry:
EpicReader,
IssueReader,
MergeRequestReader,
CommitReader,
}
@pytest.mark.parametrize(
......@@ -120,39 +121,3 @@ class TestDuoChatToolRegistry:
tools = DuoChatToolsRegistry().get_on_behalf(user, "")
assert len(tools) == 0
@pytest.mark.parametrize(
"feature_flag, unit_primitive, reader_tool_type",
[("ai_commit_reader_for_chat", GitLabUnitPrimitive.ASK_COMMIT, CommitReader)],
)
def test_feature_flag(
self,
feature_flag: str,
unit_primitive: GitLabUnitPrimitive,
reader_tool_type: Type[BaseTool],
):
current_feature_flag_context.set({feature_flag})
user = StarletteUser(
CloudConnectorUser(
authenticated=True,
claims=UserClaims(
scopes=[
unit_primitive.value,
GitLabUnitPrimitive.DOCUMENTATION_SEARCH.value,
]
),
)
)
tools = DuoChatToolsRegistry().get_on_behalf(user, "17.5.0-pre")
actual_tools = {type(tool) for tool in tools}
assert actual_tools == {GitlabDocumentation, reader_tool_type}
current_feature_flag_context.set(set())
tools = DuoChatToolsRegistry().get_on_behalf(user, "17.5.0-pre")
actual_tools = {type(tool) for tool in tools}
assert actual_tools == {GitlabDocumentation}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment