Skip to main content

llama-index llms langchain integration

Project description

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/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_llms_langchain-0.7.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_llms_langchain-0.7.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_llms_langchain-0.7.2.tar.gz.

File metadata

  • Download URL: llama_index_llms_langchain-0.7.2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_llms_langchain-0.7.2.tar.gz
Algorithm Hash digest
SHA256 86f2e5654c22d63dfaa94772569401d6148ef146bc04c427a5673503f23db00f
MD5 d2a1e5825e243dcc6b9498711d4f48ad
BLAKE2b-256 0bb987b76f270a424d07ed8e9524576136b9de675ad50f9da3c29708e5fbfbb2

See more details on using hashes here.

File details

Details for the file llama_index_llms_langchain-0.7.2-py3-none-any.whl.

File metadata

  • Download URL: llama_index_llms_langchain-0.7.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_llms_langchain-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4c8af654237b3a03f886b8effec2126d66d2b06c0352f6805ee6193d51c16aa3
MD5 43a184914f27d47a9ae2f36963ab7173
BLAKE2b-256 58fdbdd96add193bd8b7604edbedd94fd9c71e0ab66f70a85e7405f70d2138d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page