Skip to content

Conversation

@rasmi
Copy link
Contributor

@rasmi rasmi commented Dec 30, 2025

Fixes issues when creating experiments via the Python REST API. If certain fields weren't populated when creating an experiment via the API, the backend would not populate them with defaults, leading to errors. This happened automatically when creating things via the frontend, but not via the backend. Now passed parameters are merged with defaults as expected.

Changes

  • client.py: Added mode="json" to model_dump() calls to properly serialize enums
  • utils/src/experiment.ts:
    • Changed ?? to || for ID generation (empty strings now trigger ID generation)
    • defaultCohortConfig now always merges with defaults via createCohortParticipantConfig()
  • functions/src/experiment.utils.ts:
    • Set timestamps when creating or updating experiments (this happened automatically when updating from the frontend, but the backend did not independently do this if timestamps weren't set by the frontend).
    • Agent personas are merged with defaults via createAgentMediatorPersonaConfig() / createAgentParticipantPersonaConfig()

@cjqian cjqian requested a review from jimbojw January 5, 2026 23:51
Copy link
Collaborator

@jimbojw jimbojw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the as UnifiedTimestamp a bit weird, like maybe the createMetadataConfig() function would benefit from being able to receive whatever type Timestamp.now() returns without the cast. Not worth nitpicking, just an observation.

Also with the repeated mode="json", by_alias=True, exclude_none=True that gets repeated in the Python. Not worth changing, just observing the repetition.

@jimbojw jimbojw merged commit 6856759 into PAIR-code:main Jan 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants