-
Notifications
You must be signed in to change notification settings - Fork 0
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
[issue_4156] Improves handling of empty or blank input for openai procedures #2
base: 5.25
Are you sure you want to change the base?
Conversation
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.
Direi Eccellente Smithers, giusto un po' di cambiamentini e test in più.
Poi inserisci nel docs/asciidoc/modules/ROOT/pages/ml/openai.adoc
,
circa alla riga 32 questa riga:
| failOnError | If true (default), the procedure fails in case of empty, blank or null input
TestUtil.testCallEmpty(db, "CALL apoc.ml.openai.completion(null, $apiKey, $conf)", | ||
Map.of("apiKey", openaiKey, "conf", Map.of(FAIL_ON_ERROR_CONF, false)) | ||
); | ||
} | ||
} |
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.
Aggiungi pure dei test con lista vuota tipo:
@Test
public void embeddingsWithEmptyFails() {
assertEmptyInputFails(db, "CALL apoc.ml.openai.chat([], $apiKey, $conf)",
Map.of("apiKey", openaiKey, "conf", emptyMap())
);
}
@Test
public void embeddingsWithEmptyReturnsEmptyIfFailOnErrorFalse() {
TestUtil.testCallEmpty(db, "CALL apoc.ml.openai.embeddings([], $apiKey, $conf)",
Map.of("apiKey", openaiKey, "conf", Map.of(FAIL_ON_ERROR_CONF, false))
);
}
e la classe MLTestUtil.java
la cambi in questo modo, visto che mo abbiamo a disposizione questo stupendo ExtendedTestUtil.assertFails
:
public class MLTestUtil {
public static void assertNullInputFails(GraphDatabaseService db, String query, Map<String, Object> params) {
ExtendedTestUtil.assertFails(db, query, params, ERROR_NULL_INPUT);
}
public static void assertEmptyInputFails(GraphDatabaseService db, String query, Map<String, Object> params) {
ExtendedTestUtil.assertFails(db, query, params, ERROR_EMPTY_OR_BLANK_INPUT);
}
}
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.
dovrei aver sistemato come suggerito!
mi facci sapere se c'è altro, o mi sono dimenticato qualcosa ^^
Co-authored-by: Giuseppe Villani <[email protected]>
Co-authored-by: Giuseppe Villani <[email protected]>
:emoticon-libidine: lgtm questa puoi chiuderla, la PR sulla repo principale la devo fare io |
Fixes neo4j-contrib#4156
Improves handling of empty or blank input for OpenAI procedures
Proposed Changes (Mandatory)
Here is a brief list of proposed changes to fix the issue: