File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -281,16 +281,17 @@ def generate(
281281 documents : list [LlamaindexDocument ] | list [LangchainDocument ],
282282 test_size : int ,
283283 ) -> TestDataset :
284+ if not isinstance (documents [0 ], (LlamaindexDocument , LangchainDocument )):
285+ raise ValueError (
286+ "Testset Generatation only supports LlamaindexDocuments or LangchainDocuments" # noqa
287+ )
288+
284289 if isinstance (documents [0 ], LangchainDocument ):
285290 # cast to LangchainDocument since its the only case here
286291 documents = t .cast (list [LangchainDocument ], documents )
287292 documents = [
288293 LlamaindexDocument .from_langchain_format (doc ) for doc in documents
289294 ]
290- elif not isinstance (documents [0 ], LlamaindexDocument ):
291- raise ValueError (
292- "Testset Generatation only supports LlamaindexDocuments or LangchainDocuments" # noqa
293- )
294295 # Convert documents into nodes
295296 node_parser = SimpleNodeParser .from_defaults (
296297 chunk_size = self .chunk_size , chunk_overlap = 0 , include_metadata = True
You can’t perform that action at this time.
0 commit comments