Skip to content

Commit a74f970

Browse files
authored
Merge pull request #913 from PAIR-code/agent-participant-fix
Check for empty agent participant ID before attempting to fetch prompt
2 parents 03d1b1c + 3f16dd9 commit a74f970

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

frontend/src/components/experiment_dashboard/agent_participant_configuration_dialog.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
ApiKeyType,
1818
AgentPersonaType,
1919
createAgentModelSettings,
20+
DEFAULT_AGENT_PARTICIPANT_ID,
2021
} from '@deliberation-lab/utils';
2122

2223
import {styles} from './cohort_settings_dialog.scss';
@@ -86,7 +87,7 @@ export class AgentParticipantDialog extends MobxLitElement {
8687
);
8788
if (this.cohort && this.model) {
8889
this.experimentEditor.addAgentParticipant();
89-
this.agentId = ''; //Make agent ID blank for agents added from cohort panel that use default prompts
90+
this.agentId = DEFAULT_AGENT_PARTICIPANT_ID;
9091
const modelSettings = createAgentModelSettings({
9192
apiType: ApiKeyType.GEMINI_API_KEY,
9293
modelName: this.model,

functions/src/utils/firestore.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,10 @@ export async function getAgentParticipantPrompt(
388388
stageId: string,
389389
agentId: string,
390390
): Promise<ParticipantPromptConfig | null> {
391+
if (!agentId) {
392+
return null;
393+
}
394+
391395
const prompt = await app
392396
.firestore()
393397
.collection('experiments')

utils/src/agent.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ export const DEFAULT_AGENT_MODEL_SETTINGS: AgentModelSettings = {
179179
modelName: DEFAULT_AGENT_API_MODEL,
180180
};
181181

182+
// Use this ID when defining agent participants in experiment dashboard
183+
export const DEFAULT_AGENT_PARTICIPANT_ID = '';
184+
182185
// ************************************************************************* //
183186
// FUNCTIONS //
184187
// ************************************************************************* //

0 commit comments

Comments
 (0)