Curl localhost:8080/vectorize doesn't work

I’m using the multi2vec-clip Vectorizer.
When calling it manually using this command, I get the following error:

$ curl localhost:8080/vectorize -d '{"texts": ["hello"], "images":[]}'
{"detail":[{"type":"model_attributes_type","loc":["body"],"msg":"Input should be a valid dictionary or object to extract fields from","input":"{\"texts\": [\"hello\"], \"images\":[]}","url":""}]}

I am unsure how to proceed, as this command was taken from the documentation.

Documentation: multi2vec-clip | Weaviate - Vector Database

Hi @Mindaugas !!! Welcome to our community!

Nice catch!

I figured that that service will require the Content Type.

so this will work:

curl localhost:9090/vectorize -d '{"texts": ["hello"], "images":[]}'  --header 'Content-Type: application/json'

Note: this is considering the model is exposed in 9090, by adding the port mapping:

  multi2vec-clip:  # Set the name of the inference container
      - 9090:8080
      ENABLE_CUDA: 0 # set to 1 to enable

I had changed the docs:

Also, a nice place to check for our inference models tests is here:

Let me know if this helps :slight_smile:

1 Like

Thanks. Providing Content Type solved the issue.
Yeah, I forgot to check the tests :slight_smile:

1 Like

On the same note, it looks like Go clients have the same Content-Type issue or similar. I’m getting the same errors when calling with Go Client.

See the source code:

I tried with this example commit, but I still see the same issue:

I added debug logging to the Clip-inference service to log all requests."/vectorize")
  async def read_item(payload: ClipInput, response: Response):
+"Vectorizing data: {payload}")
  		result = await clip.vectorize(payload)
  		return {
  			"textVectors": result.text_vectors,
  			"imageVectors": result.image_vectors

And when doing curl, I see these logs:

INFO: - "GET /.well-known/ready HTTP/1.1" 204 No Content
INFO:     Vectorizing data: texts=['hello'] images=[]
INFO: - "POST /vectorize HTTP/1.1" 200 OK
INFO: - "GET /.well-known/ready HTTP/1.1" 204 No Content

But when doing it with a GO client, it doesn’t hit the handler:

INFO: - "GET /.well-known/ready HTTP/1.1" 204 No Content
INFO: - "POST /vectorize HTTP/1.1" 422 Unprocessable Entity
INFO: - "GET /.well-known/ready HTTP/1.1" 204 No Content

More debug data. Using netcat as a listener:

This is what go client sends:

POST /vectorize HTTP/1.1
Host: localhost:444
User-Agent: Go-http-client/1.1
Content-Length: 32
Content-Type: application/json
Accept-Encoding: gzip


And this is what curl client sends:

POST /vectorize HTTP/1.1
Host: localhost:444
User-Agent: curl/8.6.0
Accept: */*
Content-Type: application/json
Content-Length: 33

{"texts": ["hello"], "images":[]}

It looks very similar, so I’m baffled why Go clients don’t work.

Hi @Mindaugas !

You say that you were not able to use the clip with Weaviate?

I have updated our recipe here:

Can you check it out?

I was able to use it, using all latest versions

print("Server Version", client.get_meta().get("version"))
print("Client Version", weaviate.__version__)
>> Server Version 1.25.4
>> Client Version 4.6.4

No, I’m saying that Go clients don’t work.
This fixes my issues: Fix vectorizer client. by mindaugasrukas · Pull Request #5171 · weaviate/weaviate · GitHub

1 Like