pycall example: use llm-guard pip - #60221
Closed
snickell wants to merge 28 commits into
Closed
Conversation
…h/pycall-llmguard-demo
snickell
marked this pull request as draft
August 11, 2024 09:04
Draft
Contributor
Author
|
Replaced by #60335 which is a continuation of this PR with a nice rebase, and a better focus. This PR did its job: it shaped our Python.run API to the point that it is now updated in name, etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
THIS PR DOES NOT WORK IT WILL CRASH
Replaced by #60335 which is a rebase
Short example of using the llm-guard pip. Eventually I'll expand this to include calling it from a rails controller.
Adding llm_guard to existing pycdo package
Add deps to pycdo/pyproject.toml and install them
cd python/pycdopdm add llm-guardcd ../..pdm installCreate python source
See changed files for details, but its just vanilla python at this point:
Now that we've added source, you can run python tests. From /python/pycdo run:
Or if you want to try using them from, say, ipython:
Alternative approach: create a new genai package
In this PR, I create
llmguard.pyinside the existing pycdo module, and add it to the deps for pycdo.If genai (your name here) is going to use more python code than just a little llmguard, I suggest creating a new top-level
genaipackage parallel to pycdo. Its not much harder, and I'm happy to help with this, but I just started here with the simplest possible example.