rename bank facts to interactions

This commit is contained in:
Nicolò Boschi 2025-12-04 17:21:10 +01:00
parent 8e575ce619
commit b4a2915d89
11 changed files with 412 additions and 57 deletions

View file

@ -131,7 +131,7 @@ class RecallResult(BaseModel):
id: str
text: str
type: Optional[str] = None # fact type: world, agent, opinion, observation
type: Optional[str] = None # fact type: world, interactions, opinion, observation
entities: Optional[List[str]] = None # Entity names mentioned in this fact
context: Optional[str] = None
occurred_start: Optional[str] = None # ISO format date when the event started
@ -397,7 +397,7 @@ class ReflectFact(BaseModel):
id: Optional[str] = None
text: str
type: Optional[str] = None # fact type: world, agent, opinion
type: Optional[str] = None # fact type: world, interactions, opinion
context: Optional[str] = None
occurred_start: Optional[str] = None
occurred_end: Optional[str] = None
@ -833,7 +833,7 @@ def _register_routes(app: FastAPI):
"/v1/default/banks/{bank_id}/graph",
response_model=GraphDataResponse,
summary="Get memory graph data",
description="Retrieve graph data for visualization, optionally filtered by type (world/agent/opinion). Limited to 1000 most recent items.",
description="Retrieve graph data for visualization, optionally filtered by type (world/interactions/opinion). Limited to 1000 most recent items.",
operation_id="get_graph"
)
async def api_graph(bank_id: str,
@ -871,7 +871,7 @@ def _register_routes(app: FastAPI):
Args:
bank_id: Memory Bank ID (from path)
type: Filter by fact type (world, agent, opinion)
type: Filter by fact type (world, interactions, opinion)
q: Search query for full-text search (searches text and context)
limit: Maximum number of results (default: 100)
offset: Offset for pagination (default: 0)
@ -1026,7 +1026,7 @@ def _register_routes(app: FastAPI):
Reflect and formulate an answer using bank identity, world facts, and opinions.
This endpoint:
1. Retrieves agent facts (bank's identity)
1. Retrieves interactions (conversations and events)
2. Retrieves world facts relevant to the query
3. Retrieves existing opinions (bank's perspectives)
4. Uses LLM to formulate a contextual answer
@ -1852,11 +1852,11 @@ This operation cannot be undone.
"/v1/default/banks/{bank_id}/memories",
response_model=DeleteResponse,
summary="Clear memory bank memories",
description="Delete memory units for a memory bank. Optionally filter by type (world, agent, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.",
description="Delete memory units for a memory bank. Optionally filter by type (world, interactions, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.",
operation_id="clear_bank_memories"
)
async def api_clear_bank_memories(bank_id: str,
type: Optional[str] = Query(None, description="Optional fact type filter (world, agent, opinion)")
type: Optional[str] = Query(None, description="Optional fact type filter (world, interactions, opinion)")
):
"""Clear memories for a memory bank, optionally filtered by type."""
try:

View file

@ -896,7 +896,7 @@ class MemoryEngine:
Args:
bank_id: bank ID to recall for
query: Recall query
fact_type: Required filter for fact type ('world', 'agent', or 'opinion')
fact_type: Required filter for fact type ('world', 'interactions', or 'opinion')
budget: Budget level for graph traversal (low=100, mid=300, high=600 units)
max_tokens: Maximum tokens to return (counts only 'text' field, default 4096)
enable_trace: If True, returns detailed trace object
@ -2559,7 +2559,7 @@ Guidelines:
Reflect and formulate an answer using bank identity, world facts, and opinions.
This method:
1. Retrieves agent facts (bank's identity and past actions)
1. Retrieves interactions (conversations and events)
2. Retrieves world facts (general knowledge)
3. Retrieves existing opinions (bank's formed perspectives)
4. Uses LLM to formulate an answer
@ -2575,7 +2575,7 @@ Guidelines:
Returns:
ReflectResult containing:
- text: Plain text answer (no markdown)
- based_on: Dict with 'world', 'agent', and 'opinion' fact lists (MemoryFact objects)
- based_on: Dict with 'world', 'interactions', and 'opinion' fact lists (MemoryFact objects)
- new_opinions: List of newly formed opinions
"""
# Use cached LLM config
@ -2589,7 +2589,7 @@ Guidelines:
budget=budget,
max_tokens=4096,
enable_trace=False,
fact_type=['agent', 'world', 'opinion'],
fact_type=['interactions', 'world', 'opinion'],
include_entities=True
)
@ -2657,7 +2657,7 @@ Guidelines:
text=answer_text,
based_on={
"world": world_results,
"agent": agent_results,
"interactions": agent_results,
"opinion": opinion_results
},
new_opinions=[] # Opinions are being extracted asynchronously
@ -2871,7 +2871,7 @@ Guidelines:
JOIN unit_entities ue ON mu.id = ue.unit_id
WHERE mu.bank_id = $1
AND ue.entity_id = $2
AND mu.fact_type IN ('world', 'agent')
AND mu.fact_type IN ('world', 'interactions')
ORDER BY mu.occurred_start DESC
LIMIT 50
""",

View file

@ -142,7 +142,7 @@ class ReflectResult(BaseModel):
"occurred_end": "2024-01-15T10:30:00Z"
}
],
"agent": [],
"interactions": [],
"opinion": []
},
"new_opinions": [
@ -153,7 +153,7 @@ class ReflectResult(BaseModel):
text: str = Field(description="The formulated answer text")
based_on: Dict[str, List[MemoryFact]] = Field(
description="Facts used to formulate the answer, organized by type (world, agent, opinion)"
description="Facts used to formulate the answer, organized by type (world, interactions, opinion)"
)
new_opinions: List[str] = Field(
default_factory=list,

View file

@ -631,7 +631,7 @@ class DefaultApi:
async def clear_bank_memories(
self,
bank_id: StrictStr,
type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, agent, opinion)")] = None,
type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, interactions, opinion)")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@ -647,11 +647,11 @@ class DefaultApi:
) -> DeleteResponse:
"""Clear memory bank memories
Delete memory units for a memory bank. Optionally filter by type (world, agent, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.
Delete memory units for a memory bank. Optionally filter by type (world, interactions, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.
:param bank_id: (required)
:type bank_id: str
:param type: Optional fact type filter (world, agent, opinion)
:param type: Optional fact type filter (world, interactions, opinion)
:type type: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
@ -703,7 +703,7 @@ class DefaultApi:
async def clear_bank_memories_with_http_info(
self,
bank_id: StrictStr,
type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, agent, opinion)")] = None,
type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, interactions, opinion)")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@ -719,11 +719,11 @@ class DefaultApi:
) -> ApiResponse[DeleteResponse]:
"""Clear memory bank memories
Delete memory units for a memory bank. Optionally filter by type (world, agent, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.
Delete memory units for a memory bank. Optionally filter by type (world, interactions, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.
:param bank_id: (required)
:type bank_id: str
:param type: Optional fact type filter (world, agent, opinion)
:param type: Optional fact type filter (world, interactions, opinion)
:type type: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
@ -775,7 +775,7 @@ class DefaultApi:
async def clear_bank_memories_without_preload_content(
self,
bank_id: StrictStr,
type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, agent, opinion)")] = None,
type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, interactions, opinion)")] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@ -791,11 +791,11 @@ class DefaultApi:
) -> RESTResponseType:
"""Clear memory bank memories
Delete memory units for a memory bank. Optionally filter by type (world, agent, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.
Delete memory units for a memory bank. Optionally filter by type (world, interactions, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.
:param bank_id: (required)
:type bank_id: str
:param type: Optional fact type filter (world, agent, opinion)
:param type: Optional fact type filter (world, interactions, opinion)
:type type: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
@ -2841,7 +2841,7 @@ class DefaultApi:
) -> GraphDataResponse:
"""Get memory graph data
Retrieve graph data for visualization, optionally filtered by type (world/agent/opinion). Limited to 1000 most recent items.
Retrieve graph data for visualization, optionally filtered by type (world/interactions/opinion). Limited to 1000 most recent items.
:param bank_id: (required)
:type bank_id: str
@ -2913,7 +2913,7 @@ class DefaultApi:
) -> ApiResponse[GraphDataResponse]:
"""Get memory graph data
Retrieve graph data for visualization, optionally filtered by type (world/agent/opinion). Limited to 1000 most recent items.
Retrieve graph data for visualization, optionally filtered by type (world/interactions/opinion). Limited to 1000 most recent items.
:param bank_id: (required)
:type bank_id: str
@ -2985,7 +2985,7 @@ class DefaultApi:
) -> RESTResponseType:
"""Get memory graph data
Retrieve graph data for visualization, optionally filtered by type (world/agent/opinion). Limited to 1000 most recent items.
Retrieve graph data for visualization, optionally filtered by type (world/interactions/opinion). Limited to 1000 most recent items.
:param bank_id: (required)
:type bank_id: str
@ -4554,7 +4554,7 @@ class DefaultApi:
) -> RecallResponse:
"""Recall memory
Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - 'world': General knowledge about people, places, events, and things that happen - 'agent': Memories about what the AI agent did, actions taken, and tasks performed - 'opinion': The bank's formed beliefs, perspectives, and viewpoints - 'observation': Synthesized observations about entities (generated automatically) Set include_entities=true to get entity observations alongside recall results.
Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - 'world': General knowledge about people, places, events, and things that happen - 'interactions': Memories about interactions, conversations, actions taken, and tasks performed - 'opinion': The bank's formed beliefs, perspectives, and viewpoints Set include_entities=true to get entity observations alongside recall results.
:param bank_id: (required)
:type bank_id: str
@ -4626,7 +4626,7 @@ class DefaultApi:
) -> ApiResponse[RecallResponse]:
"""Recall memory
Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - 'world': General knowledge about people, places, events, and things that happen - 'agent': Memories about what the AI agent did, actions taken, and tasks performed - 'opinion': The bank's formed beliefs, perspectives, and viewpoints - 'observation': Synthesized observations about entities (generated automatically) Set include_entities=true to get entity observations alongside recall results.
Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - 'world': General knowledge about people, places, events, and things that happen - 'interactions': Memories about interactions, conversations, actions taken, and tasks performed - 'opinion': The bank's formed beliefs, perspectives, and viewpoints Set include_entities=true to get entity observations alongside recall results.
:param bank_id: (required)
:type bank_id: str
@ -4698,7 +4698,7 @@ class DefaultApi:
) -> RESTResponseType:
"""Recall memory
Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - 'world': General knowledge about people, places, events, and things that happen - 'agent': Memories about what the AI agent did, actions taken, and tasks performed - 'opinion': The bank's formed beliefs, perspectives, and viewpoints - 'observation': Synthesized observations about entities (generated automatically) Set include_entities=true to get entity observations alongside recall results.
Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - 'world': General knowledge about people, places, events, and things that happen - 'interactions': Memories about interactions, conversations, actions taken, and tasks performed - 'opinion': The bank's formed beliefs, perspectives, and viewpoints Set include_entities=true to get entity observations alongside recall results.
:param bank_id: (required)
:type bank_id: str
@ -4845,7 +4845,7 @@ class DefaultApi:
) -> ReflectResponse:
"""Reflect and generate answer
Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves agent facts (bank's identity) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions
Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves interactions (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions
:param bank_id: (required)
:type bank_id: str
@ -4917,7 +4917,7 @@ class DefaultApi:
) -> ApiResponse[ReflectResponse]:
"""Reflect and generate answer
Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves agent facts (bank's identity) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions
Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves interactions (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions
:param bank_id: (required)
:type bank_id: str
@ -4989,7 +4989,7 @@ class DefaultApi:
) -> RESTResponseType:
"""Reflect and generate answer
Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves agent facts (bank's identity) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions
Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves interactions (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions
:param bank_id: (required)
:type bank_id: str

View file

@ -36,6 +36,251 @@ class MonitoringApi:
self.api_client = api_client
@validate_call
async def health_endpoint_health_get(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> object:
"""Health check endpoint
Checks the health of the API and database connection
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._health_endpoint_health_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "object",
}
response_data = await self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
await response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
async def health_endpoint_health_get_with_http_info(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[object]:
"""Health check endpoint
Checks the health of the API and database connection
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._health_endpoint_health_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "object",
}
response_data = await self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
await response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
async def health_endpoint_health_get_without_preload_content(
self,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Health check endpoint
Checks the health of the API and database connection
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._health_endpoint_health_get_serialize(
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "object",
}
response_data = await self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _health_endpoint_health_get_serialize(
self,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'application/json'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/health',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)
@validate_call
async def metrics_endpoint_metrics_get(
self,

View file

@ -174,7 +174,7 @@ No authorization required
Clear memory bank memories
Delete memory units for a memory bank. Optionally filter by type (world, agent, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.
Delete memory units for a memory bank. Optionally filter by type (world, interactions, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.
### Example
@ -197,7 +197,7 @@ async with hindsight_client_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hindsight_client_api.DefaultApi(api_client)
bank_id = 'bank_id_example' # str |
type = 'type_example' # str | Optional fact type filter (world, agent, opinion) (optional)
type = 'type_example' # str | Optional fact type filter (world, interactions, opinion) (optional)
try:
# Clear memory bank memories
@ -216,7 +216,7 @@ async with hindsight_client_api.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**bank_id** | **str**| |
**type** | **str**| Optional fact type filter (world, agent, opinion) | [optional]
**type** | **str**| Optional fact type filter (world, interactions, opinion) | [optional]
### Return type
@ -742,7 +742,7 @@ No authorization required
Get memory graph data
Retrieve graph data for visualization, optionally filtered by type (world/agent/opinion). Limited to 1000 most recent items.
Retrieve graph data for visualization, optionally filtered by type (world/interactions/opinion). Limited to 1000 most recent items.
### Example
@ -1172,9 +1172,8 @@ Recall memory using semantic similarity and spreading activation.
The type parameter is optional and must be one of:
- 'world': General knowledge about people, places, events, and things that happen
- 'agent': Memories about what the AI agent did, actions taken, and tasks performed
- 'interactions': Memories about interactions, conversations, actions taken, and tasks performed
- 'opinion': The bank's formed beliefs, perspectives, and viewpoints
- 'observation': Synthesized observations about entities (generated automatically)
Set include_entities=true to get entity observations alongside recall results.
@ -1251,7 +1250,7 @@ Reflect and generate answer
Reflect and formulate an answer using bank identity, world facts, and opinions.
This endpoint:
1. Retrieves agent facts (bank's identity)
1. Retrieves interactions (conversations and events)
2. Retrieves world facts relevant to the query
3. Retrieves existing opinions (bank's perspectives)
4. Uses LLM to formulate a contextual answer

View file

@ -4,9 +4,73 @@ All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**health_endpoint_health_get**](MonitoringApi.md#health_endpoint_health_get) | **GET** /health | Health check endpoint
[**metrics_endpoint_metrics_get**](MonitoringApi.md#metrics_endpoint_metrics_get) | **GET** /metrics | Prometheus metrics endpoint
# **health_endpoint_health_get**
> object health_endpoint_health_get()
Health check endpoint
Checks the health of the API and database connection
### Example
```python
import hindsight_client_api
from hindsight_client_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = hindsight_client_api.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
async with hindsight_client_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hindsight_client_api.MonitoringApi(api_client)
try:
# Health check endpoint
api_response = await api_instance.health_endpoint_health_get()
print("The response of MonitoringApi->health_endpoint_health_get:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling MonitoringApi->health_endpoint_health_get: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return type
**object**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful Response | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **metrics_endpoint_metrics_get**
> object metrics_endpoint_metrics_get()

View file

@ -26,6 +26,13 @@ class TestMonitoringApi(unittest.IsolatedAsyncioTestCase):
async def asyncTearDown(self) -> None:
await self.api.api_client.close()
async def test_health_endpoint_health_get(self) -> None:
"""Test case for health_endpoint_health_get
Health check endpoint
"""
pass
async def test_metrics_endpoint_metrics_get(self) -> None:
"""Test case for metrics_endpoint_metrics_get

View file

@ -2,7 +2,7 @@
import type { Client, Options as Options2, TDataShape } from './client';
import { client } from './client.gen';
import type { AddBankBackgroundData, AddBankBackgroundErrors, AddBankBackgroundResponses, CancelOperationData, CancelOperationErrors, CancelOperationResponses, ClearBankMemoriesData, ClearBankMemoriesErrors, ClearBankMemoriesResponses, CreateOrUpdateBankData, CreateOrUpdateBankErrors, CreateOrUpdateBankResponses, DeleteDocumentData, DeleteDocumentErrors, DeleteDocumentResponses, GetAgentStatsData, GetAgentStatsErrors, GetAgentStatsResponses, GetBankProfileData, GetBankProfileErrors, GetBankProfileResponses, GetChunkData, GetChunkErrors, GetChunkResponses, GetDocumentData, GetDocumentErrors, GetDocumentResponses, GetEntityData, GetEntityErrors, GetEntityResponses, GetGraphData, GetGraphErrors, GetGraphResponses, ListBanksData, ListBanksResponses, ListDocumentsData, ListDocumentsErrors, ListDocumentsResponses, ListEntitiesData, ListEntitiesErrors, ListEntitiesResponses, ListMemoriesData, ListMemoriesErrors, ListMemoriesResponses, ListOperationsData, ListOperationsErrors, ListOperationsResponses, MetricsEndpointMetricsGetData, MetricsEndpointMetricsGetResponses, RecallMemoriesData, RecallMemoriesErrors, RecallMemoriesResponses, ReflectData, ReflectErrors, ReflectResponses, RegenerateEntityObservationsData, RegenerateEntityObservationsErrors, RegenerateEntityObservationsResponses, RetainMemoriesData, RetainMemoriesErrors, RetainMemoriesResponses, UpdateBankPersonalityData, UpdateBankPersonalityErrors, UpdateBankPersonalityResponses } from './types.gen';
import type { AddBankBackgroundData, AddBankBackgroundErrors, AddBankBackgroundResponses, CancelOperationData, CancelOperationErrors, CancelOperationResponses, ClearBankMemoriesData, ClearBankMemoriesErrors, ClearBankMemoriesResponses, CreateOrUpdateBankData, CreateOrUpdateBankErrors, CreateOrUpdateBankResponses, DeleteDocumentData, DeleteDocumentErrors, DeleteDocumentResponses, GetAgentStatsData, GetAgentStatsErrors, GetAgentStatsResponses, GetBankProfileData, GetBankProfileErrors, GetBankProfileResponses, GetChunkData, GetChunkErrors, GetChunkResponses, GetDocumentData, GetDocumentErrors, GetDocumentResponses, GetEntityData, GetEntityErrors, GetEntityResponses, GetGraphData, GetGraphErrors, GetGraphResponses, HealthEndpointHealthGetData, HealthEndpointHealthGetResponses, ListBanksData, ListBanksResponses, ListDocumentsData, ListDocumentsErrors, ListDocumentsResponses, ListEntitiesData, ListEntitiesErrors, ListEntitiesResponses, ListMemoriesData, ListMemoriesErrors, ListMemoriesResponses, ListOperationsData, ListOperationsErrors, ListOperationsResponses, MetricsEndpointMetricsGetData, MetricsEndpointMetricsGetResponses, RecallMemoriesData, RecallMemoriesErrors, RecallMemoriesResponses, ReflectData, ReflectErrors, ReflectResponses, RegenerateEntityObservationsData, RegenerateEntityObservationsErrors, RegenerateEntityObservationsResponses, RetainMemoriesData, RetainMemoriesErrors, RetainMemoriesResponses, UpdateBankPersonalityData, UpdateBankPersonalityErrors, UpdateBankPersonalityResponses } from './types.gen';
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
/**
@ -18,6 +18,13 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
meta?: Record<string, unknown>;
};
/**
* Health check endpoint
*
* Checks the health of the API and database connection
*/
export const healthEndpointHealthGet = <ThrowOnError extends boolean = false>(options?: Options<HealthEndpointHealthGetData, ThrowOnError>) => (options?.client ?? client).get<HealthEndpointHealthGetResponses, unknown, ThrowOnError>({ url: '/health', ...options });
/**
* Prometheus metrics endpoint
*
@ -28,7 +35,7 @@ export const metricsEndpointMetricsGet = <ThrowOnError extends boolean = false>(
/**
* Get memory graph data
*
* Retrieve graph data for visualization, optionally filtered by type (world/agent/opinion). Limited to 1000 most recent items.
* Retrieve graph data for visualization, optionally filtered by type (world/interactions/opinion). Limited to 1000 most recent items.
*/
export const getGraph = <ThrowOnError extends boolean = false>(options: Options<GetGraphData, ThrowOnError>) => (options.client ?? client).get<GetGraphResponses, GetGraphErrors, ThrowOnError>({ url: '/v1/default/banks/{bank_id}/graph', ...options });
@ -46,9 +53,8 @@ export const listMemories = <ThrowOnError extends boolean = false>(options: Opti
*
* The type parameter is optional and must be one of:
* - 'world': General knowledge about people, places, events, and things that happen
* - 'agent': Memories about what the AI agent did, actions taken, and tasks performed
* - 'interactions': Memories about interactions, conversations, actions taken, and tasks performed
* - 'opinion': The bank's formed beliefs, perspectives, and viewpoints
* - 'observation': Synthesized observations about entities (generated automatically)
*
* Set include_entities=true to get entity observations alongside recall results.
*/
@ -67,7 +73,7 @@ export const recallMemories = <ThrowOnError extends boolean = false>(options: Op
* Reflect and formulate an answer using bank identity, world facts, and opinions.
*
* This endpoint:
* 1. Retrieves agent facts (bank's identity)
* 1. Retrieves interactions (conversations and events)
* 2. Retrieves world facts relevant to the query
* 3. Retrieves existing opinions (bank's perspectives)
* 4. Uses LLM to formulate a contextual answer
@ -219,7 +225,7 @@ export const createOrUpdateBank = <ThrowOnError extends boolean = false>(options
/**
* Clear memory bank memories
*
* Delete memory units for a memory bank. Optionally filter by type (world, agent, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.
* Delete memory units for a memory bank. Optionally filter by type (world, interactions, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.
*/
export const clearBankMemories = <ThrowOnError extends boolean = false>(options: Options<ClearBankMemoriesData, ThrowOnError>) => (options.client ?? client).delete<ClearBankMemoriesResponses, ClearBankMemoriesErrors, ThrowOnError>({ url: '/v1/default/banks/{bank_id}/memories', ...options });

View file

@ -521,7 +521,7 @@ export type MemoryItem = {
/**
* Document Id
*
* Optional document ID for this memory item. Items with the same document_id are grouped together for efficient processing.
* Optional document ID for this memory item.
*/
document_id?: string | null;
};
@ -885,6 +885,20 @@ export type ValidationError = {
type: string;
};
export type HealthEndpointHealthGetData = {
body?: never;
path?: never;
query?: never;
url: '/health';
};
export type HealthEndpointHealthGetResponses = {
/**
* Successful Response
*/
200: unknown;
};
export type MetricsEndpointMetricsGetData = {
body?: never;
path?: never;
@ -1521,7 +1535,7 @@ export type ClearBankMemoriesData = {
/**
* Type
*
* Optional fact type filter (world, agent, opinion)
* Optional fact type filter (world, interactions, opinion)
*/
type?: string | null;
};

View file

@ -13,6 +13,26 @@
"version": "1.0.0"
},
"paths": {
"/health": {
"get": {
"tags": [
"Monitoring"
],
"summary": "Health check endpoint",
"description": "Checks the health of the API and database connection",
"operationId": "health_endpoint_health_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/metrics": {
"get": {
"tags": [
@ -36,7 +56,7 @@
"/v1/default/banks/{bank_id}/graph": {
"get": {
"summary": "Get memory graph data",
"description": "Retrieve graph data for visualization, optionally filtered by type (world/agent/opinion). Limited to 1000 most recent items.",
"description": "Retrieve graph data for visualization, optionally filtered by type (world/interactions/opinion). Limited to 1000 most recent items.",
"operationId": "get_graph",
"parameters": [
{
@ -184,7 +204,7 @@
"/v1/default/banks/{bank_id}/memories/recall": {
"post": {
"summary": "Recall memory",
"description": "Recall memory using semantic similarity and spreading activation.\n\n The type parameter is optional and must be one of:\n - 'world': General knowledge about people, places, events, and things that happen\n - 'agent': Memories about what the AI agent did, actions taken, and tasks performed\n - 'opinion': The bank's formed beliefs, perspectives, and viewpoints\n - 'observation': Synthesized observations about entities (generated automatically)\n\n Set include_entities=true to get entity observations alongside recall results.",
"description": "Recall memory using semantic similarity and spreading activation.\n\n The type parameter is optional and must be one of:\n - 'world': General knowledge about people, places, events, and things that happen\n - 'interactions': Memories about interactions, conversations, actions taken, and tasks performed\n - 'opinion': The bank's formed beliefs, perspectives, and viewpoints\n\n Set include_entities=true to get entity observations alongside recall results.",
"operationId": "recall_memories",
"parameters": [
{
@ -234,7 +254,7 @@
"/v1/default/banks/{bank_id}/reflect": {
"post": {
"summary": "Reflect and generate answer",
"description": "Reflect and formulate an answer using bank identity, world facts, and opinions.\n\n This endpoint:\n 1. Retrieves agent facts (bank's identity)\n 2. Retrieves world facts relevant to the query\n 3. Retrieves existing opinions (bank's perspectives)\n 4. Uses LLM to formulate a contextual answer\n 5. Extracts and stores any new opinions formed\n 6. Returns plain text answer, the facts used, and new opinions",
"description": "Reflect and formulate an answer using bank identity, world facts, and opinions.\n\n This endpoint:\n 1. Retrieves interactions (conversations and events)\n 2. Retrieves world facts relevant to the query\n 3. Retrieves existing opinions (bank's perspectives)\n 4. Uses LLM to formulate a contextual answer\n 5. Extracts and stores any new opinions formed\n 6. Returns plain text answer, the facts used, and new opinions",
"operationId": "reflect",
"parameters": [
{
@ -1022,7 +1042,7 @@
},
"delete": {
"summary": "Clear memory bank memories",
"description": "Delete memory units for a memory bank. Optionally filter by type (world, agent, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.",
"description": "Delete memory units for a memory bank. Optionally filter by type (world, interactions, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (personality and background) will be preserved.",
"operationId": "clear_bank_memories",
"parameters": [
{
@ -1047,10 +1067,10 @@
"type": "null"
}
],
"description": "Optional fact type filter (world, agent, opinion)",
"description": "Optional fact type filter (world, interactions, opinion)",
"title": "Type"
},
"description": "Optional fact type filter (world, agent, opinion)"
"description": "Optional fact type filter (world, interactions, opinion)"
}
],
"responses": {
@ -2006,7 +2026,7 @@
}
],
"title": "Document Id",
"description": "Optional document ID for this memory item. Items with the same document_id are grouped together for efficient processing."
"description": "Optional document ID for this memory item."
}
},
"type": "object",
@ -2222,7 +2242,7 @@
"trace": true,
"types": [
"world",
"agent"
"interactions"
]
}
},
@ -2657,7 +2677,7 @@
{
"id": "456",
"text": "I discussed AI applications last week",
"type": "agent"
"type": "interactions"
}
],
"text": "Based on my understanding, AI is a transformative technology..."