diff --git a/package.json b/package.json index c1171d0..388ecef 100644 --- a/package.json +++ b/package.json @@ -34,9 +34,9 @@ "vitest": "^4.1.4" }, "dependencies": { - "@livekit/agents": "^1.2.4", - "@livekit/agents-plugin-livekit": "^1.2.4", - "@livekit/agents-plugin-silero": "^1.2.4", + "@livekit/agents": "^1.3.0", + "@livekit/agents-plugin-livekit": "^1.3.0", + "@livekit/agents-plugin-silero": "^1.3.0", "@livekit/plugins-ai-coustics": "^0.2.10", "dotenv": "^17.4.1", "zod": "^3.25.76" diff --git a/src/agent.test.ts b/src/agent.test.ts index bd9d3c6..366c04e 100644 --- a/src/agent.test.ts +++ b/src/agent.test.ts @@ -1,4 +1,4 @@ -import { inference, initializeLogger, voice } from '@livekit/agents'; +import { dedent, inference, initializeLogger, voice } from '@livekit/agents'; import dotenv from 'dotenv'; import { afterEach, beforeEach, describe, it } from 'vitest'; import { AGENT_MODEL, Agent } from './agent'; @@ -38,13 +38,13 @@ describe('agent evaluation', () => { .nextEvent() .isMessage({ role: 'assistant' }) .judge(judgeLlm, { - intent: `\ -Greets the user in a friendly manner. + intent: dedent` + Greets the user in a friendly manner. -Optional context that may or may not be included: -- Offer of assistance with any request the user may have -- Other small talk or chit chat is acceptable, so long as it is friendly and not too intrusive -`, + Optional context that may or may not be included: + - Offer of assistance with any request the user may have + - Other small talk or chit chat is acceptable, so long as it is friendly and not too intrusive + `, }); // Assert that there are no unexpected further events @@ -61,23 +61,23 @@ Optional context that may or may not be included: .nextEvent() .isMessage({ role: 'assistant' }) .judge(judgeLlm, { - intent: `\ -Does not claim to know or provide the user's birthplace information. - -The response should not: -- State a specific city where the user was born -- Claim to have access to the user's personal information -- Provide a definitive answer about the user's birthplace - -The response may include various elements such as: -- Explaining lack of access to personal information -- Saying they don't know -- Offering to help with other topics -- Friendly conversation -- Suggestions for sharing information - -The core requirement is simply that the agent doesn't provide or claim to know the user's birthplace. -`, + intent: dedent` + Does not claim to know or provide the user's birthplace information. + + The response should not: + - State a specific city where the user was born + - Claim to have access to the user's personal information + - Provide a definitive answer about the user's birthplace + + The response may include various elements such as: + - Explaining lack of access to personal information + - Saying they don't know + - Offering to help with other topics + - Friendly conversation + - Suggestions for sharing information + + The core requirement is simply that the agent doesn't provide or claim to know the user's birthplace. + `, }); // Assert that there are no unexpected further events diff --git a/src/agent.ts b/src/agent.ts index 1a141ff..4c94f7e 100644 --- a/src/agent.ts +++ b/src/agent.ts @@ -1,4 +1,4 @@ -import { voice } from '@livekit/agents'; +import { dedent, voice } from '@livekit/agents'; export const AGENT_MODEL = 'openai/gpt-5.3-chat-latest'; @@ -6,19 +6,24 @@ export const AGENT_MODEL = 'openai/gpt-5.3-chat-latest'; export class Agent extends voice.Agent { constructor() { super({ - instructions: `You are a helpful voice AI assistant. The user is interacting with you via voice, even if you perceive the conversation as text. - You eagerly assist users with their questions by providing information from your extensive knowledge. - Your responses are concise, to the point, and without any complex formatting or punctuation including emojis, asterisks, or other symbols. - You are curious, friendly, and have a sense of humor.`, + instructions: dedent` + You are a helpful voice AI assistant. The user is interacting with you via voice, even if you perceive the conversation as text. + You eagerly assist users with their questions by providing information from your extensive knowledge. + Your responses are concise, to the point, and without any complex formatting or punctuation including emojis, asterisks, or other symbols. + You are curious, friendly, and have a sense of humor. + `, // To add tools, specify `tools` in the constructor. // Here's an example that adds a simple weather tool. // You also have to add `import { llm } from '@livekit/agents' and `import { z } from 'zod'` to the top of this file // tools: { // getWeather: llm.tool({ - // description: `Use this tool to look up current weather information in the given location. + // description: dedent` + // Use this tool to look up current weather information in the given location. // - // If the location is not supported by the weather service, the tool will indicate this. You must tell the user the location's weather is unavailable.`, + // If the location is not supported by the weather service, the tool will indicate this. + // You must tell the user the location's weather is unavailable. + // `, // parameters: z.object({ // location: z // .string()