inflearn logo
강의

Course

Instructor

Silicon Valley Engineer's Guide to LangChain, LangGraph, and MCP

Learn about Agents

Custom Agent executor error

Resolved

450

joung65170555

33 asked

1

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'>
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'}

NLP openai 프롬프트엔지니어링 llm langchain

Answer 2

1

altoformula

안녕하세요 정채진님,

이상하네요. 저는 코드가 아무 문제 없이 돌아가는데요? AgentFinish의 인스턴스가 아닌 경우, 아래와 같이 output을 확인했지만 tool과 tool_input 모두 존재하고 있었습니다.

image

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

joung65170555

아하 저는 그냥 최신 버전으로 설치했는데 버저닝 문제였나보네요

감사합니다

클로드 데스크톱 강의에서 교안찾기

0

10

0

강의내용중에 CoT 부분

0

22

2

강의 내용중에 var

0

20

1

목차랑 내용이 전혀 다른데요

0

21

2

수강인증 수료배지 링크가 만료되었습니다.

0

31

1

4.2.2 ~ 10.3.2.1 강의 영상 안나옴

0

39

2

강의 교안 예시

0

26

1

완독 챌린지 도서 인정 방법에 대한 문의

0

52

2

햅틱? 백틱?

0

53

1

response api를 사용하는것과 codex, cluade code 에이전트를 사용하는것과의 차이

0

36

1

api응답내용이 한글이 아닌 다른 언어와 섞여서 나옴.

0

49

1

클로드코드 아이콘 화면 표시

0

37

1

섹션 10에 수업 자료 링크가 없네요

0

123

3

100% 수강 완료가 되지 않아요

0

107

1

100% 수강 완료가 되지 않아 문의드립니다.

0

205

4

MCP 서버 관련 질문이있습니다.

0

208

2

랭체인 외부 인터넷 사용 관련

0

255

1

summary buffer memory token_limit 질문

1

338

2

[공유] SQLDatabase를 에디터에서 인식하지 못한다면

1

325

1

ChatPromptTemplate.from_messages(("ai", ...)) 질문

1

445

1

chroma db import 가 업데이트된 것 같습니다.

1

541

1

CommonList output이 안되는데 무엇이 문제일까요 ?

1

313

2

Langchain version이 업데이트 되어서 코드를 수정해야할 것 같습니다.

1

1085

2

주어진 코드를 그대로 실행 해 보았는데 결과가 달라요

1

621

3