refactor: make litellm and litellmembedder consistent #1331
GitHub Actions / JUnit Test Report
failed
Mar 31, 2025 in 0s
455 tests run, 441 passed, 12 skipped, 2 failed.
Annotations
Check failure on line 23 in packages/ragbits-core/tests/unit/embeddings/test_from_config.py
github-actions / JUnit Test Report
test_from_config.test_subclass_from_config_litellm
TypeError: LiteLLMEmbedder.__init__() got an unexpected keyword argument 'model'
Raw output
def test_subclass_from_config_litellm():
config = ObjectConstructionConfig.model_validate(
{
"type": "ragbits.core.embeddings.litellm:LiteLLMEmbedder",
"config": {
"model": "some_model",
"default_options": {
"option1": "value1",
"option2": "value2",
},
},
}
)
> embedder: Embedder = Embedder.subclass_from_config(config)
packages/ragbits-core/tests/unit/embeddings/test_from_config.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
packages/ragbits-core/src/ragbits/core/utils/config_handling.py:108: in subclass_from_config
return subclass.from_config(config.config)
packages/ragbits-core/src/ragbits/core/embeddings/litellm.py:138: in from_config
return super().from_config(config)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'ragbits.core.embeddings.litellm.LiteLLMEmbedder'>
config = {'model': 'some_model'}
@classmethod
def from_config(cls, config: dict[str, Any]) -> Self:
"""
Initializes the class with the provided configuration.
Args:
config: A dictionary containing configuration details for the class.
Returns:
An instance of the class initialized with the provided configuration.
"""
default_options = config.pop("default_options", None)
options = cls.options_cls(**default_options) if default_options else None
> return cls(**config, default_options=options)
E TypeError: LiteLLMEmbedder.__init__() got an unexpected keyword argument 'model'
packages/ragbits-core/src/ragbits/core/utils/config_handling.py:210: TypeError
Check failure on line 91 in packages/ragbits-core/tests/unit/embeddings/test_from_config.py
github-actions / JUnit Test Report
test_from_config.test_from_config_with_router
TypeError: LiteLLMEmbedder.__init__() got an unexpected keyword argument 'model'
Raw output
def test_from_config_with_router():
config = ObjectConstructionConfig(
type="ragbits.core.embeddings.litellm:LiteLLMEmbedder",
config={
"model": "text-embedding-3-small",
"api_key": "test_api_key",
"router": [
{
"model_name": "small",
"litellm_params": {
"model": "text-embedding-3-small",
"dimensions": 3000,
"api_key": "test_api_key",
},
},
{
"model_name": "large",
"litellm_params": {
"model": "text-embedding-3-large",
"api_key": "test_api_key",
},
},
],
},
)
> embedder: Embedder = Embedder.subclass_from_config(config)
packages/ragbits-core/tests/unit/embeddings/test_from_config.py:91:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
packages/ragbits-core/src/ragbits/core/utils/config_handling.py:108: in subclass_from_config
return subclass.from_config(config.config)
packages/ragbits-core/src/ragbits/core/embeddings/litellm.py:138: in from_config
return super().from_config(config)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'ragbits.core.embeddings.litellm.LiteLLMEmbedder'>
config = {'api_key': 'test_api_key', 'model': 'text-embedding-3-small', 'router': <litellm.router.Router object at 0x7f92379d2480>}
@classmethod
def from_config(cls, config: dict[str, Any]) -> Self:
"""
Initializes the class with the provided configuration.
Args:
config: A dictionary containing configuration details for the class.
Returns:
An instance of the class initialized with the provided configuration.
"""
default_options = config.pop("default_options", None)
options = cls.options_cls(**default_options) if default_options else None
> return cls(**config, default_options=options)
E TypeError: LiteLLMEmbedder.__init__() got an unexpected keyword argument 'model'
packages/ragbits-core/src/ragbits/core/utils/config_handling.py:210: TypeError
Loading