Skip to content

Commit

Permalink
Merge pull request modelscope#8 from ZiTao-Li/zitao/dev_copilot
Browse files Browse the repository at this point in the history
fix langchain_rag.py
  • Loading branch information
ZiTao-Li authored Apr 28, 2024
2 parents 32adc04 + 3dc828e commit 130c235
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/agentscope/rag/langchain_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
TextSplitter = None
CharacterTextSplitter = None

from examples.conversation_with_RAG_agents.rag import RAGBase
from examples.conversation_with_RAG_agents.rag.rag import (
from agentscope.models import ModelWrapperBase
from .rag import RAGBase
from .rag import (
DEFAULT_CHUNK_OVERLAP,
DEFAULT_CHUNK_SIZE,
)
from agentscope.models import ModelWrapperBase


class _LangChainEmbModel(Embeddings):
Expand Down Expand Up @@ -133,7 +133,7 @@ def load_data(

def store_and_index(
self,
docs: Any,
docs_list: Any,
vector_store: Optional[VectorStore] = None,
splitter: Optional[TextSplitter] = None,
**kwargs: Any,
Expand All @@ -142,7 +142,7 @@ def store_and_index(
"""
Preprocessing the loaded documents.
Args:
docs (Any):
docs_list (Any):
documents to be processed
vector_store (Optional[VectorStore]):
vector store in LangChain RAG
Expand All @@ -167,7 +167,9 @@ def store_and_index(
DEFAULT_CHUNK_OVERLAP,
),
)
all_splits = self.splitter.split_documents(docs)
all_splits = []
for docs in docs_list:
all_splits = all_splits + self.splitter.split_documents(docs)

# indexing the chunks and store them into the vector store
if vector_store is None:
Expand Down

0 comments on commit 130c235

Please sign in to comment.