🧠 Dynamic Behavior

The chat adapts in real time to the user's profile: mood, technical level and preferred format.

With dynamic_mode active, on every message the orchestrator runs a mini-analysis of the input and updates three context variables (mood, technical level, preferred format). The model reads the profile before generating the response and adapts tone, structure and language: empathic validation if the user is frustrated, essential bullet lists if in a hurry, simple analogies if a beginner, technical jargon if an expert. The detected profile comes back in result.dynamic, so you can build a visible "AI Mind" panel for your users.

user_mood

calmo · frustrato · entusiasta · di_fretta

Mood detected from the text: frustrated → empathic opener and calm tone; in a hurry → no pleasantries, bullet lists only.

technical_level

principiante · intermedio · esperto

Technical level based on the terms used: beginner → simple analogies and metaphors; expert → advanced jargon, straight to the point.

response_format

sintetico · dettagliato · elenco_puntato · metaforico

Preferred response format: sintetico → 2-3 sentences; elenco_puntato → scannable lists; metaforico → explanations with analogies.

How to enable or disable it — toggle in your code

• JSON body parameter: dynamic_mode (boolean, default false — disabled).

• dynamic_mode: true — enabled for the request. To keep it PERMANENTLY ON, include the parameter in every request of your app (or in your wrapper function, as in the example below).

• dynamic_mode: false — PERMANENTLY OFF: omit the parameter entirely or set it to false. You decide the default behavior of your integration.

• User toggle (example): read the end user's preference (e.g. localStorage or a setting in your app) and pass the value to the parameter, so the end user chooses.

JavaScript — funzione wrapper con toggle

// Wrapper: DYNAMIC_DEFAULT = true → attivo permanente; false → disattivo permanente
const DYNAMIC_DEFAULT = true;
 
async function askAI(prompt, { dynamic = DYNAMIC_DEFAULT } = {}) {
const res = await fetch("https://app.neuralaiweb.com/functions/neuralaiPublicApi", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
api_key: API_KEY,
prompt: prompt,
session_id: sessionId, // memoria conversazionale (opzionale)
dynamic_mode: dynamic // toggle: true | false (default false)
})
});
const data = await res.json();
return data.result; // result.dynamic = profilo rilevato ("AI Mind")
}
 
// Toggle dell'utente finale nel tuo UI:
// <Switch checked={userPref} onChange={(v) => askAI(p, { dynamic: v })} />

curl

curl -X POST https://app.neuralaiweb.com/functions/neuralaiPublicApi \
-H "Content-Type: application/json" \
-d '{
"api_key": "nai_xxx",
"prompt": "Come funziona il machine learning?",
"dynamic_mode": true,
"session_id": "opzionale"
}'

Response — result.dynamic

{
"status": "success",
"result": {
"response": "Il machine learning è ...",
"dynamic": {
"user_mood": "calmo",
"technical_level": "principiante",
"response_format": "dettagliato"
},
"dynamic_tokens": 5
}
}

Token cost

+5 tokens per request with dynamic_mode: true (on top of the intent's base cost). The charge applies only if the response is generated successfully: if the call fails you don't pay for the analysis. Available in textual responses of the unified endpoint (chat and web search) and in the Playground («Dynamic behavior» toggle). Agent AI agents have their own dedicated dynamic_mode, enabled from the agent's card (see Agent AI API).

Where it works

  • Playground (API Hub): «Dynamic behavior» +5 toggle next to the Intent selector.
  • Unified endpoint neuralaiPublicApi (from external apps, with an API key).
  • Agent AI: each agent has its own dynamic_mode (toggle on its card), including agents run via Agent API.

Related references

  • • Token Costs (/api-docs/token-pricing)
  • • Conversation Memory (/api-docs/ai-instructions)
  • • Agent AI API (/api-docs/agent-api)