Support to access model gardens using endpoints: rawPredict or streamRawPredict

未关闭
#900 4 条评论 1 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@hemasekhar-p 已经在做这个了。

开始于 2026年3月26日。

评估

这个 Issue 还没有评估数据。

描述

priority: p3 type: feature request

Description

The Vertex AI documentation describes that we can select one of the different models: open, partner, gemini-family and access them using curl, python and probably this Java SDK (as documented here) but when we use the following code

        Client client = null;
        try {
            GoogleCredentials creds = GoogleCredentials.getApplicationDefault();
            creds.refreshIfExpired();

            client = Client.builder()
                    .credentials(creds)
                    .build();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        GenerateContentResponse response =
                client.models.generateContent("anthropic/claude-opus-4-6", "What is your name?", null);

then we got this error

com.google.genai.errors.ClientException: 400 . claude-opus-4-6 is not supported in the generateContent API.
    at com.google.genai.errors.ApiException.throwFromResponse (ApiException.java:94)
    at com.google.genai.HttpApiResponse.getBody (HttpApiResponse.java:37)
    at com.google.genai.Models.processResponseForPrivateGenerateContent (Models.java:5480)
    at com.google.genai.Models.privateGenerateContent (Models.java:5546)
    at com.google.genai.Models.generateContent (Models.java:7076)
    at com.google.genai.Models.generateContent (Models.java:7150)
    at com.google.genai.examples.GenerateContent.main (GenerateContent.java:89)

Suggestion

This Java SDK project is a great library as it allows third-party projects to access the Google Cloud platform and Vertex AI using HTTP(s) with JSON body messages instead of using gRPC.

As the access to one of the model partners like Claude, Mistral, etc relies on the following endpoints

https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/anthropic/models/MODEL:rawPredict
https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/anthropic/models/MODEL:streamRawPredict

I suggest that this Java SDK also support them. Here is the API documentation: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/projects.locations.endpoints/rawPredict

FYI: The projects Langchain4j and Quarkus Langchains4j currently use the gRPC code of the following GAV and will be more than happy to use now this SDK with HTTP(S).

<dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>google-cloud-aiplatform</artifactId>
            <version>3.69.0</version>
        </dependency>
主要语言
Java
星标
399
派生
127
平均合并
1 天 22 小时
30 天内合并 PR
74

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

googleapis/java-genai 的其他 Issue

查看 googleapis/java-genai 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。