https://github.com/deffstudio/langchain-exercises
LangChain Simple LLM Application This repository demonstrates how to build a simple LLM (Large Language Model) application using LangChain. The application translates text from English into another language using chat models and prompt templates. It includes examples of environment setup, etc.
https://github.com/deffstudio/langchain-exercises
langchain langchain-python llm openai
Last synced: about 2 months ago
JSON representation
LangChain Simple LLM Application This repository demonstrates how to build a simple LLM (Large Language Model) application using LangChain. The application translates text from English into another language using chat models and prompt templates. It includes examples of environment setup, etc.
- Host: GitHub
- URL: https://github.com/deffstudio/langchain-exercises
- Owner: deffstudio
- Created: 2024-12-25T06:59:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-13T17:12:23.000Z (over 1 year ago)
- Last Synced: 2025-02-17T21:46:27.513Z (over 1 year ago)
- Topics: langchain, langchain-python, llm, openai
- Language: Jupyter Notebook
- Homepage:
- Size: 2.15 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LangChain Exercises Collection
This repository contains a collection of exercises demonstrating various concepts and models using LangChain. Each exercise showcases different features and capabilities of LangChain, such as text translation, prompt templates, and streaming responses.
## Features
- **Environment Setup**: Load environment variables using `dotenv`.
- **Language Model Usage**: Utilize the `ChatOpenAI` model for text translation.
- **Prompt Templates**: Create and use prompt templates for structured input to the language model.
- **Streaming**: Stream responses from the language model.
## Getting Started
1. **Clone the repository**:
```sh
git clone https://github.com/deffstudio/langchain-exercises.git
cd langchain-exercises
```
2. **Install dependencies**:
```sh
pip install -r requirements.txt
```
3. **Set up environment variables**:
Create a `.env` file in the root directory and add your API keys:
```env
OPEN_API_KEY=your_openai_api_key
LANGCHAIN_API_KEY=your_langchain_api_key
```
4. **Run the Jupyter Notebook**:
```sh
jupyter notebook 1.simple_llm_app.ipynb
```
## Usage
- Follow the steps in the Jupyter Notebooks to learn how to use different language models and prompt templates.
- Modify the prompt templates and messages to customize the exercises for different use cases.
## License
This project is licensed under the MIT License.