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
File details
Details for the file llama_index_llms_langchain-0.5.0.tar.gz
.
File metadata
- Download URL: llama_index_llms_langchain-0.5.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7781510ff6179ad7ba5969d8803290e12ae55e6944ecd2d4b325caec270fb531 |
|
MD5 | d6577cfc62849e5978e758626ccd17ae |
|
BLAKE2b-256 | 5a5759d54fa492e5361b7521d248e4eee0cd252f47d4cb6ad391a285fe1e6f77 |
File details
Details for the file llama_index_llms_langchain-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_llms_langchain-0.5.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93e2d643f716eb840752a04a2b4e216627bb6b3a54fbae9e80db0b4b017e2c08 |
|
MD5 | 923de5b9139f6a1be9b092a6b9ddddde |
|
BLAKE2b-256 | 660e7b4ad3dd0879417765daa4e52563a8da53c9b197b4e9ea6d6144d5a9e2a1 |