AssistenteSessione

Visão geral

Qua crea() e get() back main: una conversazione che si puènt continuare a chiedere, con sua configurazion attachada.

3 methods · 1 propertymemory on by default
Using Python?

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

Tu non ne construis uno. Viene da api.models.create() per una conversazione nuova, o api.models.get(id) per una conversazione che si riprende.

La superficie

MembroFunção
genera( { inputs, outputs })Pregunta. Questo è l'esperta.
getHistory()Legge ce era dicit, senza aggiunger a esso.
destroy()Suprime la sessione e i suoi messaggi.
DatiLa configurazion, come un objete lingunt.
const assistant = await api.models.create({ model: "gemini-3.5-flash" });

assistant.id;         // keep this — it is all you need to come back
assistant.model;
assistant.settings;
assistant.schema;
assistant.memory;     // true unless you asked otherwise
assistant.title;      // named by the first message
assistant.createdAt;
assistant.updatedAt;
assistant = api.models.create(model="gemini-3.5-flash")

assistant.id           # keep this — it is all you need to come back
assistant.model
assistant.settings
assistant.schema
assistant.memory       # True unless you asked otherwise
assistant.title        # named by the first message
assistant.created_at
assistant.updated_at

Forma di usar un

// Open, and remember which conversation this is
const assistant = await api.models.create({ model: "gemini-3.5-flash" });
await db.save({ userId, sessionId: assistant.id });

// Ask, as many times as the conversation needs
await assistant.generate({ inputs: [{ type: "text", content: "…" }] });

// Later, anywhere, any process
const again = await api.models.get(await db.load(userId));

// And when it is over
await again.destroy();
# Open, and remember which conversation this is
assistant = api.models.create(model="gemini-3.5-flash")
db.save(user_id=user_id, session_id=assistant.id)

# Ask, as many times as the conversation needs
assistant.generate(inputs=[{"type": "text", "content": "…"}])

# Later, anywhere, any process
again = api.models.get(db.load(user_id))

# And when it is over
again.destroy()
L'obiet è un manie, non la conversa

La conversazione è sul server. Due maniees per la stessa id sono la stessa conversa, e nulla è perdut al gettar una via.

Que non pots cambiar

Il model, le impostazioni e il schema sono fixs quando la sessione è creata. Non c'è metodo per cambiarli — per rispondere differente, aprire una sessione differente. Ciò è deliberat: una conversazione cui le regole cambiate a midème è una cui l'historia non explica più le ses risposte.