-
Notifications
You must be signed in to change notification settings - Fork 167
Add Guardrails functionality and tests to chatbot sample #2007
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
base: main
Are you sure you want to change the base?
Conversation
a70936f to
e88de3f
Compare
|
This seems a lot more like an integration test than a sample TBH |
...ails/src/main/java/io/quarkiverse/langchain4j/sample/guardrails/chat/ProfanityGuardrail.java
Show resolved
Hide resolved
|
Yeah it doesn't conceptually fit very well into the existing |
|
Either that, or create a whole new sample that is focused on demonstrating guardrails... |
|
Yeah, that's a viable option |
This comment has been minimized.
This comment has been minimized.
|
@jmartisk I thought, that samples are more like vertical slices (eg., they are using several related features to have a realistic use case) and in that case guardrails would be a good fit for the most basic one. The solutions which I see:
As a side note: from QE standpoint, |
|
Now that I think of it, we have a relatively new |
|
That would have the slight issue that it wouldn't be backportable to 1.2.x, but for the future, it would be the best solution IMO |
|
I agree, we could have a guardrail sample containing the different kind of guradrails. |
4b6d54b to
fa43f24
Compare
|
Per the discussion above, I moved the example and tests to tool-guardrail module |
fa43f24 to
e183329
Compare
| @@ -56,7 +56,7 @@ public ToolInputGuardrailResult validate(ToolInputGuardrailRequest request) { | |||
| return ToolInputGuardrailResult.success(); | |||
|
|
|||
| } catch (Exception e) { | |||
| return ToolInputGuardrailResult.failure( | |||
| return ToolInputGuardrailResult.fatal( | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To answer the question, which is not asked yet: API of ToolInputGuardrailResult was changed[1] recently, and it looks like fatal failure is better describes the intention here. Otherwise, we will need to get rid of either exception or custom message.
[1] #1993
|
Thanks!
(Maybe "Chat guardrails" isn't a good term, so if anybody has a better idea how to distinguish them....?!) |
This comment has been minimized.
This comment has been minimized.
e183329 to
6aa0fb2
Compare
|
@jmartisk done! |
6aa0fb2 to
0b82af1
Compare
This comment has been minimized.
This comment has been minimized.
0b82af1 to
e0d0f40
Compare
This comment has been minimized.
This comment has been minimized.
- Add the functionality - Rename `tool-guardrails` to `guardrails` - Change the README - Add an ability to run with the platform BOMs
e0d0f40 to
1db6dba
Compare
Status for workflow
|
| Status | Name | Step | Failures | Logs | Raw logs |
|---|---|---|---|---|---|
| ❌ | Quick Build | Build with Maven |
Failures | Logs | Raw logs |
| ❌ | Build report | Produce report and add it as job summary |
Logs | Raw logs |
Failures
⚙️ Quick Build #
- Failing: docs
📦 docs
❌ Failed to execute goal io.quarkus:quarkus-maven-plugin:3.27.1:build (default) on project quarkus-langchain4j-docs: Failed to build quarkus application
Verifying, that #1999 is fixed for good, and acting as a source of truth for the documentation