https://www.boundaryml.com logo
GPT-OSS on vertex help
# help
b
Has anyone gotten gpt-oss through vertex working? Using this config
Copy code
client<llm> GptOss120b {
  provider vertex-ai
  options {
    model gpt-oss-120b-maas
    project_id PROJECT_ID
    base_url "https://aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/openai/models"
    generation_config {
      temperature 0.0
      seed 42
    }
  }
}
and it does make the call, but it seems to return a response in a different form, so baml fails to parse it. I can't figure out how to parse it. I tried using
openai-generic
as the client provider, thinking it would match the openai format, but that failed too with a 404. Here's an example output from the raw-curl
Copy code
{
  "candidates": [
    {
      "content": {
        "role": "assistant",
        "parts": [
          {
            "text": "Why donโ€™t skeletons fight each other?\n\nThey donโ€™t have the guts."
          }
        ]
      },
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 71,
    "candidatesTokenCount": 47,
    "totalTokenCount": 118
  }
}
and here's the error from baml
Copy code
Unspecified error code: 2 Failed to parse into a response accepted by baml_runtime::internal::llm_client::primitive::vertex::types::VertexResponse: {"usageMetadata":{"promptTokenCount":71,"candidatesTokenCount":47,"totalTokenCount":118}}

Caused by:
    missing field `candidates`

Request options: {"generation_config":{"temperature":0.0,"seed":42}}
and when i try
openai-generic
Copy code
Unspecified error code: 404 Request failed with status code: 404 Not Found, 
<no response or invalid utf-8>

Request options: {"model":"gpt-oss-120b-maas","project_id":"{}","generation_config":{"temperature":0.0,"seed":42}}
v
You can set the response type!
Just set the response type to โ€œopenaiโ€
b
hm @Vaibhav (BAML ๐Ÿ‘) getting
Copy code
Unspecified error code: 2 error sending request

If you haven't yet, try enabling the proxy (See API Keys button)

Request options: {"client_response_type":"openai","generation_config":{"temperature":0.0,"seed":42}}
i haev the proxy enabled already
v
oh what?! let me check why that isn't work
a
@nikitoshina it seems you got this to work -- do you use vertex?
b
i just updated baml from 0.214 to 0.215 and now seeing
Copy code
Unspecified error code: 400 Request failed with status code: 400 Bad Request, 
{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"client_response_type\": Cannot find field.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "description": "Invalid JSON payload received. Unknown name \"client_response_type\": Cannot find field."
          }
        ]
      }
    ]
  }
}
the docs make it seem like this is maybe only allowed for openai providers?
v
oh interesting, ok that is def a bug! i'll patch this for a friday!
b
ty! no rush from my perspective, i use groq and baseten right now, just looking for more capacity haha
n
i use vertex for gemini. Haven't used it for oss directly. You can try OpenRouter with BYK if you want a quick workaround.
but yeah vertex has its own quirks
b
vertex is so annoying