@@ -3,8 +3,8 @@ use backon::Retryable;
33use chroma_api_types:: ErrorResponse ;
44use chroma_error:: ChromaValidationError ;
55use chroma_types:: Collection ;
6- use chroma_types:: CollectionConfiguration ;
76use chroma_types:: Metadata ;
7+ use chroma_types:: Schema ;
88use chroma_types:: WhereError ;
99use parking_lot:: Mutex ;
1010use reqwest:: Method ;
@@ -437,10 +437,10 @@ impl ChromaHttpClient {
437437 pub async fn get_or_create_collection (
438438 & self ,
439439 name : impl AsRef < str > ,
440- configuration : Option < CollectionConfiguration > ,
440+ schema : Option < Schema > ,
441441 metadata : Option < Metadata > ,
442442 ) -> Result < ChromaCollection , ChromaHttpClientError > {
443- self . common_create_collection ( name, configuration , metadata, true )
443+ self . common_create_collection ( name, schema , metadata, true )
444444 . await
445445 }
446446
@@ -473,10 +473,10 @@ impl ChromaHttpClient {
473473 pub async fn create_collection (
474474 & self ,
475475 name : impl AsRef < str > ,
476- configuration : Option < CollectionConfiguration > ,
476+ schema : Option < Schema > ,
477477 metadata : Option < Metadata > ,
478478 ) -> Result < ChromaCollection , ChromaHttpClientError > {
479- self . common_create_collection ( name, configuration , metadata, false )
479+ self . common_create_collection ( name, schema , metadata, false )
480480 . await
481481 }
482482
@@ -620,7 +620,7 @@ impl ChromaHttpClient {
620620 async fn common_create_collection (
621621 & self ,
622622 name : impl AsRef < str > ,
623- configuration : Option < CollectionConfiguration > ,
623+ schema : Option < Schema > ,
624624 metadata : Option < Metadata > ,
625625 get_or_create : bool ,
626626 ) -> Result < ChromaCollection , ChromaHttpClientError > {
@@ -637,7 +637,7 @@ impl ChromaHttpClient {
637637 ) ,
638638 Some ( serde_json:: json!( {
639639 "name" : name. as_ref( ) ,
640- "configuration " : configuration ,
640+ "schema " : schema ,
641641 "metadata" : metadata,
642642 "get_or_create" : get_or_create,
643643 } ) ) ,
@@ -877,6 +877,7 @@ mod tests {
877877 use super :: * ;
878878 use crate :: client:: ChromaRetryOptions ;
879879 use crate :: tests:: with_client;
880+ use chroma_types:: { EmbeddingFunctionConfiguration , EmbeddingFunctionNewConfiguration } ;
880881 use httpmock:: { HttpMockResponse , MockServer } ;
881882 use std:: sync:: atomic:: AtomicBool ;
882883 use std:: time:: Duration ;
@@ -1059,13 +1060,23 @@ mod tests {
10591060 #[ test_log:: test]
10601061 async fn test_live_cloud_create_collection ( ) {
10611062 with_client ( |client| async move {
1062- let collection = client. create_collection ( "foo" , None , None ) . await . unwrap ( ) ;
1063+ let schema = Schema :: default_with_embedding_function (
1064+ EmbeddingFunctionConfiguration :: Known ( EmbeddingFunctionNewConfiguration {
1065+ name : "bar" . to_string ( ) ,
1066+ config : serde_json:: json!( { } ) ,
1067+ } ) ,
1068+ ) ;
1069+ let collection = client
1070+ . create_collection ( "foo" , Some ( schema. clone ( ) ) , None )
1071+ . await
1072+ . unwrap ( ) ;
10631073 assert_eq ! ( collection. collection. name, "foo" ) ;
10641074
1065- client
1075+ let collection = client
10661076 . get_or_create_collection ( "foo" , None , None )
10671077 . await
10681078 . unwrap ( ) ;
1079+ assert_eq ! ( collection. schema( ) . clone( ) . unwrap( ) , schema) ;
10691080 } )
10701081 . await ;
10711082 }
0 commit comments