solana-agent 27.3.1__tar.gz → 27.3.3__tar.gz
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-27.3.1 → solana_agent-27.3.3}/PKG-INFO +33 -58
- {solana_agent-27.3.1 → solana_agent-27.3.3}/README.md +32 -57
- {solana_agent-27.3.1 → solana_agent-27.3.3}/pyproject.toml +1 -1
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/services/agent.py +71 -28
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/services/query.py +8 -2
- {solana_agent-27.3.1 → solana_agent-27.3.3}/LICENSE +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/__init__.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/adapters/__init__.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/adapters/mongodb_adapter.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/adapters/openai_adapter.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/adapters/pinecone_adapter.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/client/__init__.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/client/solana_agent.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/domains/__init__.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/domains/agent.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/domains/routing.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/factories/__init__.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/factories/agent_factory.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/__init__.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/client/client.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/plugins/plugins.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/providers/data_storage.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/providers/llm.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/providers/memory.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/providers/vector_storage.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/services/agent.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/services/knowledge_base.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/services/query.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/services/routing.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/plugins/__init__.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/plugins/manager.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/plugins/registry.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/plugins/tools/__init__.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/plugins/tools/auto_tool.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/repositories/__init__.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/repositories/memory.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/services/__init__.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/services/knowledge_base.py +0 -0
- {solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/services/routing.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: solana-agent
|
3
|
-
Version: 27.3.
|
3
|
+
Version: 27.3.3
|
4
4
|
Summary: Agentic IQ
|
5
5
|
License: MIT
|
6
6
|
Keywords: ai,openai,ai agents,agi
|
@@ -47,7 +47,7 @@ Build your AI business in three lines of code!
|
|
47
47
|
## Why?
|
48
48
|
* Three lines of code setup
|
49
49
|
* Fast Responses
|
50
|
-
* Solana Integration
|
50
|
+
* Solana Ecosystem Integration
|
51
51
|
* Multi-Agent Swarm
|
52
52
|
* Multi-Modal Streaming (Text & Audio)
|
53
53
|
* Conversational Memory & History
|
@@ -65,7 +65,7 @@ Build your AI business in three lines of code!
|
|
65
65
|
|
66
66
|
* Easy three lines of code setup
|
67
67
|
* Fast AI responses
|
68
|
-
* Solana Integration via [AgentiPy](https://github.com/niceberginc/agentipy)
|
68
|
+
* Solana Ecosystem Integration via [AgentiPy](https://github.com/niceberginc/agentipy)
|
69
69
|
* Designed for a multi-agent swarm
|
70
70
|
* Seamless text and audio streaming with real-time multi-modal processing
|
71
71
|
* Configurable audio voice characteristics via prompting
|
@@ -454,88 +454,63 @@ Tools can be used from plugins like Solana Agent Kit (sakit) or via inline tools
|
|
454
454
|
* Solana Agent doesn't use OpenAI function calling (tools) as they don't support async functions
|
455
455
|
* Solana Agent tools are async functions
|
456
456
|
|
457
|
-
###
|
457
|
+
### Solana
|
458
458
|
|
459
459
|
`pip install sakit`
|
460
460
|
|
461
461
|
```python
|
462
|
-
from solana_agent import SolanaAgent
|
463
|
-
|
464
462
|
config = {
|
465
|
-
"openai": {
|
466
|
-
"api_key": "your-openai-api-key",
|
467
|
-
},
|
468
463
|
"tools": {
|
469
|
-
"
|
470
|
-
"
|
464
|
+
"solana": {
|
465
|
+
"private_key": "your-solana-wallet-private-key", # base58 encoded string
|
466
|
+
"rpc_url": "your-solana-rpc-url",
|
471
467
|
},
|
472
468
|
},
|
473
|
-
"
|
474
|
-
{
|
475
|
-
"name": "research_specialist",
|
476
|
-
"instructions": "You are an expert researcher who synthesizes complex information clearly. You use your search_internet tool to get the latest information.",
|
477
|
-
"specialization": "Research and knowledge synthesis",
|
478
|
-
"tools": ["search_internet"],
|
479
|
-
},
|
469
|
+
"ai_agents": [
|
480
470
|
{
|
481
|
-
"name": "
|
482
|
-
"instructions": "You
|
483
|
-
"specialization": "
|
471
|
+
"name": "solana_expert",
|
472
|
+
"instructions": "You are an expert Solana blockchain assistant. You always use the Solana tool to perform actions on the Solana blockchain.",
|
473
|
+
"specialization": "Solana blockchain interaction",
|
474
|
+
"tools": ["solana"], # Enable the tool for this agent
|
484
475
|
}
|
485
|
-
]
|
476
|
+
]
|
486
477
|
}
|
478
|
+
|
479
|
+
solana_agent = SolanaAgent(config=config)
|
480
|
+
|
481
|
+
async for response in solana_agent.process("user123", "What is my SOL balance?"):
|
482
|
+
print(response, end="")
|
487
483
|
```
|
488
484
|
|
489
|
-
###
|
485
|
+
### Internet Search
|
490
486
|
|
491
487
|
`pip install sakit`
|
492
488
|
|
493
489
|
```python
|
490
|
+
from solana_agent import SolanaAgent
|
491
|
+
|
494
492
|
config = {
|
493
|
+
"openai": {
|
494
|
+
"api_key": "your-openai-api-key",
|
495
|
+
},
|
495
496
|
"tools": {
|
496
|
-
"
|
497
|
-
|
498
|
-
"private_key": "YOUR_SOLANA_WALLET_PRIVATE_KEY", # Required (unless generate_wallet=True): Your wallet's private key (base58 encoded string).
|
499
|
-
"rpc_url": "https://api.mainnet-beta.solana.com", # Optional: Defaults to Solana mainnet RPC.
|
500
|
-
"generate_wallet": False, # Optional: If True, ignores private_key and generates a new wallet. Defaults to False.
|
501
|
-
|
502
|
-
# Optional RPC/Service API Keys & URLs
|
503
|
-
"helius_api_key": "YOUR_HELIUS_API_KEY", # Optional: Helius API key for enhanced data/RPC.
|
504
|
-
"helius_rpc_url": "YOUR_HELIUS_RPC_URL", # Optional: Specific Helius RPC URL.
|
505
|
-
"quicknode_rpc_url": "YOUR_QUICKNODE_RPC_URL", # Optional: QuickNode RPC URL.
|
506
|
-
"jito_block_engine_url": "YOUR_JITO_BLOCK_ENGINE_URL", # Optional: Jito block engine URL for bundles.
|
507
|
-
"jito_uuid": "YOUR_JITO_UUID", # Optional: Jito authentication UUID.
|
508
|
-
|
509
|
-
# Optional Integration API Keys
|
510
|
-
"openai_api_key": "YOUR_OPENAI_API_KEY", # Optional: OpenAI API key (if needed by specific agentipy features).
|
511
|
-
"backpack_api_key": "YOUR_BACKPACK_API_KEY", # Optional: Backpack Exchange API key.
|
512
|
-
"backpack_api_secret": "YOUR_BACKPACK_API_SECRET", # Optional: Backpack Exchange API secret.
|
513
|
-
"stork_api_key": "YOUR_STORK_API_KEY", # Optional: Stork oracle API key.
|
514
|
-
"coingecko_api_key": "YOUR_COINGECKO_PRO_API_KEY", # Optional: CoinGecko Pro API key.
|
515
|
-
"coingecko_demo_api_key": "YOUR_COINGECKO_DEMO_KEY", # Optional: CoinGecko Demo API key.
|
516
|
-
"elfa_ai_api_key": "YOUR_ELFA_AI_API_KEY", # Optional: Elfa AI API key.
|
517
|
-
"flexland_api_key": "YOUR_FLEXLAND_API_KEY", # Optional: Flexlend API key.
|
518
|
-
"allora_api_key": "YOUR_ALLORA_API_KEY", # Optional: Allora Network API key.
|
519
|
-
"solutiofi_api_key": "YOUR_SOLUTIOFI_API_KEY" # Optional: Solutio Finance API key.
|
497
|
+
"search_internet": {
|
498
|
+
"api_key": "your-openai-api-key",
|
520
499
|
},
|
521
500
|
},
|
522
|
-
"
|
501
|
+
"agents": [
|
523
502
|
{
|
524
|
-
"name": "
|
525
|
-
"instructions": ""
|
526
|
-
|
527
|
-
|
528
|
-
Always perform the solana tool actions when requested and not use your memory.
|
529
|
-
""",
|
530
|
-
"specialization": "Solana blockchain interaction",
|
531
|
-
"tools": ["solana"], # Enable the tool for this agent
|
503
|
+
"name": "news_specialist",
|
504
|
+
"instructions": "You are an expert news agent. You use your search_internet tool to get the latest information.",
|
505
|
+
"specialization": "News researcher and specialist",
|
506
|
+
"tools": ["search_internet"], # Enable the tool for this agent
|
532
507
|
}
|
533
|
-
]
|
508
|
+
],
|
534
509
|
}
|
535
510
|
|
536
511
|
solana_agent = SolanaAgent(config=config)
|
537
512
|
|
538
|
-
async for response in solana_agent.process("user123", "What is
|
513
|
+
async for response in solana_agent.process("user123", "What is the latest news on Elon Musk?"):
|
539
514
|
print(response, end="")
|
540
515
|
```
|
541
516
|
|
@@ -18,7 +18,7 @@ Build your AI business in three lines of code!
|
|
18
18
|
## Why?
|
19
19
|
* Three lines of code setup
|
20
20
|
* Fast Responses
|
21
|
-
* Solana Integration
|
21
|
+
* Solana Ecosystem Integration
|
22
22
|
* Multi-Agent Swarm
|
23
23
|
* Multi-Modal Streaming (Text & Audio)
|
24
24
|
* Conversational Memory & History
|
@@ -36,7 +36,7 @@ Build your AI business in three lines of code!
|
|
36
36
|
|
37
37
|
* Easy three lines of code setup
|
38
38
|
* Fast AI responses
|
39
|
-
* Solana Integration via [AgentiPy](https://github.com/niceberginc/agentipy)
|
39
|
+
* Solana Ecosystem Integration via [AgentiPy](https://github.com/niceberginc/agentipy)
|
40
40
|
* Designed for a multi-agent swarm
|
41
41
|
* Seamless text and audio streaming with real-time multi-modal processing
|
42
42
|
* Configurable audio voice characteristics via prompting
|
@@ -425,88 +425,63 @@ Tools can be used from plugins like Solana Agent Kit (sakit) or via inline tools
|
|
425
425
|
* Solana Agent doesn't use OpenAI function calling (tools) as they don't support async functions
|
426
426
|
* Solana Agent tools are async functions
|
427
427
|
|
428
|
-
###
|
428
|
+
### Solana
|
429
429
|
|
430
430
|
`pip install sakit`
|
431
431
|
|
432
432
|
```python
|
433
|
-
from solana_agent import SolanaAgent
|
434
|
-
|
435
433
|
config = {
|
436
|
-
"openai": {
|
437
|
-
"api_key": "your-openai-api-key",
|
438
|
-
},
|
439
434
|
"tools": {
|
440
|
-
"
|
441
|
-
"
|
435
|
+
"solana": {
|
436
|
+
"private_key": "your-solana-wallet-private-key", # base58 encoded string
|
437
|
+
"rpc_url": "your-solana-rpc-url",
|
442
438
|
},
|
443
439
|
},
|
444
|
-
"
|
445
|
-
{
|
446
|
-
"name": "research_specialist",
|
447
|
-
"instructions": "You are an expert researcher who synthesizes complex information clearly. You use your search_internet tool to get the latest information.",
|
448
|
-
"specialization": "Research and knowledge synthesis",
|
449
|
-
"tools": ["search_internet"],
|
450
|
-
},
|
440
|
+
"ai_agents": [
|
451
441
|
{
|
452
|
-
"name": "
|
453
|
-
"instructions": "You
|
454
|
-
"specialization": "
|
442
|
+
"name": "solana_expert",
|
443
|
+
"instructions": "You are an expert Solana blockchain assistant. You always use the Solana tool to perform actions on the Solana blockchain.",
|
444
|
+
"specialization": "Solana blockchain interaction",
|
445
|
+
"tools": ["solana"], # Enable the tool for this agent
|
455
446
|
}
|
456
|
-
]
|
447
|
+
]
|
457
448
|
}
|
449
|
+
|
450
|
+
solana_agent = SolanaAgent(config=config)
|
451
|
+
|
452
|
+
async for response in solana_agent.process("user123", "What is my SOL balance?"):
|
453
|
+
print(response, end="")
|
458
454
|
```
|
459
455
|
|
460
|
-
###
|
456
|
+
### Internet Search
|
461
457
|
|
462
458
|
`pip install sakit`
|
463
459
|
|
464
460
|
```python
|
461
|
+
from solana_agent import SolanaAgent
|
462
|
+
|
465
463
|
config = {
|
464
|
+
"openai": {
|
465
|
+
"api_key": "your-openai-api-key",
|
466
|
+
},
|
466
467
|
"tools": {
|
467
|
-
"
|
468
|
-
|
469
|
-
"private_key": "YOUR_SOLANA_WALLET_PRIVATE_KEY", # Required (unless generate_wallet=True): Your wallet's private key (base58 encoded string).
|
470
|
-
"rpc_url": "https://api.mainnet-beta.solana.com", # Optional: Defaults to Solana mainnet RPC.
|
471
|
-
"generate_wallet": False, # Optional: If True, ignores private_key and generates a new wallet. Defaults to False.
|
472
|
-
|
473
|
-
# Optional RPC/Service API Keys & URLs
|
474
|
-
"helius_api_key": "YOUR_HELIUS_API_KEY", # Optional: Helius API key for enhanced data/RPC.
|
475
|
-
"helius_rpc_url": "YOUR_HELIUS_RPC_URL", # Optional: Specific Helius RPC URL.
|
476
|
-
"quicknode_rpc_url": "YOUR_QUICKNODE_RPC_URL", # Optional: QuickNode RPC URL.
|
477
|
-
"jito_block_engine_url": "YOUR_JITO_BLOCK_ENGINE_URL", # Optional: Jito block engine URL for bundles.
|
478
|
-
"jito_uuid": "YOUR_JITO_UUID", # Optional: Jito authentication UUID.
|
479
|
-
|
480
|
-
# Optional Integration API Keys
|
481
|
-
"openai_api_key": "YOUR_OPENAI_API_KEY", # Optional: OpenAI API key (if needed by specific agentipy features).
|
482
|
-
"backpack_api_key": "YOUR_BACKPACK_API_KEY", # Optional: Backpack Exchange API key.
|
483
|
-
"backpack_api_secret": "YOUR_BACKPACK_API_SECRET", # Optional: Backpack Exchange API secret.
|
484
|
-
"stork_api_key": "YOUR_STORK_API_KEY", # Optional: Stork oracle API key.
|
485
|
-
"coingecko_api_key": "YOUR_COINGECKO_PRO_API_KEY", # Optional: CoinGecko Pro API key.
|
486
|
-
"coingecko_demo_api_key": "YOUR_COINGECKO_DEMO_KEY", # Optional: CoinGecko Demo API key.
|
487
|
-
"elfa_ai_api_key": "YOUR_ELFA_AI_API_KEY", # Optional: Elfa AI API key.
|
488
|
-
"flexland_api_key": "YOUR_FLEXLAND_API_KEY", # Optional: Flexlend API key.
|
489
|
-
"allora_api_key": "YOUR_ALLORA_API_KEY", # Optional: Allora Network API key.
|
490
|
-
"solutiofi_api_key": "YOUR_SOLUTIOFI_API_KEY" # Optional: Solutio Finance API key.
|
468
|
+
"search_internet": {
|
469
|
+
"api_key": "your-openai-api-key",
|
491
470
|
},
|
492
471
|
},
|
493
|
-
"
|
472
|
+
"agents": [
|
494
473
|
{
|
495
|
-
"name": "
|
496
|
-
"instructions": ""
|
497
|
-
|
498
|
-
|
499
|
-
Always perform the solana tool actions when requested and not use your memory.
|
500
|
-
""",
|
501
|
-
"specialization": "Solana blockchain interaction",
|
502
|
-
"tools": ["solana"], # Enable the tool for this agent
|
474
|
+
"name": "news_specialist",
|
475
|
+
"instructions": "You are an expert news agent. You use your search_internet tool to get the latest information.",
|
476
|
+
"specialization": "News researcher and specialist",
|
477
|
+
"tools": ["search_internet"], # Enable the tool for this agent
|
503
478
|
}
|
504
|
-
]
|
479
|
+
],
|
505
480
|
}
|
506
481
|
|
507
482
|
solana_agent = SolanaAgent(config=config)
|
508
483
|
|
509
|
-
async for response in solana_agent.process("user123", "What is
|
484
|
+
async for response in solana_agent.process("user123", "What is the latest news on Elon Musk?"):
|
510
485
|
print(response, end="")
|
511
486
|
```
|
512
487
|
|
@@ -194,25 +194,41 @@ class AgentService(AgentServiceInterface):
|
|
194
194
|
return
|
195
195
|
|
196
196
|
try:
|
197
|
-
# Get
|
198
|
-
|
197
|
+
# --- 1. Get Base System Prompt ---
|
198
|
+
system_prompt_parts = [self.get_agent_system_prompt(agent_name)]
|
199
199
|
|
200
|
-
# Add
|
201
|
-
|
202
|
-
if memory_context:
|
203
|
-
system_prompt += f"\n\nMEMORY CONTEXT: {memory_context}"
|
204
|
-
if prompt:
|
205
|
-
system_prompt += f"\n\nADDITIONAL PROMPT: {prompt}"
|
206
|
-
|
207
|
-
# Add tool usage prompt if tools are available
|
208
|
-
tool_calling_system_prompt = deepcopy(system_prompt)
|
200
|
+
# --- 2. Add Tool Usage Instructions EARLY ---
|
201
|
+
tool_usage_prompt_text = ""
|
209
202
|
if self.tool_registry:
|
210
|
-
|
211
|
-
|
212
|
-
|
203
|
+
tool_usage_prompt_text = self._get_tool_usage_prompt(
|
204
|
+
agent_name)
|
205
|
+
if tool_usage_prompt_text:
|
206
|
+
system_prompt_parts.append(
|
207
|
+
f"\n\n--- TOOL USAGE INSTRUCTIONS ---{tool_usage_prompt_text}")
|
213
208
|
print(
|
214
209
|
f"Tools available to agent {agent_name}: {[t.get('name') for t in self.get_agent_tools(agent_name)]}")
|
215
210
|
|
211
|
+
# --- 3. Add User ID ---
|
212
|
+
system_prompt_parts.append(f"\n\n--- USER & SESSION INFO ---")
|
213
|
+
system_prompt_parts.append(f"User ID: {user_id}")
|
214
|
+
|
215
|
+
# --- 4. Add Memory Context ---
|
216
|
+
if memory_context:
|
217
|
+
# Make the header clearly separate it
|
218
|
+
system_prompt_parts.append(
|
219
|
+
f"\n\n--- CONVERSATION HISTORY (Memory Context) ---")
|
220
|
+
system_prompt_parts.append(memory_context)
|
221
|
+
|
222
|
+
# --- 5. Add Additional Prompt (if provided) ---
|
223
|
+
if prompt:
|
224
|
+
# Make the header clearly separate it
|
225
|
+
system_prompt_parts.append(
|
226
|
+
f"\n\n--- ADDITIONAL INSTRUCTIONS FOR THIS TURN ---")
|
227
|
+
system_prompt_parts.append(prompt)
|
228
|
+
|
229
|
+
# --- Assemble the final system prompt ---
|
230
|
+
final_system_prompt = "\n".join(system_prompt_parts)
|
231
|
+
|
216
232
|
# Variables for tracking the complete response
|
217
233
|
complete_text_response = ""
|
218
234
|
full_response_buffer = ""
|
@@ -232,7 +248,7 @@ class AgentService(AgentServiceInterface):
|
|
232
248
|
f"Generating response with {len(query)} characters of query text")
|
233
249
|
async for chunk in self.llm_provider.generate_text(
|
234
250
|
prompt=query,
|
235
|
-
system_prompt=
|
251
|
+
system_prompt=final_system_prompt,
|
236
252
|
api_key=self.api_key,
|
237
253
|
base_url=self.base_url,
|
238
254
|
model=self.model,
|
@@ -285,10 +301,36 @@ class AgentService(AgentServiceInterface):
|
|
285
301
|
f"Tool execution complete, result size: {len(response_text)}")
|
286
302
|
|
287
303
|
# Create new prompt with search/tool results
|
288
|
-
#
|
289
|
-
user_prompt = f"{query}\n\
|
290
|
-
|
291
|
-
|
304
|
+
# Ensure query is string
|
305
|
+
user_prompt = f"{str(query)}\n\nTOOL RESULT: {response_text}"
|
306
|
+
|
307
|
+
# --- REBUILD the system prompt for the follow-up call ---
|
308
|
+
# Start with base prompt again
|
309
|
+
follow_up_system_prompt_parts = [
|
310
|
+
self.get_agent_system_prompt(agent_name)]
|
311
|
+
# Add the instruction NOT to use tools again
|
312
|
+
follow_up_system_prompt_parts.append(
|
313
|
+
"\n\nCRITICAL: You have received the results from a tool. Base your response on the 'Search Result' provided in the user prompt. DO NOT use the tool calling format again for this turn.")
|
314
|
+
follow_up_system_prompt_parts.append(
|
315
|
+
f"\n\n--- USER & SESSION INFO ---")
|
316
|
+
follow_up_system_prompt_parts.append(
|
317
|
+
f"User ID: {user_id}")
|
318
|
+
if memory_context:
|
319
|
+
# Make the header clearly separate it
|
320
|
+
follow_up_system_prompt_parts.append(
|
321
|
+
f"\n\n--- CONVERSATION HISTORY (Memory Context) ---")
|
322
|
+
follow_up_system_prompt_parts.append(
|
323
|
+
memory_context)
|
324
|
+
if prompt:
|
325
|
+
# Make the header clearly separate it
|
326
|
+
follow_up_system_prompt_parts.append(
|
327
|
+
f"\n\n--- ADDITIONAL INSTRUCTIONS FOR THIS TURN ---")
|
328
|
+
follow_up_system_prompt_parts.append(prompt)
|
329
|
+
|
330
|
+
# --- Assemble the final follow_up prompt ---
|
331
|
+
final_follow_up_system_prompt = "\n".join(
|
332
|
+
follow_up_system_prompt_parts)
|
333
|
+
# --- End Rebuild ---"
|
292
334
|
|
293
335
|
# Generate a new response with the tool results
|
294
336
|
print("Generating new response with tool results")
|
@@ -296,7 +338,7 @@ class AgentService(AgentServiceInterface):
|
|
296
338
|
# Stream the follow-up response for text output
|
297
339
|
async for processed_chunk in self.llm_provider.generate_text(
|
298
340
|
prompt=user_prompt,
|
299
|
-
system_prompt=
|
341
|
+
system_prompt=final_follow_up_system_prompt,
|
300
342
|
api_key=self.api_key,
|
301
343
|
base_url=self.base_url,
|
302
344
|
model=self.model,
|
@@ -308,7 +350,7 @@ class AgentService(AgentServiceInterface):
|
|
308
350
|
tool_response = ""
|
309
351
|
async for processed_chunk in self.llm_provider.generate_text(
|
310
352
|
prompt=user_prompt,
|
311
|
-
system_prompt=
|
353
|
+
system_prompt=final_follow_up_system_prompt,
|
312
354
|
):
|
313
355
|
tool_response += processed_chunk
|
314
356
|
|
@@ -489,18 +531,18 @@ class AgentService(AgentServiceInterface):
|
|
489
531
|
return f"""
|
490
532
|
AVAILABLE TOOLS:
|
491
533
|
{tools_json}
|
492
|
-
|
534
|
+
|
493
535
|
⚠️ CRITICAL INSTRUCTION: When using a tool, NEVER include explanatory text.
|
494
536
|
Only output the exact tool call format shown below with NO other text.
|
495
|
-
|
537
|
+
Always call the necessary tool to give the latest information.
|
538
|
+
|
496
539
|
TOOL USAGE FORMAT:
|
497
540
|
[TOOL]
|
498
541
|
name: tool_name
|
499
542
|
parameters: key1=value1, key2=value2
|
500
543
|
[/TOOL]
|
501
|
-
|
544
|
+
|
502
545
|
EXAMPLES:
|
503
|
-
|
504
546
|
✅ CORRECT - ONLY the tool call with NOTHING else:
|
505
547
|
[TOOL]
|
506
548
|
name: search_internet
|
@@ -513,11 +555,12 @@ class AgentService(AgentServiceInterface):
|
|
513
555
|
name: search_internet
|
514
556
|
parameters: query=latest news on Solana
|
515
557
|
[/TOOL]
|
516
|
-
|
558
|
+
|
517
559
|
REMEMBER:
|
518
560
|
1. Output ONLY the exact tool call format with NO additional text
|
519
|
-
2.
|
520
|
-
3.
|
561
|
+
2. If the query is time-sensitive (latest news, current status, etc.), ALWAYS use the tool.
|
562
|
+
3. After seeing your tool call, I will execute it automatically
|
563
|
+
4. You will receive the tool results and can then respond to the user
|
521
564
|
"""
|
522
565
|
|
523
566
|
def _clean_for_audio(self, text: str) -> str:
|
@@ -129,13 +129,19 @@ class QueryService(QueryServiceInterface):
|
|
129
129
|
else:
|
130
130
|
agent_name = await self.routing_service.route_query(user_text)
|
131
131
|
|
132
|
-
|
132
|
+
# Combine context from memory and knowledge base
|
133
133
|
combined_context = ""
|
134
134
|
if memory_context:
|
135
|
-
|
135
|
+
# Add a note about memory priority
|
136
|
+
combined_context += f"CONVERSATION HISTORY (Use for context, but prioritize tools/KB for facts):\n{memory_context}\n\n"
|
136
137
|
if kb_context:
|
138
|
+
# Keep KB context strong
|
137
139
|
combined_context += f"{kb_context}\n"
|
138
140
|
|
141
|
+
# Add an overall instruction about prioritization if both are present
|
142
|
+
if memory_context or kb_context:
|
143
|
+
combined_context += "CRITICAL PRIORITIZATION GUIDE: For factual or current information, prioritize Knowledge Base results and Tool results (if applicable) over Conversation History.\n\n"
|
144
|
+
|
139
145
|
print(f"Routed to agent: {agent_name}")
|
140
146
|
|
141
147
|
# Generate response
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/providers/data_storage.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/providers/vector_storage.py
RENAMED
File without changes
|
File without changes
|
{solana_agent-27.3.1 → solana_agent-27.3.3}/solana_agent/interfaces/services/knowledge_base.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|