solana-agent 17.0.3__py3-none-any.whl → 17.0.4__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.
- solana_agent/services/query.py +53 -20
- {solana_agent-17.0.3.dist-info → solana_agent-17.0.4.dist-info}/METADATA +2 -2
- {solana_agent-17.0.3.dist-info → solana_agent-17.0.4.dist-info}/RECORD +5 -5
- {solana_agent-17.0.3.dist-info → solana_agent-17.0.4.dist-info}/LICENSE +0 -0
- {solana_agent-17.0.3.dist-info → solana_agent-17.0.4.dist-info}/WHEEL +0 -0
solana_agent/services/query.py
CHANGED
@@ -92,38 +92,70 @@ class QueryService(QueryServiceInterface):
|
|
92
92
|
|
93
93
|
# Route query to appropriate agent
|
94
94
|
agent_name = await self.routing_service.route_query(user_text)
|
95
|
-
print(f"
|
95
|
+
print(f"Routed to agent: {agent_name}")
|
96
96
|
|
97
|
-
# For
|
98
|
-
|
99
|
-
|
97
|
+
# For audio mode, we need to carefully handle the response to make sure
|
98
|
+
# tool calls are properly executed and formatted for audio
|
99
|
+
if output_format == "audio":
|
100
|
+
# Use the agent service to generate the response
|
101
|
+
text_response = ""
|
102
|
+
|
103
|
+
# First, get complete text response
|
104
|
+
# Note: This is a separate call from the audio generation
|
105
|
+
temp_response = ""
|
100
106
|
async for chunk in self.agent_service.generate_response(
|
101
107
|
agent_name=agent_name,
|
102
108
|
user_id=user_id,
|
103
109
|
query=user_text,
|
104
110
|
memory_context=memory_context,
|
105
|
-
output_format="text"
|
111
|
+
output_format="text"
|
106
112
|
):
|
107
|
-
|
108
|
-
full_response += chunk
|
113
|
+
temp_response += chunk
|
109
114
|
|
110
|
-
|
111
|
-
|
112
|
-
|
115
|
+
# Store the complete text for memory
|
116
|
+
text_response = temp_response
|
117
|
+
|
118
|
+
# Now generate audio from same request
|
119
|
+
async for audio_chunk in self.agent_service.generate_response(
|
113
120
|
agent_name=agent_name,
|
114
121
|
user_id=user_id,
|
115
122
|
query=user_text,
|
116
123
|
memory_context=memory_context,
|
117
124
|
output_format="audio",
|
125
|
+
audio_voice=audio_voice,
|
118
126
|
audio_input_format=audio_input_format,
|
119
127
|
audio_output_format=audio_output_format,
|
120
|
-
|
128
|
+
audio_instructions=audio_instructions
|
129
|
+
):
|
130
|
+
yield audio_chunk
|
131
|
+
|
132
|
+
# Store conversation in memory
|
133
|
+
if self.memory_provider and text_response:
|
134
|
+
await self._store_conversation(
|
135
|
+
user_id=user_id,
|
136
|
+
user_message=user_text,
|
137
|
+
assistant_message=text_response
|
138
|
+
)
|
139
|
+
else:
|
140
|
+
# For text mode, we can collect the response and store it directly
|
141
|
+
full_text_response = ""
|
142
|
+
async for chunk in self.agent_service.generate_response(
|
143
|
+
agent_name=agent_name,
|
144
|
+
user_id=user_id,
|
145
|
+
query=user_text,
|
146
|
+
memory_context=memory_context,
|
147
|
+
output_format="text"
|
121
148
|
):
|
122
149
|
yield chunk
|
150
|
+
full_text_response += chunk
|
123
151
|
|
124
|
-
|
125
|
-
|
126
|
-
|
152
|
+
# Store conversation in memory
|
153
|
+
if self.memory_provider and full_text_response:
|
154
|
+
await self._store_conversation(
|
155
|
+
user_id=user_id,
|
156
|
+
user_message=user_text,
|
157
|
+
assistant_message=full_text_response
|
158
|
+
)
|
127
159
|
|
128
160
|
except Exception as e:
|
129
161
|
error_msg = f"I apologize for the technical difficulty. {str(e)}"
|
@@ -248,25 +280,26 @@ class QueryService(QueryServiceInterface):
|
|
248
280
|
}
|
249
281
|
|
250
282
|
async def _store_conversation(
|
251
|
-
self, user_id: str,
|
283
|
+
self, user_id: str, user_message: str, assistant_message: str
|
252
284
|
) -> None:
|
253
285
|
"""Store conversation history in memory provider.
|
254
286
|
|
255
287
|
Args:
|
256
288
|
user_id: User ID
|
257
|
-
|
258
|
-
|
289
|
+
user_message: User message
|
290
|
+
assistant_message: Assistant message
|
259
291
|
"""
|
260
292
|
if self.memory_provider:
|
261
293
|
try:
|
262
294
|
# Truncate excessively long responses
|
263
|
-
|
295
|
+
truncated_assistant_message = self._truncate(assistant_message)
|
296
|
+
truncated_user_message = self._truncate(user_message)
|
264
297
|
|
265
298
|
await self.memory_provider.store(
|
266
299
|
user_id,
|
267
300
|
[
|
268
|
-
{"role": "user", "content":
|
269
|
-
{"role": "assistant", "content":
|
301
|
+
{"role": "user", "content": truncated_user_message},
|
302
|
+
{"role": "assistant", "content": truncated_assistant_message},
|
270
303
|
],
|
271
304
|
)
|
272
305
|
except Exception as e:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: solana-agent
|
3
|
-
Version: 17.0.
|
3
|
+
Version: 17.0.4
|
4
4
|
Summary: The Future of Work
|
5
5
|
License: MIT
|
6
6
|
Keywords: ai,openai,ai agents,agi
|
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.13
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
15
15
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
16
|
-
Requires-Dist: openai (>=1.68.
|
16
|
+
Requires-Dist: openai (>=1.68.1,<2.0.0)
|
17
17
|
Requires-Dist: pydantic (>=2.10.6,<3.0.0)
|
18
18
|
Requires-Dist: pymongo (>=4.11.3,<5.0.0)
|
19
19
|
Requires-Dist: zep-cloud (>=2.7.0,<3.0.0)
|
@@ -29,9 +29,9 @@ solana_agent/repositories/agent.py,sha256=e1rnsQiigkKwJNLKro86a3b6TBiky3GMfmCRc5
|
|
29
29
|
solana_agent/repositories/memory.py,sha256=GABGwaz00thjviHewLvb18NeKE8dkBROxy_stsiiWrE,4722
|
30
30
|
solana_agent/services/__init__.py,sha256=ab_NXJmwYUCmCrCzuTlZ47bJZINW0Y0F5jfQ9OovidU,163
|
31
31
|
solana_agent/services/agent.py,sha256=j0aI_BGaY5Nhkb9ga0r4BqI3qMKu5TOc4QPQsU3NHyQ,17000
|
32
|
-
solana_agent/services/query.py,sha256=
|
32
|
+
solana_agent/services/query.py,sha256=_RHcT7LDvaVhgie96--l7N4ktEtL6UDtgk1_2t25PtQ,12305
|
33
33
|
solana_agent/services/routing.py,sha256=TPJ2Pas4acE93QzMEV6ZP670OtTNrVEPa76fz6urEV4,4996
|
34
|
-
solana_agent-17.0.
|
35
|
-
solana_agent-17.0.
|
36
|
-
solana_agent-17.0.
|
37
|
-
solana_agent-17.0.
|
34
|
+
solana_agent-17.0.4.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
|
35
|
+
solana_agent-17.0.4.dist-info/METADATA,sha256=_QLt1zJUJQ-wBy6qYBycjZ6w8bxvcpdwYrxbr2vZWZk,4888
|
36
|
+
solana_agent-17.0.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
37
|
+
solana_agent-17.0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|