Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/cai/parallel_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def main() -> int:

try:
with open(args.result_file, "w", encoding="utf-8") as f:
json.dump(payload, f, ensure_ascii=False)
json.dump(payload, f, ensure_ascii=False, default=str)
except Exception as write_error: # pylint: disable=broad-except
print(f"[CAI worker] failed to write result file: {write_error}", file=sys.stderr)
return 2
Expand Down
11 changes: 7 additions & 4 deletions src/cai/tools/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,13 @@ def _get_agent_token_info():
from cai.sdk.agents.models.openai_chatcompletions import ACTIVE_MODEL_INSTANCES

if ACTIVE_MODEL_INSTANCES:
# Get the most recent instance (highest instance ID)
latest_key = max(ACTIVE_MODEL_INSTANCES.keys(), key=lambda x: x[1])
model_ref = ACTIVE_MODEL_INSTANCES[latest_key]
model = model_ref() if model_ref else None
try:
# Get the most recent instance (highest instance ID)
latest_key = max(ACTIVE_MODEL_INSTANCES.keys(), key=lambda x: x[1])
model_ref = ACTIVE_MODEL_INSTANCES.get(latest_key)
model = model_ref() if model_ref else None
except Exception:
model = None

if model:
# Get display name with ID
Expand Down