Skip to content

Commit 35bf797

Browse files
committedJan 14, 2025
feat: add aisuite_llm_python extension
1 parent 5f6657d commit 35bf797

File tree

8 files changed

+424
-64
lines changed

8 files changed

+424
-64
lines changed
 

‎agents/examples/default/manifest.json

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@
5353
"name": "openai_chatgpt_python",
5454
"version": "=0.1.0"
5555
},
56+
{
57+
"type": "extension",
58+
"name": "aisuite_llm_python",
59+
"version": "=0.1.0"
60+
},
5661
{
5762
"type": "extension",
5863
"name": "fish_audio_tts",

‎agents/examples/default/property.json

+18-64
Original file line numberDiff line numberDiff line change
@@ -283,34 +283,35 @@
283283
"agora_asr_session_control_file_path": "session_control.conf"
284284
}
285285
},
286+
{
287+
"type": "extension",
288+
"extension_group": "tts",
289+
"addon": "azure_tts",
290+
"name": "tts",
291+
"property": {
292+
"azure_subscription_key": "${env:AZURE_TTS_KEY}",
293+
"azure_subscription_region": "${env:AZURE_TTS_REGION}",
294+
"azure_synthesis_voice_name": "en-US-AndrewMultilingualNeural"
295+
}
296+
},
286297
{
287298
"type": "extension",
288299
"name": "llm",
289-
"addon": "openai_chatgpt_python",
300+
"addon": "aisuite_llm_python",
290301
"extension_group": "chatgpt",
291302
"property": {
292-
"api_key": "${env:OPENAI_API_KEY}",
293303
"base_url": "",
294304
"frequency_penalty": 0.9,
295305
"greeting": "TEN Agent connected. How can I help you today?",
296306
"max_memory_length": 10,
297307
"max_tokens": 512,
298-
"model": "${env:OPENAI_MODEL}",
308+
"model": "openai:gpt-4o-mini",
299309
"prompt": "",
300-
"proxy_url": "${env:OPENAI_PROXY_URL}"
301-
}
302-
},
303-
{
304-
"type": "extension",
305-
"name": "tts",
306-
"addon": "fish_audio_tts",
307-
"extension_group": "tts",
308-
"property": {
309-
"api_key": "${env:FISH_AUDIO_TTS_KEY}",
310-
"model_id": "d8639b5cc95548f5afbcfe22d3ba5ce5",
311-
"optimize_streaming_latency": true,
312-
"request_timeout_seconds": 30,
313-
"base_url": "https://api.fish.audio"
310+
"provider_config": {
311+
"openai": {
312+
"api_key": "${env:OPENAI_API_KEY}"
313+
}
314+
}
314315
}
315316
},
316317
{
@@ -326,15 +327,6 @@
326327
"addon": "message_collector",
327328
"extension_group": "transcriber",
328329
"property": {}
329-
},
330-
{
331-
"type": "extension",
332-
"name": "weatherapi_tool_python",
333-
"addon": "weatherapi_tool_python",
334-
"extension_group": "default",
335-
"property": {
336-
"api_key": "${env:WEATHERAPI_API_KEY|}"
337-
}
338330
}
339331
],
340332
"connections": [
@@ -390,14 +382,6 @@
390382
"extension": "tts"
391383
}
392384
]
393-
},
394-
{
395-
"name": "tool_call",
396-
"dest": [
397-
{
398-
"extension": "weatherapi_tool_python"
399-
}
400-
]
401385
}
402386
],
403387
"data": [
@@ -472,19 +456,6 @@
472456
]
473457
}
474458
]
475-
},
476-
{
477-
"extension": "weatherapi_tool_python",
478-
"cmd": [
479-
{
480-
"name": "tool_register",
481-
"dest": [
482-
{
483-
"extension": "llm"
484-
}
485-
]
486-
}
487-
]
488459
}
489460
]
490461
},
@@ -509,23 +480,6 @@
509480
"subscribe_audio_sample_rate": 24000
510481
}
511482
},
512-
{
513-
"type": "extension",
514-
"name": "v2v",
515-
"addon": "openai_v2v_python",
516-
"extension_group": "llm",
517-
"property": {
518-
"api_key": "${env:OPENAI_REALTIME_API_KEY}",
519-
"temperature": 0.9,
520-
"model": "gpt-4o-realtime-preview-2024-12-17",
521-
"max_tokens": 2048,
522-
"voice": "alloy",
523-
"language": "en-US",
524-
"server_vad": true,
525-
"dump": true,
526-
"max_history": 10
527-
}
528-
},
529483
{
530484
"type": "extension",
531485
"name": "message_collector",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import aisuite_llm_addon
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# This file is part of TEN Framework, an open source project.
3+
# Licensed under the Apache License, Version 2.0.
4+
# See the LICENSE file for more information.
5+
#
6+
from ten import (
7+
Addon,
8+
register_addon_as_extension,
9+
TenEnv,
10+
)
11+
12+
13+
@register_addon_as_extension("aisuite_llm_python")
14+
class AISuiteLLMExtensionAddon(Addon):
15+
def on_create_instance(self, ten: TenEnv, addon_name: str, context):
16+
from .aisuite_llm_extension import AISuiteLLMExtension
17+
18+
ten.log_info("on_create_instance")
19+
ten.on_create_instance_done(AISuiteLLMExtension(addon_name), context)

0 commit comments

Comments
 (0)
Failed to load comments.