Skip to content

Conversation

@majiayu000
Copy link

Summary

Fixes #1658

The _get_embedding_llm_config_dict method was always returning a fallback OpenAI configuration when no embedding_llm_config was provided. This made local sentence-transformers embeddings unreachable when using AdaptiveCrawler.

List of files changed and why

  • crawl4ai/adaptive_crawler.py - Changed _get_embedding_llm_config_dict to return None instead of a fallback dict, allowing get_text_embeddings() to use the local sentence-transformers path when the user intends to use local embeddings
  • tests/unit/test_embedding_strategy_local.py - Added unit test to verify the fix

How Has This Been Tested?

  • Unit test verifies _get_embedding_llm_config_dict() returns None when no config provided
  • Test uses AST parsing to avoid import dependency issues

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added/updated unit tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Fixes unclecode#1658

The _get_embedding_llm_config_dict method was always returning a fallback
OpenAI configuration when no embedding_llm_config was provided. This made
local sentence-transformers embeddings unreachable when using AdaptiveCrawler.

Changed the method to return None instead of a fallback dict, allowing
get_text_embeddings() to use the local sentence-transformers path when
the user intends to use local embeddings.

Signed-off-by: majiayu000 <1835304752@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant