Skip to content

Commit c74b337

Browse files
authored
fix: additional tools won't duplicate (#928)
additional_tools stay just will be overriden by duplicate tools passed in from additional_tools
1 parent a54a070 commit c74b337

File tree

1 file changed

+5
-9
lines changed
  • src/codegen/extensions/langchain

1 file changed

+5
-9
lines changed

src/codegen/extensions/langchain/agent.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def create_codebase_agent(
6363
"""
6464
llm = LLM(model_provider=model_provider, model_name=model_name, **kwargs)
6565

66-
# Get all codebase tools
66+
# Initialize default tools
6767
tools = [
6868
ViewFileTool(codebase),
6969
ListDirectoryTool(codebase),
@@ -80,17 +80,13 @@ def create_codebase_agent(
8080
ReflectionTool(codebase),
8181
SearchFilesByNameTool(codebase),
8282
GlobalReplacementEditTool(codebase),
83-
# SemanticSearchTool(codebase),
84-
# =====[ Github Integration ]=====
85-
# Enable Github integration
86-
# GithubCreatePRTool(codebase),
87-
# GithubViewPRTool(codebase),
88-
# GithubCreatePRCommentTool(codebase),
89-
# GithubCreatePRReviewCommentTool(codebase),
9083
]
9184

92-
# Add additional tools if provided
9385
if additional_tools:
86+
# Get names of additional tools
87+
additional_names = {t.get_name() for t in additional_tools}
88+
# Keep only tools that don't have matching names in additional_tools
89+
tools = [t for t in tools if t.get_name() not in additional_names]
9490
tools.extend(additional_tools)
9591

9692
memory = MemorySaver() if memory else None

0 commit comments

Comments
 (0)