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.8.0.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.8.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llama_index_llms_langchain-0.8.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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.8.0.tar.gz
Algorithm Hash digest
SHA256 3642cb7ae840fdf6d440002df2d34064520b8ca030f26409610dd43fd435a450
MD5 d19a589afbe738e5a9897767bad6d380
BLAKE2b-256 635973ebaeafff73af902b821150fd4693515095bf0587fd9491dec91328253c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llama_index_llms_langchain-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a36d09193a720689143e91f0875e9ece81975d653b4d2036a00b34688b82b702
MD5 0eee0146e87312e424a89e3b040502ac
BLAKE2b-256 3334d6579b5a3535d02276a3e5bff976fb586592076a6d9ab718baa15af0ecc1

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