Skip to main content

An integration package connecting Upstage and LangChain

Project description

langchain-upstage

This package contains the LangChain integrations for Upstage through their APIs.

Installation and Setup

  • Install the LangChain partner package
pip install -U langchain-upstage
  • Get an Upstage api key from Upstage Console 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

Embeddings

See a usage example

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

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 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.

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 is installed before using the loader.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_upstage-0.7.6.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_upstage-0.7.6-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file langchain_upstage-0.7.6.tar.gz.

File metadata

  • Download URL: langchain_upstage-0.7.6.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for langchain_upstage-0.7.6.tar.gz
Algorithm Hash digest
SHA256 2a20a648d7c4efb8cb864b5d3dfc8976a17d90abeafc27a8d6abca69ddec5463
MD5 d99b35eaf059a2b3f7580176ab5dd94a
BLAKE2b-256 4697cb35d6ce8dae89dccbd0b55b39a11954bf21401f10454c70f24f62787cfa

See more details on using hashes here.

File details

Details for the file langchain_upstage-0.7.6-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_upstage-0.7.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7459903794d14f7eca9a1d269cd18bc561aec8b084a80b33cffe5c1f64c06075
MD5 e105542aeff6c0e777ef06139a94472b
BLAKE2b-256 8e2691762251c81907994bee01d5f5f7659b1c019e869dd8a284ccdd5cc99042

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page