diff --git a/integrations/weaviate/src/haystack_integrations/document_stores/weaviate/document_store.py b/integrations/weaviate/src/haystack_integrations/document_stores/weaviate/document_store.py index ec66e07c3..1b6e95155 100644 --- a/integrations/weaviate/src/haystack_integrations/document_stores/weaviate/document_store.py +++ b/integrations/weaviate/src/haystack_integrations/document_stores/weaviate/document_store.py @@ -166,7 +166,9 @@ def __init__( } else: # Set the class if not set - collection_settings["class"] = collection_settings.get("class", "default").capitalize() + _class_name = collection_settings.get("class", "Default") + _class_name = _class_name[0].upper() + _class_name[1:] + collection_settings["class"] = _class_name # Set the properties if they're not set collection_settings["properties"] = collection_settings.get("properties", DOCUMENT_COLLECTION_PROPERTIES) diff --git a/integrations/weaviate/tests/test_document_store.py b/integrations/weaviate/tests/test_document_store.py index cc76923f6..59a6ed2e3 100644 --- a/integrations/weaviate/tests/test_document_store.py +++ b/integrations/weaviate/tests/test_document_store.py @@ -664,3 +664,18 @@ def test_filter_documents_over_default_limit(self, document_store): document_store.write_documents(docs) with pytest.raises(DocumentStoreError): document_store.filter_documents({"field": "content", "operator": "==", "value": "This is some content"}) + + def test_schema_class_name_conversion_preserves_pascal_case(self): + collection_settings = {"class": "CaseDocument"} + doc_score = WeaviateDocumentStore( + url="http://localhost:8080", + collection_settings=collection_settings, + ) + assert doc_score._collection_settings["class"] == "CaseDocument" + + collection_settings = {"class": "lower_case_name"} + doc_score = WeaviateDocumentStore( + url="http://localhost:8080", + collection_settings=collection_settings, + ) + assert doc_score._collection_settings["class"] == "Lower_case_name"