mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-12-27 07:17:43 -06:00
ADK changes
PiperOrigin-RevId: 754131080
This commit is contained in:
committed by
Copybara-Service
parent
879064343c
commit
bcf1deb582
@@ -27,7 +27,9 @@ if TYPE_CHECKING:
|
||||
from ..models import LlmRequest
|
||||
|
||||
|
||||
def load_memory(query: str, tool_context: ToolContext) -> 'list[MemoryResult]':
|
||||
async def load_memory(
|
||||
query: str, tool_context: ToolContext
|
||||
) -> 'list[MemoryResult]':
|
||||
"""Loads the memory for the current user.
|
||||
|
||||
Args:
|
||||
@@ -36,7 +38,7 @@ def load_memory(query: str, tool_context: ToolContext) -> 'list[MemoryResult]':
|
||||
Returns:
|
||||
A list of memory results.
|
||||
"""
|
||||
response = tool_context.search_memory(query)
|
||||
response = await tool_context.search_memory(query)
|
||||
return response.memories
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class PreloadMemoryTool(BaseTool):
|
||||
if not parts or not parts[0].text:
|
||||
return
|
||||
query = parts[0].text
|
||||
response = tool_context.search_memory(query)
|
||||
response = await tool_context.search_memory(query)
|
||||
if not response.memories:
|
||||
return
|
||||
memory_text = ''
|
||||
|
||||
@@ -79,11 +79,11 @@ class ToolContext(CallbackContext):
|
||||
session_id=self._invocation_context.session.id,
|
||||
)
|
||||
|
||||
def search_memory(self, query: str) -> 'SearchMemoryResponse':
|
||||
async def search_memory(self, query: str) -> SearchMemoryResponse:
|
||||
"""Searches the memory of the current user."""
|
||||
if self._invocation_context.memory_service is None:
|
||||
raise ValueError('Memory service is not available.')
|
||||
return self._invocation_context.memory_service.search_memory(
|
||||
return await self._invocation_context.memory_service.search_memory(
|
||||
app_name=self._invocation_context.app_name,
|
||||
user_id=self._invocation_context.user_id,
|
||||
query=query,
|
||||
|
||||
Reference in New Issue
Block a user