llama-index-llms-langchain


Namellama-index-llms-langchain JSON
Version 0.6.1 PyPI version JSON
download
home_pageNone
Summaryllama-index llms langchain integration
upload_time2025-03-18 21:41:49
maintainerNone
docs_urlNone
authorYour Name
requires_python<4.0,>=3.9
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.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/9a/7d/341b9dc778a688756c97c7490436105ddfac83bd397ba6b49d79978323e4/llama_index_llms_langchain-0.6.1.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.6.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "974ddeab35c0a36746f8aec280ca66cee1346db7fe7c4c0d8a8987f59a964cf3",
                "md5": "3a982903749da4a09e122c017ca125ae",
                "sha256": "dff4320c29f1f67d2775ba4727655684e0abf1f80a78c1ad99eac1a5cd17128d"
            },
            "downloads": -1,
            "filename": "llama_index_llms_langchain-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3a982903749da4a09e122c017ca125ae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 6088,
            "upload_time": "2025-03-18T21:41:48",
            "upload_time_iso_8601": "2025-03-18T21:41:48.013913Z",
            "url": "https://files.pythonhosted.org/packages/97/4d/deab35c0a36746f8aec280ca66cee1346db7fe7c4c0d8a8987f59a964cf3/llama_index_llms_langchain-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a7d341b9dc778a688756c97c7490436105ddfac83bd397ba6b49d79978323e4",
                "md5": "a25869b0793f77ced290819c1eacfc85",
                "sha256": "2284845ddd1f15500f9a0ec89f3b30f9c55d0c24f98ffc1c68f020f6028f8c10"
            },
            "downloads": -1,
            "filename": "llama_index_llms_langchain-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a25869b0793f77ced290819c1eacfc85",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 5247,
            "upload_time": "2025-03-18T21:41:49",
            "upload_time_iso_8601": "2025-03-18T21:41:49.135985Z",
            "url": "https://files.pythonhosted.org/packages/9a/7d/341b9dc778a688756c97c7490436105ddfac83bd397ba6b49d79978323e4/llama_index_llms_langchain-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-03-18 21:41:49",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-llms-langchain"
}
        
Elapsed time: 2.57877s