Hi everyone,
I’m currently using the Python Client v4 for Weaviate. Here’s the code snippet I use to create a schema directly in Python:
collection = self.client.collections.create(
name=collection_name,
vectorizer_config=wvc.config.Configure.Vectorizer.text2vec_openai()
)
In the above code, I’m only providing the collection_name
and vectorizer_config
, and the rest of the values are set to default.
Now, I am converting this functionality into a custom API class. I need to pass the schema details through the API body and create the schema programmatically via an HTTP POST request.
For example:
- Endpoint:
POST http://localhost:8311/matching-engine/v1/collection/add_schema
- Request Body: Contains schema details.
I want to achieve this without using the default Weaviate endpoint like:
curl http://localhost:8080/v1/schema \
--request POST \
--header 'Content-Type: text/plain;charset=UTF-8'
Could someone guide me on how to structure the API body and write the server-side logic in Python to handle this? Any code examples or documentation references would be greatly appreciated.
Thanks in advance!