diff --git a/99-TEMPLATE/00-BASE-TEMPLATE-GUIDE.ipynb b/99-TEMPLATE/00-BASE-TEMPLATE-GUIDE.ipynb new file mode 100644 index 000000000..3de150ba0 --- /dev/null +++ b/99-TEMPLATE/00-BASE-TEMPLATE-GUIDE.ipynb @@ -0,0 +1,235 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "daf8602b", + "metadata": {}, + "source": [ + "## 작성 가이드 (작업 이후에 이 셀은 지우고 커밋)\n", + "\n", + "### 마크다운 문법 당부사항\n", + "- 강조는 \"**\"로 bold\n", + "- 변수, 함수, 모듈명 등은 backtick(\\`)으로\n", + "- 중요! backtick, bold 좌우에 1칸 space 꼭 띄우기\n", + " - 예시: 다음 단계에서는 \\*\\*쿼리 라우팅** 과 \\*\\*문서 평가** 를 수행합니다.\n", + "- 다음 줄 넘어갈 때 개행 2개 (enter키 두번!)\n", + "### 약어 공식표기명 사용\n", + "- e.g., Llama (O) LlaMa (X)\n", + "### 코드 주석 작성 가이드라인\n", + "- 주석은 상세히 달기\n", + "- 단, 매 Line마다 달면 역효과\n", + "### 데이터\n", + "- 데이터 경로는 항상 `data` 폴더 참조\n", + "- 데이터 저작권이 있는 경우 다운로드 받을 수 있는 링크와 설명을 포함 (data폴더에 포함 x)\n", + "### 이미지\n", + "- 이미지는 `assets` 폴더에 추가\n", + "- 마크다운 문법으로 이미지 경로 지정\n", + " - 예시: \\!\\[adaptive-rag](./assets/langgraph-adaptive-rag.png)\n", + "- 이미지 파일명\n", + " - 모두 **영문 소문자** 로 작성\n", + " - 공백이 없어야 하며 공백 대신 `-` 하이픈으로 대체\n", + " - jupyter notebook 파일명 + 이미지 제목 + 필요시 숫자 (01, 02, 03, ...)\n", + " - 예시: `10-LangGraph-Self-RAG.ipynb` 인 경우\n", + " ```\n", + " 이미지 파일명: \n", + " - `10-langgraph-self-rag-flow-explanation.png` : OK\n", + " - `10-langgraph-self-rag-flow-explanation-01.png`: OK\n", + " - `10-langgraph-self-rag-flow-explanation-02.png`: OK\n", + " ```\n", + "### Jupyter Notebook 출력\n", + "- 출력이 전부 나온 상태 그대로 commit\n", + "### pip usage\n", + "- 환경설정 / 패키지 설치 가이드의 pip command는 꼭 `!pip`가 아닌 `%pip`로\n", + "### Anchor 관련 가이드\n", + "- 목차에 들어가는 anchor는 각 헤딩에 정확히 일치하는 text를 #기호 다음 모두 소문자로, 대시는 하나만 사용\n", + "- 예시: `#environment-setup`\n", + "- 잘못된 예시: `#Environment-Setup`, `#environment--setup`\n", + "- 참고: [깃헙 docs에서 Section links](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links)\n", + "\n", + "---\n", + "*(작업 가이드 끝. 작업이 끝나면 이 셀 지우고 커밋!)*\n", + "\n", + "*(⬇️⬇️아래부터 튜토리얼 작성 시작⬇️⬇️)*" + ] + }, + { + "cell_type": "markdown", + "id": "635d8ebb", + "metadata": {}, + "source": [ + "# Title \n", + "\n", + "*(`Author`에 본인 이름과 깃헙 링크 채우기, `Design`은 디자인팀 협업이 있을 경우만 작성, `Peer Review` `Colab&Github Badge` 는 개인 작성없이 일괄 처리)*\n", + "*(내용 작성 후 지우기)*\n", + "\n", + "- Author: [your_name](github_link)\n", + "- Design: \n", + "- Peer Review: \n", + "- This is a part of [LangChain Open Tutorial](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial)\n", + "\n", + "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/LangChain-OpenTutorial/LangChain-OpenTutorial/blob/main/99-TEMPLATE/00-BASE-TEMPLATE-EXAMPLE.ipynb) [![Open in GitHub](https://img.shields.io/badge/Open%20in%20GitHub-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial/blob/main/99-TEMPLATE/00-BASE-TEMPLATE-EXAMPLE.ipynb)\n", + "\n", + "## Overview\n", + "\n", + "*(튜토리얼의 목적 / 주로 다루는 내용을 언급하기, 최소 3 문장 이상 기입을 권장)*\n", + "*(내용 작성 후 지우기)*\n", + "\n", + "...\n", + "\n", + "### Table of Contents\n", + "\n", + "*(이 튜토리얼의 목차, anchor가 달린 링크 형식의 불렛포인트, anchor에 대문자 넣지 않기, dash \"-\" 는 하나만)*\n", + "*(내용 작성 후 지우기)*\n", + "\n", + "- [Overview](#overview)\n", + "- [Environment Setup](#environment-setup)\n", + "- [...](#...)\n", + "\n", + "### References\n", + "\n", + "*(사용한 모든 출처 및 패키지 API Reference 남기기. References 아래에는 \"---\"으로 글 맺기)*\n", + "*(내용 작성 후 지우기)*\n", + "\n", + "- [LangChain](https://blog.langchain.dev/)\n", + "- [...](...)\n", + "----" + ] + }, + { + "cell_type": "markdown", + "id": "c6c7aba4", + "metadata": {}, + "source": [ + "## Environment Setup\n", + "\n", + "Setting up your environment is the first step. See the [Environment Setup](https://wikidocs.net/257836) guide for more details.\n", + "\n", + "\n", + "**[Note]**\n", + "\n", + "The langchain-opentutorial is a package of easy-to-use environment setup guidance, useful functions and utilities for tutorials.\n", + "Check out the [`langchain-opentutorial`](https://github.com/LangChain-OpenTutorial/langchain-opentutorial-pypi) for more details." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "21943adb", + "metadata": {}, + "outputs": [], + "source": [ + "%%capture --no-stderr\n", + "%pip install langchain-opentutorial" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "f25ec196", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n" + ] + } + ], + "source": [ + "# Install required packages\n", + "from langchain_opentutorial import package\n", + "\n", + "package.install(\n", + " [\n", + " \"langsmith\",\n", + " \"langchain\",\n", + " \"langchain_core\",\n", + " \"langchain-anthropic\",\n", + " \"langchain_community\",\n", + " \"langchain_text_splitters\",\n", + " \"langchain_openai\",\n", + " ],\n", + " verbose=False,\n", + " upgrade=False,\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "690a9ae0", + "metadata": {}, + "source": [ + "You can set API keys in a `.env` file or set them manually.\n", + "\n", + "[Note] If you’re not using the `.env` file, no worries! Just enter the keys directly in the cell below, and you’re good to go." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "327c2c7c", + "metadata": {}, + "outputs": [], + "source": [ + "from dotenv import load_dotenv\n", + "from langchain_opentutorial import set_env\n", + "\n", + "# Attempt to load environment variables from a .env file; if unsuccessful, set them manually.\n", + "if not load_dotenv():\n", + " set_env(\n", + " {\n", + " \"OPENAI_API_KEY\": \"\",\n", + " \"LANGCHAIN_API_KEY\": \"\",\n", + " \"LANGCHAIN_TRACING_V2\": \"true\",\n", + " \"LANGCHAIN_ENDPOINT\": \"https://api.smith.langchain.com\",\n", + " \"LANGCHAIN_PROJECT\": \"\", # set the project name same as the title\n", + " }\n", + " )" + ] + }, + { + "cell_type": "markdown", + "id": "aa00c3f4", + "metadata": {}, + "source": [ + "## 소제목\n", + "\n", + "### 소제목의 하위 카테고리\n", + "\n", + "*(### 3개 까지만 사용. 그 이상은 사용 x)*" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "69cb77da", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "langchain-kr-lwwSZlnu-py3.11", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/99-TEMPLATE/00-BASE-TEMPLATE.ipynb b/99-TEMPLATE/00-BASE-TEMPLATE.ipynb new file mode 100644 index 000000000..eff106f75 --- /dev/null +++ b/99-TEMPLATE/00-BASE-TEMPLATE.ipynb @@ -0,0 +1,171 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "635d8ebb", + "metadata": {}, + "source": [ + "# Title \n", + "\n", + "- Author: [your_name](github_link)\n", + "- Design: \n", + "- Peer Review: \n", + "- This is a part of [LangChain Open Tutorial](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial)\n", + "\n", + "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/LangChain-OpenTutorial/LangChain-OpenTutorial/blob/main/99-TEMPLATE/00-BASE-TEMPLATE-EXAMPLE.ipynb) [![Open in GitHub](https://img.shields.io/badge/Open%20in%20GitHub-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial/blob/main/99-TEMPLATE/00-BASE-TEMPLATE-EXAMPLE.ipynb)\n", + "\n", + "## Overview\n", + "\n", + "...\n", + "\n", + "### Table of Contents\n", + "\n", + "- [Overview](#overview)\n", + "- [Environment Setup](#environment-setup)\n", + "- [...](#...)\n", + "\n", + "### References\n", + "\n", + "- [LangChain](https://blog.langchain.dev/)\n", + "- [...](...)\n", + "----" + ] + }, + { + "cell_type": "markdown", + "id": "c6c7aba4", + "metadata": {}, + "source": [ + "## Environment Setup\n", + "\n", + "Setting up your environment is the first step. See the [Environment Setup](https://wikidocs.net/257836) guide for more details.\n", + "\n", + "\n", + "**[Note]**\n", + "\n", + "The langchain-opentutorial is a package of easy-to-use environment setup guidance, useful functions and utilities for tutorials.\n", + "Check out the [`langchain-opentutorial`](https://github.com/LangChain-OpenTutorial/langchain-opentutorial-pypi) for more details." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "21943adb", + "metadata": {}, + "outputs": [], + "source": [ + "%%capture --no-stderr\n", + "%pip install langchain-opentutorial" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "f25ec196", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n" + ] + } + ], + "source": [ + "# Install required packages\n", + "from langchain_opentutorial import package\n", + "\n", + "package.install(\n", + " [\n", + " \"langsmith\",\n", + " \"langchain\",\n", + " \"langchain_core\",\n", + " \"langchain-anthropic\",\n", + " \"langchain_community\",\n", + " \"langchain_text_splitters\",\n", + " \"langchain_openai\",\n", + " ],\n", + " verbose=False,\n", + " upgrade=False,\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "690a9ae0", + "metadata": {}, + "source": [ + "You can set API keys in a `.env` file or set them manually.\n", + "\n", + "[Note] If you’re not using the `.env` file, no worries! Just enter the keys directly in the cell below, and you’re good to go." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "327c2c7c", + "metadata": {}, + "outputs": [], + "source": [ + "from dotenv import load_dotenv\n", + "from langchain_opentutorial import set_env\n", + "\n", + "# Attempt to load environment variables from a .env file; if unsuccessful, set them manually.\n", + "if not load_dotenv():\n", + " set_env(\n", + " {\n", + " \"OPENAI_API_KEY\": \"\",\n", + " \"LANGCHAIN_API_KEY\": \"\",\n", + " \"LANGCHAIN_TRACING_V2\": \"true\",\n", + " \"LANGCHAIN_ENDPOINT\": \"https://api.smith.langchain.com\",\n", + " \"LANGCHAIN_PROJECT\": \"\", # set the project name same as the title\n", + " }\n", + " )" + ] + }, + { + "cell_type": "markdown", + "id": "aa00c3f4", + "metadata": {}, + "source": [ + "## 소제목\n", + "...\n", + "\n", + "### 소제목의 하위 카테고리\n", + "..." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "69cb77da", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "langchain-kr-lwwSZlnu-py3.11", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}