Skip to content

Commit

Permalink
make it work a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
nbsp committed Nov 22, 2024
1 parent c8e4a69 commit 69b3968
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 189 deletions.
10 changes: 9 additions & 1 deletion agents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
"version": "0.4.6",
"description": "LiveKit Agents - Node.js",
"main": "dist/index.js",
"require": "dist/index.cjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"author": "LiveKit",
"type": "module",
"repository": "git@github.com:livekit/agents-js.git",
Expand All @@ -13,7 +21,7 @@
"src"
],
"scripts": {
"build": "tsup --splitting true --onSuccess \"tsc --declaration --emitDeclarationOnly\"",
"build": "tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\"",
"clean": "rm -rf dist",
"clean:build": "pnpm clean && pnpm build",
"lint": "eslint -f unix \"src/**/*.ts\"",
Expand Down
20 changes: 10 additions & 10 deletions examples/src/multimodal_agent.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
//
// SPDX-License-Identifier: Apache-2.0
const { JobContext, WorkerOptions, cli, defineAgent, llm, multimodal } = require('@livekit/agents');
const openai = require('@livekit/agents-plugin-openai');
const { z } = require('zod');
import agents = require('@livekit/agents');
import openai = require('@livekit/agents-plugin-openai');
import z = require('zod');

export default defineAgent({
entry: async (ctx: typeof JobContext) => {
module.exports = agents.defineAgent({
entry: async (ctx: agents.JobContext) => {
await ctx.connect();

console.log('waiting for participant');
Expand All @@ -29,7 +29,7 @@ export default defineAgent({
});
}

const fncCtx: llm.FunctionContext = {
const fncCtx: agents.llm.FunctionContext = {
weather: {
description: 'Get the weather in a location',
parameters: z.object({
Expand All @@ -47,7 +47,7 @@ export default defineAgent({
},
};

const agent = new multimodal.MultimodalAgent({
const agent = new agents.multimodal.MultimodalAgent({
model,
fncCtx,
});
Expand All @@ -57,13 +57,13 @@ export default defineAgent({
.then((session) => session as openai.realtime.RealtimeSession);

session.conversation.item.create(
llm.ChatMessage.create({
role: llm.ChatRole.USER,
agents.llm.ChatMessage.create({
role: agents.llm.ChatRole.USER,
text: 'Say "How can I help you today?"',
}),
);
session.response.create();
},
});

cli.runApp(new WorkerOptions({ agent: __filename }));
agents.cli.runApp(new agents.WorkerOptions({ agent: __filename }));
70 changes: 0 additions & 70 deletions examples/src/pipeline_voice_agent.ts

This file was deleted.

44 changes: 0 additions & 44 deletions examples/src/stt.ts

This file was deleted.

50 changes: 0 additions & 50 deletions examples/src/tts.ts

This file was deleted.

3 changes: 2 additions & 1 deletion examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// match output dir to input dir. e.g. dist/index instead of dist/src/index
"rootDir": "./src",
"declarationDir": "./dist",
"outDir": "./dist"
"outDir": "./dist",
"module": "commonjs"
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
"pnpm": {
"overrides": {
"@livekit/protocol": "file:/home/nbsp/src/@livekit/protocol/packages/javascript",
"@livekit/rtc-node": "file:/home/nbsp/src/@livekit/node-sdks/packages/livekit-rtc"
"@livekit/mutex": "file:/home/nbsp/src/@livekit/ts-mutex",
"@livekit/rtc-node": "file:/home/nbsp/src/@livekit/node-sdks/packages/livekit-rtc",
"livekit-server-sdk": "file:/home/nbsp/src/@livekit/node-sdks/packages/livekit-server-sdk"
}
}
}
8 changes: 8 additions & 0 deletions plugins/deepgram/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
"version": "0.4.6",
"description": "Deepgram plugin for LiveKit Agents for Node.js",
"main": "dist/index.js",
"require": "dist/index.cjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"author": "LiveKit",
"type": "module",
"repository": "git@github.com:livekit/agents-js.git",
Expand Down
8 changes: 8 additions & 0 deletions plugins/elevenlabs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
"version": "0.4.6",
"description": "ElevenLabs plugin for LiveKit Node Agents",
"main": "dist/index.js",
"require": "dist/index.cjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"author": "LiveKit",
"type": "module",
"repository": "git@github.com:livekit/agents-js.git",
Expand Down
8 changes: 8 additions & 0 deletions plugins/openai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
"version": "0.6.1",
"description": "OpenAI plugin for LiveKit Node Agents",
"main": "dist/index.js",
"require": "dist/index.cjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"author": "LiveKit",
"type": "module",
"repository": "git@github.com:livekit/agents-js.git",
Expand Down
8 changes: 8 additions & 0 deletions plugins/silero/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
"version": "0.4.6",
"description": "Silero voice activity detection LiveKit Node Agents",
"main": "dist/index.js",
"require": "dist/index.cjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"author": "LiveKit",
"type": "module",
"repository": "git@github.com:livekit/agents-js.git",
Expand Down
Loading

0 comments on commit 69b3968

Please sign in to comment.