Skip to main content

LlamaIndex Llms Integration: Langchain

Installation

  1. Install the required Python packages:

    %pip install llama-index-llms-langchain
    

Usage

Import Required Libraries

from langchain.llms import OpenAI
from llama_index.llms.langchain import LangChainLLM

Initialize LangChain LLM

To create an instance of LangChainLLM with OpenAI:

llm = LangChainLLM(llm=OpenAI())

Generate Streaming Response

To generate a streaming response, use the following code:

response_gen = llm.stream_complete("Hi this is")
for delta in response_gen:
    print(delta.delta, end="")

LLM Implementation example

https://docs.llamaindex.ai/en/stable/examples/llm/langchain/

Metadata

Release files for llama-index-llms-langchain 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-llms-langchain 0.10.0
File Size Uploaded Provenance Actions
llama_index_llms_langchain-0.10.0.tar.gz 6.1 kB Without provenance Details for llama_index_llms_langchain-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-llms-langchain 0.10.0
File Interpreter ABI Platform Actions
llama_index_llms_langchain-0.10.0-py3-none-any.whl Python 3 none any Details for llama_index_llms_langchain-0.10.0-py3-none-any.whl

Total release size: 12.2 kB

Release files / llama_index_llms_langchain-0.10.0.tar.gz

Download URL llama_index_llms_langchain-0.10.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6cbf389838f892199ec7bded60b40dea95f82c385e840f35505ec84655260ab1
BLAKE2b-256 checksum
How to use checksums
e6cc26ab692cb9a6a00d64521b0e357be230beaeec45afd5813b4bd52e359718
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_llms_langchain-0.10.0-py3-none-any.whl

Download URL llama_index_llms_langchain-0.10.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce392aa29848c9762756e3f72db2df7af58493a0dae8139f4d68dc8652b45df8
BLAKE2b-256 checksum
How to use checksums
15e264eb2a923a034915f5c470f6283876bef7417e0ec53b42cc571010e03c9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-llms-langchain 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page