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

Add base moderation to Providers #513

Open
wants to merge 4 commits into
base: v1.0
Choose a base branch
from
Open

Add base moderation to Providers #513

wants to merge 4 commits into from

Conversation

zakiali
Copy link
Collaborator

@zakiali zakiali commented Dec 20, 2024

Adding in moderation for user inputs.

  • A Moderation trait is added to the base Provider struct along
  • Update the base provider complete method to make a concurrent request to both the moderation and LLM endpoint. If moderation fails, we error out and abort the LLM completion if the request is still in flight. If moderation passes, we wait for the LLM response and continue as normal
  • Only moderates on the latest User message
  • Implemented moderation for the OpenAI provider using the openai's moderation endpoint, as an example

@zakiali zakiali marked this pull request as ready for review December 20, 2024 22:26
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.

1 participant