Custom Agent executor error
else:
print("TOOL NAME : ", output.tool)
print("TOOL INPUT : ", output.tool_input)
Traceback (most recent call last):
File "/Users/chaejinjeong/Desktop/myGit/Study/langchain/inflearn/5.Agent/basic.py", line 75, in <module>
print("TOOL NAME : ", output.tool)output : [OpenAIToolAgentAction(tool='get_word_length', tool_input={'word': 'eudca'}, log="\nInvoking: `get_word_length` with `{'word': 'eudca'}`\n\n\n", message_log=[AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_DlTa5qRanu9HhiWGneMz2V3C', 'function': {'arguments': '{"word":"eudca"}', 'name': 'get_word_length'}, 'type': 'function'}]})], tool_call_id='call_DlTa5qRanu9HhiWGneMz2V3C')], <class 'list'>output.tool 이라는 속성이 없어서 print 해보니 AgentAction List 형태로 출력이 되었습니다.
intermediate_steps = []
final_result = dict()
while True:
query.update({"intermediate_steps": intermediate_steps})
output: Union[AgentFinish, AgentAction] = agent.invoke(query)
if isinstance(output, AgentFinish):
final_result = output.return_values
final_result = final_result.get("output")
break
else:
if isinstance(output, list):
output = output[0]
print("TOOL NAME : ", output.tool)
print("TOOL INPUT : ", output.tool_input)
_tool = tools.get(output.tool)
observation = _tool.run(output.tool_input)
intermediate_steps.append((output, observation))
TOOL NAME : get_word_length
TOOL INPUT : {'word': 'eudca'}위처럼 인덱스 0으로 접근해서 처리해야할 것 같아 글 남깁니다.
Answer 2
1
안녕하세요 정채진님,
이상하네요. 저는 코드가 아무 문제 없이 돌아가는데요? AgentFinish의 인스턴스가 아닌 경우, 아래와 같이 output을 확인했지만 tool과 tool_input 모두 존재하고 있었습니다.

tool='get_word_length' tool_input={'word': 'educa'} log="\nInvoking: `get_word_length` with `{'word': 'educa'}`\n\n\n" message_log=[AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{"word":"educa"}', 'name': 'get_word_length'}})]혹시 에러가 나시는 분들은 output을 확인하시고 정채진님처럼 하시는 것도 좋은 방법인 것 같습니다.
마크다운을 텍스트 파일로 변환하기
0
10
1
18강 smithery 를 이용한 mcp 실습(업데이트 요청)
0
17
1
guardrails 부분도 현재버전과 약간 다릅니다.
0
18
1
smithery ai 언제 업데이트 되나요?
0
17
1
가상환경 생성 필요한가요?
0
24
1
무료할당량 사용하는데 문제가 생겼습니다.
0
21
1
섹션2-11 내용중 tool_call
0
25
2
제공해준 자료가 압축해제되지 않습니다.
0
33
2
max token을 제한하는게 왜 성능을 개선하게 되는걸까요?
0
41
2
20강에서 파인튜닝 때 사용한 데이터가 없어졌습니다. LoRA Trainer 매개변수도 라이브러리 업그레이드로 수정되었습니다.
0
20
1
n8n으로 context를 고려한 이메일 답장 드래프트 작성 봇 생성 강의
0
42
2
강의자료 오류
0
43
1
섹션 10에 수업 자료 링크가 없네요
0
75
3
100% 수강 완료가 되지 않아요
0
71
1
100% 수강 완료가 되지 않아 문의드립니다.
0
118
4
MCP 서버 관련 질문이있습니다.
0
164
2
랭체인 외부 인터넷 사용 관련
0
211
1
summary buffer memory token_limit 질문
1
286
2
[공유] SQLDatabase를 에디터에서 인식하지 못한다면
1
293
1
ChatPromptTemplate.from_messages(("ai", ...)) 질문
1
399
1
chroma db import 가 업데이트된 것 같습니다.
1
504
1
CommonList output이 안되는데 무엇이 문제일까요 ?
1
263
2
Langchain version이 업데이트 되어서 코드를 수정해야할 것 같습니다.
1
1044
2
주어진 코드를 그대로 실행 해 보았는데 결과가 달라요
1
574
3

