Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
feat: access prompt prefix, suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
deepankarm committed Jun 28, 2023
1 parent 0591f90 commit d3967f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lcserve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def _ignore_warnings():

_ignore_warnings()

from .backend import serving, slackbot, download_df, upload_df
from .backend import download_df, serving, slackbot, upload_df
from .backend.slackbot import SlackBot
from .backend.slackbot.memory import MemoryMode, get_memory

__version__ = '0.0.48'
14 changes: 9 additions & 5 deletions lcserve/backend/slackbot/slackbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ def get_agent_tools() -> List[StructuredTool]:
]

@staticmethod
def get_agent_prompt() -> PromptTemplate:
prefix = """
def get_agent_prompt_prefix() -> str:
return """
As an AI bot on Slack, your primary objective is to provide substantial assistance to one or more human users within a Slack thread. \
Your mission is to facilitate the completion of tasks through a strategic approach, gathering comprehensive information by posing pertinent questions to refine your understanding of the users' needs. \
Not only should you deliver precise, insightful responses to aid users in task fulfillment, \
Expand All @@ -315,18 +315,22 @@ def get_agent_prompt() -> PromptTemplate:
Assistant has access to the following tools:
"""

suffix = """Begin!
@staticmethod
def get_agent_prompt_suffix() -> str:
return """Begin!
Previous conversation history:
{chat_history}
Human: {input}
{agent_scratchpad}"""

@staticmethod
def get_agent_prompt() -> PromptTemplate:
return ConversationalAgent.create_prompt(
tools=SlackBot.get_agent_tools(),
prefix=prefix,
suffix=suffix,
prefix=SlackBot.get_agent_prompt_prefix(),
suffix=SlackBot.get_agent_prompt_suffix(),
)

def app_mention(self, func):
Expand Down

0 comments on commit d3967f6

Please sign in to comment.