Skip to content

Commit 29caf1e

Browse files
Gaudy BlancoGaudy Blanco
authored andcommitted
test validation
1 parent ab8e11e commit 29caf1e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

graphrag/config/models/vector_store_config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ def _validate_embeddings_schema(self) -> None:
9595
if name not in all_embeddings:
9696
msg = f"vector_store.embeddings_schema contains an invalid embedding schema name: {name}. Please rerun `graphrag init` and select the correct embedding schema names."
9797
raise ValueError(msg)
98+
99+
if self.type == VectorStoreType.CosmosDB:
100+
for id_field in self.embeddings_schema.values():
101+
if id_field.id_field != "id":
102+
msg = "When using CosmosDB, the id_field in embeddings_schema must be 'id'. Please rerun `graphrag init` and set the id_field to 'id'."
103+
raise ValueError(msg)
98104

99105
@model_validator(mode="after")
100106
def _validate_model(self):

tests/integration/vector_stores/test_cosmosdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_vector_store_customization():
110110
vector_store = CosmosDBVectorStore(
111111
vector_store_schema_config=VectorStoreSchemaConfig(
112112
index_name="text-embeddings",
113-
id_field="id",
113+
id_field="id_custom",
114114
text_field="text_custom",
115115
vector_field="vector_custom",
116116
attributes_field="attributes_custom",

0 commit comments

Comments
 (0)