Skip to content

[v3-beta] Personas #1313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dlqqq opened this issue Apr 8, 2025 · 2 comments
Open

[v3-beta] Personas #1313

dlqqq opened this issue Apr 8, 2025 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@dlqqq
Copy link
Member

dlqqq commented Apr 8, 2025

Problem

In Jupyter AI v3, we are exploring ways to introduce multiple AI agents into the chat.

To do this, we need to define the data representation of an AI agent, and describe what it does.

Proposed Solution

A persona is a complete description of an agent which can directly accept user queries, and is treated like "just another user" in the chat.

  • This agent should be @-mentionable from the chat.
  • When a user types a new message into the chat, the persona should respond intelligently:
    • When there is only one user & one persona: always reply to new messages.
    • Otherwise: only reply when @-mentioned.
  • The persona should be able to fully represent Jupyternaut.
  • The persona should be configurable and read from the ConfigManager to allow users to override our defaults.

Proposed interface:

class PersonaDefaults(BaseModel):
  
  # required fields

  name: str # e.g. "Jupyternaut"
  avatar_path: str # e.g. /avatars/jupyternaut.svg
  system_prompt: str # e.g. "You are a language model named..."
  slash_commands: Set[str] = set("*") # change this to enable/disable slash commands

  # optional fields

  model_uid: Optional[str] = None # e.g. "ollama:deepseek-coder-v2" 
  # ^^^ set this to automatically default to a model after a fresh start, no config file
  

class Persona(BaseModel):
  id: str # e.g. 'jupyternaut'
  defaults: PersonaDefaults
  subagents: Set[Persona]
  config_manager: ConfigManager
  
  @property
  def name(self) -> str:
    """The name that users should use to `@`-mention this persona."
    return self.config.jupyternaut.name or self.defaults.name

  @property
  def avatar_path(self) -> str:
    """The path to this persona's avatar, shown in the chat."""
    return self.config.jupyternaut.avatar_path or self.defaults.avatar_path

  @property
  def system_prompt(self) -> str:
    """The system prompt used by this persona."""
    return self.config.jupyternaut.system_prompt or self.defaults.system_prompt

  @property
  def lc_runnable(self) -> Runnable:
    """The LangChain runnable used to define the implementation of this persona."""

Additional context

We will elaborate on how to extend this to build a multi-agent collaboration (MAC) experience later in a future issue.

@krassowski
Copy link
Member

krassowski commented Apr 10, 2025

We had quite a few issues with avatar_url which never worked well. Could the API allow to accept bytes (e.g. raw bytes or base64 PNG)?

@dlqqq
Copy link
Member Author

dlqqq commented Apr 10, 2025

@krassowski Are you psychic? Brian and I discussed this exact same subject yesterday. 😂

Yes, we should allow avatars to be sent directly w/ the response. I'll add that as a subissue to this one. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants