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

Allows OpenAI-Key to be set in header for /converse and /chat endpoints. #41

Merged
merged 6 commits into from
Apr 16, 2023

Conversation

rithviknishad
Copy link
Member

@rithviknishad rithviknishad commented Apr 15, 2023

Changes:

  • Adds field to User model: allow_key
  • Uses OpenAI-Key from the headers if present. Else falls back to using the OpenAI API key from settings if allow_key for user is True.
  • Raises ValidationError if either was not provided. Validation performed at perform_create and converse actions.

@ishanExtreme
Copy link
Contributor

@skks1212 @rithviknishad
if we are allowing user giving the api request to set "allow" variable on their own in the request body, then our api will not safe to be made public. Instead if we can create a new field in user model specifying if "special/nurse" or not and use our api key in that case. So normal user have to send the api_key everytime 🤔

ayushma/views/chat.py Outdated Show resolved Hide resolved
@shivankacker
Copy link
Member

@ishanExtreme yep that is how it is planned to be. @rithviknishad I have suggested changes 😬

@rithviknishad rithviknishad marked this pull request as draft April 15, 2023 08:05
@rithviknishad rithviknishad marked this pull request as ready for review April 16, 2023 04:40
Copy link
Member

@shivankacker shivankacker left a comment

Choose a reason for hiding this comment

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

LGTM

@shivankacker shivankacker merged commit 37c09a9 into master Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow API key overrides to /chat and /converse endpoints
3 participants