Skip to content

Commit 37e7b04

Browse files
committed
v0.0.51
1 parent a5cc808 commit 37e7b04

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

agixtsdk/__init__.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,11 @@ async def chat_completions(
12161216
.replace("bearer ", "")
12171217
)
12181218
openai.base_url = f"{self.base_uri}/v1/"
1219+
self.new_conversation_message(
1220+
role=agent_name,
1221+
message=f"[ACTIVITY] Transcribing audio to text.",
1222+
conversation_name=conversation_name,
1223+
)
12191224
with open(wav_file, "rb") as audio_file:
12201225
transcription = openai.audio.transcriptions.create(
12211226
model=agent_name, file=audio_file
@@ -1232,6 +1237,11 @@ async def chat_completions(
12321237
else:
12331238
collection_number = "0"
12341239
if video_url.startswith("https://www.youtube.com/watch?v="):
1240+
self.new_conversation_message(
1241+
role=agent_name,
1242+
message=f"[ACTIVITY] Learning video from YouTube.",
1243+
conversation_name=conversation_name,
1244+
)
12351245
self.learn_url(
12361246
agent_name=agent_name,
12371247
url=video_url,
@@ -1258,12 +1268,22 @@ async def chat_completions(
12581268
collection_number = "0"
12591269
if file_url.startswith("http"):
12601270
if file_url.startswith("https://www.youtube.com/watch?v="):
1271+
self.new_conversation_message(
1272+
role=agent_name,
1273+
message=f"[ACTIVITY] Learning video from YouTube.",
1274+
conversation_name=conversation_name,
1275+
)
12611276
self.learn_url(
12621277
agent_name=agent_name,
12631278
url=file_url,
12641279
collection_number=collection_number,
12651280
)
12661281
elif file_url.startswith("https://github.com"):
1282+
self.new_conversation_message(
1283+
role=agent_name,
1284+
message=f"[ACTIVITY] Learning from GitHub.",
1285+
conversation_name=conversation_name,
1286+
)
12671287
self.learn_github_repo(
12681288
agent_name=agent_name,
12691289
github_repo=file_url,
@@ -1285,6 +1305,11 @@ async def chat_completions(
12851305
collection_number=collection_number,
12861306
)
12871307
else:
1308+
self.new_conversation_message(
1309+
role=agent_name,
1310+
message=f"[ACTIVITY] Browsing {file_url} .",
1311+
conversation_name=conversation_name,
1312+
)
12881313
self.learn_url(
12891314
agent_name=agent_name,
12901315
url=file_url,
@@ -1300,20 +1325,43 @@ async def chat_completions(
13001325
f.write(file_data)
13011326
# file name should be a safe timestamp
13021327
file_name = f"Uploaded File {datetime.now().strftime('%Y%m%d%H%M%S')}.{file_type}"
1328+
self.new_conversation_message(
1329+
role=agent_name,
1330+
message=f"[ACTIVITY] Learning from uploaded file.",
1331+
conversation_name=conversation_name,
1332+
)
13031333
self.learn_file(
13041334
agent_name=agent_name,
13051335
file_name=f"Uploaded File {uuid.uuid4().hex}.{file_type}",
13061336
file_content=file_data,
13071337
collection_number=collection_number,
13081338
)
1339+
self.new_conversation_message(
1340+
role="user",
1341+
message=new_prompt,
1342+
conversation_name=conversation_name,
1343+
)
13091344
if async_func:
13101345
response = await async_func(new_prompt)
13111346
else:
13121347
response = func(new_prompt)
1348+
self.new_conversation_message(
1349+
role=agent_name,
1350+
message=response,
1351+
conversation_name=conversation_name,
1352+
)
13131353
if tts:
1354+
self.new_conversation_message(
1355+
role=agent_name,
1356+
message=f"[ACTIVITY] Generating audio response.",
1357+
conversation_name=conversation_name,
1358+
)
13141359
tts_response = self.text_to_speech(agent_name=agent_name, text=response)
1315-
if tts_response:
1316-
response = f'{response}\n\n<audio controls><source src="{tts_response}" type="audio/wav"></audio>'
1360+
self.new_conversation_message(
1361+
role=agent_name,
1362+
message=f'<audio controls><source src="{tts_response}" type="audio/wav"></audio>',
1363+
conversation_name=conversation_name,
1364+
)
13171365
prompt_tokens = get_tokens(str(new_prompt))
13181366
completion_tokens = get_tokens(str(response))
13191367
total_tokens = int(prompt_tokens) + int(completion_tokens)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name="agixtsdk",
11-
version="0.0.50",
11+
version="0.0.51",
1212
description="The AGiXT SDK for Python.",
1313
long_description=long_description,
1414
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)