Changed the way embedding model creation is handled in the AbstractGraph class. #135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now instead of using
self._create_llm()
method for both embedding models and LLMs and delegating the correct instantiation of embedding models to theRAGNode
class, there are two dedicated methods for creating embedding models and the logic is completely inside theAbstractGraph
class:self.create_default_embedder()
: This method handles the case where no embedding model is provided in the config. This will try to instantiate the proper embedding model based on the chosen LLM. Previously, this case was handled in theself.execute()
method in theRAGNode
class. I didn't change the code for this part (it's a copy-paste of the old code) so that it works just like it was previously.self.create_embedder()
: This method handles the case where an embedding model is explicitly provided in the config. It checks for the embedding model's name in the config and instantiates the proper embedding model. Code-wise it looks similar toself._create_llm()
.This pull request was created to address the issue that was discussed in #120