llama-index-llms-langchain


Namellama-index-llms-langchain JSON
Version 0.4.2 PyPI version JSON
download
home_pageNone
Summaryllama-index llms langchain integration
upload_time2024-10-08 22:29:33
maintainerNone
docs_urlNone
authorYour Name
requires_python<4.0,>=3.8.1
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LlamaIndex Llms Integration: Langchain

## Installation

1. Install the required Python packages:

   ```bash
   %pip install llama-index-llms-langchain
   ```

## Usage

### Import Required Libraries

```python
from langchain.llms import OpenAI
from llama_index.llms.langchain import LangChainLLM
```

### Initialize LangChain LLM

To create an instance of `LangChainLLM` with OpenAI:

```python
llm = LangChainLLM(llm=OpenAI())
```

### Generate Streaming Response

To generate a streaming response, use the following code:

```python
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/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-llms-langchain",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8.1",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/c9/de/a17b506052497cc5e92ab925f31c7dbe08659af1371f3cb50348e0ec38dd/llama_index_llms_langchain-0.4.2.tar.gz",
    "platform": null,
    "description": "# LlamaIndex Llms Integration: Langchain\n\n## Installation\n\n1. Install the required Python packages:\n\n   ```bash\n   %pip install llama-index-llms-langchain\n   ```\n\n## Usage\n\n### Import Required Libraries\n\n```python\nfrom langchain.llms import OpenAI\nfrom llama_index.llms.langchain import LangChainLLM\n```\n\n### Initialize LangChain LLM\n\nTo create an instance of `LangChainLLM` with OpenAI:\n\n```python\nllm = LangChainLLM(llm=OpenAI())\n```\n\n### Generate Streaming Response\n\nTo generate a streaming response, use the following code:\n\n```python\nresponse_gen = llm.stream_complete(\"Hi this is\")\nfor delta in response_gen:\n    print(delta.delta, end=\"\")\n```\n\n### LLM Implementation example\n\nhttps://docs.llamaindex.ai/en/stable/examples/llm/langchain/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "llama-index llms langchain integration",
    "version": "0.4.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e6b7502cf122c7e4d12c80aeaca23f0209223c6208e33e3208f42f0607596e63",
                "md5": "ac95ebb05edc305e20e2a48076267209",
                "sha256": "f36e6d06f5e31b7e4b83ea89f32a39ce3648bb7228c5aaf49d8af91485dc2ee1"
            },
            "downloads": -1,
            "filename": "llama_index_llms_langchain-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ac95ebb05edc305e20e2a48076267209",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8.1",
            "size": 5196,
            "upload_time": "2024-10-08T22:29:32",
            "upload_time_iso_8601": "2024-10-08T22:29:32.655777Z",
            "url": "https://files.pythonhosted.org/packages/e6/b7/502cf122c7e4d12c80aeaca23f0209223c6208e33e3208f42f0607596e63/llama_index_llms_langchain-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c9dea17b506052497cc5e92ab925f31c7dbe08659af1371f3cb50348e0ec38dd",
                "md5": "da42ee578d6cd44fd9e3f255d098c9c6",
                "sha256": "4ddbf8495ad6cfda6c5899cdf1cffe25a3e8317ae2e4bb1c41db5d3e184ace44"
            },
            "downloads": -1,
            "filename": "llama_index_llms_langchain-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "da42ee578d6cd44fd9e3f255d098c9c6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8.1",
            "size": 4493,
            "upload_time": "2024-10-08T22:29:33",
            "upload_time_iso_8601": "2024-10-08T22:29:33.438299Z",
            "url": "https://files.pythonhosted.org/packages/c9/de/a17b506052497cc5e92ab925f31c7dbe08659af1371f3cb50348e0ec38dd/llama_index_llms_langchain-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-08 22:29:33",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-llms-langchain"
}
        
Elapsed time: 0.37010s