Persona

July 31, 2026 · View on GitHub

Module: ovos_persona.Persona

Persona is the runtime representation of a single named AI personality. It holds the ordered solver pipeline for answering queries and optionally a memory plugin for maintaining conversation history.


Constructor

from ovos_persona import Persona

persona = Persona(name="MyChatBot", config={...}, blacklist=[])
ParameterDescription
nameDisplay name of the persona
configPersona config dict (from JSON file or plugin)
blacklistList of solver plugin names to never load for this persona

Raises ValueError if the config provides no handler plugins.


Configuration Keys

KeyDescription
handlersOrdered list of utterance handler plugin entry point names (preferred key)
solversSame as handlers (legacy alias)
memory_moduleEntry point name of the memory plugin (default: ovos-agents-short-term-memory-plugin)
<plugin_name>Per-plugin configuration dict passed to each handler
{
  "name": "MyChatBot",
  "handlers": [
    "ovos-solver-openai-plugin",
    "ovos-solver-wolfram-alpha-plugin"
  ],
  "ovos-solver-openai-plugin": {
    "api_url": "https://api.openai.com/v1",
    "key": "sk-..."
  },
  "memory_module": "ovos-agents-short-term-memory-plugin"
}

Memory

If memory_module is set (and not empty), the plugin is loaded via load_memory_plugin(). The default is BasicShortTermMemory from this package.

Set memory_module to null or "" to disable memory entirely:

{
  "name": "Stateless",
  "handlers": ["ovos-solver-openai-plugin"],
  "memory_module": null
}

Without memory, each utterance is sent to the solver as a single USER message with no history context.


Key Methods

get_messages(utterance, sess) → List[AgentMessage]

Build the message list to send to the solver:

  • With memory: calls memory.build_conversation_context(utterance, sess.session_id) — prepends system prompt and prior history
  • Without memory: returns [AgentMessage(MessageRole.USER, utterance)]

chat(messages, sess) → str

Single-shot completion. Returns the full response as a string. Used by PersonaProtocol (HiveMind integration).

stream(messages, sess) → Iterable[str]

Streaming completion. Yields response sentences as they are produced. Used by PersonaService.handle_persona_query() to speak answers incrementally.

Both methods delegate to QuestionSolversService, passing sess.lang and sess.system_unit.


Repr

repr(persona)
# → "Persona(MyChatBot:['ovos-solver-openai-plugin', 'ovos-solver-wolfram-alpha-plugin'])"

← PersonaService · Home · Solvers →