LangChain Tutorial: Introduction
Welcome to this page, this is a series of tutorials to LangChain.
What is LangChain?¶
LangChain is an open-source framework for building applications using large language models (LLMs).
Why LangChain?¶
- Data-aware: LangChain applications can connect and interact with various data sources, including databases, APIs, and files, allowing them to incorporate and process external data.
- Agentic: LangChain applications are designed to interact with their environment, they can take actions based on inputs from users or other systems.
- Extensible: LangChain is built on a modular architecture, enabling users to extend and customise components to meet their specific use cases.
- Open-source: LangChain is an open-source project, with active support and contribution from its community.
Useful links and resources¶
Disclaimer: This exercise aims to cover the most representative scenarios and use cases. For more specific cases, make sure to check out the documents or source code linked above.
Set up¶
Before heading over the instructions and code examples, let's spend some time to make sure you have the appropriate setup. I will show you how to setup local environment with OpenAI, you can also refer to other sections of this repository if you were using other LLMs, such as Azure OpenAI, Vertex AI, etc.
Create and retrieve API key¶
First you need to create and retrieve your API key from OpenAI. Make sure to make a note of the API key after you have created a key.
Setup API key¶
Then insert the api key into .env
file using this command echo "OPENAI_API_KEY='your-api-key'" >> ~/.env
Install Python¶
As the instruction is written in Python, make sure you have Python setup, easiest way to get started is brew install python@3.10
.
Also note that, when the instruction starts with something like from langchain.schema import Document
, as you may not have langchain
installed locally yet, run pip install langchain
or pip install <missing package>
whenever you were prompted so by the compiler.
Final Thoughts¶
Now you've got the environment setup, head straight to Components where I will kick start by walking you through the fundamental building blocks of LangChain.
Checkout other learnings and resources I shared in my GitHub.
If you'd like to share your questions and feedback, or keen to get involved in building, you can reach out to me directly on Twitter and LinkedIn!
Comments
Post a Comment