728x90
📚 오늘 공부한 내용
✅ 풀스택 GPT - #2 Introduction
✅ 풀스택 GPT - #3 Welcome To Langchain
✅ Python 가상환경 관련 블로그 글 작성하기
📡 새로 알게 된 내용
- python-dotenv - Python-dotenv reads key-value pairs from a .env file and can set them as environment variables. (출처: https://pypi.org/project/python-dotenv/)
- flask 사용할 때 제대로 모르고 그냥 썼는데, 좀 알아봤다. 말그래도 점(dot)env 라는 라이브러리로 os 와 같이 사용한다. os는 운영체제와 상호작용한다. 하지만 .env 파일에 접근하는 것은 불가능하다는 한계가 있다. 그래서 dotenv를 사용해 .env 파일에 정의된 키-값 쌍을 읽어서 os.environ에 자동으로 로드하여 사용한다.
import os
from dotenv import load_dotenv
# .env 파일에서 환경 변수 로드
load_dotenv()
# 환경 변수 가져오기
value = os.getenv("MY_ENV_VAR")
print(value) # "my_value"
Langchain
- llm, chat_model 를 사용할 수 있는데, chat_model이 chat에 더 특화되어 있음.
- 공식 langchain 문서에는 llm을 older forms of language models that take a string in and output a string 라고 정의해 놨다.
- temperature : 높으면 창의적이고 다양한 답변을 제공하고 낮으면 좀 더 focused and conservative한 답변을 제공한다.
- Schema : AI 에게 사전 정보를 제공하여 더 맥락에 맞는 답변을 유도할 수 있도록 도움을 주는 모듈
- HumanMessage: 원래 chatgpt한테 넣는 Prompt 내용
- AIMessage: AI 에서 이전 맥락을 제시하거나 정보를 제시하여 더 정확한 답변을 낼 수 있도록 도움을 줌, 메모리를 추가하는 것
- SystemMessage: AI 에게 역할을 제시하는 부분
- PromptTemplate, ChatPromptTemplate 를 사용하면 format 를 사용하여 변수로 설정해 둘 수 있다.
- PromptTemplate은 plainText만 필요한 경우에 사용하면 되고, 역할을 지정하여 답변을 받고 싶으면 ChatPromptTemplate을 사용하면 된다.
template = PromptTemplate.from_template(
"What is the distance between {country_a} and {country_b}",
)
prompt = template.format(country_a="Mexico", country_b="Thailand")
template = ChatPromptTemplate.from_messages(
[
("system", "You are a geography expert. And you only reply in {language}."),
("ai", "Ciao, mi chiamo {name}!"),
(
"human",
"What is the distance between {country_a} and {country_b}. Also, what is your name?",
),
]
)
prompt = template.format_messages(
language="Greek",
name="Socrates",
country_a="Mexico",
country_b="Thailand",
)
- chain - linux 의 pipe와 비슷한 것으로 input 내용을 어떤 과정을 통해 내놓길 바라는 지 정리해 둘 수 있다.
chain = template | chat | CommaOutputParser()
🎛️ GIT 기본 내용
- linux 기본 명령어 학습
- grep를 서버 log에서 무엇을 찾을 때 사용함
- git branch 의 기본
- git branch [new-branch]
- git checkout [new-branch]
- git checkout -b [new-branch] : git branch 와 git checkout을 동시에 할 수 있음
- git checkout -b hotfix/critical-bug main : main 에서 시작되는 새로운 branch hotfix/critical-bug 를 생성
- git merge [other-branch] : 지금 현재 있는 branch 로 other-branch merge
- git tag
- X.Y.Z - major, minor, patch 이렇게 3가지 요소들이 있다.
- X (Major): 주요 변경사항
- Y (Minor): 새로운 기능 추가
- Z (Patch): 버그 수정
- 예를들어, 1.0.0 ➡️ 2.0.0 이 되면 호환되지 않는 완전히 새로워진 버전라고 생각하면 된다.
- 1.0.0 ➡️ 1.1.0 이라면 새로운 기능이 추가되었다고 생각하면 된다.
- 1.0.0 ➡️ 1.0.1 이라면 버그 수정이 되었다고 생각하면 된다.
- git fetch 를 하면 가져오기만 하고 merge하는 과정은 따로 해야함
👻 오늘 하루 복기
오늘은 좀 슬픈 날이다... 세웠던 신년계획과 다짐이 상황에 의해 다 무너져 내린 상황.. 하지만 이겨낸다... 신년계획을 다시 짰다. 지피티 유료결제 한 김에 계획 짜달라고 했더니 하루 30시간인것처럼 짜줬다.. 다시 열심히 해야겠지. 내일부터 다시 화 이 팅😇
728x90
'TIL' 카테고리의 다른 글
TIL - Spring DI, Inversion of Control (1) | 2025.01.04 |
---|---|
TIL - 스프링, 자연어처리 (2) | 2025.01.03 |
데이터 베이스 관련 궁금증 정리 - redis, mysql, mariadb, nosql, rdms (0) | 2024.12.15 |
Flask SQLAlchemy ORM 개발시작 (0) | 2024.11.22 |
java sort comperator (1) | 2024.11.20 |