mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 07:14:20 +00:00
Added a check on turn_ids
This commit is contained in:
parent
9bcd03fe2a
commit
c2e8011175
1 changed files with 16 additions and 15 deletions
|
@ -160,21 +160,22 @@ class MetaReferenceAgentsImpl(Agents):
|
||||||
f"Could not JSON decode session for {agent_id} and {session_id}"
|
f"Could not JSON decode session for {agent_id} and {session_id}"
|
||||||
) from e
|
) from e
|
||||||
turns = []
|
turns = []
|
||||||
for turn_id in turn_ids:
|
if turn_ids:
|
||||||
turn = await self.persistence_store.get(f"session:{agent_id}:{session_id}:{turn_id}")
|
for turn_id in turn_ids:
|
||||||
try:
|
turn = await self.persistence_store.get(f"session:{agent_id}:{session_id}:{turn_id}")
|
||||||
turn = json.loads(turn)
|
try:
|
||||||
except json.JSONDecodeError as e:
|
turn = json.loads(turn)
|
||||||
raise ValueError(
|
except json.JSONDecodeError as e:
|
||||||
f"Could not JSON decode session for {agent_id} and {session_id}"
|
raise ValueError(
|
||||||
) from e
|
f"Could not JSON decode session for {agent_id} and {session_id}"
|
||||||
try:
|
) from e
|
||||||
turn = Turn(**turn)
|
try:
|
||||||
except Exception as e:
|
turn = Turn(**turn)
|
||||||
raise ValueError(
|
except Exception as e:
|
||||||
f"Could not validate(?) Turns for {turn_id}"
|
raise ValueError(
|
||||||
) from e
|
f"Could not validate(?) Turns for {turn_id}"
|
||||||
turns.append(turn)
|
) from e
|
||||||
|
turns.append(turn)
|
||||||
return Session(
|
return Session(
|
||||||
session_name=session.session_name,
|
session_name=session.session_name,
|
||||||
session_id=session_id,
|
session_id=session_id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue