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

Use langchain llm and vector store as input to support more models #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marswen
Copy link

@marswen marswen commented Mar 21, 2024

To support more online/local models and vector stores, it will be more convenient to pass into langchain components, so that we don't need to handle initiation of various models and vector stores in Rebuff, as well as different invoking methods.

Main changes:

  • Add a new python api RebuffDetectionWithLangchain besides RebuffSdk, which requires langchain LanguageModel and VectorStore as inputs.
  • Reformat prompt template to reuse examples.
  • Initiate vector store with positive examples.
  • Change calling of openai to langchain llm.
  • Add feature of log positive outcome in detection.
  • Use similarity_search_with_relevance_scores instead of similarity_search_with_scores in detect_pi_vectorbase.py, because the output should be the similarity score other than distance.
  • Add corresponding unit test and usage example notebook.

@marswen marswen force-pushed the python-langchain branch from bf37935 to b82fff7 Compare July 16, 2024 09:06
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