inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

실리콘밸리 엔지니어와 함께하는 랭체인(LangChain)과 랭그래프(LangGraph) 그리고 MCP

Agents에 대해 알아보기

Custom Agent executor error

해결된 질문

473

정채진

작성한 질문수 33

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

답변 2

1

미쿡엔지니어

안녕하세요 정채진님,

이상하네요. 저는 코드가 아무 문제 없이 돌아가는데요? 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

정채진

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

감사합니다

수업진행 중 질문이 나오는 것에 대해서

0

12

1

새로운 세션에서 이전 세션의 context 활용

0

10

0

1-5와 1-6이 동일한 영상입니다. 1-6이 누락되었어여

0

30

1

LLM 관련해서 여쭙습니다.

1

30

1

클로드코드, 옵시디언을 사용해도 되나요

1

34

1

AWS 할인쿠폰 관련

0

36

2

마지막강에 자료를 제공해주신다고 했는데 자료가 없습니다.

0

31

1

40강 까지 들었는데 이후 강의는 언제쯤 업로드 되나요?

0

42

1

로컬 LLM 목적이 뚜렷할 때

0

41

1

[22강 4단계] 장중 두 종목 동시 수집 시 두 번째 종목의 호가 구독이 거부됩니다

0

45

1

09:07- 3. 1-2 유출은 어느 길로 나가는가

0

47

1

5분56초부터 7분쯤까지 화면입니다.2. 1-1 shadow AI란 무엇인가

0

45

1

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

0

128

3

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

0

125

1

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

0

250

4

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

0

218

2

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

0

271

1

summary buffer memory token_limit 질문

1

364

2

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

1

336

1

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

1

456

1

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

1

552

1

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

1

339

2

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

1

1100

2

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

1

640

3