Skip to content

wikp/faiss-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

faiss-rest-api

REST API for Faiss.

To use this, you have to compile faiss-rs using instructions from the README file.

Usage:

$ curl -v 'localhost:8000/faiss/search' \ 
    -H "Content-type: application/json" \
     -XPOST \
     -d '{"k": 5, "vectors": [[54.7, 0.3, 0.6, 0.4, 0.1, 0.7, 0.2, 0.0, 0.6, 0.5, 0.3, 0.2, 0.1, 0.9, 0.3, 0.6, 0.2, 0.9, 0.5, 0.0, 0.9, 0.1, 0.9, 0.1, 0.5, 0.5, 0.8, 0.8, 0.5, 0.2, 0.6, 0.2, 0.2, 0.7, 0.1, 0.7, 0.8, 0.2, 0.9, 0.0, 0.4, 0.4, 0.9, 0.0, 0.6, 0.4, 0.4, 0.6, 0.6, 0.2, 0.5, 0.0, 0.1, 0.6, 0.0, 0.0, 0.4, 0.7, 0.5, 0.7, 0.2, 0.5, 0.5, 0.7], [54.7, 0.3, 0.6, 0.4, 0.1, 0.7, 0.2, 0.0, 0.6, 0.5, 0.3, 0.2, 0.1, 0.9, 0.3, 0.6, 0.2, 0.9, 0.5, 0.0, 0.9, 0.1, 0.9, 0.1, 0.5, 0.5, 0.8, 0.8, 0.5, 0.2, 0.6, 0.2, 0.2, 0.7, 0.1, 0.7, 0.8, 0.2, 0.9, 0.0, 0.4, 0.4, 0.9, 0.0, 0.6, 0.4, 0.4, 0.6, 0.6, 0.2, 0.5, 0.0, 0.1, 0.6, 0.0, 0.0, 0.4, 0.7, 0.5, 0.7, 0.1, 0.3, 0.5]]}'
*   Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 8000 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8000 (#0)
> POST /faiss/search HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.54.0
> Accept: */*
> Content-type: application/json
> Content-Length: 344
>
* upload completely sent off: 344 out of 344 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json
< Server: Rocket
< Content-Length: 1209
< Date: Sun, 19 May 2019 04:06:16 GMT
<
* Connection #0 to host localhost left intact
[{"neighbors":[{"id":54104,"score":0.22991317510604858},{"id":53227,"score":6.515602111816406},{"id":54408,"score":6.633026599884033},{"id":54800,"score":6.759259223937988},{"id":54102,"score":6.813137054443359}],"vector":[54.70000076293945,0.30000001192092896,0.6000000238418579,0.4000000059604645,0.10000000149011612,0.699999988079071,0.20000000298023224,0.0,0.6000000238418579,0.5,0.30000001192092896,0.20000000298023224,0.10000000149011612,0.8999999761581421,0.30000001192092896,0.6000000238418579,0.20000000298023224,0.8999999761581421,0.5,0.0,0.8999999761581421,0.10000000149011612,0.8999999761581421,0.10000000149011612,0.5,0.5,0.800000011920929,0.800000011920929,0.5,0.20000000298023224,0.6000000238418579,0.20000000298023224,0.20000000298023224,0.699999988079071,0.10000000149011612,0.699999988079071,0.800000011920929,0.20000000298023224,0.8999999761581421,0.0,0.4000000059604645,0.4000000059604645,0.8999999761581421,0.0,0.6000000238418579,0.4000000059604645,0.4000000059604645,0.6000000238418579,0.6000000238418579,0.20000000298023224,0.5,0.0,0.10000000149011612,0.6000000238418579,0.0,0.0,0.4000000059604645,0.699999988079071,0.5,0.699999988079071,0.20000000298023224,0.5,0.5,0.699999988079071]}]

Releases

No releases published

Packages

No packages published

Languages