mirror of
https://github.com/kennethreitz/simplemind.git
synced 2026-06-05 22:50:18 +00:00
coderabbit suggestions fix
This commit is contained in:
@@ -8,7 +8,7 @@ import os
|
||||
import pickle
|
||||
|
||||
|
||||
class ContextualMemoryPlugin:
|
||||
class ContextualMemoryPlugin(sm.BasePlugin):
|
||||
def __init__(
|
||||
self,
|
||||
api_key: str,
|
||||
|
||||
@@ -25,7 +25,7 @@ class QuotesList(BaseModel):
|
||||
quotes: List[MovieQuote]
|
||||
|
||||
|
||||
def gen_quotes(n=10) -> Iterator[MovieQuote]:
|
||||
def gen_quotes(n: int = 10) -> Iterator[MovieQuote]:
|
||||
"""Generate a list of quotes from famous movies."""
|
||||
|
||||
for q in sm.generate_data(
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from _context import sm
|
||||
|
||||
|
||||
class MathPlugin:
|
||||
class MathPlugin(sm.BasePlugin):
|
||||
def send_hook(self, conversation: sm.Conversation):
|
||||
last_user_message = conversation.get_last_message(role="user")
|
||||
if last_user_message is None:
|
||||
return
|
||||
if "calculate" in last_user_message.text.lower():
|
||||
expression = last_user_message.text.lower().replace("calculate", "").strip()
|
||||
try:
|
||||
@@ -14,7 +16,7 @@ class MathPlugin:
|
||||
except Exception:
|
||||
conversation.add_message(
|
||||
role="assistant",
|
||||
text="I'm sorry, I couldn't compute that expression.",
|
||||
text="I'm sorry, I couldn't compute that expression. Please try again.",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ class ConversationPlugin(sm.BasePlugin):
|
||||
print(f"{conversation.llm_model}:\n{response.text.strip()}\n\n------------\n")
|
||||
|
||||
|
||||
def have_conversation(rounds=3):
|
||||
def have_conversation(rounds: int = 3):
|
||||
# Create two conversations - one for each AI
|
||||
with (
|
||||
sm.create_conversation(
|
||||
|
||||
Reference in New Issue
Block a user