Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ def __init__(self, embedding_function: Any) -> None:
self.embedding_function = embedding_function

# Store the class name for serialization
self._embedding_function_class = embedding_function.__class__.__name__
# Cache the static configuration dictionary for efficient get_config
class_name = embedding_function.__class__.__name__
# Precompute and store the config dictionary as it's static for the life of this instance
self._config: Dict[str, Any] = {
"embedding_function_class": class_name,
"note": "This is a placeholder config. You will need to recreate the langchain embedding function.",
}
self._embedding_function_class = class_name

def embed_documents(self, documents: Sequence[str]) -> List[List[float]]:
"""
Expand Down Expand Up @@ -144,10 +151,8 @@ def build_from_config(
)

def get_config(self) -> Dict[str, Any]:
return {
"embedding_function_class": self._embedding_function_class,
"note": "This is a placeholder config. You will need to recreate the langchain embedding function.",
}
# Return a reference to the pre-built config dictionary
return self._config

def validate_config_update(
self, old_config: Dict[str, Any], new_config: Dict[str, Any]
Expand Down