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.
- Environment Setup: Load environment variables using
dotenv. - Language Model Usage: Utilize the
ChatOpenAImodel for text translation. - Prompt Templates: Create and use prompt templates for structured input to the language model.
- Streaming: Stream responses from the language model.
-
Clone the repository:
git clone https://github.com/deffstudio/langchain-exercises.git cd langchain-exercises -
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in the root directory and add your API keys:OPEN_API_KEY=your_openai_api_key LANGCHAIN_API_KEY=your_langchain_api_key
-
Run the Jupyter Notebook:
jupyter notebook 1.simple_llm_app.ipynb
- 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.
This project is licensed under the MIT License.