Skip to content

Commit

Permalink
set FunctionCallAgent::FunctionCall::LLM.used_by to FunctionCallAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyongchao committed Dec 2, 2024
1 parent b0e1bf9 commit 29a1fa4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lazyllm/tools/agent/functionCall.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ class FunctionCallAgent(ModuleBase):
def __init__(self, llm, tools: List[str], max_retries: int = 5, return_trace: bool = False, stream: bool = False):
super().__init__(return_trace=return_trace)
self._max_retries = max_retries
self._agent = loop(FunctionCall(llm, tools, return_trace=return_trace, stream=stream),
stop_condition=lambda x: isinstance(x, str), count=self._max_retries)
self._fc = FunctionCall(llm, tools, return_trace=return_trace, stream=stream)
self._agent = loop(self._fc, stop_condition=lambda x: isinstance(x, str), count=self._max_retries)
self._fc._llm.used_by(self._module_id)

def forward(self, query: str, llm_chat_history: List[Dict[str, Any]] = None):
ret = self._agent(query, llm_chat_history) if llm_chat_history is not None else self._agent(query)
Expand Down

0 comments on commit 29a1fa4

Please sign in to comment.