From a2f38935896877a80738fbba58f13fc8eff371b0 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Tue, 2 May 2023 11:03:42 -0400 Subject: [PATCH] Fix breaking change in langchain --- kor/extraction/api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kor/extraction/api.py b/kor/extraction/api.py index 1a3c72f..5b656b4 100644 --- a/kor/extraction/api.py +++ b/kor/extraction/api.py @@ -5,7 +5,11 @@ from langchain import PromptTemplate from langchain.chains import LLMChain from langchain.docstore.document import Document -from langchain.schema import BaseLanguageModel + +try: # Handle breaking change in langchain + from langchain.base_language import BaseLanguageModel +except ImportError: + from langchain.schema import BaseLanguageModel from kor.encoders import Encoder, InputFormatter, initialize_encoder from kor.extraction.typedefs import DocumentExtraction, Extraction