VOOZH about

URL: https://www.geeksforgeeks.org/artificial-intelligence/langchain-apis-environment-setup/

⇱ LangChain APIs & Environment Setup - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

LangChain APIs & Environment Setup

Last Updated : 24 Oct, 2025

LangChain is transforming the way developers build applications with Large Language Models (LLMs). From chatbots to retrieval-augmented generation (RAG) pipelines, it allows us to seamlessly connect language models with external data and tools. LangChain is a framework designed to simplify the development of LLM-powered applications. Its key capabilities include:

  • LLM orchestration: Easily call multiple language models in a chain.
  • Data integration: Connect models to documents, APIs, databases and other data sources.
  • Agents & tools: Enable LLMs to perform actions such as web search, math calculation or API calls.
  • Vector stores & retrieval: Integrate embeddings and semantic search for RAG pipelines.
  • Observability: Trace LLM calls and monitor their outputs (LangSmith).
👁 langchain-key-components
LangChain Features

Let's see the various steps which should be considered to setup the environment for LangChain.

Step 1: Set Up Python Environment

We need to open command prompt and run the following commands,

We need to activate the environment,

1. For Windows(PowerShell):

2. For macOS/Linux:

Step 2: Upgrade pip

We need to upgrade pip,

Step 3: Install the Required Packages

We will install the necessary packages such as LangChain core, community modules and OpenAI integrations,

Step 4: Install Vector Database Dependencies

We will install vector database dependencies which can be used further.

Step 5: Configure API Keys

We need to add required API keys for our project, we need to store them in a .env file which should be stored in our project root directory.

Step 6: Loading API keys

We can access our API keys in our project, either of the API key can be accessed by commands:

Step 7: Initialize LLMs

We will prepare our LLMs with using the API keys,

1. OpenAI Example:

Output:

Response: LangChain is a decentralized language learning platform that uses blockchain technology to connect language learners with native speakers for personalized language exchange.

2. Gemini Example:

Output:

LangChain is a framework that enables developers to build applications powered by large language models by connecting them to external data, tools and memory.

Step 8: Vector Store Integration

We will now try to integrate vector store (Chroma),

Output:

Agents in LangChain can take actions based on tools.

LangChain connects LLMs with data sources.

The source code can be downloaded from here.

Applications

  • Chatbots & Virtual Assistants: Intelligent conversations and support.
  • RAG Systems: Semantic search over documents using vector stores.
  • Agents: Perform actions via tools and APIs.
  • Content Generation: Summaries, emails, reports or code.
  • Educational Tools: Learning assistants and tutors.
  • Data Analysis: Summarize and extract insights from large datasets.
Comment

Explore