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
13 changes: 5 additions & 8 deletions crawl4ai/adaptive_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,18 +630,15 @@ def __init__(self, embedding_model: str = None, llm_config: Union[LLMConfig, Dic
self._validation_embeddings_cache = None # Cache validation query embeddings
self._kb_similarity_threshold = 0.95 # Threshold for deduplication

def _get_embedding_llm_config_dict(self) -> Dict:
"""Get embedding LLM config as dict with fallback to default."""
def _get_embedding_llm_config_dict(self) -> Optional[Dict]:
"""Get embedding LLM config as dict, or None for local embeddings."""
if hasattr(self, 'config') and self.config:
config_dict = self.config._embedding_llm_config_dict
if config_dict:
return config_dict

# Fallback to default if no config provided
return {
'provider': 'openai/text-embedding-3-small',
'api_token': os.getenv('OPENAI_API_KEY')
}

# Return None to use local sentence-transformers embeddings
return None

async def _get_embeddings(self, texts: List[str]) -> Any:
"""Get embeddings using configured method"""
Expand Down