Skip to content

Commit

Permalink
Compatible with Langchain version 0.3.0 (#724)
Browse files Browse the repository at this point in the history
* Compatible with Langchain version 0.3.0

* Change clova default batch 8 to 5

* Change UpstageLayoutAnalysis to DocumentParse

* upgrade langchain-core version 0.3.0 at requirements.txt

* set limit batch size at clova.py
  • Loading branch information
bwook00 authored Sep 18, 2024
1 parent babb54c commit ce92a7e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion autorag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from llama_index.llms.ollama import Ollama
from llama_index.llms.openai import OpenAI
from llama_index.llms.openai_like import OpenAILike
from langchain.embeddings import OpenAIEmbeddings
from langchain_openai.embeddings import OpenAIEmbeddings
from rich.logging import RichHandler

version_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "VERSION")
Expand Down
4 changes: 2 additions & 2 deletions autorag/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
DirectoryLoader,
)
from langchain_unstructured import UnstructuredLoader
from langchain_upstage import UpstageLayoutAnalysisLoader
from langchain_upstage import UpstageDocumentParseLoader

from llama_index.core.node_parser import (
TokenTextSplitter,
Expand Down Expand Up @@ -56,7 +56,7 @@
# 6. All files
"directory": DirectoryLoader,
"unstructured": UnstructuredLoader,
"upstagelayoutanalysis": UpstageLayoutAnalysisLoader,
"upstagedocumentparse": UpstageDocumentParseLoader,
}

chunk_modules = {
Expand Down
4 changes: 3 additions & 1 deletion autorag/data/parse/clova.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def clova_ocr(
data_path_list: List[str],
url: Optional[str] = None,
api_key: Optional[str] = None,
batch: int = 8,
batch: int = 5,
table_detection: bool = False,
) -> Tuple[List[str], List[str], List[int]]:
"""
Expand Down Expand Up @@ -46,6 +46,8 @@ def clova_ocr(
"Please set the API key for Clova OCR in the environment variable CLOVA_API_KEY "
"or directly set it on the config YAML file."
)
if batch > 5:
raise ValueError("The batch size should be less than or equal to 5.")

image_data_lst = list(
map(lambda data_path: pdf_to_images(data_path), data_path_list)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ streamlit
gradio

### Langchain ###
langchain-core>=0.1.6
langchain-core>=0.3.0
langchain_unstructured
langchain-upstage

Expand Down

0 comments on commit ce92a7e

Please sign in to comment.