Skip to content

Commit

Permalink
Merge pull request #91 from brnaba-aws/main
Browse files Browse the repository at this point in the history
Fixed agentId not populated in history section of the prompt for classifier when using in memory storage
  • Loading branch information
brnaba-aws authored Nov 20, 2024
2 parents bb317dd + 3156653 commit 8a9283f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ async def process_request(
:param additional_params: Optional additional parameters as key-value pairs.
:return: A ConversationMessage object containing the agent's response.
"""

session_state = {}
if (additional_params and 'sessionState' in additional_params):
session_state = additional_params['sessionState']
try:
print(session_state)
response = self.client.invoke_agent(
agentId=self.agent_id,
agentAliasId=self.agent_alias_id,
sessionId=session_id,
inputText=input_text
inputText=input_text,
sessionState=session_state
)

completion = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ async def fetch_all_chats(
if stored_user_id == user_id and stored_session_id == session_id:
for message in messages:
new_content = message.content if message.content else []
if len(new_content) > 0 and message.role == "assistant":
new_content[0]['text'] = f"[{agent_id}] {new_content[0]['text']}"
all_messages.append(TimestampedMessage(
role=message.role,
content=new_content,
Expand Down

0 comments on commit 8a9283f

Please sign in to comment.