diff --git a/Directory.Packages.props b/Directory.Packages.props index 5f7bf38..d3ba0c6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -24,7 +24,7 @@ - + diff --git a/src/ChromaDB.VectorData/ChromaModelBuilder.cs b/src/ChromaDB.VectorData/ChromaModelBuilder.cs index c74a5e3..1d8948a 100644 --- a/src/ChromaDB.VectorData/ChromaModelBuilder.cs +++ b/src/ChromaDB.VectorData/ChromaModelBuilder.cs @@ -30,6 +30,13 @@ protected override void ValidateKeyProperty(KeyPropertyModel keyProperty) throw new NotSupportedException( $"Property '{keyProperty.ModelName}' has unsupported type '{type.Name}'. Key properties must be either string or Guid."); } + + // String and Guid keys are supported by the Chroma provider, but we support auto-generation of keys only for GUIDs + if (keyProperty.IsAutoGenerated && keyProperty.Type != typeof(Guid)) + { + throw new NotSupportedException( + $"Auto-generation is only supported for key properties of type Guid. Property '{keyProperty.ModelName}' has type '{keyProperty.Type.Name}'."); + } } // Checked when the collection object is constructed, rather than when it is first used.