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

Introduce SEND_USERNAME_TO_MODEL to send username instead of id to model calls #4249

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alihacks
Copy link
Contributor

@alihacks alihacks commented Sep 25, 2024

Summary

Some users may benefit from logging username instead of user id when calling LLMs, this change introduces environment variable SEND_USERNAME_TO_MODEL which when set to true will send username instead of id.

Change Type

Please delete any irrelevant options.

  • New feature (non-breaking change which adds functionality)

Testing

Tested with Azure Open AI and confirmed username can be passed when this variable is set

Checklist

Please delete any irrelevant options.

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes
  • A pull request for updating the documentation has been submitted.

@alihacks
Copy link
Contributor Author

Sorry -I have been away last week. Doc updates are ready at LibreChat-AI/librechat.ai#149

@owengo
Copy link

owengo commented Dec 3, 2024

Hello, there is an issue with this patch with Anthropic: the user sent to the api at api/app/clients/Anthropic/Client.js should be non identifiable as per:
https://docs.anthropic.com/en/api/messages

If the api detects it's an email address or other non-anymous data the request is blocked with a 400 error.

Cline suggests this quick fix:

    const metadata = {
      user_id: process.env.SEND_USERNAME_TO_MODEL === 'true'
        ? crypto.createHash('sha256').update(this.user).digest('hex')
        : this.user,
    };

It seems there is also an issue with the subsequent calls to "spendToken"

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.

2 participants