File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
src/codegen/extensions/langchain Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 33from langchain import hub
44from langchain .agents import AgentExecutor
55from langchain .agents .openai_functions_agent .base import OpenAIFunctionsAgent
6- from langchain_core . chat_history import ChatMessageHistory
6+ from langchain_community . chat_message_histories import ChatMessageHistory
77from langchain_core .runnables .history import RunnableWithMessageHistory
88from langchain_openai import ChatOpenAI
99
2020 RevealSymbolTool ,
2121 SearchTool ,
2222 SemanticEditTool ,
23+ SemanticSearchTool ,
2324 ViewFileTool ,
2425)
2526
@@ -59,6 +60,7 @@ def create_codebase_agent(
5960 MoveSymbolTool (codebase ),
6061 RevealSymbolTool (codebase ),
6162 SemanticEditTool (codebase ),
63+ SemanticSearchTool (codebase ),
6264 CommitTool (codebase ),
6365 ]
6466
Original file line number Diff line number Diff line change @@ -312,20 +312,18 @@ def _run(
312312 return json .dumps (result , indent = 2 )
313313
314314
315+ class SemanticSearchInput (BaseModel ):
316+ query : str = Field (..., description = "The natural language search query" )
317+ k : int = Field (default = 5 , description = "Number of results to return" )
318+ preview_length : int = Field (default = 200 , description = "Length of content preview in characters" )
319+
320+
315321class SemanticSearchTool (BaseTool ):
316322 """Tool for semantic code search."""
317323
318324 name : ClassVar [str ] = "semantic_search"
319325 description : ClassVar [str ] = "Search the codebase using natural language queries and semantic similarity"
320- args_schema : ClassVar [type [BaseModel ]] = type (
321- "SemanticSearchInput" ,
322- (BaseModel ,),
323- {
324- "query" : (str , Field (..., description = "The natural language search query" )),
325- "k" : (int , Field (default = 5 , description = "Number of results to return" )),
326- "preview_length" : (int , Field (default = 200 , description = "Length of content preview in characters" )),
327- },
328- )
326+ args_schema : ClassVar [type [BaseModel ]] = SemanticSearchInput
329327 codebase : Codebase = Field (exclude = True )
330328
331329 def __init__ (self , codebase : Codebase ) -> None :
You can’t perform that action at this time.
0 commit comments