Lightning-AI / LitServe

Lightning-fast serving engine for any AI model of any size. Flexible. Easy. Enterprise-scale.
https://lightning.ai/docs/litserve
Apache License 2.0
2.5k stars 158 forks source link

GET Request #355

Closed gururaser closed 2 weeks ago

gururaser commented 2 weeks ago

🚀 Feature

Motivation

I want to use LitServe for the search engine endpoint, so it would be nice to be able to send a GET request

Pitch

I plan to use LitServe to create an embedding from the query entered and search it in the vector database. But I can't see how to make any GET endpoint. It seems that there is only POST at the moment.

Alternatives

Additional context

aniketmaurya commented 2 weeks ago

Hi @gururaser, you can use the POST request to accept the query and perform vector search. GET requests has limitations and POST should be used in such cases.

Here is the docs for managing request-response with LitServe - https://lightning.ai/docs/litserve/features/request-response-format

gururaser commented 2 weeks ago

Hi @gururaser, you can use the POST request to accept the query and perform vector search. GET requests has limitations and POST should be used in such cases.

Here is the docs for managing request-response with LitServe - https://lightning.ai/docs/litserve/features/request-response-format

Hello @aniketmaurya, I've already done demo with POST request. But I feel like GET requests are used in search endpoints in websites. For example, when I search on any e-commerce site, I notice that the GET request is used from the link of the site.

GET Request has some advantages for example GET requests can be bookmarked, which can be helpful if users want to save or share a specific search URL.

aniketmaurya commented 2 weeks ago

@gururaser usually in production when serving the model, the server is put behind an UI or it's used as an API by another backend service. So, users shouldn't be directly talking to server. May I know how you're serving the model?

gururaser commented 2 weeks ago

@gururaser usually in production when serving the model, the server is put behind an UI or it's used as an API by another backend service. So, users shouldn't be directly talking to server. May I know how you're serving the model?

@aniketmaurya When the user makes a search in the search box on the website, I plan to send this text to my model via LitServe endpoint, extract the feature vector through the models, and then use the search function of the vector database to get the relevant data and return it back to the frontend. Isn't this the right approach?

aniketmaurya commented 2 weeks ago

When users search in the input box, you can still send the text to LitServe endpoint using a POST request and return the response to the frontend.