Add Vertex AI support
- Rename Generation#text to content and info to properties. - Make Generation extend the AbstractMessage and default to ASSISTANT message type. - Add vevertex-ai project with native api client for generation and embedding. - Add unit and IT tests for the vertex-ai native client. - Add AiClient and EmbeddingClient implementation for the the Vertex AI along with ITs.
This commit is contained in:
committed by
Mark Pollack
parent
5890d565aa
commit
69906db4f5
@@ -55,7 +55,7 @@ public class BasicEvaluationTest {
|
||||
|
||||
protected void evaluateQuestionAndAnswer(String question, AiResponse response, boolean factBased) {
|
||||
assertThat(response).isNotNull();
|
||||
String answer = response.getGeneration().getText();
|
||||
String answer = response.getGeneration().getContent();
|
||||
logger.info("Question: " + question);
|
||||
logger.info("Answer:" + answer);
|
||||
PromptTemplate userPromptTemplate = new PromptTemplate(userEvaluatorResource,
|
||||
@@ -69,12 +69,12 @@ public class BasicEvaluationTest {
|
||||
}
|
||||
Message userMessage = userPromptTemplate.createMessage();
|
||||
Prompt prompt = new Prompt(List.of(userMessage, systemMessage));
|
||||
String yesOrNo = openAiClient.generate(prompt).getGeneration().getText();
|
||||
String yesOrNo = openAiClient.generate(prompt).getGeneration().getContent();
|
||||
logger.info("Is Answer related to question: " + yesOrNo);
|
||||
if (yesOrNo.equalsIgnoreCase("no")) {
|
||||
SystemMessage notRelatedSystemMessage = new SystemMessage(qaEvaluatorNotRelatedResource);
|
||||
prompt = new Prompt(List.of(userMessage, notRelatedSystemMessage));
|
||||
String reasonForFailure = openAiClient.generate(prompt).getGeneration().getText();
|
||||
String reasonForFailure = openAiClient.generate(prompt).getGeneration().getContent();
|
||||
fail(reasonForFailure);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user