Skip to content

Commit 143e935

Browse files
Merge branch 'main' into ollama_and_module_config_example
2 parents 20d29a0 + 03c0fc0 commit 143e935

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ Ruby wrapper for the Weaviate.io API.
1010

1111
Part 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

@@ -338,6 +341,30 @@ client.live?
338341
client.ready?
339342
```
340343

344+
### Tenants
345+
346+
Any schema can be multi-tenant
347+
348+
```ruby
349+
client.schema.create(
350+
# Other keys...
351+
mutli_tenant: true, # passes { enabled: true } to weaviate
352+
)
353+
```
354+
355+
You can also manually specify your multi tenancy configuration with a hash
356+
357+
```ruby
358+
client.schema.create(
359+
# Other keys...
360+
mutli_tenant: { enabled: true, autoTenantCreation: true, autoTenantActivation: true },
361+
)
362+
```
363+
364+
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.
365+
366+
All data methods in this library support an optional `tenant` argument which must be passed if multi-tenancy is enabled on the related collection
367+
341368
## Development
342369

343370
After 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.

lib/weaviate/schema.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ def create(
4343
req.body["vectorizer"] = vectorizer unless vectorizer.nil?
4444
req.body["moduleConfig"] = module_config unless module_config.nil?
4545
req.body["properties"] = properties unless properties.nil?
46-
req.body["multiTenancyConfig"] = {enabled: true} unless multi_tenant.nil?
46+
if multi_tenant.is_a?(Hash)
47+
req.body["multiTenancyConfig"] = multi_tenant
48+
elsif multi_tenant.present?
49+
req.body["multiTenancyConfig"] = {enabled: true}
50+
end
4751
req.body["invertedIndexConfig"] = inverted_index_config unless inverted_index_config.nil?
4852
req.body["replicationConfig"] = replication_config unless replication_config.nil?
4953
end

0 commit comments

Comments
 (0)