Thanks to visit codestin.com
Credit goes to github.com

Skip to content
1,133 changes: 1,133 additions & 0 deletions 99-TEMPLATE/English/00-BASE-TEMPLATE-EXAMPLE.ipynb

Large diffs are not rendered by default.

232 changes: 232 additions & 0 deletions 99-TEMPLATE/English/00-BASE-TEMPLATE-GUIDE.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "daf8602b",
"metadata": {},
"source": [
"## Housekeeping: How to Format Your Notebook \n",
"\n",
"This guide aims to provide insructions on how to format your notebooks before creating a pull request (PR).\n",
"\n",
"**[Keep it Clean - Ensure this guidance cell is deleted before your final PR]**\n",
"\n",
"\n",
"### Markdown Style\n",
"- For emphasis in text, use double asterisk (`**`) to apply **bold** formatting.\n",
"- For code-related elements, use backticks (` `). This includes variables, functions, and module names.\n",
"- For spacing, always add a single whitespace before and after asterisks (in **bold**) to ensure proper formatting during later GitBook conversion. See the following example: In the next step, we will perform \\*\\*query routing\\*\\* and \\*\\*document evaluation\\*\\* .\n",
"- To start a new paragraph, insert two newlines (press the Enter key twice!) to move to the next line.\n",
"\n",
"### Terminology\n",
"- Maintain consistency by using official terminology and abbreviations throughout your writing. For example, use \"Llama\" instead of \"LlaMa\" or \"Open AI\" instead of \"open ai\".\n",
"\n",
"### Comments for maximum readability\n",
"- Be kind and focus on adding self-explanatory comments.\n",
"- Please minimize comments to avoid simply restating what the code already clearly expresses. Comments that merely duplicate the code they describe are counterproductive.\n",
"\n",
"### Data\n",
"- Always refer to the `data` folder for the data path.\n",
"- If data is copyrighted or you are not sure, include a link and description to instruct how to download and import them on your notebook. (You should not include the data in the `data` folder without copyright clearance.)\n",
"\n",
"### Naming Conventions for Images\n",
"- You may want to add images in the `assets` folder.\n",
"- Specify image paths in your notebook cell using Markdown syntax. For example, `\\!\\[adaptive-rag](./assets/langgraph-adaptive-rag.png)`\n",
"- Use the following conventions for image file names:\n",
"- Use all **lowercase letters**.\n",
"- Replace spaces with hyphens (`-`). \n",
"- Use the Jupyter Notebook file name, followed by the image title, and add numbers (01, 02, ..., etc.) if necessary. For example, if the notebook file is `10-LangGraph-Self-RAG.ipynb`, and image file could be named as following examples:\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",
"### Notebook Output\n",
"- Include all all output. Ensure that the final version of your notebook all generated output from code execution.\n",
"\n",
"### Magic command\n",
"- Using `%pip` promotes consistency and avoids potential confusion or erros that might arise from using system-level installtions. Therefore, we don't recommed for package installation using `!pip` command.\n",
"\n",
"### TOC Anchor Links \n",
"- Anchors in the Table of Contents (TOC) should be exactly the same text as each heading, all lowercase letters after the # symbol, and only one dash. For example, `#environment-setup`, verifying fail for `#Environment-Setup` or `#environment--setup`.\n",
"- For more information on anchor links in GitHub documentation, check out the [Section links in GitHub docs](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",
"*Housekeeping Complete*\n",
"\n",
"You've reached the end of hosekeeping guide. A reminder, you can remove this cell before committing your final notebook.\n",
"\n",
"----\n",
"\n",
"*(⬇️⬇️ Now, let's begin crafting your tutorial by updating the \"Author\" section with your details ⬇️⬇️)*\n",
"\n",
"- `Author`: input your preferred name and any public profile link such as Github, LinkedIn or any other social media handles\n",
"- `Design`: leave it as empty. Fill in only if you have added an image or diagrams from your collaborators.\n",
"- `Peer Review`: leave it as empty, as this repository will apply the PR approvals details in this section.\n",
"- `Colab & Github Badge`: leave these sections blank; the badges will be handled by the infra team seperately once PR is merged to main"
]
},
{
"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",
"{Provide a brief overview of your tutorial what it aims to demonstrate and what key topics are. Describe the main goal you wish your reader to achieve at the end of the notebook. More than three sentences are recommended}\n",
"\n",
"### Table of Contents\n",
"\n",
"- [Overview](#overview)\n",
"- [Environment Setup](#environment-setup)\n",
"- [...](#...)\n",
"\n",
"### References\n",
"\n",
"{Cite all sources and package API references that you used in the notebook}\n",
"\n",
"- [LangChain](https://blog.langchain.dev/)\n",
"- [...](...)\n",
"\n",
"{Conclude the references section with a horizontal line using four dashes (`----`) to visually separate it from the rest of the content.}\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": [
"## Subheading\n",
"\n",
"### Subcategories of Subheadings\n",
"\n",
"{Limit the heading hierarchy to three levels (e.g., `#`, `##`, and `###`). Avoid using more than three levels of subheadings to maintain clarity and readability.}"
]
}
],
"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
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ At this base repository, it serves as a home for both beginners and seasoned Lan
1. **Open a Pull request (PR)**: Develop at least **one** existing or new content file (`.ipynb`). Optionally, add examples related to open LLMs. Then, Submit a PR with the developed content.
*- Note: Self-Check Before PR Submission (Recommended)*
- **License Compliance & Copyright Issues**: Verify that all dataset and content comply with licensing requirements. Confirm that there are no copyright infringements.
- **Template Compliance**: Follow the provided [templates](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial/tree/main/99-TEMPLATE)
- **Template Compliance**: Follow the provided templates in [Korean](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial/tree/main/99-TEMPLATE/Korean) or in [English](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial/tree/main/99-TEMPLATE/English)
- **Execution Platform**: Individual files should be executable on **Google Colab**.
- **Specifications Submission (if Required)**: If using open models or additional packages, specify the required environment to Infra Team.
2. **Team Peer Reviews**: Assign at least **two team members** as reviewers. Reviewers will evaluate the code and content quality and check tutorials are compatible with **Mac**, **Windows**, and **Linux** environments. **Approve** the Pull Request if there are no issues.
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ At this base repository, it serves as a home for both beginners and seasoned Lan
1. **Open a Pull request (PR)**: Develop at least **one** existing or new content file (`.ipynb`). Optionally, add examples related to open LLMs. Then, Submit a PR with the developed content.
*- Note: Self-Check Before PR Submission (Recommended)*
- **License Compliance & Copyright Issues**: Verify that all dataset and content comply with licensing requirements. Confirm that there are no copyright infringements.
- **Template Compliance**: Follow the provided [templates](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial/tree/main/99-TEMPLATE)
- **Template Compliance**: Follow the provided templates in [Korean](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial/tree/main/99-TEMPLATE/Korean) or in [English](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial/tree/main/99-TEMPLATE/English)
- **Execution Platform**: Individual files should be executable on **Google Colab**.
- **Specifications Submission (if Required)**: If using open models or additional packages, specify the required environment to Infra Team.
2. **Team Peer Reviews**: Assign at least **two team members** as reviewers. Reviewers will evaluate the code and content quality and check tutorials are compatible with **Mac**, **Windows**, and **Linux** environments. **Approve** the Pull Request if there are no issues.
Expand Down