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.1.tar.gz (6.0 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.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for llama_index_llms_langchain-0.7.1.tar.gz
Algorithm Hash digest
SHA256 b28ff406f2538ee833d7dee2d64973741895e5d092f6adc08ec5b77c6429e993
MD5 2e304e418311e56279e8a8d076ab5802
BLAKE2b-256 54592125b4efd3b92e81994f27071c4cd4c85a59b0dfc22fdd8547f01a08ff31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_llms_langchain-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eaf9b465d98d30d5a0fa1355d2538cd8d31d37ff78d59109997ad0905cb34ce5
MD5 c93f02befcb687c7f942509c4eb2e6d3
BLAKE2b-256 55c7783fd5d09fca9b292c02508d989373d0baf01f204687bbd0a50f01510a3a

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