@@ -10,11 +10,14 @@ Ruby wrapper for the Weaviate.io API.
1010
1111Part of the [ Langchain.rb] ( https://github.com/andreibondarev/langchainrb ) stack.
1212
13+ Available for paid consulting engagements!
[ Email me
] ( mailto:[email protected] ) .
14+
1315![ Tests status] ( https://github.com/andreibondarev/weaviate-ruby/actions/workflows/ci.yml/badge.svg )
1416[ ![ Gem Version] ( https://badge.fury.io/rb/weaviate-ruby.svg )] ( https://badge.fury.io/rb/weaviate-ruby )
1517[ ![ Docs] ( http://img.shields.io/badge/yard-docs-blue.svg )] ( http://rubydoc.info/gems/weaviate-ruby )
1618[ ![ License] ( https://img.shields.io/badge/license-MIT-green.svg )] ( https://github.com/andreibondarev/weaviate-ruby/blob/main/LICENSE.txt )
1719[ ![ ] ( https://dcbadge.vercel.app/api/server/WDARp7J2n8?compact=true&style=flat )] ( https://discord.gg/WDARp7J2n8 )
20+ [ ![ X] ( https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40rushing_andrei )] ( https://twitter.com/rushing_andrei )
1821
1922## Installation
2023
@@ -63,7 +66,7 @@ client.schema.create(
6366 " name" : " category"
6467 }
6568 ],
66- # Possible values: 'text2vec-cohere', 'text2vec-openai', 'text2vec-huggingface', 'text2vec-transformers', 'text2vec-contextionary', 'img2vec-neural', 'multi2vec-clip', 'ref2vec-centroid'
69+ # Possible values: 'text2vec-cohere', 'text2vec-ollama', 'text2vec- openai', 'text2vec-huggingface', 'text2vec-transformers', 'text2vec-contextionary', 'img2vec-neural', 'multi2vec-clip', 'ref2vec-centroid'
6770 vectorizer: " text2vec-openai"
6871)
6972
@@ -73,9 +76,6 @@ client.schema.get(class_name: 'Question')
7376# Get the schema
7477client.schema.list()
7578
76- # Remove a class (and all data in the instances) from the schema.
77- client.schema.delete(class_name: ' Question' )
78-
7979# Update settings of an existing schema class.
8080# Does not support modifying existing properties.
8181client.schema.update(
@@ -94,6 +94,51 @@ client.schema.add_property(
9494
9595# Inspect the shards of a class
9696client.schema.shards(class_name: ' Question' )
97+
98+ # Remove a class (and all data in the instances) from the schema.
99+ client.schema.delete(class_name: ' Question' )
100+
101+ # Creating a new data object class in the schema while configuring the vectorizer on the schema and on individual properties (Ollama example)
102+ client.schema.create(
103+ class_name: ' Question' ,
104+ description: ' Information from a Jeopardy! question' ,
105+ properties: [
106+ {
107+ " dataType" : [" text" ],
108+ " description" : " The question" ,
109+ " name" : " question"
110+ # By default all properties are included in the vector
111+ }, {
112+ " dataType" : [" text" ],
113+ " description" : " The answer" ,
114+ " name" : " answer" ,
115+ " moduleConfig" : {
116+ " text2vec-ollama" : {
117+ " skip" : false ,
118+ " vectorizePropertyName" : true ,
119+ },
120+ },
121+ }, {
122+ " dataType" : [" text" ],
123+ " description" : " The category" ,
124+ " name" : " category" ,
125+ " indexFilterable" : true ,
126+ " indexSearchable" : false ,
127+ " moduleConfig" : {
128+ " text2vec-ollama" : {
129+ " skip" : true , # Don't include in the vector
130+ },
131+ },
132+ }
133+ ],
134+ vectorizer: " text2vec-ollama" ,
135+ module_config: {
136+ " text2vec-ollama" : {
137+ apiEndpoint: " http://localhost:11434" ,
138+ model: " mxbai-embed-large" ,
139+ },
140+ },
141+ )
97142```
98143
99144### Using the Objects endpoint
@@ -305,6 +350,30 @@ client.live?
305350client.ready?
306351```
307352
353+ ### Tenants
354+
355+ Any schema can be multi-tenant
356+
357+ ``` ruby
358+ client.schema.create(
359+ # Other keys...
360+ mutli_tenant: true , # passes { enabled: true } to weaviate
361+ )
362+ ```
363+
364+ You can also manually specify your multi tenancy configuration with a hash
365+
366+ ``` ruby
367+ client.schema.create(
368+ # Other keys...
369+ mutli_tenant: { enabled: true , autoTenantCreation: true , autoTenantActivation: true },
370+ )
371+ ```
372+
373+ See [ Weaviate Multi-tenancy operations] ( https://weaviate.io/developers/weaviate/manage-data/multi-tenancy ) . Note that the mix of snake case(used by Ruby) and lower camel case(used by Weaviate) is intentional as that hash is passed directly to Weaviate.
374+
375+ All data methods in this library support an optional ` tenant ` argument which must be passed if multi-tenancy is enabled on the related collection
376+
308377## Development
309378
310379After checking out the repo, run ` bin/setup ` to install dependencies. Then, run ` rake spec ` to run the tests. You can also run ` bin/console ` for an interactive prompt that will allow you to experiment.
0 commit comments