meshagent-livekit 0.6.1__py3-none-any.whl → 0.6.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of meshagent-livekit might be problematic. Click here for more details.

@@ -15,6 +15,9 @@ from livekit.agents import (
15
15
  llm,
16
16
  utils,
17
17
  )
18
+ from livekit.agents.stt import STT
19
+
20
+ from meshagent.openai.proxy import get_client
18
21
  from livekit.plugins import openai, silero
19
22
  from meshagent.api import MeshDocument, SchemaRegistration, SchemaRegistry
20
23
  from meshagent.agents import SingleRoomAgent
@@ -83,7 +86,12 @@ class StopTranscriptionTool(Tool):
83
86
 
84
87
 
85
88
  class MeetingTranscriber(SingleRoomAgent):
86
- def __init__(self, name: str, requires: Optional[list[Requirement]] = None):
89
+ def __init__(
90
+ self,
91
+ name: str,
92
+ requires: Optional[list[Requirement]] = None,
93
+ stt: Optional[STT] = None,
94
+ ):
87
95
  super().__init__(
88
96
  name=name,
89
97
  requires=requires,
@@ -95,6 +103,7 @@ class MeetingTranscriber(SingleRoomAgent):
95
103
  StopTranscriptionTool(transcriber=self),
96
104
  ],
97
105
  )
106
+ self.stt = stt
98
107
  self._vad = None
99
108
  self._transcription_tasks = dict[str, tuple[asyncio.Task, asyncio.Future]]()
100
109
 
@@ -120,7 +129,12 @@ class MeetingTranscriber(SingleRoomAgent):
120
129
  ) as conn:
121
130
  doc = await self.room.sync.open(path=path, create=True)
122
131
 
123
- transcriber = MultiUserTranscriber(conn, doc, self._vad)
132
+ stt = self.stt
133
+ if stt is None:
134
+ openai_client = get_client(room=self.room)
135
+ stt = openai.STT(client=openai_client)
136
+
137
+ transcriber = MultiUserTranscriber(conn, doc, self._vad, stt)
124
138
  transcriber.start()
125
139
 
126
140
  for participant in conn.livekit_room.remote_participants.values():
@@ -180,10 +194,10 @@ class TranscriptRegistry(SchemaRegistry):
180
194
 
181
195
 
182
196
  class Transcriber(Agent):
183
- def __init__(self, *, participant, doc: MeshDocument):
197
+ def __init__(self, *, participant, doc: MeshDocument, stt):
184
198
  super().__init__(
185
199
  instructions="not-needed",
186
- stt=openai.STT(),
200
+ stt=stt,
187
201
  )
188
202
  self.doc = doc
189
203
  self.participant = participant
@@ -205,10 +219,11 @@ class Transcriber(Agent):
205
219
 
206
220
 
207
221
  class MultiUserTranscriber:
208
- def __init__(self, ctx: VoiceConnection, doc: MeshDocument, vad):
222
+ def __init__(self, ctx: VoiceConnection, doc: MeshDocument, vad, stt):
209
223
  self.ctx = ctx
210
224
  self.doc = doc
211
225
  self.vad = vad
226
+ self.stt = stt
212
227
  self._sessions: dict[str, AgentSession] = {}
213
228
  self._tasks: set[asyncio.Task] = set()
214
229
 
@@ -285,6 +300,7 @@ class MultiUserTranscriber:
285
300
  agent=Transcriber(
286
301
  participant=participant,
287
302
  doc=self.doc,
303
+ stt=self.stt,
288
304
  )
289
305
  )
290
306
  return session
@@ -18,9 +18,15 @@ from meshagent.tools import ToolContext, Toolkit
18
18
  from livekit.agents import Agent, AgentSession, ChatContext
19
19
  from livekit.agents.llm import RawFunctionTool, ToolError, function_tool
20
20
 
21
- from openai import AsyncOpenAI
21
+ from meshagent.openai.proxy import get_client
22
22
  from meshagent.agents import AgentChatContext
23
- from livekit.agents import BackgroundAudioPlayer, AudioConfig, BuiltinAudioClip
23
+ from livekit.agents import (
24
+ BackgroundAudioPlayer,
25
+ AudioConfig,
26
+ BuiltinAudioClip,
27
+ RoomInputOptions,
28
+ RoomOutputOptions,
29
+ )
24
30
 
25
31
  from livekit.plugins import openai, silero
26
32
  # from livekit.plugins.turn_detector.multilingual import MultilingualModel
@@ -32,7 +38,6 @@ from typing import Any
32
38
 
33
39
 
34
40
  from livekit import rtc
35
- from livekit.agents import RunContext
36
41
 
37
42
  from typing import Optional
38
43
 
@@ -270,13 +275,6 @@ class VoiceBot(SingleRoomAgent):
270
275
  )
271
276
 
272
277
  async def create_agent(self, *, context: ToolContext, session: AgentSession):
273
- @function_tool
274
- async def say(context: RunContext, text: str):
275
- "says something out loud to the user"
276
- logger.info(f"saying: {text}")
277
- session.say(text)
278
- return "success"
279
-
280
278
  ctx = ChatContext()
281
279
 
282
280
  initial_context = await self.init_chat_context()
@@ -287,7 +285,7 @@ class VoiceBot(SingleRoomAgent):
287
285
  chat_ctx=ctx,
288
286
  instructions="\n".join(self.rules),
289
287
  allow_interruptions=True,
290
- tools=[*await self.make_function_tools(context=context), say],
288
+ tools=[*await self.make_function_tools(context=context)],
291
289
  )
292
290
 
293
291
  # agent = Agent(
@@ -305,23 +303,14 @@ class VoiceBot(SingleRoomAgent):
305
303
  return AgentChatContext()
306
304
 
307
305
  def create_session(self, *, context: ToolContext) -> AgentSession:
308
- token: str = context.room.protocol.token
309
- url: str = context.room.room_url
310
-
311
- room_proxy_url = f"{url}/v1"
312
-
313
- oaiclient = AsyncOpenAI(
314
- api_key=token,
315
- base_url=room_proxy_url,
316
- default_headers={"Meshagent-Session": context.room.session_id},
317
- )
306
+ oaiclient = get_client(room=self.room)
318
307
 
319
308
  session = AgentSession(
320
309
  max_tool_steps=50,
321
310
  allow_interruptions=True,
322
311
  vad=silero.VAD.load(),
323
312
  stt=openai.STT(client=oaiclient),
324
- tts=openai.TTS(client=oaiclient, voice="echo"),
313
+ tts=openai.TTS(client=oaiclient),
325
314
  llm=openai.LLM(client=oaiclient),
326
315
  # turn_detection=MultilingualModel(),
327
316
  )
@@ -355,7 +344,18 @@ class VoiceBot(SingleRoomAgent):
355
344
  room=connection.livekit_room, agent_session=session
356
345
  )
357
346
 
358
- await session.start(agent=agent, room=connection.livekit_room)
347
+ await session.start(
348
+ agent=agent,
349
+ room=connection.livekit_room,
350
+ room_input_options=RoomInputOptions(
351
+ text_enabled=False,
352
+ delete_room_on_close=False,
353
+ ),
354
+ room_output_options=RoomOutputOptions(
355
+ transcription_enabled=True,
356
+ audio_enabled=True,
357
+ ),
358
+ )
359
359
 
360
360
  if self.auto_greet_prompt is not None:
361
361
  session.generate_reply(user_input=self.auto_greet_prompt)
@@ -1 +1 @@
1
- __version__ = "0.6.1"
1
+ __version__ = "0.6.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshagent-livekit
3
- Version: 0.6.1
3
+ Version: 0.6.3
4
4
  Summary: Livekit support for Meshagent
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Documentation, https://docs.meshagent.com
@@ -17,8 +17,8 @@ Requires-Dist: livekit-agents~=1.2
17
17
  Requires-Dist: livekit-plugins-openai~=1.2
18
18
  Requires-Dist: livekit-plugins-silero~=1.2
19
19
  Requires-Dist: livekit-plugins-turn-detector~=1.2
20
- Requires-Dist: meshagent-api~=0.6.1
21
- Requires-Dist: meshagent-tools~=0.6.1
20
+ Requires-Dist: meshagent-api~=0.6.3
21
+ Requires-Dist: meshagent-tools~=0.6.3
22
22
  Dynamic: license-file
23
23
 
24
24
  # [Meshagent](https://www.meshagent.com)
@@ -0,0 +1,12 @@
1
+ meshagent/livekit/__init__.py,sha256=X78Z4yEg5XfkNKH0HiIdG4k1q5ktB-ampTuXHLNFrAw,58
2
+ meshagent/livekit/livekit_protocol.py,sha256=5Zu4ymLWEGt5SGXLNu94gOeyjnjhaV6uTS2FhSdODqs,1470
3
+ meshagent/livekit/livekit_protocol_test.py,sha256=o7yYxXad4tMazcxFkq44yW-A9tJ0Lk6WdZpG5ifxcU4,2980
4
+ meshagent/livekit/version.py,sha256=zYiFHqR7JwbvdK9dvKrh-RTNfUqjHUwC4CTcFAPVYLc,22
5
+ meshagent/livekit/agents/meeting_transcriber.py,sha256=4B5Qi0vKP0TU00vR4KsNdIiR2uyvfgiOL2hjuzhLotw,10210
6
+ meshagent/livekit/agents/transcriber.py,sha256=S992oVVBt3ShWDQQWprLjyl6Yh0hyNRd8d3qCmg_toU,5795
7
+ meshagent/livekit/agents/voice.py,sha256=9aaQHPxnX86D2SasJn6SMiKIh1OX1dPmfQBow2tCvzE,11857
8
+ meshagent_livekit-0.6.3.dist-info/licenses/LICENSE,sha256=eTt0SPW-sVNdkZe9PS_S8WfCIyLjRXRl7sUBWdlteFg,10254
9
+ meshagent_livekit-0.6.3.dist-info/METADATA,sha256=KLQn05wjmiThdg4OgJKNcRJzO6xSGKct4qAZqf-Xo40,1749
10
+ meshagent_livekit-0.6.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ meshagent_livekit-0.6.3.dist-info/top_level.txt,sha256=GlcXnHtRP6m7zlG3Df04M35OsHtNXy_DY09oFwWrH74,10
12
+ meshagent_livekit-0.6.3.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- meshagent/livekit/__init__.py,sha256=X78Z4yEg5XfkNKH0HiIdG4k1q5ktB-ampTuXHLNFrAw,58
2
- meshagent/livekit/livekit_protocol.py,sha256=5Zu4ymLWEGt5SGXLNu94gOeyjnjhaV6uTS2FhSdODqs,1470
3
- meshagent/livekit/livekit_protocol_test.py,sha256=o7yYxXad4tMazcxFkq44yW-A9tJ0Lk6WdZpG5ifxcU4,2980
4
- meshagent/livekit/version.py,sha256=baAcEjLSYFIeNZF51tOMmA_zAMhN8HvKael-UU-Ruec,22
5
- meshagent/livekit/agents/meeting_transcriber.py,sha256=_DHFCuOGCE3LBBBDoF1xGTBMHXaVm2yzqya-OO4g6xg,9778
6
- meshagent/livekit/agents/transcriber.py,sha256=S992oVVBt3ShWDQQWprLjyl6Yh0hyNRd8d3qCmg_toU,5795
7
- meshagent/livekit/agents/voice.py,sha256=STgjMSqzUgV9UAmleOy1vkgRXP93MDSYgiOO6Lo0peU,11964
8
- meshagent_livekit-0.6.1.dist-info/licenses/LICENSE,sha256=eTt0SPW-sVNdkZe9PS_S8WfCIyLjRXRl7sUBWdlteFg,10254
9
- meshagent_livekit-0.6.1.dist-info/METADATA,sha256=_z2iTjyR9cJEo2Y_6IMJGSD5kKs6-cm7Cf23Qb7b2wo,1749
10
- meshagent_livekit-0.6.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- meshagent_livekit-0.6.1.dist-info/top_level.txt,sha256=GlcXnHtRP6m7zlG3Df04M35OsHtNXy_DY09oFwWrH74,10
12
- meshagent_livekit-0.6.1.dist-info/RECORD,,