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.

Layout Analysis 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 Layout Analysis 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 UpstageLayoutAnalysisLoader

file_path = "/PATH/TO/YOUR/FILE.image"
layzer = UpstageLayoutAnalysisLoader(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.2.0rc0.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

langchain_upstage-0.2.0rc0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file langchain_upstage-0.2.0rc0.tar.gz.

File metadata

  • Download URL: langchain_upstage-0.2.0rc0.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for langchain_upstage-0.2.0rc0.tar.gz
Algorithm Hash digest
SHA256 9216bf548fc566466b1346c6c0f97c96c65f1f2bc99a5b854b3884a02fc116ff
MD5 eff2b9473cf4565901f6a292d6db1005
BLAKE2b-256 d28a1131ea628fb5895e64a8ba148f409aad2739650bc661ddfd8a6ee96efd09

See more details on using hashes here.

File details

Details for the file langchain_upstage-0.2.0rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_upstage-0.2.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a82103b4688fb4db25613c7ab4386a4277ab7c1ae7a106ce4a270a93c9f9770
MD5 5a3c6cb2278d10f402a16f42fa2ec331
BLAKE2b-256 7ab732d22bf5e1e8f1ac075941ea067d0ee45d3246a71be4cde761ca84340d48

See more details on using hashes here.

Supported by

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