Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Serve][Example] Authentication example #3251

Closed
wants to merge 6 commits into from
Closed

Conversation

cblmemo
Copy link
Collaborator

@cblmemo cblmemo commented Feb 28, 2024

A simple example with authentication.

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
    • The usage section in the service YAML
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: bash tests/backward_comaptibility_tests.sh



if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8087)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe can give an example of client program that accesses the server with the verify token

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've already has one in the Task YAML's comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement in python is rather challenging as I didn't find any default support for this; ref https://stackoverflow.com/questions/34359529/python-requests-equivalent-for-curls-location-trusted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not being able to programmatically interacting with the service seems like a key limitation in this mode.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... I guess that is another reason we might want to use a proxy. Will investigate more

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test it with OpenAI API? Maybe their library handles the authentication key automatically with redirection.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose the problem is our controller does not forward the request with previous auth headers..? Correct me if I'm wrong, but why does replica-side Openai API have a relation to this problem..?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I mean the client side OpenAI python API, to see if the client querying the endpoint programmatically will have the similar behavior as curl --trust-location.

If this is an issue, we should start migrating our load balancer to proxy based solution.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried, the OpenAI Client does not support forwarding auth headers as well. It could access the replica endpoint but not the load balancer endpoint.

image

@Michaelvll
Copy link
Collaborator

Can we add a README for the example folder to explain how this will work and how to access the service? Also, can we make the example a real LLM serving, e.g. using vllm?

@cblmemo
Copy link
Collaborator Author

cblmemo commented Mar 20, 2024

TODO:

  • double-check the example works;
  • add README.md;
  • check client of openai library to see if it implemented --location-trusted.

@Michaelvll
Copy link
Collaborator

Is this outdated? Should we close this @cblmemo?

@cblmemo
Copy link
Collaborator Author

cblmemo commented May 22, 2024

Is this outdated? Should we close this @cblmemo?

Yes. Closing now

@cblmemo cblmemo closed this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants