infinity icon indicating copy to clipboard operation
infinity copied to clipboard

API Key Authentication for Michaelfeil Infinity

Open AjayKarma05 opened this issue 1 year ago • 1 comments

Model description

Could you please provide guidance on how to enable API_KEY authentication? Alternatively, is there a plan to implement API_KEY authentication similar to OpenAI's approach?

Open source status

  • [ ] The model implementation is available on transformers
  • [ ] The model weights are available on huggingface-hub
  • [ ] I verified that the model is currently not running in infinity

Provide useful links for the implementation

No response

AjayKarma05 avatar Apr 26 '24 13:04 AjayKarma05

It's just a fastapi server, implement it as usual like you do on FastAPI.

semoal avatar May 12 '24 21:05 semoal

I added an example on how to use infinity with runpod.io

note, that API_Keys are typically not set, they are generated. Also they are not verified by the application itself, but by e.g. AWS API Gateway. I understand ypur interest, but i think such a feature is easy to implement yourself or better be added with another service

michaelfeil avatar May 29 '24 16:05 michaelfeil

https://github.com/monotykamary/infinity/commit/36680ae5435eac2e7db2ec70963ee82121943f10

@monotykamary has implemented it. Changed my mind: If the contribution is easy enough, comes with a unit test that covers every LOC, and defaults to no api key as default behauviour, would be accepted

michaelfeil avatar May 29 '24 21:05 michaelfeil

Oh, I just did a dirty implementation to quickly spin up a quick embedding server with auth on Modal: https://github.com/dwarvesf/llm-hosting/blob/main/infinity_snowflake_arctic_embed_l_335m.py

monotykamary avatar May 30 '24 03:05 monotykamary

Looks not dirty at all @monotykamary! Awesome

michaelfeil avatar May 30 '24 04:05 michaelfeil

@monotykamary @semoal @AjayKarma05 Added auth, you can set a Bearer token via INFINITY_API_KEY=mykey123 or --api-key mykey123

michaelfeil avatar May 31 '24 04:05 michaelfeil

How to set the API_KEY in the Langchain Infinity Embedding?

Jimmy-Newtron avatar Jun 20 '24 10:06 Jimmy-Newtron

@Jimmy-Newtron PRs to langchain are welcome. I think this feature is missing there.

michaelfeil avatar Jun 20 '24 15:06 michaelfeil