quarkiverse / quarkus-langchain4j

Quarkus Langchain4j extension
https://docs.quarkiverse.io/quarkus-langchain4j/dev/index.html
Apache License 2.0
133 stars 79 forks source link

Suggestion: Reduce repetition of words in Guardrails API signature? #926

Open holly-cummins opened 1 week ago

holly-cummins commented 1 week ago

I notice that

public interface InputGuardrail extends Guardrail<InputGuardrail.InputGuardrailParams, InputGuardrailResult> {

repeats InputGuardrail four times in the one line.

Instead, could we have

public interface InputGuardrail extends Guardrail<InputGuardrailParams, InputGuardrailResult> {

(no inner class)

or

public interface InputGuardrail extends Guardrail<InputGuardrail.Params, InputGuardrailResult> {

(inner class, but without the repeated InputGuardrail?)

Similarly,

public interface OutputGuardrail extends Guardrail<OutputGuardrail.OutputGuardrailParams, OutputGuardrailResult> {

could be

public interface OutputGuardrail extends Guardrail<OutputGuardrailParams, OutputGuardrailResult> {

or

public interface OutputGuardrail extends Guardrail<OutputGuardrail.Params, OutputGuardrailResult> {

The option without the inner class is perhaps better, since otherwise there's a puzzling asymmetry (why is the Params an inner class, but OutputGuardrailResult gets its own top-level class?)

holly-cummins commented 1 week ago

(I can do a PR, but won't until we discuss whether there's a reason for the current style.)

geoand commented 6 days ago

+1 from me, but it's up to @cescoffier

cescoffier commented 6 days ago

No problem for me, @mariofusco you ok with it?

mariofusco commented 6 days ago

This is also ok for me. Thanks for giving a look at it @holly-cummins, let me know if I can help.