Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- jupyter notebook
- pmf
- 기본행연산
- 포아송분포
- 사조사
- 누적분포함수
- 이산확률질량함수
- 피어슨상관계수
- 통계학개론
- 범주형자료
- 행사다리꼴
- 기댓값과 분산
- 확률밀도함수
- 수치형자료
- 이변량자료
- 통계학입문
- 수학적확률
- 모수
- 표본공간
- 모평균
- 균일분포
- 베르누이분포
- 절삭평균
- 이산형
- 연속확률변수
- 첨가행렬
- Anaconda
- 표본평균
- 이항분포
- 조건부확률
Archives
- Today
- Total
Syeonny의 블로그
[Langchain] langchain 본문
Langchain이란 ?
LLM 개발을 중점으로 둔 프레임워크
사용 전
pip install langchain
코랩사용시 (!붙여서)
langchian 구성 시 프롬프트 설정 필요
프롬프트란? 요구사항, 작업을 정의하기 위해 만들어짐.
PromptTemplate을 가져와서 {변수}를 할당하며 초기화, 생성
prompt 생성됨. question이 prompt에 들어가 llm을 거쳐 답변을 사용자에게 알려줌.
from langchain import PromptTemplate
template = """Question: {question}
Answer: """
prompt = PromptTemplate(
template=template,
input_variables=['question']
)
question = "Which NFL team won the Super Bowl in the 2010 season?"
temperature
temperature은 값이 낮을수록 정확한 결과를 제시함. 0에서 2 사이의 값을 지정할 수 있으며, 일반적으로 0.5 ~ 1.0 사이의 값을 사용
동일한 PromptTemplate 객체로 여러 질문에 대해 답변도 가능하다. 딕셔너리 형태로
qs = [
{'question': "Which NFL team won the Super Bowl in the 2010 season?"},
{'question': "If I am 6 ft 4 inches, how tall am I in centimeters?"},
{'question': "Who was the 12th person on the moon?"},
{'question': "How many eyes does a blade of grass have?"}
]
res = llm_chain.generate(qs)
res
'langchain' 카테고리의 다른 글
[Langchain] AI agent (0) | 2024.09.04 |
---|---|
[Langchain] Retrieval Agents (0) | 2024.08.21 |
[Langchain] chain (0) | 2024.07.15 |
[Langchain] fewshot prompting (0) | 2024.07.15 |
[Langchain] OpenAI api key 발급받기 (0) | 2024.07.08 |