From 475e19648d96a55571e95efb45a07a093192214b Mon Sep 17 00:00:00 2001 From: everos-sdk-factory Date: Fri, 6 Nov 2026 23:16:20 +0000 Subject: [PATCH] chore(sdk): generate 1.3.0-rc2 from contract 2.0.0 Sources: memory-engine@release-20261102_v4 multimodal-storage@release-20260729_v1 gateway-tasks@evermemos-gateway_release-20260901_v1 --- .openapi-generator/FILES | 27 + docs/DeleteByIdsData.md | 1 + docs/DeleteByIdsInput.md | 1 + docs/MemoryApi.md | 258 +++++- docs/MongoValue.md | 28 + docs/PurgeConfirmInput.md | 30 + docs/PurgeJobData.md | 39 + docs/PurgeRequestData.md | 35 + docs/PurgeRequestInput.md | 32 + docs/PurgeStepData.md | 33 + docs/PurgeSummary.md | 37 + docs/SuccessEnvelopePurgeJobData.md | 30 + docs/SuccessEnvelopePurgeRequestData.md | 30 + docs/UpdateInput.md | 1 + everos_cloud/__init__.py | 11 +- everos_cloud/api/memory_api.py | 873 +++++++++++++++++- everos_cloud/api_client.py | 2 +- everos_cloud/configuration.py | 2 +- everos_cloud/models/__init__.py | 9 + everos_cloud/models/delete_by_ids_data.py | 8 +- everos_cloud/models/delete_by_ids_input.py | 11 +- everos_cloud/models/mongo_value.py | 128 +++ everos_cloud/models/purge_confirm_input.py | 109 +++ everos_cloud/models/purge_job_data.py | 167 ++++ everos_cloud/models/purge_request_data.py | 133 +++ everos_cloud/models/purge_request_input.py | 123 +++ everos_cloud/models/purge_step_data.py | 119 +++ everos_cloud/models/purge_summary.py | 149 +++ .../models/success_envelope_purge_job_data.py | 107 +++ .../success_envelope_purge_request_data.py | 107 +++ everos_cloud/models/update_input.py | 11 +- openapi.json | 711 +++++++++++++- pyproject.toml | 2 +- setup.py | 2 +- test/test_delete_by_ids_data.py | 4 +- test/test_delete_by_ids_input.py | 3 +- test/test_memory_api.py | 21 + test/test_mongo_value.py | 51 + test/test_purge_confirm_input.py | 53 ++ test/test_purge_job_data.py | 71 ++ test/test_purge_request_data.py | 81 ++ test/test_purge_request_input.py | 55 ++ test/test_purge_step_data.py | 57 ++ test/test_purge_summary.py | 70 ++ ...est_success_envelope_delete_by_ids_data.py | 6 +- test/test_success_envelope_purge_job_data.py | 87 ++ ...est_success_envelope_purge_request_data.py | 87 ++ test/test_update_input.py | 3 +- 48 files changed, 3975 insertions(+), 40 deletions(-) create mode 100644 docs/MongoValue.md create mode 100644 docs/PurgeConfirmInput.md create mode 100644 docs/PurgeJobData.md create mode 100644 docs/PurgeRequestData.md create mode 100644 docs/PurgeRequestInput.md create mode 100644 docs/PurgeStepData.md create mode 100644 docs/PurgeSummary.md create mode 100644 docs/SuccessEnvelopePurgeJobData.md create mode 100644 docs/SuccessEnvelopePurgeRequestData.md create mode 100644 everos_cloud/models/mongo_value.py create mode 100644 everos_cloud/models/purge_confirm_input.py create mode 100644 everos_cloud/models/purge_job_data.py create mode 100644 everos_cloud/models/purge_request_data.py create mode 100644 everos_cloud/models/purge_request_input.py create mode 100644 everos_cloud/models/purge_step_data.py create mode 100644 everos_cloud/models/purge_summary.py create mode 100644 everos_cloud/models/success_envelope_purge_job_data.py create mode 100644 everos_cloud/models/success_envelope_purge_request_data.py create mode 100644 test/test_mongo_value.py create mode 100644 test/test_purge_confirm_input.py create mode 100644 test/test_purge_job_data.py create mode 100644 test/test_purge_request_data.py create mode 100644 test/test_purge_request_input.py create mode 100644 test/test_purge_step_data.py create mode 100644 test/test_purge_summary.py create mode 100644 test/test_success_envelope_purge_job_data.py create mode 100644 test/test_success_envelope_purge_request_data.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 82c8867..74c44ce 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -61,7 +61,14 @@ docs/KbSearchData.md docs/KnowledgeApi.md docs/MemoryApi.md docs/MessageItem.md +docs/MongoValue.md docs/ProfileItem.md +docs/PurgeConfirmInput.md +docs/PurgeJobData.md +docs/PurgeRequestData.md +docs/PurgeRequestInput.md +docs/PurgeStepData.md +docs/PurgeSummary.md docs/Reason.md docs/RelatedTagUsageBody.md docs/RelatedTagUsageItem.md @@ -103,6 +110,8 @@ docs/SuccessEnvelopeKbData.md docs/SuccessEnvelopeKbDeleteData.md docs/SuccessEnvelopeKbListData.md docs/SuccessEnvelopeKbSearchData.md +docs/SuccessEnvelopePurgeJobData.md +docs/SuccessEnvelopePurgeRequestData.md docs/SuccessEnvelopeRelatedTagUsageListData.md docs/SuccessEnvelopeSearchData.md docs/SuccessEnvelopeTagBindData.md @@ -215,7 +224,14 @@ everos_cloud/models/kb_list_data.py everos_cloud/models/kb_patch_body.py everos_cloud/models/kb_search_data.py everos_cloud/models/message_item.py +everos_cloud/models/mongo_value.py everos_cloud/models/profile_item.py +everos_cloud/models/purge_confirm_input.py +everos_cloud/models/purge_job_data.py +everos_cloud/models/purge_request_data.py +everos_cloud/models/purge_request_input.py +everos_cloud/models/purge_step_data.py +everos_cloud/models/purge_summary.py everos_cloud/models/reason.py everos_cloud/models/related_tag_usage_body.py everos_cloud/models/related_tag_usage_item.py @@ -256,6 +272,8 @@ everos_cloud/models/success_envelope_kb_data.py everos_cloud/models/success_envelope_kb_delete_data.py everos_cloud/models/success_envelope_kb_list_data.py everos_cloud/models/success_envelope_kb_search_data.py +everos_cloud/models/success_envelope_purge_job_data.py +everos_cloud/models/success_envelope_purge_request_data.py everos_cloud/models/success_envelope_related_tag_usage_list_data.py everos_cloud/models/success_envelope_search_data.py everos_cloud/models/success_envelope_tag_bind_data.py @@ -366,7 +384,14 @@ test/test_kb_search_data.py test/test_knowledge_api.py test/test_memory_api.py test/test_message_item.py +test/test_mongo_value.py test/test_profile_item.py +test/test_purge_confirm_input.py +test/test_purge_job_data.py +test/test_purge_request_data.py +test/test_purge_request_input.py +test/test_purge_step_data.py +test/test_purge_summary.py test/test_reason.py test/test_related_tag_usage_body.py test/test_related_tag_usage_item.py @@ -408,6 +433,8 @@ test/test_success_envelope_kb_data.py test/test_success_envelope_kb_delete_data.py test/test_success_envelope_kb_list_data.py test/test_success_envelope_kb_search_data.py +test/test_success_envelope_purge_job_data.py +test/test_success_envelope_purge_request_data.py test/test_success_envelope_related_tag_usage_list_data.py test/test_success_envelope_search_data.py test/test_success_envelope_tag_bind_data.py diff --git a/docs/DeleteByIdsData.md b/docs/DeleteByIdsData.md index dafaab7..7cbf66f 100644 --- a/docs/DeleteByIdsData.md +++ b/docs/DeleteByIdsData.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **memory_type** | **str** | The memory type the request named. | **success** | **bool** | Always true on a 200 — the batch was applied. Failures use the error envelope instead. | +**deleted** | **int** | Records this request removed. Ids that were absent, already deleted, another tenant's or (with `user_id`) another user's are skipped and count 0 alike. | ## Example diff --git a/docs/DeleteByIdsInput.md b/docs/DeleteByIdsInput.md index d3f7174..783b684 100644 --- a/docs/DeleteByIdsInput.md +++ b/docs/DeleteByIdsInput.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **memory_type** | **str** | Kind of the memories being deleted. Only \"episode\" is accepted today. | **memory_ids** | **List[str]** | 1 to 50 memory ids. Every one must be well-formed; duplicates are collapsed. | **reason** | [**Reason**](Reason.md) | | [optional] +**user_id** | **str** | | [optional] ## Example diff --git a/docs/MemoryApi.md b/docs/MemoryApi.md index 46227be..44f1262 100644 --- a/docs/MemoryApi.md +++ b/docs/MemoryApi.md @@ -6,12 +6,15 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**add_memory**](MemoryApi.md#add_memory) | **POST** /api/v2/memory/add | Add messages [OSS + Cloud] [**bind_tags**](MemoryApi.md#bind_tags) | **POST** /api/v2/memory/tag/bind | Bind tags to memories [Cloud] +[**confirm_purge**](MemoryApi.md#confirm_purge) | **POST** /api/v2/memory/purge/confirm | Confirm a memory-space purge (step 2 of 2) [Cloud-only] [**delete_memories_by_ids**](MemoryApi.md#delete_memories_by_ids) | **POST** /api/v2/memory/delete_by_ids | Soft-delete memory records by id [Cloud-only] [**delete_memory**](MemoryApi.md#delete_memory) | **POST** /api/v2/memory/delete | Delete memories [Cloud-only] [**edit_profile**](MemoryApi.md#edit_profile) | **POST** /api/v2/memory/edit | Edit profile items [Cloud-only] [**flush_memory**](MemoryApi.md#flush_memory) | **POST** /api/v2/memory/flush | Force memory extraction [OSS + Cloud] [**get_memory**](MemoryApi.md#get_memory) | **POST** /api/v2/memory/get | Get memories [OSS + Cloud] +[**get_purge_job**](MemoryApi.md#get_purge_job) | **GET** /api/v2/memory/purge/{job_id} | Get a memory-space purge job [Cloud-only] [**replace_tags**](MemoryApi.md#replace_tags) | **POST** /api/v2/memory/tag/replace | Replace tags on memories [Cloud] +[**request_purge**](MemoryApi.md#request_purge) | **POST** /api/v2/memory/purge | Request a memory-space purge (step 1 of 2) [Cloud-only] [**retrieve_context**](MemoryApi.md#retrieve_context) | **POST** /api/v2/memory/context | Context Retrieval [Cloud-only] [**search_memory**](MemoryApi.md#search_memory) | **POST** /api/v2/memory/search | Search memories [OSS + Cloud] [**submit_feedback**](MemoryApi.md#submit_feedback) | **POST** /api/v2/memory/feedback | Submit feedback about one memory [Cloud-only] @@ -188,12 +191,96 @@ Name | Type | Description | Notes [[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) +# **confirm_purge** +> SuccessEnvelopePurgeJobData confirm_purge(purge_confirm_input) + +Confirm a memory-space purge (step 2 of 2) [Cloud-only] + +**Permanent — there is no undo.** Step 2 of 2: confirms the `nonce` from `POST /purge` and queues the purge (202). The scope is the one the nonce was issued for. From this moment every write to the memory space (add, flush, delete, update, feedback, tags, knowledge changes) is rejected with `409 purge_in_progress` until the purge ends; reads keep working and may return partial results. Poll `GET /purge/{job_id}` for progress. Only one purge per memory space runs at a time: confirming while one is queued or running returns that job. An unknown, expired or already used nonce is `404 purge_nonce_invalid`. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import everos_cloud +from everos_cloud.models.purge_confirm_input import PurgeConfirmInput +from everos_cloud.models.success_envelope_purge_job_data import SuccessEnvelopePurgeJobData +from everos_cloud.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.evermind.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = everos_cloud.Configuration( + host = "https://api.evermind.ai" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = everos_cloud.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with everos_cloud.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = everos_cloud.MemoryApi(api_client) + purge_confirm_input = everos_cloud.PurgeConfirmInput() # PurgeConfirmInput | + + try: + # Confirm a memory-space purge (step 2 of 2) [Cloud-only] + api_response = api_instance.confirm_purge(purge_confirm_input) + print("The response of MemoryApi->confirm_purge:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MemoryApi->confirm_purge: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **purge_confirm_input** | [**PurgeConfirmInput**](PurgeConfirmInput.md)| | + +### Return type + +[**SuccessEnvelopePurgeJobData**](SuccessEnvelopePurgeJobData.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**202** | Successful Response | - | +**422** | Validation Error | - | +**401** | Missing or invalid bearer token. | - | +**403** | Authenticated but not permitted — either rejected by the auth service, or the account's memory API version does not match the interface version implied by the path (a v1 account calling an /api/v2 route). | - | +**429** | Rate limit or quota exceeded. Besides the account-wide limits, each memory space may send /purge and /purge/confirm only a limited number of times per minute (10 each by default); wait for the `Retry-After` header. Requests the engine rejects do not count against this limit. | - | +**503** | The gateway could not reach the authentication service. Transient — retry with backoff. | - | + +[[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) + # **delete_memories_by_ids** > SuccessEnvelopeDeleteByIdsData delete_memories_by_ids(delete_by_ids_input) Soft-delete memory records by id [Cloud-only] -Soft-delete up to 50 memories chosen by id, together with what was derived from them (extracted facts, cluster membership and search-index copies). Only \"episode\" is supported today. - Every id must be well-formed; one malformed id rejects the whole request with 422 and nothing is deleted. - Ids that do not exist, are already deleted, or belong to another tenant are skipped rather than reported — the rest of the batch is still deleted, so re-sending a batch is safe. Duplicates are collapsed. To remove memories by owner or session rather than by id, use /api/v2/memory/delete. +Soft-delete up to 50 memories chosen by id, together with what was derived from them (extracted facts, cluster membership and search-index copies). Only \"episode\" is supported today. - Every id must be well-formed; one malformed id rejects the whole request with 422 and nothing is deleted. - Ids that do not exist, are already deleted, or belong to another tenant are skipped — the rest of the batch is still deleted, so re-sending a batch is safe. Duplicates are collapsed. - `deleted` in the response counts the records this request removed. Every skipped id counts 0 alike, so the count does not reveal which ids exist. Pass `user_id` to delete only that user's memories: an id owned by anyone else is skipped like a missing one. Set it from your own session (the signed-in user), never from model output, so that an agent tool cannot touch another user's memory with a wrong or invented id. To remove memories by owner or session rather than by id, use /api/v2/memory/delete. ### Example @@ -608,6 +695,89 @@ Name | Type | Description | Notes [[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) +# **get_purge_job** +> SuccessEnvelopePurgeJobData get_purge_job(job_id) + +Get a memory-space purge job [Cloud-only] + +Read a purge job by the `job_id` that /api/v2/memory/purge/confirm returned. `status` goes `queued` → `running` → `succeeded` or `failed`. `steps` lists every store the purge touches (for example `mongo:v2_episodes` or `es:episode`) with its own state and deleted count, and `error` for a store that failed. Writes to the memory space are rejected with `409 purge_in_progress` until the job has ended, so poll this before writing again. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import everos_cloud +from everos_cloud.models.success_envelope_purge_job_data import SuccessEnvelopePurgeJobData +from everos_cloud.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.evermind.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = everos_cloud.Configuration( + host = "https://api.evermind.ai" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = everos_cloud.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with everos_cloud.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = everos_cloud.MemoryApi(api_client) + job_id = 'job_id_example' # str | + + try: + # Get a memory-space purge job [Cloud-only] + api_response = api_instance.get_purge_job(job_id) + print("The response of MemoryApi->get_purge_job:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MemoryApi->get_purge_job: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **job_id** | **str**| | + +### Return type + +[**SuccessEnvelopePurgeJobData**](SuccessEnvelopePurgeJobData.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | +**401** | Missing or invalid bearer token. | - | +**403** | Authenticated but not permitted — either rejected by the auth service, or the account's memory API version does not match the interface version implied by the path (a v1 account calling an /api/v2 route). | - | +**429** | Rate limit or quota exceeded. | - | +**503** | The gateway could not reach the authentication service. Transient — retry with backoff. | - | + +[[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) + # **replace_tags** > SuccessEnvelopeTagReplaceData replace_tags(tag_replace_input) @@ -692,6 +862,90 @@ Name | Type | Description | Notes [[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) +# **request_purge** +> SuccessEnvelopePurgeRequestData request_purge(purge_request_input) + +Request a memory-space purge (step 1 of 2) [Cloud-only] + +**Permanent — there is no undo.** Step 1 of 2: asks for a purge and returns a `nonce`. Nothing is deleted yet. - `scope: \"space\"` purges the whole memory space; `\"app\"` one app (`app_id`); `\"project\"` one project of one app (`app_id` + `project_id`). - Confirm with `POST /purge/confirm` before `expires_at` (5 minutes). The nonce is single use and only valid for the same memory space and API key. What is deleted: memories, sessions, messages, memory cells, feedback, events and (space scope only) senders and engine knowledge bases, from every index. Not deleted: files uploaded through `/object/sign`, and data of the separate knowledge-base service. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import everos_cloud +from everos_cloud.models.purge_request_input import PurgeRequestInput +from everos_cloud.models.success_envelope_purge_request_data import SuccessEnvelopePurgeRequestData +from everos_cloud.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.evermind.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = everos_cloud.Configuration( + host = "https://api.evermind.ai" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = everos_cloud.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with everos_cloud.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = everos_cloud.MemoryApi(api_client) + purge_request_input = everos_cloud.PurgeRequestInput() # PurgeRequestInput | + + try: + # Request a memory-space purge (step 1 of 2) [Cloud-only] + api_response = api_instance.request_purge(purge_request_input) + print("The response of MemoryApi->request_purge:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MemoryApi->request_purge: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **purge_request_input** | [**PurgeRequestInput**](PurgeRequestInput.md)| | + +### Return type + +[**SuccessEnvelopePurgeRequestData**](SuccessEnvelopePurgeRequestData.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | +**401** | Missing or invalid bearer token. | - | +**403** | Authenticated but not permitted — either rejected by the auth service, or the account's memory API version does not match the interface version implied by the path (a v1 account calling an /api/v2 route). | - | +**429** | Rate limit or quota exceeded. Besides the account-wide limits, each memory space may send /purge and /purge/confirm only a limited number of times per minute (10 each by default); wait for the `Retry-After` header. Requests the engine rejects do not count against this limit. | - | +**503** | The gateway could not reach the authentication service. Transient — retry with backoff. | - | + +[[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) + # **retrieve_context** > SuccessEnvelopeSearchData retrieve_context(context_input) @@ -1033,7 +1287,7 @@ Name | Type | Description | Notes Edit one memory record [Cloud-only] -Rewrite the editable fields of one memory. Only \"episode\" can be edited today. - `patch` uses the episode's own field names — `episode`, `summary`, `subject` — and needs at least one of them. Fields left out keep their current value. - A patch that changes only `episode` makes the server regenerate `summary` from the new text; `subject` is never regenerated. - No `app_id` / `project_id`: the record already knows its scope. There is no version check — the last write wins. Re-sending content equal to what is stored answers 200 with `unchanged: true` and writes nothing. Changing the narrative re-indexes the memory and re-extracts its facts in the background; the response is the edited record itself, with `edited_at` and `reflect_state` set. A record that does not exist, is already deleted, or belongs to another tenant is rejected with 404. Profile items are edited through /api/v2/memory/edit, not here. +Rewrite the editable fields of one memory. Only \"episode\" can be edited today. - `patch` uses the episode's own field names — `episode`, `summary`, `subject` — and needs at least one of them. Fields left out keep their current value. - A patch that changes only `episode` makes the server regenerate `summary` from the new text; `subject` is never regenerated. - No `app_id` / `project_id`: the record already knows its scope. There is no version check — the last write wins. Re-sending content equal to what is stored answers 200 with `unchanged: true` and writes nothing. Changing the narrative re-indexes the memory and re-extracts its facts in the background; the response is the edited record itself, with `edited_at` and `reflect_state` set. A record that does not exist, is already deleted, or belongs to another tenant is rejected with 404. Pass `user_id` to limit the edit to that user's memory: a record owned by anyone else is rejected with the same 404. Set it from your own session (the signed-in user), never from model output, so that an agent tool cannot touch another user's memory with a wrong or invented id. Profile items are edited through /api/v2/memory/edit, not here. ### Example diff --git a/docs/MongoValue.md b/docs/MongoValue.md new file mode 100644 index 0000000..4eeff7f --- /dev/null +++ b/docs/MongoValue.md @@ -0,0 +1,28 @@ +# MongoValue + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from everos_cloud.models.mongo_value import MongoValue + +# TODO update the JSON string below +json = "{}" +# create an instance of MongoValue from a JSON string +mongo_value_instance = MongoValue.from_json(json) +# print the JSON string representation of the object +print(MongoValue.to_json()) + +# convert the object into a dict +mongo_value_dict = mongo_value_instance.to_dict() +# create an instance of MongoValue from a dict +mongo_value_from_dict = MongoValue.from_dict(mongo_value_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PurgeConfirmInput.md b/docs/PurgeConfirmInput.md new file mode 100644 index 0000000..22ae80e --- /dev/null +++ b/docs/PurgeConfirmInput.md @@ -0,0 +1,30 @@ +# PurgeConfirmInput + +Step 2: confirm. The scope is the one bound to the nonce. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nonce** | **str** | | + +## Example + +```python +from everos_cloud.models.purge_confirm_input import PurgeConfirmInput + +# TODO update the JSON string below +json = "{}" +# create an instance of PurgeConfirmInput from a JSON string +purge_confirm_input_instance = PurgeConfirmInput.from_json(json) +# print the JSON string representation of the object +print(PurgeConfirmInput.to_json()) + +# convert the object into a dict +purge_confirm_input_dict = purge_confirm_input_instance.to_dict() +# create an instance of PurgeConfirmInput from a dict +purge_confirm_input_from_dict = PurgeConfirmInput.from_dict(purge_confirm_input_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PurgeJobData.md b/docs/PurgeJobData.md new file mode 100644 index 0000000..15d855b --- /dev/null +++ b/docs/PurgeJobData.md @@ -0,0 +1,39 @@ +# PurgeJobData + +A purge job as the caller sees it. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**job_id** | **str** | | +**status** | **str** | | +**scope** | **str** | | +**app_id** | **str** | | [optional] +**project_id** | **str** | | [optional] +**created_at** | **datetime** | | +**started_at** | **datetime** | | [optional] +**heartbeat_at** | **datetime** | | [optional] +**finished_at** | **datetime** | | [optional] +**steps** | [**List[PurgeStepData]**](PurgeStepData.md) | | [optional] + +## Example + +```python +from everos_cloud.models.purge_job_data import PurgeJobData + +# TODO update the JSON string below +json = "{}" +# create an instance of PurgeJobData from a JSON string +purge_job_data_instance = PurgeJobData.from_json(json) +# print the JSON string representation of the object +print(PurgeJobData.to_json()) + +# convert the object into a dict +purge_job_data_dict = purge_job_data_instance.to_dict() +# create an instance of PurgeJobData from a dict +purge_job_data_from_dict = PurgeJobData.from_dict(purge_job_data_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PurgeRequestData.md b/docs/PurgeRequestData.md new file mode 100644 index 0000000..8233571 --- /dev/null +++ b/docs/PurgeRequestData.md @@ -0,0 +1,35 @@ +# PurgeRequestData + +The nonce to confirm, and what it will purge. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nonce** | **str** | Send to /purge/confirm before `expires_at`. | +**expires_at** | **datetime** | | +**scope** | **str** | | +**app_id** | **str** | | [optional] +**project_id** | **str** | | [optional] +**summary** | [**PurgeSummary**](PurgeSummary.md) | | + +## Example + +```python +from everos_cloud.models.purge_request_data import PurgeRequestData + +# TODO update the JSON string below +json = "{}" +# create an instance of PurgeRequestData from a JSON string +purge_request_data_instance = PurgeRequestData.from_json(json) +# print the JSON string representation of the object +print(PurgeRequestData.to_json()) + +# convert the object into a dict +purge_request_data_dict = purge_request_data_instance.to_dict() +# create an instance of PurgeRequestData from a dict +purge_request_data_from_dict = PurgeRequestData.from_dict(purge_request_data_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PurgeRequestInput.md b/docs/PurgeRequestInput.md new file mode 100644 index 0000000..0657b71 --- /dev/null +++ b/docs/PurgeRequestInput.md @@ -0,0 +1,32 @@ +# PurgeRequestInput + +Step 1: ask for a purge. Nothing is deleted. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scope** | **str** | `space` purges the whole memory space; `app` one app in it (`app_id`); `project` one project of one app (`app_id` + `project_id`). | +**app_id** | **str** | | [optional] +**project_id** | **str** | | [optional] + +## Example + +```python +from everos_cloud.models.purge_request_input import PurgeRequestInput + +# TODO update the JSON string below +json = "{}" +# create an instance of PurgeRequestInput from a JSON string +purge_request_input_instance = PurgeRequestInput.from_json(json) +# print the JSON string representation of the object +print(PurgeRequestInput.to_json()) + +# convert the object into a dict +purge_request_input_dict = purge_request_input_instance.to_dict() +# create an instance of PurgeRequestInput from a dict +purge_request_input_from_dict = PurgeRequestInput.from_dict(purge_request_input_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PurgeStepData.md b/docs/PurgeStepData.md new file mode 100644 index 0000000..614644b --- /dev/null +++ b/docs/PurgeStepData.md @@ -0,0 +1,33 @@ +# PurgeStepData + +One store of one purge step, e.g. ``mongo:v2_episodes`` or ``es:episode``. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**store** | **str** | | +**state** | **str** | | +**deleted** | **int** | | [optional] [default to 0] +**error** | **str** | | [optional] + +## Example + +```python +from everos_cloud.models.purge_step_data import PurgeStepData + +# TODO update the JSON string below +json = "{}" +# create an instance of PurgeStepData from a JSON string +purge_step_data_instance = PurgeStepData.from_json(json) +# print the JSON string representation of the object +print(PurgeStepData.to_json()) + +# convert the object into a dict +purge_step_data_dict = purge_step_data_instance.to_dict() +# create an instance of PurgeStepData from a dict +purge_step_data_from_dict = PurgeStepData.from_dict(purge_step_data_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PurgeSummary.md b/docs/PurgeSummary.md new file mode 100644 index 0000000..f845b48 --- /dev/null +++ b/docs/PurgeSummary.md @@ -0,0 +1,37 @@ +# PurgeSummary + +What the purge would delete right now, counted per store. A snapshot at request time: data written before the purge runs is deleted too. Counts include soft-deleted rows (the purge removes those as well), so they can be higher than what ``get`` shows. Feedback is not memory data and is not counted. A count that did not finish in time is ``null`` and ``complete`` is ``false``. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mongo** | [**Dict[str, MongoValue]**](MongoValue.md) | MongoDB documents per memory type (collection without the `v2_` prefix), the source of truth. | +**mongo_total** | **int** | | +**elasticsearch_total** | **int** | | +**milvus_total** | **int** | | +**complete** | **bool** | False when any count timed out or failed. | +**counted_at** | **datetime** | | +**comment** | **str** | What the counts include and exclude (soft-deleted rows, feedback). | +**error** | **str** | | [optional] + +## Example + +```python +from everos_cloud.models.purge_summary import PurgeSummary + +# TODO update the JSON string below +json = "{}" +# create an instance of PurgeSummary from a JSON string +purge_summary_instance = PurgeSummary.from_json(json) +# print the JSON string representation of the object +print(PurgeSummary.to_json()) + +# convert the object into a dict +purge_summary_dict = purge_summary_instance.to_dict() +# create an instance of PurgeSummary from a dict +purge_summary_from_dict = PurgeSummary.from_dict(purge_summary_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SuccessEnvelopePurgeJobData.md b/docs/SuccessEnvelopePurgeJobData.md new file mode 100644 index 0000000..990fa31 --- /dev/null +++ b/docs/SuccessEnvelopePurgeJobData.md @@ -0,0 +1,30 @@ +# SuccessEnvelopePurgeJobData + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **str** | Request trace id (peer to data) | +**data** | [**PurgeJobData**](PurgeJobData.md) | Endpoint-defined business result | + +## Example + +```python +from everos_cloud.models.success_envelope_purge_job_data import SuccessEnvelopePurgeJobData + +# TODO update the JSON string below +json = "{}" +# create an instance of SuccessEnvelopePurgeJobData from a JSON string +success_envelope_purge_job_data_instance = SuccessEnvelopePurgeJobData.from_json(json) +# print the JSON string representation of the object +print(SuccessEnvelopePurgeJobData.to_json()) + +# convert the object into a dict +success_envelope_purge_job_data_dict = success_envelope_purge_job_data_instance.to_dict() +# create an instance of SuccessEnvelopePurgeJobData from a dict +success_envelope_purge_job_data_from_dict = SuccessEnvelopePurgeJobData.from_dict(success_envelope_purge_job_data_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SuccessEnvelopePurgeRequestData.md b/docs/SuccessEnvelopePurgeRequestData.md new file mode 100644 index 0000000..c927d73 --- /dev/null +++ b/docs/SuccessEnvelopePurgeRequestData.md @@ -0,0 +1,30 @@ +# SuccessEnvelopePurgeRequestData + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **str** | Request trace id (peer to data) | +**data** | [**PurgeRequestData**](PurgeRequestData.md) | Endpoint-defined business result | + +## Example + +```python +from everos_cloud.models.success_envelope_purge_request_data import SuccessEnvelopePurgeRequestData + +# TODO update the JSON string below +json = "{}" +# create an instance of SuccessEnvelopePurgeRequestData from a JSON string +success_envelope_purge_request_data_instance = SuccessEnvelopePurgeRequestData.from_json(json) +# print the JSON string representation of the object +print(SuccessEnvelopePurgeRequestData.to_json()) + +# convert the object into a dict +success_envelope_purge_request_data_dict = success_envelope_purge_request_data_instance.to_dict() +# create an instance of SuccessEnvelopePurgeRequestData from a dict +success_envelope_purge_request_data_from_dict = SuccessEnvelopePurgeRequestData.from_dict(success_envelope_purge_request_data_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateInput.md b/docs/UpdateInput.md index 5ab6bc9..7d1f751 100644 --- a/docs/UpdateInput.md +++ b/docs/UpdateInput.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **memory_id** | **str** | The memory's `id` as returned by /api/v2/memory/get or /search. | **patch** | [**EpisodePatch**](EpisodePatch.md) | The fields to rewrite — at least one. Fields left out keep their current value. | **reason** | [**Reason**](Reason.md) | | [optional] +**user_id** | **str** | | [optional] ## Example diff --git a/everos_cloud/__init__.py b/everos_cloud/__init__.py index 2ad3e33..906b9f1 100644 --- a/everos_cloud/__init__.py +++ b/everos_cloud/__init__.py @@ -15,7 +15,7 @@ """ # noqa: E501 -__version__ = "1.3.0-rc1" +__version__ = "1.3.0-rc2" # import apis into sdk package from everos_cloud.api.knowledge_api import KnowledgeApi @@ -94,7 +94,14 @@ from everos_cloud.models.kb_patch_body import KbPatchBody from everos_cloud.models.kb_search_data import KbSearchData from everos_cloud.models.message_item import MessageItem +from everos_cloud.models.mongo_value import MongoValue from everos_cloud.models.profile_item import ProfileItem +from everos_cloud.models.purge_confirm_input import PurgeConfirmInput +from everos_cloud.models.purge_job_data import PurgeJobData +from everos_cloud.models.purge_request_data import PurgeRequestData +from everos_cloud.models.purge_request_input import PurgeRequestInput +from everos_cloud.models.purge_step_data import PurgeStepData +from everos_cloud.models.purge_summary import PurgeSummary from everos_cloud.models.reason import Reason from everos_cloud.models.related_tag_usage_body import RelatedTagUsageBody from everos_cloud.models.related_tag_usage_item import RelatedTagUsageItem @@ -135,6 +142,8 @@ from everos_cloud.models.success_envelope_kb_delete_data import SuccessEnvelopeKbDeleteData from everos_cloud.models.success_envelope_kb_list_data import SuccessEnvelopeKbListData from everos_cloud.models.success_envelope_kb_search_data import SuccessEnvelopeKbSearchData +from everos_cloud.models.success_envelope_purge_job_data import SuccessEnvelopePurgeJobData +from everos_cloud.models.success_envelope_purge_request_data import SuccessEnvelopePurgeRequestData from everos_cloud.models.success_envelope_related_tag_usage_list_data import SuccessEnvelopeRelatedTagUsageListData from everos_cloud.models.success_envelope_search_data import SuccessEnvelopeSearchData from everos_cloud.models.success_envelope_tag_bind_data import SuccessEnvelopeTagBindData diff --git a/everos_cloud/api/memory_api.py b/everos_cloud/api/memory_api.py index 9da4c7f..8382d24 100644 --- a/everos_cloud/api/memory_api.py +++ b/everos_cloud/api/memory_api.py @@ -17,6 +17,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from pydantic import StrictStr from everos_cloud.models.add_input import AddInput from everos_cloud.models.context_input import ContextInput from everos_cloud.models.delete_by_ids_input import DeleteByIdsInput @@ -25,6 +26,8 @@ from everos_cloud.models.feedback_input import FeedbackInput from everos_cloud.models.flush_input import FlushInput from everos_cloud.models.get_input import GetInput +from everos_cloud.models.purge_confirm_input import PurgeConfirmInput +from everos_cloud.models.purge_request_input import PurgeRequestInput from everos_cloud.models.search_input import SearchInput from everos_cloud.models.success_envelope_add_data import SuccessEnvelopeAddData from everos_cloud.models.success_envelope_delete_by_ids_data import SuccessEnvelopeDeleteByIdsData @@ -33,6 +36,8 @@ from everos_cloud.models.success_envelope_feedback_data import SuccessEnvelopeFeedbackData from everos_cloud.models.success_envelope_flush_data import SuccessEnvelopeFlushData from everos_cloud.models.success_envelope_get_data import SuccessEnvelopeGetData +from everos_cloud.models.success_envelope_purge_job_data import SuccessEnvelopePurgeJobData +from everos_cloud.models.success_envelope_purge_request_data import SuccessEnvelopePurgeRequestData from everos_cloud.models.success_envelope_search_data import SuccessEnvelopeSearchData from everos_cloud.models.success_envelope_tag_bind_data import SuccessEnvelopeTagBindData from everos_cloud.models.success_envelope_tag_replace_data import SuccessEnvelopeTagReplaceData @@ -642,6 +647,295 @@ def _bind_tags_serialize( + @validate_call + def confirm_purge( + self, + purge_confirm_input: PurgeConfirmInput, + _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, + ) -> SuccessEnvelopePurgeJobData: + """Confirm a memory-space purge (step 2 of 2) [Cloud-only] + + **Permanent — there is no undo.** Step 2 of 2: confirms the `nonce` from `POST /purge` and queues the purge (202). The scope is the one the nonce was issued for. From this moment every write to the memory space (add, flush, delete, update, feedback, tags, knowledge changes) is rejected with `409 purge_in_progress` until the purge ends; reads keep working and may return partial results. Poll `GET /purge/{job_id}` for progress. Only one purge per memory space runs at a time: confirming while one is queued or running returns that job. An unknown, expired or already used nonce is `404 purge_nonce_invalid`. + + :param purge_confirm_input: (required) + :type purge_confirm_input: PurgeConfirmInput + :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._confirm_purge_serialize( + purge_confirm_input=purge_confirm_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "SuccessEnvelopePurgeJobData", + '422': "HTTPValidationError", + '401': "Dict[str, object]", + '403': "Dict[str, object]", + '429': "Dict[str, object]", + '503': "Dict[str, object]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def confirm_purge_with_http_info( + self, + purge_confirm_input: PurgeConfirmInput, + _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[SuccessEnvelopePurgeJobData]: + """Confirm a memory-space purge (step 2 of 2) [Cloud-only] + + **Permanent — there is no undo.** Step 2 of 2: confirms the `nonce` from `POST /purge` and queues the purge (202). The scope is the one the nonce was issued for. From this moment every write to the memory space (add, flush, delete, update, feedback, tags, knowledge changes) is rejected with `409 purge_in_progress` until the purge ends; reads keep working and may return partial results. Poll `GET /purge/{job_id}` for progress. Only one purge per memory space runs at a time: confirming while one is queued or running returns that job. An unknown, expired or already used nonce is `404 purge_nonce_invalid`. + + :param purge_confirm_input: (required) + :type purge_confirm_input: PurgeConfirmInput + :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._confirm_purge_serialize( + purge_confirm_input=purge_confirm_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "SuccessEnvelopePurgeJobData", + '422': "HTTPValidationError", + '401': "Dict[str, object]", + '403': "Dict[str, object]", + '429': "Dict[str, object]", + '503': "Dict[str, object]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def confirm_purge_without_preload_content( + self, + purge_confirm_input: PurgeConfirmInput, + _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: + """Confirm a memory-space purge (step 2 of 2) [Cloud-only] + + **Permanent — there is no undo.** Step 2 of 2: confirms the `nonce` from `POST /purge` and queues the purge (202). The scope is the one the nonce was issued for. From this moment every write to the memory space (add, flush, delete, update, feedback, tags, knowledge changes) is rejected with `409 purge_in_progress` until the purge ends; reads keep working and may return partial results. Poll `GET /purge/{job_id}` for progress. Only one purge per memory space runs at a time: confirming while one is queued or running returns that job. An unknown, expired or already used nonce is `404 purge_nonce_invalid`. + + :param purge_confirm_input: (required) + :type purge_confirm_input: PurgeConfirmInput + :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._confirm_purge_serialize( + purge_confirm_input=purge_confirm_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': "SuccessEnvelopePurgeJobData", + '422': "HTTPValidationError", + '401': "Dict[str, object]", + '403': "Dict[str, object]", + '429': "Dict[str, object]", + '503': "Dict[str, object]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _confirm_purge_serialize( + self, + purge_confirm_input, + _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 + if purge_confirm_input is not None: + _body_params = purge_confirm_input + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v2/memory/purge/confirm', + 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 def delete_memories_by_ids( self, @@ -661,7 +955,7 @@ def delete_memories_by_ids( ) -> SuccessEnvelopeDeleteByIdsData: """Soft-delete memory records by id [Cloud-only] - Soft-delete up to 50 memories chosen by id, together with what was derived from them (extracted facts, cluster membership and search-index copies). Only \"episode\" is supported today. - Every id must be well-formed; one malformed id rejects the whole request with 422 and nothing is deleted. - Ids that do not exist, are already deleted, or belong to another tenant are skipped rather than reported — the rest of the batch is still deleted, so re-sending a batch is safe. Duplicates are collapsed. To remove memories by owner or session rather than by id, use /api/v2/memory/delete. + Soft-delete up to 50 memories chosen by id, together with what was derived from them (extracted facts, cluster membership and search-index copies). Only \"episode\" is supported today. - Every id must be well-formed; one malformed id rejects the whole request with 422 and nothing is deleted. - Ids that do not exist, are already deleted, or belong to another tenant are skipped — the rest of the batch is still deleted, so re-sending a batch is safe. Duplicates are collapsed. - `deleted` in the response counts the records this request removed. Every skipped id counts 0 alike, so the count does not reveal which ids exist. Pass `user_id` to delete only that user's memories: an id owned by anyone else is skipped like a missing one. Set it from your own session (the signed-in user), never from model output, so that an agent tool cannot touch another user's memory with a wrong or invented id. To remove memories by owner or session rather than by id, use /api/v2/memory/delete. :param delete_by_ids_input: (required) :type delete_by_ids_input: DeleteByIdsInput @@ -733,7 +1027,7 @@ def delete_memories_by_ids_with_http_info( ) -> ApiResponse[SuccessEnvelopeDeleteByIdsData]: """Soft-delete memory records by id [Cloud-only] - Soft-delete up to 50 memories chosen by id, together with what was derived from them (extracted facts, cluster membership and search-index copies). Only \"episode\" is supported today. - Every id must be well-formed; one malformed id rejects the whole request with 422 and nothing is deleted. - Ids that do not exist, are already deleted, or belong to another tenant are skipped rather than reported — the rest of the batch is still deleted, so re-sending a batch is safe. Duplicates are collapsed. To remove memories by owner or session rather than by id, use /api/v2/memory/delete. + Soft-delete up to 50 memories chosen by id, together with what was derived from them (extracted facts, cluster membership and search-index copies). Only \"episode\" is supported today. - Every id must be well-formed; one malformed id rejects the whole request with 422 and nothing is deleted. - Ids that do not exist, are already deleted, or belong to another tenant are skipped — the rest of the batch is still deleted, so re-sending a batch is safe. Duplicates are collapsed. - `deleted` in the response counts the records this request removed. Every skipped id counts 0 alike, so the count does not reveal which ids exist. Pass `user_id` to delete only that user's memories: an id owned by anyone else is skipped like a missing one. Set it from your own session (the signed-in user), never from model output, so that an agent tool cannot touch another user's memory with a wrong or invented id. To remove memories by owner or session rather than by id, use /api/v2/memory/delete. :param delete_by_ids_input: (required) :type delete_by_ids_input: DeleteByIdsInput @@ -805,7 +1099,7 @@ def delete_memories_by_ids_without_preload_content( ) -> RESTResponseType: """Soft-delete memory records by id [Cloud-only] - Soft-delete up to 50 memories chosen by id, together with what was derived from them (extracted facts, cluster membership and search-index copies). Only \"episode\" is supported today. - Every id must be well-formed; one malformed id rejects the whole request with 422 and nothing is deleted. - Ids that do not exist, are already deleted, or belong to another tenant are skipped rather than reported — the rest of the batch is still deleted, so re-sending a batch is safe. Duplicates are collapsed. To remove memories by owner or session rather than by id, use /api/v2/memory/delete. + Soft-delete up to 50 memories chosen by id, together with what was derived from them (extracted facts, cluster membership and search-index copies). Only \"episode\" is supported today. - Every id must be well-formed; one malformed id rejects the whole request with 422 and nothing is deleted. - Ids that do not exist, are already deleted, or belong to another tenant are skipped — the rest of the batch is still deleted, so re-sending a batch is safe. Duplicates are collapsed. - `deleted` in the response counts the records this request removed. Every skipped id counts 0 alike, so the count does not reveal which ids exist. Pass `user_id` to delete only that user's memories: an id owned by anyone else is skipped like a missing one. Set it from your own session (the signed-in user), never from model output, so that an agent tool cannot touch another user's memory with a wrong or invented id. To remove memories by owner or session rather than by id, use /api/v2/memory/delete. :param delete_by_ids_input: (required) :type delete_by_ids_input: DeleteByIdsInput @@ -2088,7 +2382,283 @@ def _get_memory_serialize( @validate_call - def replace_tags( + def get_purge_job( + self, + job_id: StrictStr, + _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, + ) -> SuccessEnvelopePurgeJobData: + """Get a memory-space purge job [Cloud-only] + + Read a purge job by the `job_id` that /api/v2/memory/purge/confirm returned. `status` goes `queued` → `running` → `succeeded` or `failed`. `steps` lists every store the purge touches (for example `mongo:v2_episodes` or `es:episode`) with its own state and deleted count, and `error` for a store that failed. Writes to the memory space are rejected with `409 purge_in_progress` until the job has ended, so poll this before writing again. + + :param job_id: (required) + :type job_id: str + :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._get_purge_job_serialize( + job_id=job_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessEnvelopePurgeJobData", + '422': "HTTPValidationError", + '401': "Dict[str, object]", + '403': "Dict[str, object]", + '429': "Dict[str, object]", + '503': "Dict[str, object]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_purge_job_with_http_info( + self, + job_id: StrictStr, + _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[SuccessEnvelopePurgeJobData]: + """Get a memory-space purge job [Cloud-only] + + Read a purge job by the `job_id` that /api/v2/memory/purge/confirm returned. `status` goes `queued` → `running` → `succeeded` or `failed`. `steps` lists every store the purge touches (for example `mongo:v2_episodes` or `es:episode`) with its own state and deleted count, and `error` for a store that failed. Writes to the memory space are rejected with `409 purge_in_progress` until the job has ended, so poll this before writing again. + + :param job_id: (required) + :type job_id: str + :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._get_purge_job_serialize( + job_id=job_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessEnvelopePurgeJobData", + '422': "HTTPValidationError", + '401': "Dict[str, object]", + '403': "Dict[str, object]", + '429': "Dict[str, object]", + '503': "Dict[str, object]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_purge_job_without_preload_content( + self, + job_id: StrictStr, + _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: + """Get a memory-space purge job [Cloud-only] + + Read a purge job by the `job_id` that /api/v2/memory/purge/confirm returned. `status` goes `queued` → `running` → `succeeded` or `failed`. `steps` lists every store the purge touches (for example `mongo:v2_episodes` or `es:episode`) with its own state and deleted count, and `error` for a store that failed. Writes to the memory space are rejected with `409 purge_in_progress` until the job has ended, so poll this before writing again. + + :param job_id: (required) + :type job_id: str + :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._get_purge_job_serialize( + job_id=job_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessEnvelopePurgeJobData", + '422': "HTTPValidationError", + '401': "Dict[str, object]", + '403': "Dict[str, object]", + '429': "Dict[str, object]", + '503': "Dict[str, object]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_purge_job_serialize( + self, + job_id, + _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 + if job_id is not None: + _path_params['job_id'] = job_id + # 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] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v2/memory/purge/{job_id}', + 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 + def replace_tags( self, tag_replace_input: TagReplaceInput, _request_timeout: Union[ @@ -2376,6 +2946,295 @@ def _replace_tags_serialize( + @validate_call + def request_purge( + self, + purge_request_input: PurgeRequestInput, + _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, + ) -> SuccessEnvelopePurgeRequestData: + """Request a memory-space purge (step 1 of 2) [Cloud-only] + + **Permanent — there is no undo.** Step 1 of 2: asks for a purge and returns a `nonce`. Nothing is deleted yet. - `scope: \"space\"` purges the whole memory space; `\"app\"` one app (`app_id`); `\"project\"` one project of one app (`app_id` + `project_id`). - Confirm with `POST /purge/confirm` before `expires_at` (5 minutes). The nonce is single use and only valid for the same memory space and API key. What is deleted: memories, sessions, messages, memory cells, feedback, events and (space scope only) senders and engine knowledge bases, from every index. Not deleted: files uploaded through `/object/sign`, and data of the separate knowledge-base service. + + :param purge_request_input: (required) + :type purge_request_input: PurgeRequestInput + :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._request_purge_serialize( + purge_request_input=purge_request_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessEnvelopePurgeRequestData", + '422': "HTTPValidationError", + '401': "Dict[str, object]", + '403': "Dict[str, object]", + '429': "Dict[str, object]", + '503': "Dict[str, object]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def request_purge_with_http_info( + self, + purge_request_input: PurgeRequestInput, + _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[SuccessEnvelopePurgeRequestData]: + """Request a memory-space purge (step 1 of 2) [Cloud-only] + + **Permanent — there is no undo.** Step 1 of 2: asks for a purge and returns a `nonce`. Nothing is deleted yet. - `scope: \"space\"` purges the whole memory space; `\"app\"` one app (`app_id`); `\"project\"` one project of one app (`app_id` + `project_id`). - Confirm with `POST /purge/confirm` before `expires_at` (5 minutes). The nonce is single use and only valid for the same memory space and API key. What is deleted: memories, sessions, messages, memory cells, feedback, events and (space scope only) senders and engine knowledge bases, from every index. Not deleted: files uploaded through `/object/sign`, and data of the separate knowledge-base service. + + :param purge_request_input: (required) + :type purge_request_input: PurgeRequestInput + :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._request_purge_serialize( + purge_request_input=purge_request_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessEnvelopePurgeRequestData", + '422': "HTTPValidationError", + '401': "Dict[str, object]", + '403': "Dict[str, object]", + '429': "Dict[str, object]", + '503': "Dict[str, object]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def request_purge_without_preload_content( + self, + purge_request_input: PurgeRequestInput, + _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: + """Request a memory-space purge (step 1 of 2) [Cloud-only] + + **Permanent — there is no undo.** Step 1 of 2: asks for a purge and returns a `nonce`. Nothing is deleted yet. - `scope: \"space\"` purges the whole memory space; `\"app\"` one app (`app_id`); `\"project\"` one project of one app (`app_id` + `project_id`). - Confirm with `POST /purge/confirm` before `expires_at` (5 minutes). The nonce is single use and only valid for the same memory space and API key. What is deleted: memories, sessions, messages, memory cells, feedback, events and (space scope only) senders and engine knowledge bases, from every index. Not deleted: files uploaded through `/object/sign`, and data of the separate knowledge-base service. + + :param purge_request_input: (required) + :type purge_request_input: PurgeRequestInput + :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._request_purge_serialize( + purge_request_input=purge_request_input, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessEnvelopePurgeRequestData", + '422': "HTTPValidationError", + '401': "Dict[str, object]", + '403': "Dict[str, object]", + '429': "Dict[str, object]", + '503': "Dict[str, object]", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _request_purge_serialize( + self, + purge_request_input, + _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 + if purge_request_input is not None: + _body_params = purge_request_input + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v2/memory/purge', + 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 def retrieve_context( self, @@ -3551,7 +4410,7 @@ def update_memory( ) -> SuccessEnvelopeUpdateData: """Edit one memory record [Cloud-only] - Rewrite the editable fields of one memory. Only \"episode\" can be edited today. - `patch` uses the episode's own field names — `episode`, `summary`, `subject` — and needs at least one of them. Fields left out keep their current value. - A patch that changes only `episode` makes the server regenerate `summary` from the new text; `subject` is never regenerated. - No `app_id` / `project_id`: the record already knows its scope. There is no version check — the last write wins. Re-sending content equal to what is stored answers 200 with `unchanged: true` and writes nothing. Changing the narrative re-indexes the memory and re-extracts its facts in the background; the response is the edited record itself, with `edited_at` and `reflect_state` set. A record that does not exist, is already deleted, or belongs to another tenant is rejected with 404. Profile items are edited through /api/v2/memory/edit, not here. + Rewrite the editable fields of one memory. Only \"episode\" can be edited today. - `patch` uses the episode's own field names — `episode`, `summary`, `subject` — and needs at least one of them. Fields left out keep their current value. - A patch that changes only `episode` makes the server regenerate `summary` from the new text; `subject` is never regenerated. - No `app_id` / `project_id`: the record already knows its scope. There is no version check — the last write wins. Re-sending content equal to what is stored answers 200 with `unchanged: true` and writes nothing. Changing the narrative re-indexes the memory and re-extracts its facts in the background; the response is the edited record itself, with `edited_at` and `reflect_state` set. A record that does not exist, is already deleted, or belongs to another tenant is rejected with 404. Pass `user_id` to limit the edit to that user's memory: a record owned by anyone else is rejected with the same 404. Set it from your own session (the signed-in user), never from model output, so that an agent tool cannot touch another user's memory with a wrong or invented id. Profile items are edited through /api/v2/memory/edit, not here. :param update_input: (required) :type update_input: UpdateInput @@ -3623,7 +4482,7 @@ def update_memory_with_http_info( ) -> ApiResponse[SuccessEnvelopeUpdateData]: """Edit one memory record [Cloud-only] - Rewrite the editable fields of one memory. Only \"episode\" can be edited today. - `patch` uses the episode's own field names — `episode`, `summary`, `subject` — and needs at least one of them. Fields left out keep their current value. - A patch that changes only `episode` makes the server regenerate `summary` from the new text; `subject` is never regenerated. - No `app_id` / `project_id`: the record already knows its scope. There is no version check — the last write wins. Re-sending content equal to what is stored answers 200 with `unchanged: true` and writes nothing. Changing the narrative re-indexes the memory and re-extracts its facts in the background; the response is the edited record itself, with `edited_at` and `reflect_state` set. A record that does not exist, is already deleted, or belongs to another tenant is rejected with 404. Profile items are edited through /api/v2/memory/edit, not here. + Rewrite the editable fields of one memory. Only \"episode\" can be edited today. - `patch` uses the episode's own field names — `episode`, `summary`, `subject` — and needs at least one of them. Fields left out keep their current value. - A patch that changes only `episode` makes the server regenerate `summary` from the new text; `subject` is never regenerated. - No `app_id` / `project_id`: the record already knows its scope. There is no version check — the last write wins. Re-sending content equal to what is stored answers 200 with `unchanged: true` and writes nothing. Changing the narrative re-indexes the memory and re-extracts its facts in the background; the response is the edited record itself, with `edited_at` and `reflect_state` set. A record that does not exist, is already deleted, or belongs to another tenant is rejected with 404. Pass `user_id` to limit the edit to that user's memory: a record owned by anyone else is rejected with the same 404. Set it from your own session (the signed-in user), never from model output, so that an agent tool cannot touch another user's memory with a wrong or invented id. Profile items are edited through /api/v2/memory/edit, not here. :param update_input: (required) :type update_input: UpdateInput @@ -3695,7 +4554,7 @@ def update_memory_without_preload_content( ) -> RESTResponseType: """Edit one memory record [Cloud-only] - Rewrite the editable fields of one memory. Only \"episode\" can be edited today. - `patch` uses the episode's own field names — `episode`, `summary`, `subject` — and needs at least one of them. Fields left out keep their current value. - A patch that changes only `episode` makes the server regenerate `summary` from the new text; `subject` is never regenerated. - No `app_id` / `project_id`: the record already knows its scope. There is no version check — the last write wins. Re-sending content equal to what is stored answers 200 with `unchanged: true` and writes nothing. Changing the narrative re-indexes the memory and re-extracts its facts in the background; the response is the edited record itself, with `edited_at` and `reflect_state` set. A record that does not exist, is already deleted, or belongs to another tenant is rejected with 404. Profile items are edited through /api/v2/memory/edit, not here. + Rewrite the editable fields of one memory. Only \"episode\" can be edited today. - `patch` uses the episode's own field names — `episode`, `summary`, `subject` — and needs at least one of them. Fields left out keep their current value. - A patch that changes only `episode` makes the server regenerate `summary` from the new text; `subject` is never regenerated. - No `app_id` / `project_id`: the record already knows its scope. There is no version check — the last write wins. Re-sending content equal to what is stored answers 200 with `unchanged: true` and writes nothing. Changing the narrative re-indexes the memory and re-extracts its facts in the background; the response is the edited record itself, with `edited_at` and `reflect_state` set. A record that does not exist, is already deleted, or belongs to another tenant is rejected with 404. Pass `user_id` to limit the edit to that user's memory: a record owned by anyone else is rejected with the same 404. Set it from your own session (the signed-in user), never from model output, so that an agent tool cannot touch another user's memory with a wrong or invented id. Profile items are edited through /api/v2/memory/edit, not here. :param update_input: (required) :type update_input: UpdateInput diff --git a/everos_cloud/api_client.py b/everos_cloud/api_client.py index 525cd22..836876a 100644 --- a/everos_cloud/api_client.py +++ b/everos_cloud/api_client.py @@ -91,7 +91,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/1.3.0-rc1/python' + self.user_agent = 'OpenAPI-Generator/1.3.0-rc2/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/everos_cloud/configuration.py b/everos_cloud/configuration.py index 4798feb..42720d0 100644 --- a/everos_cloud/configuration.py +++ b/everos_cloud/configuration.py @@ -504,7 +504,7 @@ def to_debug_report(self) -> str: "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 2.0.0\n"\ - "SDK Package Version: 1.3.0-rc1".\ + "SDK Package Version: 1.3.0-rc2".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self) -> List[HostSetting]: diff --git a/everos_cloud/models/__init__.py b/everos_cloud/models/__init__.py index a53eef7..c719839 100644 --- a/everos_cloud/models/__init__.py +++ b/everos_cloud/models/__init__.py @@ -74,7 +74,14 @@ from everos_cloud.models.kb_patch_body import KbPatchBody from everos_cloud.models.kb_search_data import KbSearchData from everos_cloud.models.message_item import MessageItem +from everos_cloud.models.mongo_value import MongoValue from everos_cloud.models.profile_item import ProfileItem +from everos_cloud.models.purge_confirm_input import PurgeConfirmInput +from everos_cloud.models.purge_job_data import PurgeJobData +from everos_cloud.models.purge_request_data import PurgeRequestData +from everos_cloud.models.purge_request_input import PurgeRequestInput +from everos_cloud.models.purge_step_data import PurgeStepData +from everos_cloud.models.purge_summary import PurgeSummary from everos_cloud.models.reason import Reason from everos_cloud.models.related_tag_usage_body import RelatedTagUsageBody from everos_cloud.models.related_tag_usage_item import RelatedTagUsageItem @@ -115,6 +122,8 @@ from everos_cloud.models.success_envelope_kb_delete_data import SuccessEnvelopeKbDeleteData from everos_cloud.models.success_envelope_kb_list_data import SuccessEnvelopeKbListData from everos_cloud.models.success_envelope_kb_search_data import SuccessEnvelopeKbSearchData +from everos_cloud.models.success_envelope_purge_job_data import SuccessEnvelopePurgeJobData +from everos_cloud.models.success_envelope_purge_request_data import SuccessEnvelopePurgeRequestData from everos_cloud.models.success_envelope_related_tag_usage_list_data import SuccessEnvelopeRelatedTagUsageListData from everos_cloud.models.success_envelope_search_data import SuccessEnvelopeSearchData from everos_cloud.models.success_envelope_tag_bind_data import SuccessEnvelopeTagBindData diff --git a/everos_cloud/models/delete_by_ids_data.py b/everos_cloud/models/delete_by_ids_data.py index 24ae9a6..57bf9d3 100644 --- a/everos_cloud/models/delete_by_ids_data.py +++ b/everos_cloud/models/delete_by_ids_data.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self @@ -29,8 +29,9 @@ class DeleteByIdsData(BaseModel): """ # noqa: E501 memory_type: StrictStr = Field(description="The memory type the request named.") success: StrictBool = Field(description="Always true on a 200 — the batch was applied. Failures use the error envelope instead.") + deleted: StrictInt = Field(description="Records this request removed. Ids that were absent, already deleted, another tenant's or (with `user_id`) another user's are skipped and count 0 alike.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["memory_type", "success"] + __properties: ClassVar[List[str]] = ["memory_type", "success", "deleted"] model_config = ConfigDict( populate_by_name=True, @@ -91,7 +92,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "memory_type": obj.get("memory_type"), - "success": obj.get("success") + "success": obj.get("success"), + "deleted": obj.get("deleted") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/everos_cloud/models/delete_by_ids_input.py b/everos_cloud/models/delete_by_ids_input.py index fb1d705..c8d4884 100644 --- a/everos_cloud/models/delete_by_ids_input.py +++ b/everos_cloud/models/delete_by_ids_input.py @@ -32,8 +32,9 @@ class DeleteByIdsInput(BaseModel): memory_type: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Kind of the memories being deleted. Only \"episode\" is accepted today.") memory_ids: Annotated[List[StrictStr], Field(min_length=1, max_length=50)] = Field(description="1 to 50 memory ids. Every one must be well-formed; duplicates are collapsed.") reason: Optional[Reason] = None + user_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=256)]] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["memory_type", "memory_ids", "reason"] + __properties: ClassVar[List[str]] = ["memory_type", "memory_ids", "reason", "user_id"] model_config = ConfigDict( populate_by_name=True, @@ -89,6 +90,11 @@ def to_dict(self) -> Dict[str, Any]: if self.reason is None and "reason" in self.model_fields_set: _dict['reason'] = None + # set to None if user_id (nullable) is None + # and model_fields_set contains the field + if self.user_id is None and "user_id" in self.model_fields_set: + _dict['user_id'] = None + return _dict @classmethod @@ -103,7 +109,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "memory_type": obj.get("memory_type"), "memory_ids": obj.get("memory_ids"), - "reason": Reason.from_dict(obj["reason"]) if obj.get("reason") is not None else None + "reason": Reason.from_dict(obj["reason"]) if obj.get("reason") is not None else None, + "user_id": obj.get("user_id") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/everos_cloud/models/mongo_value.py b/everos_cloud/models/mongo_value.py new file mode 100644 index 0000000..02168eb --- /dev/null +++ b/everos_cloud/models/mongo_value.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator +from typing import Optional +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +MONGOVALUE_ANY_OF_SCHEMAS = ["int"] + +class MongoValue(BaseModel): + """ + MongoValue + """ + + # data type: int + anyof_schema_1_validator: Optional[StrictInt] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[int]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "int" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = MongoValue.model_construct() + error_messages = [] + # validate data type: int + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in MongoValue with anyOf schemas: int. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # deserialize data into int + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into MongoValue with anyOf schemas: int. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], int]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/everos_cloud/models/purge_confirm_input.py b/everos_cloud/models/purge_confirm_input.py new file mode 100644 index 0000000..d21b2b8 --- /dev/null +++ b/everos_cloud/models/purge_confirm_input.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class PurgeConfirmInput(BaseModel): + """ + Step 2: confirm. The scope is the one bound to the nonce. + """ # noqa: E501 + nonce: Annotated[str, Field(min_length=16, strict=True, max_length=64)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["nonce"] + + @field_validator('nonce') + def nonce_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[A-Za-z0-9_-]+$", value): + raise ValueError(r"must validate the regular expression /^[A-Za-z0-9_-]+$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PurgeConfirmInput from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PurgeConfirmInput from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "nonce": obj.get("nonce") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/everos_cloud/models/purge_job_data.py b/everos_cloud/models/purge_job_data.py new file mode 100644 index 0000000..359cd4c --- /dev/null +++ b/everos_cloud/models/purge_job_data.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from everos_cloud.models.purge_step_data import PurgeStepData +from typing import Optional, Set +from typing_extensions import Self + +class PurgeJobData(BaseModel): + """ + A purge job as the caller sees it. + """ # noqa: E501 + job_id: StrictStr + status: StrictStr + scope: StrictStr + app_id: Optional[StrictStr] = None + project_id: Optional[StrictStr] = None + created_at: datetime + started_at: Optional[datetime] = None + heartbeat_at: Optional[datetime] = None + finished_at: Optional[datetime] = None + steps: Optional[List[PurgeStepData]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["job_id", "status", "scope", "app_id", "project_id", "created_at", "started_at", "heartbeat_at", "finished_at", "steps"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['queued', 'running', 'succeeded', 'failed']): + raise ValueError("must be one of enum values ('queued', 'running', 'succeeded', 'failed')") + return value + + @field_validator('scope') + def scope_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['space', 'app', 'project']): + raise ValueError("must be one of enum values ('space', 'app', 'project')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PurgeJobData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in steps (list) + _items = [] + if self.steps: + for _item_steps in self.steps: + if _item_steps: + _items.append(_item_steps.to_dict()) + _dict['steps'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if app_id (nullable) is None + # and model_fields_set contains the field + if self.app_id is None and "app_id" in self.model_fields_set: + _dict['app_id'] = None + + # set to None if project_id (nullable) is None + # and model_fields_set contains the field + if self.project_id is None and "project_id" in self.model_fields_set: + _dict['project_id'] = None + + # set to None if started_at (nullable) is None + # and model_fields_set contains the field + if self.started_at is None and "started_at" in self.model_fields_set: + _dict['started_at'] = None + + # set to None if heartbeat_at (nullable) is None + # and model_fields_set contains the field + if self.heartbeat_at is None and "heartbeat_at" in self.model_fields_set: + _dict['heartbeat_at'] = None + + # set to None if finished_at (nullable) is None + # and model_fields_set contains the field + if self.finished_at is None and "finished_at" in self.model_fields_set: + _dict['finished_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PurgeJobData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "job_id": obj.get("job_id"), + "status": obj.get("status"), + "scope": obj.get("scope"), + "app_id": obj.get("app_id"), + "project_id": obj.get("project_id"), + "created_at": obj.get("created_at"), + "started_at": obj.get("started_at"), + "heartbeat_at": obj.get("heartbeat_at"), + "finished_at": obj.get("finished_at"), + "steps": [PurgeStepData.from_dict(_item) for _item in obj["steps"]] if obj.get("steps") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/everos_cloud/models/purge_request_data.py b/everos_cloud/models/purge_request_data.py new file mode 100644 index 0000000..d64d50a --- /dev/null +++ b/everos_cloud/models/purge_request_data.py @@ -0,0 +1,133 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from everos_cloud.models.purge_summary import PurgeSummary +from typing import Optional, Set +from typing_extensions import Self + +class PurgeRequestData(BaseModel): + """ + The nonce to confirm, and what it will purge. + """ # noqa: E501 + nonce: StrictStr = Field(description="Send to /purge/confirm before `expires_at`.") + expires_at: datetime + scope: StrictStr + app_id: Optional[StrictStr] = None + project_id: Optional[StrictStr] = None + summary: PurgeSummary + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["nonce", "expires_at", "scope", "app_id", "project_id", "summary"] + + @field_validator('scope') + def scope_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['space', 'app', 'project']): + raise ValueError("must be one of enum values ('space', 'app', 'project')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PurgeRequestData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of summary + if self.summary: + _dict['summary'] = self.summary.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if app_id (nullable) is None + # and model_fields_set contains the field + if self.app_id is None and "app_id" in self.model_fields_set: + _dict['app_id'] = None + + # set to None if project_id (nullable) is None + # and model_fields_set contains the field + if self.project_id is None and "project_id" in self.model_fields_set: + _dict['project_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PurgeRequestData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "nonce": obj.get("nonce"), + "expires_at": obj.get("expires_at"), + "scope": obj.get("scope"), + "app_id": obj.get("app_id"), + "project_id": obj.get("project_id"), + "summary": PurgeSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/everos_cloud/models/purge_request_input.py b/everos_cloud/models/purge_request_input.py new file mode 100644 index 0000000..9922599 --- /dev/null +++ b/everos_cloud/models/purge_request_input.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class PurgeRequestInput(BaseModel): + """ + Step 1: ask for a purge. Nothing is deleted. + """ # noqa: E501 + scope: StrictStr = Field(description="`space` purges the whole memory space; `app` one app in it (`app_id`); `project` one project of one app (`app_id` + `project_id`).") + app_id: Optional[Annotated[str, Field(strict=True, max_length=128)]] = None + project_id: Optional[Annotated[str, Field(strict=True, max_length=128)]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["scope", "app_id", "project_id"] + + @field_validator('scope') + def scope_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['space', 'app', 'project']): + raise ValueError("must be one of enum values ('space', 'app', 'project')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PurgeRequestInput from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if app_id (nullable) is None + # and model_fields_set contains the field + if self.app_id is None and "app_id" in self.model_fields_set: + _dict['app_id'] = None + + # set to None if project_id (nullable) is None + # and model_fields_set contains the field + if self.project_id is None and "project_id" in self.model_fields_set: + _dict['project_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PurgeRequestInput from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "scope": obj.get("scope"), + "app_id": obj.get("app_id"), + "project_id": obj.get("project_id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/everos_cloud/models/purge_step_data.py b/everos_cloud/models/purge_step_data.py new file mode 100644 index 0000000..31d503e --- /dev/null +++ b/everos_cloud/models/purge_step_data.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PurgeStepData(BaseModel): + """ + One store of one purge step, e.g. ``mongo:v2_episodes`` or ``es:episode``. + """ # noqa: E501 + store: StrictStr + state: StrictStr + deleted: Optional[StrictInt] = 0 + error: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["store", "state", "deleted", "error"] + + @field_validator('state') + def state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['pending', 'done', 'failed']): + raise ValueError("must be one of enum values ('pending', 'done', 'failed')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PurgeStepData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if error (nullable) is None + # and model_fields_set contains the field + if self.error is None and "error" in self.model_fields_set: + _dict['error'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PurgeStepData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "store": obj.get("store"), + "state": obj.get("state"), + "deleted": obj.get("deleted") if obj.get("deleted") is not None else 0, + "error": obj.get("error") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/everos_cloud/models/purge_summary.py b/everos_cloud/models/purge_summary.py new file mode 100644 index 0000000..60cf447 --- /dev/null +++ b/everos_cloud/models/purge_summary.py @@ -0,0 +1,149 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from everos_cloud.models.mongo_value import MongoValue +from typing import Optional, Set +from typing_extensions import Self + +class PurgeSummary(BaseModel): + """ + What the purge would delete right now, counted per store. A snapshot at request time: data written before the purge runs is deleted too. Counts include soft-deleted rows (the purge removes those as well), so they can be higher than what ``get`` shows. Feedback is not memory data and is not counted. A count that did not finish in time is ``null`` and ``complete`` is ``false``. + """ # noqa: E501 + mongo: Dict[str, Optional[MongoValue]] = Field(description="MongoDB documents per memory type (collection without the `v2_` prefix), the source of truth.") + mongo_total: Optional[StrictInt] + elasticsearch_total: Optional[StrictInt] + milvus_total: Optional[StrictInt] + complete: StrictBool = Field(description="False when any count timed out or failed.") + counted_at: datetime + comment: StrictStr = Field(description="What the counts include and exclude (soft-deleted rows, feedback).") + error: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["mongo", "mongo_total", "elasticsearch_total", "milvus_total", "complete", "counted_at", "comment", "error"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PurgeSummary from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each value in mongo (dict) + _field_dict = {} + if self.mongo: + for _key_mongo in self.mongo: + if self.mongo[_key_mongo]: + _field_dict[_key_mongo] = self.mongo[_key_mongo].to_dict() + _dict['mongo'] = _field_dict + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + # set to None if mongo_total (nullable) is None + # and model_fields_set contains the field + if self.mongo_total is None and "mongo_total" in self.model_fields_set: + _dict['mongo_total'] = None + + # set to None if elasticsearch_total (nullable) is None + # and model_fields_set contains the field + if self.elasticsearch_total is None and "elasticsearch_total" in self.model_fields_set: + _dict['elasticsearch_total'] = None + + # set to None if milvus_total (nullable) is None + # and model_fields_set contains the field + if self.milvus_total is None and "milvus_total" in self.model_fields_set: + _dict['milvus_total'] = None + + # set to None if error (nullable) is None + # and model_fields_set contains the field + if self.error is None and "error" in self.model_fields_set: + _dict['error'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PurgeSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "mongo": dict( + (_k, MongoValue.from_dict(_v)) + for _k, _v in obj["mongo"].items() + ) + if obj.get("mongo") is not None + else None, + "mongo_total": obj.get("mongo_total"), + "elasticsearch_total": obj.get("elasticsearch_total"), + "milvus_total": obj.get("milvus_total"), + "complete": obj.get("complete"), + "counted_at": obj.get("counted_at"), + "comment": obj.get("comment"), + "error": obj.get("error") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/everos_cloud/models/success_envelope_purge_job_data.py b/everos_cloud/models/success_envelope_purge_job_data.py new file mode 100644 index 0000000..adfe0be --- /dev/null +++ b/everos_cloud/models/success_envelope_purge_job_data.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from everos_cloud.models.purge_job_data import PurgeJobData +from typing import Optional, Set +from typing_extensions import Self + +class SuccessEnvelopePurgeJobData(BaseModel): + """ + SuccessEnvelopePurgeJobData + """ # noqa: E501 + request_id: StrictStr = Field(description="Request trace id (peer to data)") + data: PurgeJobData = Field(description="Endpoint-defined business result") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["request_id", "data"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SuccessEnvelopePurgeJobData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SuccessEnvelopePurgeJobData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "request_id": obj.get("request_id"), + "data": PurgeJobData.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/everos_cloud/models/success_envelope_purge_request_data.py b/everos_cloud/models/success_envelope_purge_request_data.py new file mode 100644 index 0000000..1dbd096 --- /dev/null +++ b/everos_cloud/models/success_envelope_purge_request_data.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from everos_cloud.models.purge_request_data import PurgeRequestData +from typing import Optional, Set +from typing_extensions import Self + +class SuccessEnvelopePurgeRequestData(BaseModel): + """ + SuccessEnvelopePurgeRequestData + """ # noqa: E501 + request_id: StrictStr = Field(description="Request trace id (peer to data)") + data: PurgeRequestData = Field(description="Endpoint-defined business result") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["request_id", "data"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SuccessEnvelopePurgeRequestData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SuccessEnvelopePurgeRequestData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "request_id": obj.get("request_id"), + "data": PurgeRequestData.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/everos_cloud/models/update_input.py b/everos_cloud/models/update_input.py index 48c0b42..371bbbd 100644 --- a/everos_cloud/models/update_input.py +++ b/everos_cloud/models/update_input.py @@ -34,8 +34,9 @@ class UpdateInput(BaseModel): memory_id: Annotated[str, Field(min_length=1, strict=True)] = Field(description="The memory's `id` as returned by /api/v2/memory/get or /search.") patch: EpisodePatch = Field(description="The fields to rewrite — at least one. Fields left out keep their current value.") reason: Optional[Reason] = None + user_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=256)]] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["memory_type", "memory_id", "patch", "reason"] + __properties: ClassVar[List[str]] = ["memory_type", "memory_id", "patch", "reason", "user_id"] model_config = ConfigDict( populate_by_name=True, @@ -94,6 +95,11 @@ def to_dict(self) -> Dict[str, Any]: if self.reason is None and "reason" in self.model_fields_set: _dict['reason'] = None + # set to None if user_id (nullable) is None + # and model_fields_set contains the field + if self.user_id is None and "user_id" in self.model_fields_set: + _dict['user_id'] = None + return _dict @classmethod @@ -109,7 +115,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "memory_type": obj.get("memory_type"), "memory_id": obj.get("memory_id"), "patch": EpisodePatch.from_dict(obj["patch"]) if obj.get("patch") is not None else None, - "reason": Reason.from_dict(obj["reason"]) if obj.get("reason") is not None else None + "reason": Reason.from_dict(obj["reason"]) if obj.get("reason") is not None else None, + "user_id": obj.get("user_id") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/openapi.json b/openapi.json index 50d0dc8..44c8542 100644 --- a/openapi.json +++ b/openapi.json @@ -350,7 +350,7 @@ } } }, - "description": "Soft-delete up to 50 memories chosen by id, together with what was derived from them (extracted facts, cluster membership and search-index copies). Only \"episode\" is supported today.\n\n- Every id must be well-formed; one malformed id rejects the whole request with 422 and nothing is deleted.\n- Ids that do not exist, are already deleted, or belong to another tenant are skipped rather than reported \u2014 the rest of the batch is still deleted, so re-sending a batch is safe. Duplicates are collapsed.\n\nTo remove memories by owner or session rather than by id, use /api/v2/memory/delete." + "description": "Soft-delete up to 50 memories chosen by id, together with what was derived from them (extracted facts, cluster membership and search-index copies). Only \"episode\" is supported today.\n\n- Every id must be well-formed; one malformed id rejects the whole request with 422 and nothing is deleted.\n- Ids that do not exist, are already deleted, or belong to another tenant are skipped \u2014 the rest of the batch is still deleted, so re-sending a batch is safe. Duplicates are collapsed.\n- `deleted` in the response counts the records this request removed. Every skipped id counts 0 alike, so the count does not reveal which ids exist.\n\nPass `user_id` to delete only that user's memories: an id owned by anyone else is skipped like a missing one. Set it from your own session (the signed-in user), never from model output, so that an agent tool cannot touch another user's memory with a wrong or invented id.\n\nTo remove memories by owner or session rather than by id, use /api/v2/memory/delete." } }, "/api/v2/memory/edit": { @@ -681,6 +681,253 @@ "description": "List stored memories of one type, paginated.\n\n- Exactly one of `user_id` / `agent_id` is required.\n- `memory_type` must match that owner: a user owns \"episode\" and \"profile\", an agent owns \"agent_case\" and \"agent_skill\". The other pairings are rejected with 422.\n\nThis is a structured read, not a query: it does not embed the request, so a memory is readable as soon as it is extracted \u2014 whereas the vector index /api/v2/memory/search relies on lags behind extraction by seconds." } }, + "/api/v2/memory/purge/confirm": { + "post": { + "tags": [ + "Memory" + ], + "summary": "Confirm a memory-space purge (step 2 of 2) [Cloud-only]", + "description": "**Permanent \u2014 there is no undo.** Step 2 of 2: confirms the `nonce` from `POST /purge` and queues the purge (202). The scope is the one the nonce was issued for.\n\nFrom this moment every write to the memory space (add, flush, delete, update, feedback, tags, knowledge changes) is rejected with `409 purge_in_progress` until the purge ends; reads keep working and may return partial results. Poll `GET /purge/{job_id}` for progress.\n\nOnly one purge per memory space runs at a time: confirming while one is queued or running returns that job. An unknown, expired or already used nonce is `404 purge_nonce_invalid`.", + "operationId": "confirmPurge", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PurgeConfirmInput" + } + } + }, + "required": true + }, + "responses": { + "202": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessEnvelope_PurgeJobData_" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + }, + "401": { + "description": "Missing or invalid bearer token.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + }, + "403": { + "description": "Authenticated but not permitted \u2014 either rejected by the auth service, or the account's memory API version does not match the interface version implied by the path (a v1 account calling an /api/v2 route).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + }, + "429": { + "description": "Rate limit or quota exceeded. Besides the account-wide limits, each memory space may send /purge and /purge/confirm only a limited number of times per minute (10 each by default); wait for the `Retry-After` header. Requests the engine rejects do not count against this limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + }, + "503": { + "description": "The gateway could not reach the authentication service. Transient \u2014 retry with backoff.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + } + } + } + }, + "/api/v2/memory/purge": { + "post": { + "tags": [ + "Memory" + ], + "summary": "Request a memory-space purge (step 1 of 2) [Cloud-only]", + "description": "**Permanent \u2014 there is no undo.** Step 1 of 2: asks for a purge and returns a `nonce`. Nothing is deleted yet.\n\n- `scope: \"space\"` purges the whole memory space; `\"app\"` one app (`app_id`); `\"project\"` one project of one app (`app_id` + `project_id`).\n- Confirm with `POST /purge/confirm` before `expires_at` (5 minutes). The nonce is single use and only valid for the same memory space and API key.\n\nWhat is deleted: memories, sessions, messages, memory cells, feedback, events and (space scope only) senders and engine knowledge bases, from every index. Not deleted: files uploaded through `/object/sign`, and data of the separate knowledge-base service.", + "operationId": "requestPurge", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PurgeRequestInput" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessEnvelope_PurgeRequestData_" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + }, + "401": { + "description": "Missing or invalid bearer token.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + }, + "403": { + "description": "Authenticated but not permitted \u2014 either rejected by the auth service, or the account's memory API version does not match the interface version implied by the path (a v1 account calling an /api/v2 route).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + }, + "429": { + "description": "Rate limit or quota exceeded. Besides the account-wide limits, each memory space may send /purge and /purge/confirm only a limited number of times per minute (10 each by default); wait for the `Retry-After` header. Requests the engine rejects do not count against this limit.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + }, + "503": { + "description": "The gateway could not reach the authentication service. Transient \u2014 retry with backoff.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + } + } + } + }, + "/api/v2/memory/purge/{job_id}": { + "get": { + "tags": [ + "Memory" + ], + "summary": "Get a memory-space purge job [Cloud-only]", + "operationId": "getPurgeJob", + "parameters": [ + { + "name": "job_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Job Id" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SuccessEnvelope_PurgeJobData_" + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } + }, + "401": { + "description": "Missing or invalid bearer token.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + }, + "403": { + "description": "Authenticated but not permitted \u2014 either rejected by the auth service, or the account's memory API version does not match the interface version implied by the path (a v1 account calling an /api/v2 route).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + }, + "429": { + "description": "Rate limit or quota exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + }, + "503": { + "description": "The gateway could not reach the authentication service. Transient \u2014 retry with backoff.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GatewayError" + } + } + } + } + }, + "description": "Read a purge job by the `job_id` that /api/v2/memory/purge/confirm returned.\n\n`status` goes `queued` \u2192 `running` \u2192 `succeeded` or `failed`. `steps` lists every store the purge touches (for example `mongo:v2_episodes` or `es:episode`) with its own state and deleted count, and `error` for a store that failed.\n\nWrites to the memory space are rejected with `409 purge_in_progress` until the job has ended, so poll this before writing again." + } + }, "/api/v2/memory/search": { "post": { "tags": [ @@ -1088,7 +1335,7 @@ } } }, - "description": "Rewrite the editable fields of one memory. Only \"episode\" can be edited today.\n\n- `patch` uses the episode's own field names \u2014 `episode`, `summary`, `subject` \u2014 and needs at least one of them. Fields left out keep their current value.\n- A patch that changes only `episode` makes the server regenerate `summary` from the new text; `subject` is never regenerated.\n- No `app_id` / `project_id`: the record already knows its scope.\n\nThere is no version check \u2014 the last write wins. Re-sending content equal to what is stored answers 200 with `unchanged: true` and writes nothing. Changing the narrative re-indexes the memory and re-extracts its facts in the background; the response is the edited record itself, with `edited_at` and `reflect_state` set.\n\nA record that does not exist, is already deleted, or belongs to another tenant is rejected with 404.\n\nProfile items are edited through /api/v2/memory/edit, not here." + "description": "Rewrite the editable fields of one memory. Only \"episode\" can be edited today.\n\n- `patch` uses the episode's own field names \u2014 `episode`, `summary`, `subject` \u2014 and needs at least one of them. Fields left out keep their current value.\n- A patch that changes only `episode` makes the server regenerate `summary` from the new text; `subject` is never regenerated.\n- No `app_id` / `project_id`: the record already knows its scope.\n\nThere is no version check \u2014 the last write wins. Re-sending content equal to what is stored answers 200 with `unchanged: true` and writes nothing. Changing the narrative re-indexes the memory and re-extracts its facts in the background; the response is the edited record itself, with `edited_at` and `reflect_state` set.\n\nA record that does not exist, is already deleted, or belongs to another tenant is rejected with 404.\n\nPass `user_id` to limit the edit to that user's memory: a record owned by anyone else is rejected with the same 404. Set it from your own session (the signed-in user), never from model output, so that an agent tool cannot touch another user's memory with a wrong or invented id.\n\nProfile items are edited through /api/v2/memory/edit, not here." } }, "/api/v2/knowledge_bases/{kb_id}/categories": { @@ -4248,12 +4495,18 @@ "type": "boolean", "title": "Success", "description": "Always true on a 200 \u2014 the batch was applied. Failures use the error envelope instead." + }, + "deleted": { + "type": "integer", + "title": "Deleted", + "description": "Records this request removed. Ids that were absent, already deleted, another tenant's or (with `user_id`) another user's are skipped and count 0 alike." } }, "type": "object", "required": [ "memory_type", - "success" + "success", + "deleted" ], "title": "DeleteByIdsData", "description": "Result of a by-ids soft delete. A 200 means the request was applied; ids that\nwere already gone are a no-op, not a failure, so a re-sent batch is safe." @@ -4286,6 +4539,20 @@ } ], "description": "Why the memories are removed. Optional; one reason covers the whole batch." + }, + "user_id": { + "anyOf": [ + { + "type": "string", + "maxLength": 256, + "minLength": 1 + }, + { + "type": "null" + } + ], + "title": "User Id", + "description": "Optional owner guard. When set, ids owned by anyone else are skipped like absent ones. Set it from your own session, not from model output." } }, "additionalProperties": false, @@ -4302,6 +4569,7 @@ "665f0c8e1a2b3c4d5e6f7a8b", "665f0c8e1a2b3c4d5e6f7a8c" ], + "user_id": "user-1", "reason": { "code": "redundant" } @@ -6081,19 +6349,381 @@ ], "title": "ProfileItem" }, - "Reason": { + "PurgeConfirmInput": { "properties": { - "code": { + "nonce": { "type": "string", - "enum": [ - "hallucination", - "outdated", - "wrong_subject", - "wrong_time", - "redundant", - "missing", - "privacy", - "style", + "maxLength": 64, + "minLength": 16, + "pattern": "^[A-Za-z0-9_-]+$", + "title": "Nonce" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "nonce" + ], + "title": "PurgeConfirmInput", + "description": "Step 2: confirm. The scope is the one bound to the nonce." + }, + "PurgeJobData": { + "properties": { + "job_id": { + "type": "string", + "title": "Job Id" + }, + "status": { + "type": "string", + "enum": [ + "queued", + "running", + "succeeded", + "failed" + ], + "title": "Status" + }, + "scope": { + "type": "string", + "enum": [ + "space", + "app", + "project" + ], + "title": "Scope" + }, + "app_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "App Id" + }, + "project_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Project Id" + }, + "created_at": { + "type": "string", + "format": "date-time", + "title": "Created At" + }, + "started_at": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Started At" + }, + "heartbeat_at": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Heartbeat At" + }, + "finished_at": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Finished At" + }, + "steps": { + "items": { + "$ref": "#/components/schemas/PurgeStepData" + }, + "type": "array", + "title": "Steps" + } + }, + "type": "object", + "required": [ + "job_id", + "status", + "scope", + "created_at" + ], + "title": "PurgeJobData", + "description": "A purge job as the caller sees it." + }, + "PurgeRequestData": { + "properties": { + "nonce": { + "type": "string", + "title": "Nonce", + "description": "Send to /purge/confirm before `expires_at`." + }, + "expires_at": { + "type": "string", + "format": "date-time", + "title": "Expires At" + }, + "scope": { + "type": "string", + "enum": [ + "space", + "app", + "project" + ], + "title": "Scope" + }, + "app_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "App Id" + }, + "project_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Project Id" + }, + "summary": { + "$ref": "#/components/schemas/PurgeSummary" + } + }, + "type": "object", + "required": [ + "nonce", + "expires_at", + "scope", + "summary" + ], + "title": "PurgeRequestData", + "description": "The nonce to confirm, and what it will purge." + }, + "PurgeRequestInput": { + "properties": { + "scope": { + "type": "string", + "enum": [ + "space", + "app", + "project" + ], + "title": "Scope", + "description": "`space` purges the whole memory space; `app` one app in it (`app_id`); `project` one project of one app (`app_id` + `project_id`)." + }, + "app_id": { + "anyOf": [ + { + "type": "string", + "maxLength": 128 + }, + { + "type": "null" + } + ], + "title": "App Id", + "description": "Required for `app` and `project` scope." + }, + "project_id": { + "anyOf": [ + { + "type": "string", + "maxLength": 128 + }, + { + "type": "null" + } + ], + "title": "Project Id", + "description": "Required for `project` scope." + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "scope" + ], + "title": "PurgeRequestInput", + "description": "Step 1: ask for a purge. Nothing is deleted." + }, + "PurgeStepData": { + "properties": { + "store": { + "type": "string", + "title": "Store" + }, + "state": { + "type": "string", + "enum": [ + "pending", + "done", + "failed" + ], + "title": "State" + }, + "deleted": { + "type": "integer", + "title": "Deleted", + "default": 0 + }, + "error": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Error" + } + }, + "type": "object", + "required": [ + "store", + "state" + ], + "title": "PurgeStepData", + "description": "One store of one purge step, e.g. ``mongo:v2_episodes`` or ``es:episode``." + }, + "PurgeSummary": { + "properties": { + "mongo": { + "additionalProperties": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ] + }, + "type": "object", + "title": "Mongo", + "description": "MongoDB documents per memory type (collection without the `v2_` prefix), the source of truth." + }, + "mongo_total": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Mongo Total", + "description": "Sum of `mongo`; null if incomplete." + }, + "elasticsearch_total": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Elasticsearch Total", + "description": "Elasticsearch docs (derived from MongoDB); null if not counted." + }, + "milvus_total": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Milvus Total", + "description": "Milvus entities (derived from MongoDB); null if not counted." + }, + "complete": { + "type": "boolean", + "title": "Complete", + "description": "False when any count timed out or failed." + }, + "counted_at": { + "type": "string", + "format": "date-time", + "title": "Counted At" + }, + "comment": { + "type": "string", + "title": "Comment", + "description": "What the counts include and exclude (soft-deleted rows, feedback)." + }, + "error": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Error", + "description": "Which counts did not finish and why, e.g. `milvus:episode: timed out after 30s`; null when `complete`." + } + }, + "type": "object", + "required": [ + "mongo", + "mongo_total", + "elasticsearch_total", + "milvus_total", + "complete", + "counted_at", + "comment" + ], + "title": "PurgeSummary", + "description": "What the purge would delete right now, counted per store.\n\nA snapshot at request time: data written before the purge runs is deleted too.\nCounts include soft-deleted rows (the purge removes those as well), so they can be\nhigher than what ``get`` shows. Feedback is not memory data and is not counted.\nA count that did not finish in time is ``null`` and ``complete`` is ``false``." + }, + "Reason": { + "properties": { + "code": { + "type": "string", + "enum": [ + "hallucination", + "outdated", + "wrong_subject", + "wrong_time", + "redundant", + "missing", + "privacy", + "style", "other" ], "title": "Code", @@ -7460,6 +8090,44 @@ ], "title": "SuccessEnvelope[KbSearchData]" }, + "SuccessEnvelope_PurgeJobData_": { + "properties": { + "request_id": { + "type": "string", + "title": "Request Id", + "description": "Request trace id (peer to data)" + }, + "data": { + "$ref": "#/components/schemas/PurgeJobData", + "description": "Endpoint-defined business result" + } + }, + "type": "object", + "required": [ + "request_id", + "data" + ], + "title": "SuccessEnvelope[PurgeJobData]" + }, + "SuccessEnvelope_PurgeRequestData_": { + "properties": { + "request_id": { + "type": "string", + "title": "Request Id", + "description": "Request trace id (peer to data)" + }, + "data": { + "$ref": "#/components/schemas/PurgeRequestData", + "description": "Endpoint-defined business result" + } + }, + "type": "object", + "required": [ + "request_id", + "data" + ], + "title": "SuccessEnvelope[PurgeRequestData]" + }, "SuccessEnvelope_RelatedTagUsageListData_": { "properties": { "request_id": { @@ -8719,6 +9387,20 @@ } ], "description": "Why the change is made. Optional; recorded for quality analysis and never changes what is written." + }, + "user_id": { + "anyOf": [ + { + "type": "string", + "maxLength": 256, + "minLength": 1 + }, + { + "type": "null" + } + ], + "title": "User Id", + "description": "Optional owner guard. When set, a record owned by anyone else is a 404, like an absent one. Set it from your own session, not from model output." } }, "additionalProperties": false, @@ -8733,6 +9415,7 @@ "example": { "memory_type": "episode", "memory_id": "665f0c8e1a2b3c4d5e6f7a8b", + "user_id": "user-1", "patch": { "episode": "The user moved to Hangzhou last month and now lives near West Lake.", "summary": "Moved to Hangzhou; lives near West Lake.", diff --git a/pyproject.toml b/pyproject.toml index 352c3ab..cece329 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "everos_cloud" -version = "1.3.0-rc1" +version = "1.3.0-rc2" description = "EverOS Cloud Memory API" authors = ["EverMind AI "] license = "Apache-2.0" diff --git a/setup.py b/setup.py index 66fa541..2661eed 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "everos-cloud" -VERSION = "1.3.0-rc1" +VERSION = "1.3.0-rc2" # Floor = the oldest interpreter CI actually runs (see .github/workflows/ci.yml in # the public repo). Nothing in the generated code needs it this high — the tree # parses as 3.8 — so this is a support policy, not a technical bound, and it is set diff --git a/test/test_delete_by_ids_data.py b/test/test_delete_by_ids_data.py index f9943f4..9619688 100644 --- a/test/test_delete_by_ids_data.py +++ b/test/test_delete_by_ids_data.py @@ -37,12 +37,14 @@ def make_instance(self, include_optional) -> DeleteByIdsData: if include_optional: return DeleteByIdsData( memory_type = '', - success = True + success = True, + deleted = 56 ) else: return DeleteByIdsData( memory_type = '', success = True, + deleted = 56, ) """ diff --git a/test/test_delete_by_ids_input.py b/test/test_delete_by_ids_input.py index 91f0929..7abaa7f 100644 --- a/test/test_delete_by_ids_input.py +++ b/test/test_delete_by_ids_input.py @@ -40,7 +40,8 @@ def make_instance(self, include_optional) -> DeleteByIdsInput: memory_ids = [ '' ], - reason = { } + reason = { }, + user_id = '0' ) else: return DeleteByIdsInput( diff --git a/test/test_memory_api.py b/test/test_memory_api.py index 9b84862..d7bd552 100644 --- a/test/test_memory_api.py +++ b/test/test_memory_api.py @@ -41,6 +41,13 @@ def test_bind_tags(self) -> None: """ pass + def test_confirm_purge(self) -> None: + """Test case for confirm_purge + + Confirm a memory-space purge (step 2 of 2) [Cloud-only] + """ + pass + def test_delete_memories_by_ids(self) -> None: """Test case for delete_memories_by_ids @@ -76,6 +83,13 @@ def test_get_memory(self) -> None: """ pass + def test_get_purge_job(self) -> None: + """Test case for get_purge_job + + Get a memory-space purge job [Cloud-only] + """ + pass + def test_replace_tags(self) -> None: """Test case for replace_tags @@ -83,6 +97,13 @@ def test_replace_tags(self) -> None: """ pass + def test_request_purge(self) -> None: + """Test case for request_purge + + Request a memory-space purge (step 1 of 2) [Cloud-only] + """ + pass + def test_retrieve_context(self) -> None: """Test case for retrieve_context diff --git a/test/test_mongo_value.py b/test/test_mongo_value.py new file mode 100644 index 0000000..ae6ea70 --- /dev/null +++ b/test/test_mongo_value.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from everos_cloud.models.mongo_value import MongoValue + +class TestMongoValue(unittest.TestCase): + """MongoValue unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MongoValue: + """Test MongoValue + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `MongoValue` + """ + model = MongoValue() + if include_optional: + return MongoValue( + ) + else: + return MongoValue( + ) + """ + + def testMongoValue(self): + """Test MongoValue""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_purge_confirm_input.py b/test/test_purge_confirm_input.py new file mode 100644 index 0000000..7c7756c --- /dev/null +++ b/test/test_purge_confirm_input.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from everos_cloud.models.purge_confirm_input import PurgeConfirmInput + +class TestPurgeConfirmInput(unittest.TestCase): + """PurgeConfirmInput unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PurgeConfirmInput: + """Test PurgeConfirmInput + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `PurgeConfirmInput` + """ + model = PurgeConfirmInput() + if include_optional: + return PurgeConfirmInput( + nonce = 'z0123456789101112131415' + ) + else: + return PurgeConfirmInput( + nonce = 'z0123456789101112131415', + ) + """ + + def testPurgeConfirmInput(self): + """Test PurgeConfirmInput""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_purge_job_data.py b/test/test_purge_job_data.py new file mode 100644 index 0000000..530f8dd --- /dev/null +++ b/test/test_purge_job_data.py @@ -0,0 +1,71 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from everos_cloud.models.purge_job_data import PurgeJobData + +class TestPurgeJobData(unittest.TestCase): + """PurgeJobData unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PurgeJobData: + """Test PurgeJobData + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `PurgeJobData` + """ + model = PurgeJobData() + if include_optional: + return PurgeJobData( + job_id = '', + status = 'queued', + scope = 'space', + app_id = '', + project_id = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + started_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + heartbeat_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + finished_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + steps = [ + everos_cloud.models.purge_step_data.PurgeStepData( + store = '', + state = 'pending', + deleted = 56, + error = '', ) + ] + ) + else: + return PurgeJobData( + job_id = '', + status = 'queued', + scope = 'space', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ) + """ + + def testPurgeJobData(self): + """Test PurgeJobData""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_purge_request_data.py b/test/test_purge_request_data.py new file mode 100644 index 0000000..6e051bf --- /dev/null +++ b/test/test_purge_request_data.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from everos_cloud.models.purge_request_data import PurgeRequestData + +class TestPurgeRequestData(unittest.TestCase): + """PurgeRequestData unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PurgeRequestData: + """Test PurgeRequestData + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `PurgeRequestData` + """ + model = PurgeRequestData() + if include_optional: + return PurgeRequestData( + nonce = '', + expires_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + scope = 'space', + app_id = '', + project_id = '', + summary = everos_cloud.models.purge_summary.PurgeSummary( + mongo = { + 'key' : null + }, + mongo_total = 56, + elasticsearch_total = 56, + milvus_total = 56, + complete = True, + counted_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + comment = '', + error = '', ) + ) + else: + return PurgeRequestData( + nonce = '', + expires_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + scope = 'space', + summary = everos_cloud.models.purge_summary.PurgeSummary( + mongo = { + 'key' : null + }, + mongo_total = 56, + elasticsearch_total = 56, + milvus_total = 56, + complete = True, + counted_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + comment = '', + error = '', ), + ) + """ + + def testPurgeRequestData(self): + """Test PurgeRequestData""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_purge_request_input.py b/test/test_purge_request_input.py new file mode 100644 index 0000000..7d7de09 --- /dev/null +++ b/test/test_purge_request_input.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from everos_cloud.models.purge_request_input import PurgeRequestInput + +class TestPurgeRequestInput(unittest.TestCase): + """PurgeRequestInput unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PurgeRequestInput: + """Test PurgeRequestInput + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `PurgeRequestInput` + """ + model = PurgeRequestInput() + if include_optional: + return PurgeRequestInput( + scope = 'space', + app_id = '', + project_id = '' + ) + else: + return PurgeRequestInput( + scope = 'space', + ) + """ + + def testPurgeRequestInput(self): + """Test PurgeRequestInput""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_purge_step_data.py b/test/test_purge_step_data.py new file mode 100644 index 0000000..539705b --- /dev/null +++ b/test/test_purge_step_data.py @@ -0,0 +1,57 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from everos_cloud.models.purge_step_data import PurgeStepData + +class TestPurgeStepData(unittest.TestCase): + """PurgeStepData unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PurgeStepData: + """Test PurgeStepData + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `PurgeStepData` + """ + model = PurgeStepData() + if include_optional: + return PurgeStepData( + store = '', + state = 'pending', + deleted = 56, + error = '' + ) + else: + return PurgeStepData( + store = '', + state = 'pending', + ) + """ + + def testPurgeStepData(self): + """Test PurgeStepData""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_purge_summary.py b/test/test_purge_summary.py new file mode 100644 index 0000000..7cb0d38 --- /dev/null +++ b/test/test_purge_summary.py @@ -0,0 +1,70 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from everos_cloud.models.purge_summary import PurgeSummary + +class TestPurgeSummary(unittest.TestCase): + """PurgeSummary unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PurgeSummary: + """Test PurgeSummary + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `PurgeSummary` + """ + model = PurgeSummary() + if include_optional: + return PurgeSummary( + mongo = { + 'key' : null + }, + mongo_total = 56, + elasticsearch_total = 56, + milvus_total = 56, + complete = True, + counted_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + comment = '', + error = '' + ) + else: + return PurgeSummary( + mongo = { + 'key' : null + }, + mongo_total = 56, + elasticsearch_total = 56, + milvus_total = 56, + complete = True, + counted_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + comment = '', + ) + """ + + def testPurgeSummary(self): + """Test PurgeSummary""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_success_envelope_delete_by_ids_data.py b/test/test_success_envelope_delete_by_ids_data.py index 5fe7e8f..79b1210 100644 --- a/test/test_success_envelope_delete_by_ids_data.py +++ b/test/test_success_envelope_delete_by_ids_data.py @@ -39,14 +39,16 @@ def make_instance(self, include_optional) -> SuccessEnvelopeDeleteByIdsData: request_id = '', data = everos_cloud.models.delete_by_ids_data.DeleteByIdsData( memory_type = '', - success = True, ) + success = True, + deleted = 56, ) ) else: return SuccessEnvelopeDeleteByIdsData( request_id = '', data = everos_cloud.models.delete_by_ids_data.DeleteByIdsData( memory_type = '', - success = True, ), + success = True, + deleted = 56, ), ) """ diff --git a/test/test_success_envelope_purge_job_data.py b/test/test_success_envelope_purge_job_data.py new file mode 100644 index 0000000..f65a58d --- /dev/null +++ b/test/test_success_envelope_purge_job_data.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from everos_cloud.models.success_envelope_purge_job_data import SuccessEnvelopePurgeJobData + +class TestSuccessEnvelopePurgeJobData(unittest.TestCase): + """SuccessEnvelopePurgeJobData unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SuccessEnvelopePurgeJobData: + """Test SuccessEnvelopePurgeJobData + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `SuccessEnvelopePurgeJobData` + """ + model = SuccessEnvelopePurgeJobData() + if include_optional: + return SuccessEnvelopePurgeJobData( + request_id = '', + data = everos_cloud.models.purge_job_data.PurgeJobData( + job_id = '', + status = 'queued', + scope = 'space', + app_id = '', + project_id = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + started_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + heartbeat_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + finished_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + steps = [ + everos_cloud.models.purge_step_data.PurgeStepData( + store = '', + state = 'pending', + deleted = 56, + error = '', ) + ], ) + ) + else: + return SuccessEnvelopePurgeJobData( + request_id = '', + data = everos_cloud.models.purge_job_data.PurgeJobData( + job_id = '', + status = 'queued', + scope = 'space', + app_id = '', + project_id = '', + created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + started_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + heartbeat_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + finished_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + steps = [ + everos_cloud.models.purge_step_data.PurgeStepData( + store = '', + state = 'pending', + deleted = 56, + error = '', ) + ], ), + ) + """ + + def testSuccessEnvelopePurgeJobData(self): + """Test SuccessEnvelopePurgeJobData""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_success_envelope_purge_request_data.py b/test/test_success_envelope_purge_request_data.py new file mode 100644 index 0000000..9b6cc7c --- /dev/null +++ b/test/test_success_envelope_purge_request_data.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + EverOS Cloud Memory API + + Official Python client for the EverOS Cloud Memory API. Add, search, retrieve, and manage long-term memory for your AI applications over a typed interface (pydantic v2, with full type hints). Install and usage guides: https://github.com/EverMind-AI/everos-cloud-sdk-python + + The version of the OpenAPI document: 2.0.0 + Contact: service@evermind.ai + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from everos_cloud.models.success_envelope_purge_request_data import SuccessEnvelopePurgeRequestData + +class TestSuccessEnvelopePurgeRequestData(unittest.TestCase): + """SuccessEnvelopePurgeRequestData unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SuccessEnvelopePurgeRequestData: + """Test SuccessEnvelopePurgeRequestData + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `SuccessEnvelopePurgeRequestData` + """ + model = SuccessEnvelopePurgeRequestData() + if include_optional: + return SuccessEnvelopePurgeRequestData( + request_id = '', + data = everos_cloud.models.purge_request_data.PurgeRequestData( + nonce = '', + expires_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + scope = 'space', + app_id = '', + project_id = '', + summary = everos_cloud.models.purge_summary.PurgeSummary( + mongo = { + 'key' : null + }, + mongo_total = 56, + elasticsearch_total = 56, + milvus_total = 56, + complete = True, + counted_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + comment = '', + error = '', ), ) + ) + else: + return SuccessEnvelopePurgeRequestData( + request_id = '', + data = everos_cloud.models.purge_request_data.PurgeRequestData( + nonce = '', + expires_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + scope = 'space', + app_id = '', + project_id = '', + summary = everos_cloud.models.purge_summary.PurgeSummary( + mongo = { + 'key' : null + }, + mongo_total = 56, + elasticsearch_total = 56, + milvus_total = 56, + complete = True, + counted_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + comment = '', + error = '', ), ), + ) + """ + + def testSuccessEnvelopePurgeRequestData(self): + """Test SuccessEnvelopePurgeRequestData""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_update_input.py b/test/test_update_input.py index 6dd2b79..89f2d1c 100644 --- a/test/test_update_input.py +++ b/test/test_update_input.py @@ -39,7 +39,8 @@ def make_instance(self, include_optional) -> UpdateInput: memory_type = '0', memory_id = '0', patch = { }, - reason = { } + reason = { }, + user_id = '0' ) else: return UpdateInput(