Skip to content
Merged
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
48 changes: 24 additions & 24 deletions src/agent.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
19 changes: 12 additions & 7 deletions src/agent.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
import { voice } from '@livekit/agents';
import { dedent, voice } from '@livekit/agents';

export const AGENT_MODEL = 'openai/gpt-5.3-chat-latest';

// Define a custom voice AI assistant by extending the base Agent class
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()
Expand Down
Loading