- Craete new EmbeddingOptions -> ModelOptions, EmbeddigRequest -> ModelRequest, EmbeddingResponseMetadata -> ResponseMetadata and EmbeddignResultMetadata -> ResultMetadata. - Make the EmbeddigClient interface extend from ModelClient<EmbeddingRequest, EmbeddingResponse>, EmbeddingResponse implements ModelResponise and Embedding implements ModelResult. - Fix affected tests. - Steramline the EmbeddingClient interface with default method implementations based on call. - Merge EmbeddingUtil into AbstractEmbeddingClient
Vertex AI API client for the Generative Language model
The Generative Language PaLM API allows developers to build generative AI applications using the PaLM model. Large Language Models (LLMs) are a powerful, versatile type of machine learning model that enables computers to comprehend and generate natural language through a series of prompts. The PaLM API is based on Google's next generation LLM, PaLM. It excels at a variety of different tasks like code generation, reasoning, and writing. You can use the PaLM API to build generative AI applications for use cases like content generation, dialogue agents, summarization and classification systems, and more.
Based on the Models REST API.
Prerequisite
To access the PaLM2 REST API you need to obtain an access API KEY form makersuite. Note: Currently it is not available outside US, but you can use VPN for testing.
PaLM API
The VertexAI, ChatClient and EmbeddingClient are built on top the VertexAiApi.java client library:
Following snippets show how to use the VertexAiApi client directly:
VertexAiApi vertexAiApi = new VertexAiApi(< YOUR PALM_API_KEY>);
// Generate
var prompt = new MessagePrompt(List.of(new Message("0", "Hello, how are you?")));
GenerateMessageRequest request = new GenerateMessageRequest(prompt);
GenerateMessageResponse response = vertexAiApi.generateMessage(request);
// Embed text
Embedding embedding = vertexAiApi.embedText("Hello, how are you?");
// Batch embedding
List<Embedding> embeddings = vertexAiApi.batchEmbedText(List.of("Hello, how are you?", "I am fine, thank you!"));
