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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file langchain_upstage-0.2.2.tar.gz
.
File metadata
- Download URL: langchain_upstage-0.2.2.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e72ba2dda23834792f144a8ac5c87d20cdcf0b5f4de3b9cc50a9a844202276bb |
|
MD5 | 1e9befc049ed90d71f844d50aaefc579 |
|
BLAKE2b-256 | 76f47351243c4f9f9815a4385900afe4b962c1588133425e8cdd89d52acf6b25 |
File details
Details for the file langchain_upstage-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: langchain_upstage-0.2.2-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8668ff097450da9aa8567d8118aeb511b43b1e2b2b150dd7486b0f9724741b6 |
|
MD5 | e6e1ca4df51e6f334b8ddf3def08ec7a |
|
BLAKE2b-256 | 188fe27edfbf39623683d1a86a73a769afcd870fce7a168120d48eccfadcd588 |