44,000원
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 해결됨실리콘밸리 엔지니어와 함께하는 랭체인(LangChain)
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으로 접근해서 처리해야할 것 같아 글 남깁니다.
- 해결됨실리콘밸리 엔지니어와 함께하는 랭체인(LangChain)
summary buffer memory token_limit 질문
token_limit 은 대화의 input, output set 개수 일까요 ?
- 해결됨실리콘밸리 엔지니어와 함께하는 랭체인(LangChain)
[공유] SQLDatabase를 에디터에서 인식하지 못한다면
from langchain_community.utilities import SQLDatabasefrom langchain_community.utilities.sql_database import SQLDatabasevscode 에서 extension이 SQLDatabase를 코드를 수행할때는 상관없는데, 에디터상에서 인지못하는 문제가 있었어요 그런데 sql_database라는 패키지명까지 붙이니 해결되었습니다
- 해결됨실리콘밸리 엔지니어와 함께하는 랭체인(LangChain)
ChatPromptTemplate.from_messages(("ai", ...)) 질문
ChatPromptTemplate.from_messages(("ai", ...))에서 system과 human은 Context와 Role을 주는 역할인지 알겠는데 ai는 어떤 역할인가요 ?
- 해결됨실리콘밸리 엔지니어와 함께하는 랭체인(LangChain)
chroma db import 가 업데이트된 것 같습니다.
from langchain_community.vectorstores.chroma import Chroma이렇게 되어야 Chroma를 vscode에서 인식하는 것 같습니다.
- 해결됨실리콘밸리 엔지니어와 함께하는 랭체인(LangChain)
CommonList output이 안되는데 무엇이 문제일까요 ?
from langchain.output_parsers import CommaSeparatedListOutputParserfrom langchain.prompts import PromptTemplate output_parser = CommaSeparatedListOutputParser() format_instructions = output_parser.get_format_instructions()print(f"instruction : {format_instructions}")# instruction : Your response should be a list of comma separated values, eg: `foo, bar, baz` prompt = PromptTemplate( template="List five {subject}.\n{format_instructions}", input_variables=["subject"], partial_variables={"format_instructions": format_instructions},) from langchain_openai import OpenAI llm = OpenAI(temperature=0) _input = prompt.format(subject="ice create flavors")output = llm.invoke(_input) print(output_parser.parse(output)) # ['1. Vanilla\n2. Chocolate\n3. Strawberry\n4. Mint\n5. Coffee']이렇게 작성했는데, Output이 ['1. Vanilla\n2. Chocolate\n3. Strawberry\n4. Mint\n5. Coffee'] 이렇게 나옵니다.. parser의 문제일까요 모델의 문제일까요 ?
- 해결됨실리콘밸리 엔지니어와 함께하는 랭체인(LangChain)
Langchain version이 업데이트 되어서 코드를 수정해야할 것 같습니다.
from langchain_openai import OpenAI llm = OpenAI(model="davinci-002")OpenAI 라이브러리 import 하는 방식과text-devinci-003 모델이 이제 서비스를 안하는 것 같습니다.위처럼하고 몇번 수행하니 같은 결과가 나왔습니다.
- 미해결실리콘밸리 엔지니어와 함께하는 랭체인(LangChain)
주어진 코드를 그대로 실행 해 보았는데 결과가 달라요
git에서 코드를 다운받아 영상에 올라온 대로 코드를 실행 해 보았는데 저는 결과가 다음과 같아요. Question: Who was the father of Mary Ball Washington?Are follow up questions needed here: Yes.Follow up: Who was the husband of Mary Ball Washington?Intermediate answer: The husband of Mary Ball Washington was Augustine Washington.Follow up: Who was the father of Augustine Washington?Intermediate answer: The father of Augustine Washington was Lawrence Washington.So the final answer is: Lawrence Washington 처음엔 계속 Are follow up questions needed here: 에서 답변이 No로 출력 되고 질의가 끝나다가, 계속 돌려보니까 저런 틀린 답변을 내주는데, 이건 모델을 잘못 선택하기 때문일까요? 모델 설정에 따로 건드린 것이 없어 자동으로 GPT3.5 Trubo를 선택하는데 해당 강의 촬영시점과 수강시점 간에 기본이 되는 모델이 바뀐걸까요? 왜 이렇게 되는걸까요? ㅜㅜ