The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.
TypeScript ai-receptionistanswering-serviceappointment-bookinglivekitlocal-firstmcpopen-sourceself-hostedsiptelephonytypescriptvoice-agentvoice-ai
Outbound calls follow the assistant's AI disclosure setting (PR 1979)
Tim Gutberlet06dc2bcf37c4
diff --git a/apps/agent/src/outbound-call.test.ts b/apps/agent/src/outbound-call.test.tsindex 570be330..3440e55b 100644--- a/apps/agent/src/outbound-call.test.ts+++ b/apps/agent/src/outbound-call.test.ts@@ -56,3 +56,21 @@ test('the summary of an outbound call is told the goal and what the outcomes mea)expect(summarySystem('en')).toMatch(/^You summarize a phone call/)})++test("outbound instructions follow the assistant's AI disclosure: no AI in role or call for Don't mention", () => {+ const goal = { to: '+15035550123', goal: 'Book a table for two at eight.' }+ const asAi = buildOutboundInstructions({ name: 'Maya', ai_disclosure: 'at_start' } as never, goal)+ expect(asAi).toContain('You are Maya, an AI assistant, on a phone call')+ expect(asAi).toContain('say it in your next reply')+ for (const mode of ['never', 'when_asked'] as const) {+ const text = buildOutboundInstructions({ name: 'Maya', ai_disclosure: mode } as never, goal)+ expect(text).toContain('You are Maya on a phone call')+ expect(text).toContain('Do not bring up on your own that you are an AI.')+ expect(text).not.toContain('say it in your next reply')+ expect(text).toContain('When asked, say truthfully that you are an AI assistant; never claim to be human.')+ }+ const open = buildOutboundInstructions({ name: 'Maya', ai_disclosure: 'never_confirm' } as never, goal)+ expect(open).toContain("don't confirm or deny it")+ expect(open).not.toContain('say truthfully')+ expect(open).toContain('never claim to be human')+})diff --git a/packages/actions/src/call-prompt.ts b/packages/actions/src/call-prompt.tsindex 6602eebd..5f1a29fa 100644--- a/packages/actions/src/call-prompt.ts+++ b/packages/actions/src/call-prompt.ts@@ -580,16 +580,21 @@ export function buildOutboundInstructions(const language = others.length? `Speak ${LANGUAGES[main]}. If the person speaks ${languageNames(others, 'or')}, reply in that language.`: `Speak ${LANGUAGES[main]}.`+ // The assistant's AI disclosure setting holds on outbound calls too: "Don't mention" / "Only when asked" leave the AI+ // out of the role and the call, "Never, not even when asked" also leaves the answer open (aiDisclosureRisk warns).const disclosure = assistant?.ai_disclosure ?? 'at_start'- const ai =- disclosure === 'at_start' || disclosure === 'at_start_consent'- ? 'If your first sentence did not say that you are an AI assistant, say it in your next reply. '- : ''+ const atStart = disclosure === 'at_start' || disclosure === 'at_start_consent'+ const honesty =+ disclosure === 'never_confirm'+ ? "Do not bring up on your own that you are an AI. If the person asks whether you are a person, a robot or an AI, don't confirm or deny it, and carry on with the goal; never claim to be human."+ : atStart+ ? 'If your first sentence did not say that you are an AI assistant, say it in your next reply. When asked, say truthfully that you are an AI assistant; never claim to be human.'+ : 'Do not bring up on your own that you are an AI. When asked, say truthfully that you are an AI assistant; never claim to be human.'const known = caller?.name ? `You are speaking with ${quotedData(caller.name, 80)}. ` : ''const clock = clockLine(timeZone, now)return [- `You are ${name}, an AI assistant, on a phone call you placed for the person or company you work for. Reply in one or two short spoken sentences, one question at a time, no lists or emojis. ${language}`,- `${ai}When asked, say truthfully that you are an AI assistant; never claim to be human.`,+ `You are ${name}${atStart ? ', an AI assistant,' : ''} on a phone call you placed for the person or company you work for. Reply in one or two short spoken sentences, one question at a time, no lists or emojis. ${language}`,+ honesty,`You called ${displayNumber(outbound.to)}. ${known}The person did not call you: say why you are calling, and do not ask how you can help.`,`The goal of this call:\n${quotedData(outbound.goal, 4000)}`,'Ask only for what the goal needs; do not ask for their name, number or anything else, and do not offer other help. Never claim you did something you did not do. When the goal is reached, or the person does not want to talk, say that everything is done on your side, thank them and ask whether they have anything else; when they have nothing, say goodbye and call end_call. Never end the call without saying goodbye. On a voicemail or answering machine, leave one short message saying who is calling and why, say goodbye, then call end_call with voicemail true.',