I have a local instance of weaviate running on my machine. I am trying to enable multi-tenancy by following this guidance and by utilizing this code:
client.schema.create_class({
'class': 'MultiTenancyClass',
'multiTenancyConfig': {'enabled': True}
})
client.schema.add_class_tenants(
class_name='MultiTenancyClass', # The class to which the tenants will be added
tenants=[Tenant(name='tenantA'), Tenant(name='tenantB')]
)
However, I keep getting this error:
weaviate.exceptions.UnexpectedStatusCodeException: Add classes tenants! Unexpected status code: 404, with response body: {‘code’: 404, ‘message’: ‘path /v1/schema/MultiTenancyClass/tenants was not found’}.
Is it not possible to add multi-tenancy to a local instance of weaviate?
Hi @JLiz2803 ! Welcome to our Community!
Yes, you can use the multitenancy feature locally!
Please, notice that this feature will only work for Weaviate 1.20 onwards.
What version are you running?
if case you don’t know, you can get that information from:
http://localhost:8080/v1/meta
Ps: I have added a tooltip to the doc in order to make it clear
HI @DudaNogueira thank you for responding. It looks like for me Weviate is running at the following ports
Python 43618 username 6u IPv4 0x101755eca5beaecf 0t0 TCP localhost:63995->localhost:6666 (CLOSED)
weaviate- 43622 username 6u IPv6 0x101755eca60a05e7 0t0 TCP *:63980 (LISTEN)
weaviate- 43622 username 8u IPv6 0x101755eca609dde7 0t0 TCP *:6060 (LISTEN)
weaviate- 43622 username 13u IPv6 0x101755eca418e5e7 0t0 TCP *:63981 (LISTEN)
weaviate- 43622 username 15u IPv4 0x101755eca65b69ef 0t0 TCP localhost:6666 (LISTEN)
weaviate- 43622 username 54u IPv6 0x101755eca675bde7 0t0 TCP *:50051 (LISTEN)
so I tried going to http://localhost:6060/v1/meta , however it gave me a 404, and my logs show this message “Serving weaviate at http://127.0.0.1:6666” but port 6666 returns a page not found
How are you running Weaviate?
Here we have a great tool to help you create a docker-compose:
I am executing this line of code
client = weaviate.Client(
embedded_options=weaviate.embedded.EmbeddedOptions(),
)
Which spawns this message in my logs
Started /Users/jimlizzi/.cache/weaviate-embedded: process ID 45591
{“action”:“startup”,“default_vectorizer_module”:“none”,“level”:“info”,“msg”:“the default vectorizer modules is set to "none", as a result all new schema classes without an explicit vectorizer setting, will use this vectorizer”,“time”:“2023-08-09T22:31:24-07:00”}
{“action”:“startup”,“auto_schema_enabled”:true,“level”:“info”,“msg”:“auto schema enabled setting is set to "true"”,“time”:“2023-08-09T22:31:24-07:00”}
{“action”:“hnsw_vector_cache_prefill”,“count”:3000,“index_id”:“myclass_wb5Qt3iG5fl4”,“level”:“info”,“limit”:1000000000000,“msg”:“prefilled vector cache”,“time”:“2023-08-09T22:31:25-07:00”,“took”:93142}
{“action”:“grpc_startup”,“level”:“info”,“msg”:“grpc server listening at [::]:50051”,“time”:“2023-08-09T22:31:25-07:00”}
{“action”:“restapi_management”,“level”:“info”,“msg”:“Serving weaviate at http://127.0.0.1:6666”,“time”:“2023-08-09T22:31:25-07:00”}
Oh, I see.
For some reasons, Chrome (and other browsers) doesn’t like port 6666, and mark it as unsafe.
Edit: On top of that, the embedding option is by default installing Weaviate 1.9.12 as of now.
You can specify a different port (and/or specific version) for it to bind, like so:
client = weaviate.Client(
embedded_options=weaviate.embedded.EmbeddedOptions(
port=8080, version="1.20.5"
)
)
Also, if you request it using curl, insomnia, postman, etc, you’ll be able to request at the port you want:
:~/dev/weaviate/$ curl http://127.0.0.1:6666/v1/meta
{“hostname”:“http://127.0.0.1:6666”,“modules”:{“generative-openai”:{“documentationHref”:“https://beta.openai.com/docs/api-reference/completions",“name”:"Generative Search - OpenAI”},“qna-openai”:{“documentationHref”:“https://beta.openai.com/docs/api-reference/completions",“name”:"OpenAI Question & Answering Module”},“ref2vec-centroid”:{},“text2vec-cohere”:{“documentationHref”:“https://docs.cohere.ai/embedding-wiki/",“name”:"Cohere Module”},“text2vec-huggingface”:{“documentationHref”:“Detailed parameters Face Module”},“text2vec-openai”:{“documentationHref”:“https://beta.openai.com/docs/guides/embeddings/what-are-embeddings",“name”:"OpenAI Module”}},“version”:“1.19.12”}
But please, bear in mind that Weaviate Embedded is marked as Experimental as of now
Here is a link to it’s doc:
If you want to start playing around with Weaviate, the docker install is great way for that:
Let me know if this helps or if you have any troubles to start playing around with Weaviate!
Thanks!
Thank you @DudaNogueira the embeddings options, port=8080, version="1.20.5"
, solved my issue and I can now utilize multi tenancy within my application.
1 Like