| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 29 |
| 30 | 31 |
- 오블완
- AI Agent
- LLM
- 에이전트
- 파워포인트) #집(zip)파일 #아래한글(HWP) #brute-force(무차별 대입)
- try / except / else / finally
- Agent Persistence
- agent history
- Agent class
- 엑셀
- AGENT.PY
- # 암호(비밀번호) 분실 # 암호(비밀번호) 찾기 #오피스(doc
- #선진국 대한민국 #선진국 #대한민국 #아이들 #청소년 #고민 #해결 #심리
- #다산 정약용 #유배지에서 보낸 편지 #도덕 #용기 #염 #주역 #호연지기 #효제 #근검
- 파이썬
- ppt) 파일 #오피스(워드
- MAIN.PY
- AI
- dictionary vs class
- pathlib.Path
- __repr()
- LLM.PY
- 티스토리챌린지
- 로그 파일(LOG FILE)
- TOOLS.PY
- 인공지능
- xls
- AI MODEL
- list comprehension
- JSON
- Today
- Total
목록전체 글 (168)
아톨러브
#-------- 1. tools.py 파일와 main.py 파일: main.py에서 tools 사용하기 # 파일1: tools.py def calculator(expr): return eval(expr) def word_count(text): return len(text.split()) REGISTRY = {"calculator":calculator, "word_count":word_count} # 파일2: main.py import tools from tools import REGISTRY, word_count print(tools.calculator("8*5")) print(word_count("에이전트는 루프입니다..
#-------- 1. Dictionary와 Class의 차이 # 다음과 같은 경우 딕셔너리를 사용하세요: # 단순히 데이터일 때 # JSON에 바로 전달할 때 # 별도의 규칙을 적용할 필요가 없을 때 # 다음과 같은 경우 클래스를 사용하세요: # 데이터와 동작이 함께 있어야 할 때 # 여러 개의 독립적인 복사본이 필요할 때 # 유효하지 않은 상태를 방지해야 할 때 #-------- 2. 첫 번째 Agent 클래스(Agent라는 새로운 자료형 만들기): __init__()와 self class Agent: def __init__(self, name, max_steps=5): ..
#-------- 1. 파일에 쓰고 읽기 with open("notes.txt", "w", encoding="utf-8") as f: f.write("에이전트 작동이 시작되었습니다. \n") f.write("tool: search \n") with open("notes.txt", "r", encoding="utf-8") as f: contents = f.read() print(contents) print("characters: ", len(contents)) #-------- 2. 로그 파일에 추가하기 with open("runlog.txt", "a", encoding="utf-8") as f: f.write("1단계..
#-------- 1. KeyError — 딕셔너리에 없는 키를 찾았을 때 # def get_units(record): # return record["units"] # get_units({"sku":"51001"}) # 결과: Exception has occurred: KeyError 'units' #-------- 2. try / except / else / finally def to_int(value): try: number = int(value) except ValueError: print(f" {value!r}을 숫자로 변환할 수 없습니다.") return None ..
#-------- 1. 함수의 기본값과 키워드 인수 def search(query, limit=3, safe=True): mode = "safe" if safe else "unfiltered" return f"searching '{query}' | limit={limit} | {mode}" print(search("환불정책")) print(search("환불정책", 10)) print(search("환불정책", limit=5, safe=False)) print(search(limit=1, query="환불정책")) #-------- 2. 함수 기본값의 함정 (mutable default) def add_bad(item, bucket=[])..
#-------- 1. history 순회 + range() history = [ {"role":"user","content":"제품번호 5001의 재고를 확인해라."}, {"role":"assistant", "content":"지금 찾아보고 있어요."}, {"role":"user", "content":"그 제품이 어느 창고로부터 배송되는지 확인해라."}, ] for message in history: print(f"{message['role']}: {message['content']}") print() for i in range(3): print(f"step {i}") #-------- 2. enumer..
