ganeshdipdumbare / marqo-go

Go client for Marqo.ai multimodal vector search
MIT License
2 stars 1 forks source link

`double` and `long` support #14

Open brianfeister opened 2 weeks ago

brianfeister commented 2 weeks ago

Has this client been tested to verify it saves double (64 bit float) and long (64 bit integer) field types correctly? I'm getting deep into debugging this library and suspect that it's not sending these because JSON can't represent them

brianfeister commented 2 weeks ago

I think I'm close to a YES on this question. The last step before I pass documents to this go client, I am declaring this value

        if event.CreatedAt != 0 {
            document["createdAt"] = int64(event.CreatedAt)
        }

I've added the following to documents.go at this line https://github.com/ganeshdipdumbare/marqo-go/blob/main/documents.go#L106 (we should make reading the marqo body response less painful per my other opened issue #13)

    body, err := resp.ToString()
    // Log relevant response information
    logger.Error("\n\n UPSERT resp from marqo",
    "status_code", resp.StatusCode,
    "status", resp.Status,
    "headers", resp.HeaderToString(),
    "body", string(body),
    )

And this is the marqo response body (after I bashed the above in)

[sst] |  +6676ms {"time":"2024-10-03T07:17:39.044447-06:00","level":"ERROR","source":{"function":"github.com/ganeshdipdumbare/marqo-go.
(*Client).UpsertDocuments","file":"/Users/bfeister/go/pkg/mod/github.com/ganeshdipdumbare/marqo-go@v1.0.1/documents.go","line":140},"msg":"\n\n UPSERT resp from marqo",
"method":"UpsertDocuments","status_code":200,"status":"200 OK","headers":"Content-Length: 400\r\nContent-Type: application/json\r\nDate: Thu, 03 Oct 2024 13:17:39 GMT\r\nServer: nginx/1.22.1\r\n",
"body":"{\"errors\":true,\"processingTimeMs\":0.0002449710000291816,\"index_name\":\"prod-events-search-index\",\"items\":[{\"status\":400,\"_id\":\"228e38c7-35bd-41c5-ab38-a42005b679c6\",\
"message\":\**"Invalid type <class 'int'> for tensor field createdAt\",\"error\":\"Invalid** type <class 'int'> for tensor field createdAt\",\"code\":\"invalid_argument\"}],\"_batch_response_stats\":{\"success_count\":0,\"error_count\":0,\"failure_count\":1}}"}
brianfeister commented 2 weeks ago

Sorry, production 🔥 drill... I'm realizing Marqo Cloud API expects a JSON encoded body, so the limitation in JSON is implicit and they must have a way of handling 64 bit integers. I must be doing something else wrong.