Document VertexAI authentication (#463)

This commit is contained in:
LangChain4j 2024-01-09 19:50:21 +01:00 committed by GitHub
parent 9a71a4c3b7
commit 45a1133f85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 0 deletions

View File

@ -23,6 +23,21 @@ import static dev.langchain4j.internal.ValidationUtils.ensureNotNull;
/**
* Represents a Google Vertex AI Gemini language model with a chat completion interface, such as gemini-pro.
* See details <a href="https://cloud.google.com/vertex-ai/docs/generative-ai/model-reference/gemini">here</a>.
* <br>
* Please follow these steps before using this model:
* <br>
* 1. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#authentication">Authentication</a>
* <br>
* When developing locally, you can use one of:
* <br>
* a) <a href="https://github.com/googleapis/google-cloud-java?tab=readme-ov-file#local-developmenttesting">Google Cloud SDK</a>
* <br>
* b) <a href="https://github.com/googleapis/google-cloud-java?tab=readme-ov-file#using-a-service-account-recommended">Service account</a>
* When using service account, ensure that <code>GOOGLE_APPLICATION_CREDENTIALS</code> environment variable points to your JSON service account key.
* <br>
* 2. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#authorization">Authorization</a>
* <br>
* 3. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#prerequisites">Prerequisites</a>
*/
public class VertexAiGeminiChatModel implements ChatLanguageModel {

View File

@ -29,6 +29,21 @@ import static java.util.stream.Collectors.toList;
/**
* Represents a Google Vertex AI language model with a chat completion interface, such as chat-bison.
* See details <a href="https://cloud.google.com/vertex-ai/docs/generative-ai/chat/chat-prompts">here</a>.
* <br>
* Please follow these steps before using this model:
* <br>
* 1. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#authentication">Authentication</a>
* <br>
* When developing locally, you can use one of:
* <br>
* a) <a href="https://github.com/googleapis/google-cloud-java?tab=readme-ov-file#local-developmenttesting">Google Cloud SDK</a>
* <br>
* b) <a href="https://github.com/googleapis/google-cloud-java?tab=readme-ov-file#using-a-service-account-recommended">Service account</a>
* When using service account, ensure that <code>GOOGLE_APPLICATION_CREDENTIALS</code> environment variable points to your JSON service account key.
* <br>
* 2. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#authorization">Authorization</a>
* <br>
* 3. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#prerequisites">Prerequisites</a>
*/
public class VertexAiChatModel implements ChatLanguageModel {

View File

@ -26,6 +26,21 @@ import static java.util.stream.Collectors.toList;
/**
* Represents a Google Vertex AI embedding model, such as textembedding-gecko.
* See details <a href="https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings">here</a>.
* <br>
* Please follow these steps before using this model:
* <br>
* 1. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#authentication">Authentication</a>
* <br>
* When developing locally, you can use one of:
* <br>
* a) <a href="https://github.com/googleapis/google-cloud-java?tab=readme-ov-file#local-developmenttesting">Google Cloud SDK</a>
* <br>
* b) <a href="https://github.com/googleapis/google-cloud-java?tab=readme-ov-file#using-a-service-account-recommended">Service account</a>
* When using service account, ensure that <code>GOOGLE_APPLICATION_CREDENTIALS</code> environment variable points to your JSON service account key.
* <br>
* 2. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#authorization">Authorization</a>
* <br>
* 3. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#prerequisites">Prerequisites</a>
*/
public class VertexAiEmbeddingModel implements EmbeddingModel {

View File

@ -23,6 +23,21 @@ import static java.util.Collections.singletonList;
/**
* Represents a Google Vertex AI language model with a text interface, such as text-bison.
* See details <a href="https://cloud.google.com/vertex-ai/docs/generative-ai/text/text-overview">here</a>.
* <br>
* Please follow these steps before using this model:
* <br>
* 1. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#authentication">Authentication</a>
* <br>
* When developing locally, you can use one of:
* <br>
* a) <a href="https://github.com/googleapis/google-cloud-java?tab=readme-ov-file#local-developmenttesting">Google Cloud SDK</a>
* <br>
* b) <a href="https://github.com/googleapis/google-cloud-java?tab=readme-ov-file#using-a-service-account-recommended">Service account</a>
* When using service account, ensure that <code>GOOGLE_APPLICATION_CREDENTIALS</code> environment variable points to your JSON service account key.
* <br>
* 2. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#authorization">Authorization</a>
* <br>
* 3. <a href="https://github.com/googleapis/java-aiplatform?tab=readme-ov-file#prerequisites">Prerequisites</a>
*/
public class VertexAiLanguageModel implements LanguageModel {