langchain-upstage


Namelangchain-upstage JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://github.com/langchain-ai/langchain-upstage
SummaryAn integration package connecting Upstage and LangChain
upload_time2025-01-10 17:09:41
maintainerNone
docs_urlNone
authorNone
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.
            # langchain-upstage

This package contains the LangChain integrations for [Upstage](https://upstage.ai) through their [APIs](https://developers.upstage.ai/docs/getting-started/models).

## Installation and Setup

- Install the LangChain partner package
```bash
pip install -U langchain-upstage
```

- Get an Upstage api key from [Upstage Console](https://console.upstage.ai/home) and set it as an environment variable (`UPSTAGE_API_KEY`)

## Chat Models

This package contains the `ChatUpstage` class, which is the recommended way to interface with Upstage models.

See a [usage example](https://python.langchain.com/docs/integrations/chat/upstage)

## Embeddings

See a [usage example](https://python.langchain.com/docs/integrations/text_embedding/upstage)

Use `solar-embedding-1-large` model for embeddings. Do not add suffixes such as `-query` or `-passage` to the model name.
`UpstageEmbeddings` will automatically add the suffixes based on the method called.

## Document Parse Loader

See a [usage example](https://python.langchain.com/v0.1/docs/integrations/document_loaders/upstage/)

The `use_ocr` option determines whether OCR will be used for text extraction from documents. If this option is not specified, the default policy of the [Upstage Document Parse API](https://console.upstage.ai/docs/capabilities/document-parse#request) service will be applied. When `use_ocr` is set to `True`, OCR is utilized to extract text. In the case of PDF documents, this involves converting the PDF into images before performing OCR. Conversely, if `use_ocr` is set to `False` for PDF documents, the text information embedded within the PDF is used directly. However, if the input document is not a PDF, such as an image, setting `use_ocr` to `False` will result in an error.

```python
from langchain_upstage import UpstageDocumentParseLoader

file_path = "/PATH/TO/YOUR/FILE.image"
layzer = UpstageDocumentParseLoader(file_path, split="page")

# For improved memory efficiency, consider using the lazy_load method to load documents page by page.
docs = layzer.load()  # or layzer.lazy_load()

for doc in docs[:3]:
    print(doc)
```

If you are a Windows user, please ensure that the [Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170) is installed before using the loader.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/langchain-ai/langchain-upstage",
    "name": "langchain-upstage",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/67/1a/2a45690ebf6742e0301deb813fab747cc5710c843df05ce25f2be899a6a5/langchain_upstage-0.6.0.tar.gz",
    "platform": null,
    "description": "# langchain-upstage\n\nThis package contains the LangChain integrations for [Upstage](https://upstage.ai) through their [APIs](https://developers.upstage.ai/docs/getting-started/models).\n\n## Installation and Setup\n\n- Install the LangChain partner package\n```bash\npip install -U langchain-upstage\n```\n\n- Get an Upstage api key from [Upstage Console](https://console.upstage.ai/home) and set it as an environment variable (`UPSTAGE_API_KEY`)\n\n## Chat Models\n\nThis package contains the `ChatUpstage` class, which is the recommended way to interface with Upstage models.\n\nSee a [usage example](https://python.langchain.com/docs/integrations/chat/upstage)\n\n## Embeddings\n\nSee a [usage example](https://python.langchain.com/docs/integrations/text_embedding/upstage)\n\nUse `solar-embedding-1-large` model for embeddings. Do not add suffixes such as `-query` or `-passage` to the model name.\n`UpstageEmbeddings` will automatically add the suffixes based on the method called.\n\n## Document Parse Loader\n\nSee a [usage example](https://python.langchain.com/v0.1/docs/integrations/document_loaders/upstage/)\n\nThe `use_ocr` option determines whether OCR will be used for text extraction from documents. If this option is not specified, the default policy of the [Upstage Document Parse API](https://console.upstage.ai/docs/capabilities/document-parse#request) service will be applied. When `use_ocr` is set to `True`, OCR is utilized to extract text. In the case of PDF documents, this involves converting the PDF into images before performing OCR. Conversely, if `use_ocr` is set to `False` for PDF documents, the text information embedded within the PDF is used directly. However, if the input document is not a PDF, such as an image, setting `use_ocr` to `False` will result in an error.\n\n```python\nfrom langchain_upstage import UpstageDocumentParseLoader\n\nfile_path = \"/PATH/TO/YOUR/FILE.image\"\nlayzer = UpstageDocumentParseLoader(file_path, split=\"page\")\n\n# For improved memory efficiency, consider using the lazy_load method to load documents page by page.\ndocs = layzer.load()  # or layzer.lazy_load()\n\nfor doc in docs[:3]:\n    print(doc)\n```\n\nIf you are a Windows user, please ensure that the [Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170) is installed before using the loader.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An integration package connecting Upstage and LangChain",
    "version": "0.6.0",
    "project_urls": {
        "Homepage": "https://github.com/langchain-ai/langchain-upstage",
        "Repository": "https://github.com/langchain-ai/langchain-upstage",
        "Source Code": "https://github.com/langchain-ai/langchain-upstage/tree/main/libs/upstage"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a17e92e13d282af23b28b2737201bcecf94c9b9a4f9c163d1c28cff50b5928b2",
                "md5": "d8d1736a0076204c06f776ba12da94cf",
                "sha256": "ac5e161d637f52f727c4790225ce548db4fca1200a6d8cf5c3fee76f81b2a84d"
            },
            "downloads": -1,
            "filename": "langchain_upstage-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d8d1736a0076204c06f776ba12da94cf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 20251,
            "upload_time": "2025-01-10T17:09:40",
            "upload_time_iso_8601": "2025-01-10T17:09:40.442909Z",
            "url": "https://files.pythonhosted.org/packages/a1/7e/92e13d282af23b28b2737201bcecf94c9b9a4f9c163d1c28cff50b5928b2/langchain_upstage-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "671a2a45690ebf6742e0301deb813fab747cc5710c843df05ce25f2be899a6a5",
                "md5": "0dea49170e30bd22c3492255c21ffcbf",
                "sha256": "83184a66e34964fb334f901927e3e4126d6ba90ea337a7aa9e22166989608441"
            },
            "downloads": -1,
            "filename": "langchain_upstage-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0dea49170e30bd22c3492255c21ffcbf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 17576,
            "upload_time": "2025-01-10T17:09:41",
            "upload_time_iso_8601": "2025-01-10T17:09:41.558258Z",
            "url": "https://files.pythonhosted.org/packages/67/1a/2a45690ebf6742e0301deb813fab747cc5710c843df05ce25f2be899a6a5/langchain_upstage-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-10 17:09:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "langchain-ai",
    "github_project": "langchain-upstage",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "langchain-upstage"
}
        
Elapsed time: 0.40159s