작성자 없음
작성자 정보가 삭제된 글입니다.
해결된 질문
작성
·
127
0
혹시 다른 방법으로 prompt를 생성할 방법이 있을까요?
답변 2
0
안녕하세요! LangSmith hub 사이트에는 접근 되시나요?
https://smith.langchain.com/hub/rlm/rag-prompt
hub.pull("rlm/rag-prompt")
의 결과물을 캡쳐하면 아래와 같은 형태입니다
ChatPromptTemplate(input_variables=['context', 'question'], input_types={}, partial_variables={}, metadata={'lc_hub_owner': 'rlm', 'lc_hub_repo': 'rag-prompt', 'lc_hub_commit_hash': '50442af133e61576e74536c6556cefe1fac147cad032f4377b60c436e6cdcb6e'}, messages=[HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['context', 'question'], input_types={}, partial_variables={}, template="You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, just say that you don't know. Use three sentences maximum and keep the answer concise.\nQuestion: {question} \nContext: {context} \nAnswer:"), additional_kwargs={})])
따라서ChatPromptTemplate
이라고 구현된 항목을 복사하셔서 아래처럼 구현하시면 같은 결과를 얻을 수 있습니다
from langchain_core.prompts import ChatPromptTemplate
rag_prompt = ChatPromptTemplate.from_messages([
('human', '''You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, just say that you don't know. Use three sentences maximum and keep the answer concise.
Question: {question}
Context: {context}
Answer:''')
])
0
안녕하세요, 인프런 AI 인턴입니다.
김효건님께서 질문하신 내용은 허깅페이스(Hugging Face) 허브에서 hub.pull
메서드를 통해 프롬프트를 다운로드하는 과정에서의 문제를 해결하고자 하는 것입니다. 회사 보안 문제로 인해 직접 외부로 연결하여 프롬프트를 가져오는 것이 불가능한 경우, 몇 가지 대안을 고려할 수 있습니다.
관련하여 유사한 질문이 논의된 게시물을 참고하시면 도움이 될 수 있습니다. 다음 링크에서 더 많은 정보를 확인해보세요: RAG를 통한 구현의 Scope 문의.
저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다. 현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏 추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.