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

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/01-Basic/01-Getting-Started-Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ Download 64-bit Git for Windows Setup

Confirm options during installation and proceed

![](./assets/01-follow-the-installation-video-windows-02.png)
![](./img/01-follow-the-installation-video-windows-02.png)

Click the Next button for all the rest to proceed with the installation.

![](./assets/01-follow-the-installation-video-windows-03.png)
![](./img/01-follow-the-installation-video-windows-03.png)

Window key - PowerShell must be run as administrator

Expand All @@ -68,7 +68,7 @@ Enter the command "`git`" and verify that the output looks like the image below
git
```

![](./assets/01-follow-the-installation-video-windows-04.png)
![](./img/01-follow-the-installation-video-windows-04.png)


- Apply PowerShell Policy
Expand Down Expand Up @@ -109,7 +109,7 @@ Enter the following command to verify that it works.
pyenv
```

![](./assets/01-follow-the-installation-video-windows-05.png )
![](./img/01-follow-the-installation-video-windows-05.png )


- Install python
Expand Down Expand Up @@ -176,16 +176,16 @@ Install the downloaded Visual Studio Code (copy it to the Applications folder)

Click 'install' of Jupyter on left Menu of extensions

![](./assets/01-follow-the-installation-video-windows-06.png)
![](./img/01-follow-the-installation-video-windows-06.png)

## Install Jupyter Extension
Search for "python" and install

![](./assets/01-follow-the-installation-video-windows-07.png)
![](./img/01-follow-the-installation-video-windows-07.png)

Search for "jupyter" and install

![](./assets/01-follow-the-installation-video-windows-08.png)
![](./img/01-follow-the-installation-video-windows-08.png)

Turn off and restart Visual Studio Code

Expand Down
19 changes: 8 additions & 11 deletions docs/01-Basic/02-Getting-Started-Mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ This guide provides a comprehensive setup process tailored for developing with L
```

- Enter your account password when prompted.
<br>
![PasswordZ](assets/01-Follow-the-Installation-Video_Mac-01.png)
![PasswordZ](./img/01-Follow-the-Installation-Video_Mac-01.png)

- Press ENTER to proceed with the installation.

Expand All @@ -68,7 +67,7 @@ This guide provides a comprehensive setup process tailored for developing with L

whoami
```
![Jupyter Extension](assets/01-Follow-the-Installation-Video_Mac-02.png)
![Jupyter Extension](./img/01-Follow-the-Installation-Video_Mac-02.png)

- Check the installation path of Homebrew:
```bash
Expand Down Expand Up @@ -133,8 +132,7 @@ xcode-select --install
```bash
git clone https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial.git
```
![](assets/01-Follow-the-Installation-Video_Mac-03.png)

![](./img/01-Follow-the-Installation-Video_Mac-03.png)

- The repository will be cloned into a folder named LangChain-OpenTutorial within the selected directory.

Expand Down Expand Up @@ -239,16 +237,13 @@ For detailed documentation, refer to the [Poetry Official Documentation](https:/
- **Install Extensions**:
- Open Visual Studio Code.
- Click on the **Extensions** icon on the left sidebar.

![Extensions Icon](assets/01-Follow-the-Installation-Video_Mac-04.png)
![Extensions Icon](./img/01-Follow-the-Installation-Video_Mac-04.png)

- Search for **"python"** in the Extensions Marketplace and install it.

![Python Extension](assets/01-Follow-the-Installation-Video_Mac-05.png)
![Python Extension](./img/01-Follow-the-Installation-Video_Mac-05.png)

- Search for **"jupyter"** in the Extensions Marketplace and install it.

![Jupyter Extension](assets/01-Follow-the-Installation-Video_Mac-06.png)
![Jupyter Extension](./img/01-Follow-the-Installation-Video_Mac-06.png)

- **Restart Visual Studio Code**:
- After installing the extensions, restart Visual Studio Code to apply the changes.
Expand All @@ -263,3 +258,5 @@ For detailed documentation, refer to the [Poetry Official Documentation](https:/

Now, Visual Studio Code is fully set up and ready for development with Python and Jupyter support.



Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 11 additions & 19 deletions docs/03-OutputParser/05-PandasDataFrameOutputParser.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ To learn more about `pd.DataFrame` and its capabilities, visit one of Pandas off
- [Overview](#overview)
- [Environment Setup](#environment-setup)
- [Without model use](#without-model-use)
- [When input is `pd.DataFrame` or file](#when-input-is-pd.DataFrame-or-file)
- [Example of looking up a value for a column](#example-of-looking-up-a-value-for-a-column)
- [Example of a row lookup](#example-of-a-row-lookup)
- [Further Operations on Column](#further-operations-on-column)
- [With model](#with-model)

### References
Expand All @@ -75,16 +71,14 @@ Set up the environment. You may refer to [Environment Setup](https://wikidocs.ne
- `langchain-opentutorial` is a package that provides a set of easy-to-use environment setup, useful functions and utilities for tutorials.
- You can checkout the [`langchain-opentutorial`](https://github.com/LangChain-OpenTutorial/langchain-opentutorial-pypi) for more details.

## Without model use

```python
%%capture --no-stderr
!pip install langchain-opentutorial
%pip install langchain-opentutorial
```

```python
!pip install pprintpp
!pip install typing
%pip install pprintpp
%pip install typing
```

<pre class="custom">Collecting pprintpp
Expand Down Expand Up @@ -115,9 +109,9 @@ package.install(
)
```

<pre class="custom">ERROR: Could not find a version that satisfies the requirement pprint (from versions: none)
ERROR: No matching distribution found for pprint
</pre>
<pre class="custom">ERROR: Could not find a version that satisfies the requirement pprint (from versions: none)
ERROR: No matching distribution found for pprint
</pre>

```python
# Set environment variables
Expand Down Expand Up @@ -180,10 +174,8 @@ model = ChatOpenAI(temperature=0, model_name="gpt-4o-mini")
```

## Without model use

### When input is `pd.DataFrame` or file.

The `format_parser_output` function is used to convert parser output to dictionary format and format the output.
- The `format_parser_output` function is used to convert parser output to dictionary format and format the output.
- When input is `pd.DataFrame` or file.

```python
# Purpose: Only to print. It is a helper function.
Expand Down Expand Up @@ -397,7 +389,7 @@ print(parser.get_format_instructions())

</pre>

### Example of looking up a value for a column.
- Example of looking up a value for a column.

```python
print(df["GEO Region"].head())
Expand Down Expand Up @@ -448,7 +440,7 @@ format_parser_output(output)
4: 'Europe'}}
</pre>

### Example of a row lookup.
- Example of a row lookup.

```python
# Example of retrieving first row
Expand Down Expand Up @@ -484,7 +476,7 @@ format_parser_output(output)
'AM'}}
</pre>

### Further Operations on Column
- Further Operations on Column

```python
df["Passenger Count"].head(5)
Expand Down
4 changes: 2 additions & 2 deletions docs/04-Model/05-CheckTokenUsage.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ package.install(
```

<pre class="custom">
[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
</pre>

```python
Expand Down
4 changes: 2 additions & 2 deletions docs/04-Model/10-Ollama.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ package.install(
```

<pre class="custom">
[notice] A new release of pip is available: 24.1 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
[notice] A new release of pip is available: 24.1 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
</pre>

```python
Expand Down
44 changes: 20 additions & 24 deletions docs/05-Memory/01-ConversationBufferMemory.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,27 @@ pre {
# ConversationBufferMemory

- Author: [Sungchul Kim](https://github.com/rlatjcj)
- Design: [Sungchul Kim](https://github.com/rlatjcj)
- Peer Review : [Shinar12](https://github.com/Shinar12), [BAEM1N](https://github.com/BAEM1N), [YellowGangneng](https://github.com/YellowGangneng)
- This is a part of [LangChain Open Tutorial](https://github.com/LangChain-OpenTutorial/LangChain-OpenTutorial)

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/LangChain-OpenTutorial/LangChain-OpenTutorial/blob/main/05-Memory/01-ConversationBufferMemory.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/05-Memory/01-ConversationBufferMemory.ipynb)

## Overview

This tutorial introduces the `ConversationBufferMemory` class, which is a memory class that stores conversation history in a buffer.
Usually, it doesn't need any additional processing, but sometimes it may be required, such as when the conversation history is too large to fit in the context window of the model.
In this tutorial, we will learn how to use the `ConversationBufferMemory` class to store and retrieve conversation history.
This tutorial introduces `ConversationBufferMemory`, a memory class that stores conversation history in a buffer.

Typically, no additional processing is required. Sometimes, however, it may be necessary when the conversation history exceeds the model's context window.

In this tutorial, we will learn how to use `ConversationBufferMemory` to store and retrieve conversation history.


### Table of Contents

- [Overview](#overview)
- [Environment Setup](#environment-setup)
- [Extract messages as strings](#extract-messages-as-strings)
- [Extract messages as `HumanMessage` and `AIMessage` objects](#extract-messages-as-humanmessage-and-aimessage-objects)
- [Apply to Chain](#apply-to-chain)
- [Extracting messages as strings](#extracting-messages-as-strings)
- [Extracting messages as HumanMessage and AIMessage objects](#extracting-messages-as-humanmessage-and-aimessage-objects)
- [Applying to a Chain](#applying-to-a-chain)

### References
- [LangChain: ConversationBufferMemory](https://python.langchain.com/api_reference/langchain/memory/langchain.memory.buffer.ConversationBufferMemory.html)
Expand All @@ -55,7 +56,7 @@ Set up the environment. You may refer to [Environment Setup](https://wikidocs.ne

```python
%%capture --no-stderr
!pip install langchain-opentutorial
%pip install langchain-opentutorial
```

```python
Expand Down Expand Up @@ -109,9 +110,9 @@ load_dotenv()



## Extract messages as strings
## Extracting messages as strings

This memory allows you to extract messages into a variable after storing them.
After storing conversation messages, this memory allows you to extract messages into a variable.


```python
Expand All @@ -136,10 +137,10 @@ memory

You can use the `save_context(inputs, outputs)` method to save conversation records.

- This method takes two arguments, `inputs` and `outputs`.
- `inputs` stores the user's input, and `outputs` stores the AI's output.
- Using this method saves the conversation record under the `history` key.
- Later, you can use the `load_memory_variables` method to check the saved conversation record.
- This method accepts two arguments, `inputs` and `outputs`.
- `inputs` stores the user's question, and `outputs` stores the AI's answer.
- The conversation record is stored internally under the `history` key.
- You can then use the `load_memory_variables` method to retrieve and inspect the saved conversation history.


```python
Expand All @@ -166,7 +167,7 @@ memory



The `load_memory_variables({})` function of memory returns the message history.
The `load_memory_variables({})` method of the memory object returns the complete message history as a string.

```python
# Check the message history stored in the 'history' key.
Expand Down Expand Up @@ -273,11 +274,10 @@ print(memory.load_memory_variables({})["history"])
AI: Yes, the account has been opened. Your account number and related information have been sent to the email you registered. If you need additional help, please contact us at any time. Thank you!
</pre>

## Extract messages as `HumanMessage` and `AIMessage` objects
## Extracting messages as `HumanMessage` and `AIMessage` objects

Setting `return_messages=True` returns `HumanMessage` and `AIMessage` objects.


```python
memory = ConversationBufferMemory(return_messages=True)

Expand Down Expand Up @@ -326,9 +326,9 @@ memory.load_memory_variables({})["history"]



## Apply to Chain
## Applying to a Chain

Let's apply the `ConversationBufferMemory` to the `ConversationChain`.
Let's apply `ConversationBufferMemory` to a `ConversationChain`.

```python
from langchain_openai import ChatOpenAI
Expand Down Expand Up @@ -386,7 +386,7 @@ print(response)
If you have any specific questions about a particular bank or need further assistance, feel free to ask!
</pre>

Check if the previous conversation history is being remembered.
Verify if the system remembers the previous conversation.

```python
# Send a request to summarize the previous conversation in bullet points.
Expand All @@ -406,7 +406,3 @@ print(response)
- **Receive Confirmation**: Get account number and online banking details.
- **Set Up Online Banking**: Manage your account online for transactions and bill payments.
</pre>

```python

```
4 changes: 2 additions & 2 deletions docs/05-Memory/06-ConversationSummaryMemory.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ package.install(
```

<pre class="custom">
[notice] A new release of pip is available: 24.0 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
[notice] A new release of pip is available: 24.0 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
</pre>

```python
Expand Down
Loading
Loading