Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dlqqq committed Apr 4, 2024
1 parent e1fe3f6 commit 6983f3f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from langchain.pydantic_v1 import BaseModel


class Persona(BaseModel):
"""
Model of an **agent persona**, a struct that includes the name & avatar
Expand Down
10 changes: 2 additions & 8 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@

from dask.distributed import Client as DaskClient
from jupyter_ai.config_manager import ConfigManager, Logger
from jupyter_ai.models import (
AgentChatMessage,
ChatMessage,
HumanChatMessage,
)
from jupyter_ai.models import AgentChatMessage, ChatMessage, HumanChatMessage
from jupyter_ai_magics import Persona
from jupyter_ai_magics.providers import BaseProvider
from langchain.pydantic_v1 import BaseModel
Expand Down Expand Up @@ -186,9 +182,7 @@ def reply(self, response: str, human_msg: Optional[HumanChatMessage] = None):
time=time.time(),
body=response,
reply_to=human_msg.id if human_msg else "",
persona=Persona(
name=persona.name, avatar_route=persona.avatar_route
),
persona=Persona(name=persona.name, avatar_route=persona.avatar_route),
)

for handler in self._root_chat_handlers.values():
Expand Down
4 changes: 1 addition & 3 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def build_help_message(
time=time.time(),
body=_format_help_message(chat_handlers, persona, unsupported_slash_commands),
reply_to="",
persona=Persona(
name=persona.name, avatar_route=persona.avatar_route
),
persona=Persona(name=persona.name, avatar_route=persona.avatar_route),
)


Expand Down
4 changes: 2 additions & 2 deletions packages/jupyter-ai/jupyter_ai/extension.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import re
import time
import os

from dask.distributed import Client as DaskClient
from importlib_metadata import entry_points
Expand Down Expand Up @@ -31,12 +31,12 @@
RootChatHandler,
)


JUPYTERNAUT_AVATAR_ROUTE = JupyternautPersona.avatar_route
JUPYTERNAUT_AVATAR_PATH = str(
os.path.join(os.path.dirname(__file__), "static", "jupyternaut.svg")
)


class AiExtension(ExtensionApp):
name = "jupyter_ai"
handlers = [
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyter-ai/jupyter_ai/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any, Dict, List, Literal, Optional, Union

from jupyter_ai_magics.providers import AuthStrategy, Field
from jupyter_ai_magics import Persona
from jupyter_ai_magics.providers import AuthStrategy, Field
from langchain.pydantic_v1 import BaseModel, validator

DEFAULT_CHUNK_SIZE = 2000
Expand Down

0 comments on commit 6983f3f

Please sign in to comment.