# Visão geral

Canonical URL: https://developers.iagenify.com/pt/sdk/ref/assistant-session/
Language: pt

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

Status: 3 methods · 1 property · memory on by default

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

## La superficie {#surface}

| Membro | Funçã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. |
| Dati | La configurazion, come un objete lingunt. |

```javascript
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;
```

## Forma di usar un {#lifecycle}

```javascript
// 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();
```

> **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 {#no-settings}

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.

- [generate()](/pt/sdk/ref/assistant-session/generate): Pregunta, che cosa torna, e quanto costa.
- [api.models.create()](/pt/sdk/ref/models/create): Quando il comportamento di una sessione è decisi.

```python
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
```

```python
# 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()
```
