Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Upgrade to LangChain 0.2 #997

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions code/backend/batch/utilities/document_loading/web.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import List
import re
from langchain.docstore.document import Document
from langchain_community.document_loaders import WebBaseLoader
from .document_loading_base import DocumentLoadingBase
from ..common.source_document import SourceDocument
Expand All @@ -11,7 +10,7 @@ def __init__(self) -> None:
super().__init__()

def load(self, document_url: str) -> List[SourceDocument]:
documents: List[Document] = WebBaseLoader(document_url).load()
documents = WebBaseLoader(document_url).load()
for document in documents:
document.page_content = re.sub("\n{3,}", "\n\n", document.page_content)
# Remove half non-ascii character from start/end of doc content
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from typing import Union
from langchain.vectorstores.azuresearch import AzureSearch
from langchain_community.vectorstores import AzureSearch
from azure.core.credentials import AzureKeyCredential
from azure.identity import DefaultAzureCredential
from azure.search.documents import SearchClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List
from langchain.docstore.document import Document

from ..common.source_document import SourceDocument
from ..document_chunking.chunking_strategy import ChunkingSettings, ChunkingStrategy
from ..document_chunking.strategies import get_document_chunker

Expand All @@ -12,8 +12,8 @@ def __init__(self) -> None:
pass

def chunk(
self, documents: List[Document], chunking: ChunkingSettings
) -> List[Document]:
self, documents: List[SourceDocument], chunking: ChunkingSettings
) -> List[SourceDocument]:
chunker = get_document_chunker(chunking.chunking_strategy.value)
if chunker is None:
raise Exception(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import List
from langchain.docstore.document import Document

from ..common.source_document import SourceDocument
from ..document_loading import LoadingSettings
from ..document_loading.strategies import get_document_loader

Expand All @@ -8,7 +9,7 @@ class DocumentLoading:
def __init__(self) -> None:
pass

def load(self, document_url: str, loading: LoadingSettings) -> List[Document]:
def load(self, document_url: str, loading: LoadingSettings) -> List[SourceDocument]:
loader = get_document_loader(loading.loading_strategy.value)
if loader is None:
raise Exception(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from langchain.agents import Tool
from langchain.memory import ConversationBufferMemory
from langchain.agents import ZeroShotAgent, AgentExecutor
from langchain.chains import LLMChain
from langchain.chains.llm import LLMChain
from langchain_community.callbacks import get_openai_callback

from .orchestrator_base import OrchestratorBase
Expand Down
49 changes: 24 additions & 25 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ azure-storage-blob = "12.20.0"
azure-identity = "1.16.0"
flask = {extras = ["async"], version = "^3.0.3"}
openai = "1.30.3"
langchain = "0.1.20"
langchain-community = "0.0.38"
langchain = "0.2.1"
langchain-community = "0.2.1"
langchain-openai = "0.1.7"
requests = "2.32.2"
tiktoken = "0.7.0"
Expand Down
Loading