# 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/5c/f2/4502adfcdafbbbabebc847785a162cc004c5c8ffd3e8981b8dd0abdda196/langchain_upstage-0.7.1.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.7.1",
"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": null,
"digests": {
"blake2b_256": "75d2ac2c25626ffea0d3045add65f96c77a7b408f0a4739cdd65787b0886d2ed",
"md5": "090e9f76762887935cd5a015dfd5a984",
"sha256": "ff58155f6f2f3017ea60bf92c31bf64a065bc9c8eaad16f0b3743bb44df50245"
},
"downloads": -1,
"filename": "langchain_upstage-0.7.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "090e9f76762887935cd5a015dfd5a984",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 20360,
"upload_time": "2025-07-30T00:28:55",
"upload_time_iso_8601": "2025-07-30T00:28:55.130870Z",
"url": "https://files.pythonhosted.org/packages/75/d2/ac2c25626ffea0d3045add65f96c77a7b408f0a4739cdd65787b0886d2ed/langchain_upstage-0.7.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5cf24502adfcdafbbbabebc847785a162cc004c5c8ffd3e8981b8dd0abdda196",
"md5": "30c5e87894f27821aeb6b5ea0db01bd0",
"sha256": "e7197ab22214c74bda8a7b996f483bf250f28956fcecd6f8132fc4ec10777fa3"
},
"downloads": -1,
"filename": "langchain_upstage-0.7.1.tar.gz",
"has_sig": false,
"md5_digest": "30c5e87894f27821aeb6b5ea0db01bd0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 17674,
"upload_time": "2025-07-30T00:28:56",
"upload_time_iso_8601": "2025-07-30T00:28:56.222084Z",
"url": "https://files.pythonhosted.org/packages/5c/f2/4502adfcdafbbbabebc847785a162cc004c5c8ffd3e8981b8dd0abdda196/langchain_upstage-0.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-30 00:28:56",
"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"
}