Skip to content

v1.16.0

Choose a tag to compare

@sebsto sebsto released this 12 Jun 15:50
· 6 commits to main since this release
7e9136e

Google Gemma 4 and Gemma 3 models

Six Google Gemma models are now available through the library. Gemma 4 models work via the Chat Completions and Responses APIs on the bedrock-mantle endpoint. Gemma 3 models also support InvokeModel and Converse.

Gemma 4 (mantle-only):

  • Gemma 4 31B (.gemma4_31b)
  • Gemma 4 26B-A4B (.gemma4_26b_a4b)
  • Gemma 4 E2B (.gemma4_e2b)

Gemma 3 (InvokeModel + Converse + Chat Completions):

  • Gemma 3 27B IT (.gemma3_27b_it)
  • Gemma 3 12B IT (.gemma3_12b_it)
  • Gemma 3 4B IT (.gemma3_4b_it)
// Chat Completions API (Gemma 4)
let reply = try await bedrock.completeChatCompletion(
    "Explain the difference between a compiler and an interpreter",
    with: .gemma4_31b,
    authentication: .default
)
print(reply.text)

Chat Completions API

A new OpenAI-compatible Chat Completions endpoint for multi-turn conversations. Works with all Gemma models and supports both API key and SigV4 authentication.

var messages: [ChatCompletionsMessage] = []
messages.append("What is Swift?")

let reply = try await bedrock.completeChatCompletion(
    messages,
    with: .gemma4_31b,
    authentication: .default
)

messages.append(reply)
messages.append("How does it compare to Kotlin?")

let followUp = try await bedrock.completeChatCompletion(
    messages,
    with: .gemma4_31b,
    authentication: .default
)

Gemma 4 with the Responses API

Gemma 4 models also work with the Responses API introduced in v1.14.0:

let response = try await bedrock.createResponse(
    "What are three benefits of open-source software?",
    with: .gemma4_31b,
    authentication: .default
)
print(response.text)

New example

  • Examples/google-gemma/ shows both the Chat Completions and Responses APIs with Gemma 4.

What'''s Changed

  • Add Google Gemma 4 and Gemma 3 model support by @sebsto in #90
  • Extract shared makeMantleURL and makeMantleClient helpers by @sebsto in #91

Full Changelog: v1.15.0...v1.16.0'