llama-index llms langchain integration
Project description
LlamaIndex Llms Integration: Langchain
Installation
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for llama_index_llms_langchain-0.4.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ddbf8495ad6cfda6c5899cdf1cffe25a3e8317ae2e4bb1c41db5d3e184ace44 |
|
MD5 | da42ee578d6cd44fd9e3f255d098c9c6 |
|
BLAKE2b-256 | c9dea17b506052497cc5e92ab925f31c7dbe08659af1371f3cb50348e0ec38dd |
Close
Hashes for llama_index_llms_langchain-0.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f36e6d06f5e31b7e4b83ea89f32a39ce3648bb7228c5aaf49d8af91485dc2ee1 |
|
MD5 | ac95ebb05edc305e20e2a48076267209 |
|
BLAKE2b-256 | e6b7502cf122c7e4d12c80aeaca23f0209223c6208e33e3208f42f0607596e63 |