תרגום מכונה · המקור באנגלית

FunctionGemma 270M

Function Gemma 270M Gemma 3 נגזרת מעולה עבור כלי מובנה ושיחות פונקציה.במקום טקסט חינם, היא פולטת נוקשה <start_function_call>call:NAME{...}<end_function_call> דקדוק כי SDK pares לתוך הקלדה FunctionCall בערך 283 MB על הדיסק, הוא קטן מספיק כדי לטעון לצד ASR + TTS על חומרה ברמה הטלפון לשרת כ"נתב" שהופכ את הביטוי של המשתמש לתוך כלי ייעוד.

Calling, On-Device

FunctionGemma חריצים לתוך סוכנים קוליים בכל מקום שבו היית קורא אחרת LLM עבור כלי routing.הדקדוק הוא נוקשה על ידי בנייה, אז אתה מקבל בחזרה parsed FunctionCall אובייקטים ישירות - ללא תיקון JSON, no schema-deing.

פלטפורמות

פלטפורמהפורמט FormatגודלHuggingFace
Apple (macOS / iOS)CoreML283 MBaufklarer/FunctionGemma-270M-CoreML
Android (and Linux / Windows באמצעות דיבור Core)LiteRT-LM283 MBsoniqo/FunctionGemma-270M-LiteRT-LM

דקדוק

המודל מאומן לפלט שיחת טלפון אחת (או רצף של שיחות) עטוף בשני אסימונים שנשלחו:

<start_function_call>call:set_timer{"minutes": 5, "label": "tea"}<end_function_call>

SDK מכנה כל קריאה לטיפוס FunctionCall(name:, arguments:) ערך. ארגומנטים מקודמים כ-JSON כדי שתוכלו למפות אותם ישירות על Swift Codable או קוביין @Serializable שיעור נתונים

Swift (Apple, CoreML)

בפלטפורמות Apple FunctionGemma נחשף דרך speech-swift כמו FunctionGemma שיעור זה נטען במודל CoreML של HuggingFace לשימוש ראשון ורץ על Neural Engine.

import FunctionGemma

let model = try await FunctionGemma.fromPretrained()

let tools = """
- set_timer(minutes: Int, label: String)
- get_weather(city: String)
"""

let calls = try model.callFunctions(
    tools: tools,
    userMessage: "Set a 5 minute tea timer"
)

for call in calls {
    print(call.name)       // "set_timer"
    print(call.arguments)  // ["minutes": 5, "label": "tea"]
}

Kotlin (Android, LiteRT-LM)

על Android המודל נחשף speech-android כמו audio.soniqo.speech.llm.FunctionGemmaזהו מתאם מוביל-שלך-בזמן: אתה מספק מתאם: LiteRtLmRuntime לדוגמה (SDK) ספינות ברירת מחדל FunctionGemma מטפל בתבנית מהירה ובקיצור דקדוק.

import audio.soniqo.speech.llm.FunctionGemma
import audio.soniqo.speech.llm.LiteRtLmRuntime

val runtime = LiteRtLmRuntime.fromPretrained(context)
val model = FunctionGemma(runtime)

val tools = """
- set_timer(minutes: Int, label: String)
- get_weather(city: String)
""".trimIndent()

val calls = model.callFunctions(
    tools = tools,
    userMessage = "Set a 5 minute tea timer",
)

for (call in calls) {
    println(call.name)       // "set_timer"
    println(call.arguments)  // {"minutes": 5, "label": "tea"}
}

עוד קריאה