You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/partners/upstage
junkeon 4fda7bf4f2
upstage[patch] : fix error handling in Layout Analysis parser (#22054)
This pull request addresses and fixes exception handling in the
UpstageLayoutAnalysisParser and enhances the test coverage by adding
error exception tests for the document loader. These improvements ensure
robust error handling and increase the reliability of the system when
dealing with external API calls and JSON responses.

### Changes Made
1. Fix Request Exception Handling:

- Issue: The existing implementation of UpstageLayoutAnalysisParser did
not properly handle exceptions thrown by the requests library, which
could lead to unhandled exceptions and potential crashes.
- Solution: Added comprehensive exception handling for
requests.RequestException to catch any request-related errors. This
includes logging the error details and raising a ValueError with a
meaningful error message.

2. Add Error Exception Tests for Document Loader:

- New Tests: Introduced new test cases to verify the robustness of the
UpstageLayoutAnalysisLoader against various error scenarios. The tests
ensure that the loader gracefully handles:
- RequestException: Simulates network issues or invalid API requests to
ensure appropriate error handling and user feedback.
- JSONDecodeError: Simulates scenarios where the API response is not a
valid JSON, ensuring the system does not crash and provides clear error
messaging.
5 days ago
..
langchain_upstage upstage[patch] : fix error handling in Layout Analysis parser (#22054) 5 days ago
scripts upstage: init package (#20574) 1 month ago
tests upstage[patch] : fix error handling in Layout Analysis parser (#22054) 5 days ago
.gitignore upstage: init package (#20574) 1 month ago
LICENSE upstage: init package (#20574) 1 month ago
Makefile upstage: init package (#20574) 1 month ago
README.md partner-upstage[patch]: embeddings empty list bug (#22057) 5 days ago
poetry.lock partners: bump core in packages implementing ls_params (#21868) 1 week ago
pyproject.toml partners: bump core in packages implementing ls_params (#21868) 1 week ago

README.md

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.