api.tools

أنت

tools: { image: api.tools.image }, model: { main, image }

يسمح تشغيل توليد صورة. هو إعلان تم حله مقابل نموذج جلسة اسم صورة -- لذلك النموذج الذي يكتب ليس النموذج الذي يرسم.

declaration onlyneeds an image sessiondeclared cost 26
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

Nothing to call. What produces the image is a model session you created and handed to the run under the name image.

التعريف

const writer = await api.models.create({ model: "gemini-3.5-flash" });
const painter = await api.models.create({ model: "gemini-3.1-flash-image" });

const agent = api.agents.create({
  model: { main: writer, image: painter },     // the name matters
  tools: { image: api.tools.image },
  budget: 200,
});

const run = await agent.run({
  inputs: [{ type: "text", content: "Draw a logo for a tide-forecasting app, then describe it." }],
});
writer = api.models.create(model="gemini-3.5-flash")
painter = api.models.create(model="gemini-3.1-flash-image")

agent = api.agents.create(
    model={"main": writer, "image": painter},   # the name matters
    tools={"image": api.tools.image},
    budget=200,
)

run = agent.run(inputs=[
    {"type": "text", "content": "Draw a logo for a tide-forecasting app, then describe it."},
])
اسم الجلسة هو صورة، ليس مهما كنت تدعوه أداة

يمكنك إعادة تسمية الأداة بحرية ؛ الجلسة ينظر إليها من أعلى باسمها. بدون إدخال صورة في النموذج ، إجابات التشغيل التي لم يتم تقديم جلسة الصورة -- وتقول ذلك بدلا من توليد مع نموذج الكتابة.

ما يرسله النموذج

promptstringمطلوب

ما الذي يمكن أن يخلقه الوصف الكامل في حجة واحدة

حيث أنّه يجري

وهي مرتبطة بالهروب كقطعة أثرية، وهي في نتيجة التشغيل - لا تُكتب في أي مكان، وإنقاذها لك، وهو ما يسمح لنفس التشغيل بخدمة صفحة، أو ملف على الآلة أو دلو.

const [picture] = run.artifacts.filter((a) => a.type === "image");

await pc.files.write("Assets/logo.png", Buffer.from(picture.content, "base64"));
// or
await api.files.create({ name: "logo.png", content: Buffer.from(picture.content, "base64"),
                         mimeType: picture.mime }).save();
import base64

picture = next(a for a in run["artifacts"] if a["type"] == "image")

pc.files.write("Assets/logo.png", base64.b64decode(picture["content"]))
# or
api.files.create(name="logo.png", content=base64.b64decode(picture["content"]),
                 mime_type=picture.get("mime")).save()

التكلفة المعلنة هي 26، وهي مبالغة في التقديرات

يقرر حارس الميزانية ثالثاً على الرقم المعلن - بحيث يكون هذا العدد عند أو فوق ما يكلفه الجيل في الواقع. 26 هو المتخلف ؛ رفعه مع cost إذا عملت بنموذج أكثر تكلفة، ولم تخفضه أبداً ليناسب الميزانية.

tools: {
  image: { run: api.tools.image, cost: 40, options: { aspectRatio: "16:9" } },
}
tools = {
    "image": {"run": api.tools.image, "cost": 40, "options": {"aspectRatio": "16:9"}},
}

options دمج في إعدادات الجلسة لتلك الدعوة، لذا يمكن ربط نسبة أو جودة جانب ثابت دون أخذ الموضوع بعيداً عن النموذج.

ما هو مُكلف

يتم دفع فواتير الجيل إلى الحساب مثل أي حساب آخر، و كل رصيد الإدارة يوصله. لا شيء يُفرض عندما يرفض الحارس،

يُمثّل أداة الفيديو

أحدث صورة أحدث أثر من عملية تمر إلى 1 ف-5، 1 ف-4، 1 ف-3، 1 خ م، 1 خ م، 1 م و، 1 م أ م، 1 م و، 1 م أ م لذا "ارسمها، ثم حركها" هي مكالمتان لا يوجد بينهما شيء