chromadb-java-client icon indicating copy to clipboard operation
chromadb-java-client copied to clipboard

Fluent API

Open tazarov opened this issue 1 year ago • 2 comments

tazarov avatar Jul 31 '23 19:07 tazarov

Need more info on this

  • Are we planning to use a fluent style throughout all the object instantiations ?
  • Can we proceed with an approach that has the builder classes for all the respective classes in a same package under the parent package ?
  • Would be helpful to know if you have some design in mind and also how the final state of each of the current packages ie the core and model specific packages would look once the builders have been configured

Thanks

aravindcz avatar Aug 08 '23 11:08 aravindcz

Hey @aravindcz, about your first question, yes.

Ideally:

  • for Client - Client.newClient(,key etc)
  • Client.newClient(,key etc).reset()
  • Client.newClient(,key etc).newCollection( - optional).name().meta(key,value).meta(...).ef(<embeddingFunction>).create()
  • Client.newClient(,key etc).getColection().remove()
  • Client.newClient(,key etc).getColection().remove().newEmbedding().text().metadata(key,value).id(AUTO|<user_generated>).add() #add single
  • Client.newClient(,key etc).getColection().remove().newEmbedding().text().metadata(key,value).id(AUTO|<user_generated>).newEmbedding()...batchAdd() #batch add of embeddings

I hope you get the feeling.

As far as design I can draw a quick diagram later today to illustrate.

tazarov avatar Aug 08 '23 12:08 tazarov