Remove unnecessary issubclass check (#23455)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -5,14 +5,13 @@ from __future__ import annotations
|
|||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from core.model_manager import ModelInstance
|
from core.model_manager import ModelInstance
|
||||||
from core.model_runtime.model_providers.__base.tokenizers.gpt2_tokenzier import GPT2Tokenizer
|
from core.model_runtime.model_providers.__base.tokenizers.gpt2_tokenizer import GPT2Tokenizer
|
||||||
from core.rag.splitter.text_splitter import (
|
from core.rag.splitter.text_splitter import (
|
||||||
TS,
|
TS,
|
||||||
Collection,
|
Collection,
|
||||||
Literal,
|
Literal,
|
||||||
RecursiveCharacterTextSplitter,
|
RecursiveCharacterTextSplitter,
|
||||||
Set,
|
Set,
|
||||||
TokenTextSplitter,
|
|
||||||
Union,
|
Union,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -45,14 +44,6 @@ class EnhanceRecursiveCharacterTextSplitter(RecursiveCharacterTextSplitter):
|
|||||||
|
|
||||||
return [len(text) for text in texts]
|
return [len(text) for text in texts]
|
||||||
|
|
||||||
if issubclass(cls, TokenTextSplitter):
|
|
||||||
extra_kwargs = {
|
|
||||||
"model_name": embedding_model_instance.model if embedding_model_instance else "gpt2",
|
|
||||||
"allowed_special": allowed_special,
|
|
||||||
"disallowed_special": disallowed_special,
|
|
||||||
}
|
|
||||||
kwargs = {**kwargs, **extra_kwargs}
|
|
||||||
|
|
||||||
return cls(length_function=_character_encoder, **kwargs)
|
return cls(length_function=_character_encoder, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user