Skip to content
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

FIX make sure conversation IDs are not sent out as UUIDs to the database #723

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pyrit/memory/memory_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,21 @@ def get_prompt_request_pieces(
Exception: If there is an error retrieving the prompts,
an exception is logged and an empty list is returned.
"""
match prompt_ids:
case [uuid.UUID() as first_uuid, *rest]:
prompt_ids = [str(pi) for pi in prompt_ids]
case [str() as first_uuid, *rest]:
prompt_ids = prompt_ids
case _:
pass

conditions = []
if orchestrator_id:
conditions.append(self._get_prompt_pieces_orchestrator_conditions(orchestrator_id=str(orchestrator_id)))
if role:
conditions.append(PromptMemoryEntry.role == role)
if conversation_id:
conditions.append(PromptMemoryEntry.conversation_id == conversation_id)
conditions.append(PromptMemoryEntry.conversation_id == str(conversation_id))
if prompt_ids:
conditions.append(PromptMemoryEntry.id.in_(prompt_ids))
if labels:
Expand Down
Loading