Integration scenario
Multiple rounds of dialogue + backend history persistence
Use the conversations API to replace client-side session management. All history is persisted in the Nexevo backend and supports cross-device + Resume + Search.
Python
python
from nexevo_ai import Nexevo
client = Nexevo()
# 1) Create a conversation (you can add metadata to associate your user ID, etc.)
conv = client.conversations.create(
title="Technical Consulting",
metadata={"user_id": "u_123", "topic": "kubernetes"},
)
conv_id = conv["conversation_id"]
def chat_turn(user_msg: str) -> str:
# 2) Pull history + add new user messages
history = client.conversations.get(conv_id)["messages"]
messages = [
{"role": m["role"], "content": m["content"]} for m in history
] + [{"role": "user", "content": user_msg}]
# 3) Adjust LLM
resp = client.chat.completions.create(
model="nexevo/balanced",
messages=messages,
)
assistant = resp["choices"][0]["message"]["content"]
# 4) Persistence of two messages
client.conversations.append_message(conv_id, role="user", content=user_msg)
client.conversations.append_message(conv_id, role="assistant", content=assistant)
return assistant
# Use in multiple rounds
print(chat_turn("What does kube-proxy do?"))
print(chat_turn("What about ipvs mode?")) # Automatically bring into the previous round context