diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8068c845..2c863dab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -182,6 +182,83 @@ jobs: path: hindsight-cli/target/release/hindsight retention-days: 1 + test-rust-cli: + runs-on: ubuntu-latest + needs: build-rust-cli + env: + HINDSIGHT_API_LLM_PROVIDER: groq + HINDSIGHT_API_LLM_API_KEY: ${{ secrets.GROQ_API_KEY }} + HINDSIGHT_API_LLM_MODEL: openai/gpt-oss-20b + HINDSIGHT_API_URL: http://localhost:8888 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + UV_INDEX: pytorch=https://download.pytorch.org/whl/cpu + + steps: + - uses: actions/checkout@v4 + + - name: Download CLI artifact + uses: actions/download-artifact@v4 + with: + name: hindsight-cli + path: /tmp/cli + + - name: Make CLI executable + run: chmod +x /tmp/cli/hindsight + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + prune-cache: false + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: ".python-version" + + - name: Build API + working-directory: ./hindsight-api + run: uv build + + - name: Install API dependencies + working-directory: ./hindsight-api + run: uv sync --no-install-project --index-strategy unsafe-best-match + + - name: Create .env file + run: | + cat > .env << EOF + HINDSIGHT_API_LLM_PROVIDER=${{ env.HINDSIGHT_API_LLM_PROVIDER }} + HINDSIGHT_API_LLM_API_KEY=${{ env.HINDSIGHT_API_LLM_API_KEY }} + HINDSIGHT_API_LLM_MODEL=${{ env.HINDSIGHT_API_LLM_MODEL }} + EOF + + - name: Start API server + run: | + ./scripts/dev/start-api.sh > /tmp/api-server.log 2>&1 & + echo "Waiting for API server to be ready..." + for i in {1..60}; do + if curl -sf http://localhost:8888/health > /dev/null 2>&1; then + echo "API server is ready after ${i}s" + break + fi + if [ $i -eq 60 ]; then + echo "API server failed to start after 60s" + cat /tmp/api-server.log + exit 1 + fi + sleep 1 + done + + - name: Run CLI smoke test + run: | + HINDSIGHT_CLI=/tmp/cli/hindsight ./hindsight-cli/smoke-test.sh + + - name: Show API server logs + if: always() + run: | + echo "=== API Server Logs ===" + cat /tmp/api-server.log || echo "No API server log found" + lint-helm-chart: runs-on: ubuntu-latest diff --git a/hindsight-api/hindsight_api/api/http.py b/hindsight-api/hindsight_api/api/http.py index df900f4b..c6a608f8 100644 --- a/hindsight-api/hindsight_api/api/http.py +++ b/hindsight-api/hindsight_api/api/http.py @@ -689,6 +689,26 @@ class DocumentResponse(BaseModel): memory_unit_count: int +class DeleteDocumentResponse(BaseModel): + """Response model for delete document endpoint.""" + + model_config = ConfigDict( + json_schema_extra={ + "example": { + "success": True, + "message": "Document 'session_1' and 5 associated memory units deleted successfully", + "document_id": "session_1", + "memory_units_deleted": 5, + } + } + ) + + success: bool + message: str + document_id: str + memory_units_deleted: int + + class ChunkResponse(BaseModel): """Response model for get chunk endpoint.""" @@ -725,6 +745,108 @@ class DeleteResponse(BaseModel): deleted_count: int | None = None +class BankStatsResponse(BaseModel): + """Response model for bank statistics endpoint.""" + + model_config = ConfigDict( + json_schema_extra={ + "example": { + "bank_id": "user123", + "total_nodes": 150, + "total_links": 300, + "total_documents": 10, + "nodes_by_fact_type": {"fact": 100, "preference": 30, "observation": 20}, + "links_by_link_type": {"temporal": 150, "semantic": 100, "entity": 50}, + "links_by_fact_type": {"fact": 200, "preference": 60, "observation": 40}, + "links_breakdown": {"fact": {"temporal": 100, "semantic": 60, "entity": 40}}, + "pending_operations": 2, + "failed_operations": 0, + } + } + ) + + bank_id: str + total_nodes: int + total_links: int + total_documents: int + nodes_by_fact_type: dict[str, int] + links_by_link_type: dict[str, int] + links_by_fact_type: dict[str, int] + links_breakdown: dict[str, dict[str, int]] + pending_operations: int + failed_operations: int + + +class OperationResponse(BaseModel): + """Response model for a single async operation.""" + + model_config = ConfigDict( + json_schema_extra={ + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "task_type": "retain", + "items_count": 5, + "document_id": "meeting-notes-2024", + "created_at": "2024-01-15T10:30:00Z", + "status": "pending", + "error_message": None, + } + } + ) + + id: str + task_type: str + items_count: int + document_id: str | None + created_at: str + status: str + error_message: str | None + + +class OperationsListResponse(BaseModel): + """Response model for list operations endpoint.""" + + model_config = ConfigDict( + json_schema_extra={ + "example": { + "bank_id": "user123", + "operations": [ + { + "id": "550e8400-e29b-41d4-a716-446655440000", + "task_type": "retain", + "items_count": 5, + "document_id": None, + "created_at": "2024-01-15T10:30:00Z", + "status": "pending", + "error_message": None, + } + ], + } + } + ) + + bank_id: str + operations: list[OperationResponse] + + +class CancelOperationResponse(BaseModel): + """Response model for cancel operation endpoint.""" + + model_config = ConfigDict( + json_schema_extra={ + "example": { + "success": True, + "message": "Operation 550e8400-e29b-41d4-a716-446655440000 cancelled", + "operation_id": "550e8400-e29b-41d4-a716-446655440000", + } + } + ) + + success: bool + message: str + operation_id: str + + def create_app( memory: MemoryEngine, initialize_memory: bool = True, @@ -1142,6 +1264,7 @@ async def api_list_banks(request_context: RequestContext = Depends(get_request_c @app.get( "/v1/default/banks/{bank_id}/stats", + response_model=BankStatsResponse, summary="Get statistics for memory bank", description="Get statistics about nodes and links for a specific agent", operation_id="get_agent_stats", @@ -1242,18 +1365,18 @@ async def api_stats(bank_id: str): total_nodes = sum(nodes_by_type.values()) total_links = sum(links_by_type.values()) - return { - "bank_id": bank_id, - "total_nodes": total_nodes, - "total_links": total_links, - "total_documents": total_documents, - "nodes_by_fact_type": nodes_by_type, - "links_by_link_type": links_by_type, - "links_by_fact_type": links_by_fact_type, - "links_breakdown": links_breakdown, - "pending_operations": pending_operations, - "failed_operations": failed_operations, - } + return BankStatsResponse( + bank_id=bank_id, + total_nodes=total_nodes, + total_links=total_links, + total_documents=total_documents, + nodes_by_fact_type=nodes_by_type, + links_by_link_type=links_by_type, + links_by_fact_type=links_by_fact_type, + links_breakdown=links_breakdown, + pending_operations=pending_operations, + failed_operations=failed_operations, + ) except Exception as e: import traceback @@ -1477,6 +1600,7 @@ async def api_get_chunk(chunk_id: str, request_context: RequestContext = Depends @app.delete( "/v1/default/banks/{bank_id}/documents/{document_id}", + response_model=DeleteDocumentResponse, summary="Delete a document", description="Delete a document and all its associated memory units and links.\n\n" "This will cascade delete:\n" @@ -1503,12 +1627,12 @@ async def api_delete_document( if result["document_deleted"] == 0: raise HTTPException(status_code=404, detail="Document not found") - return { - "success": True, - "message": f"Document '{document_id}' and {result['memory_units_deleted']} associated memory units deleted successfully", - "document_id": document_id, - "memory_units_deleted": result["memory_units_deleted"], - } + return DeleteDocumentResponse( + success=True, + message=f"Document '{document_id}' and {result['memory_units_deleted']} associated memory units deleted successfully", + document_id=document_id, + memory_units_deleted=result["memory_units_deleted"], + ) except HTTPException: raise except Exception as e: @@ -1520,6 +1644,7 @@ async def api_delete_document( @app.get( "/v1/default/banks/{bank_id}/operations", + response_model=OperationsListResponse, summary="List async operations", description="Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations", operation_id="list_operations", @@ -1529,10 +1654,10 @@ async def api_list_operations(bank_id: str, request_context: RequestContext = De """List all async operations (pending and failed) for a memory bank.""" try: operations = await app.state.memory.list_operations(bank_id, request_context=request_context) - return { - "bank_id": bank_id, - "operations": operations, - } + return OperationsListResponse( + bank_id=bank_id, + operations=[OperationResponse(**op) for op in operations], + ) except Exception as e: import traceback @@ -1542,6 +1667,7 @@ async def api_list_operations(bank_id: str, request_context: RequestContext = De @app.delete( "/v1/default/banks/{bank_id}/operations/{operation_id}", + response_model=CancelOperationResponse, summary="Cancel a pending async operation", description="Cancel a pending async operation by removing it from the queue", operation_id="cancel_operation", @@ -1559,7 +1685,7 @@ async def api_cancel_operation( raise HTTPException(status_code=400, detail=f"Invalid operation_id format: {operation_id}") result = await app.state.memory.cancel_operation(bank_id, operation_id, request_context=request_context) - return result + return CancelOperationResponse(**result) except ValueError as e: raise HTTPException(status_code=404, detail=str(e)) except Exception as e: diff --git a/hindsight-api/hindsight_api/engine/memory_engine.py b/hindsight-api/hindsight_api/engine/memory_engine.py index 966c898a..d7d417d8 100644 --- a/hindsight-api/hindsight_api/engine/memory_engine.py +++ b/hindsight-api/hindsight_api/engine/memory_engine.py @@ -695,7 +695,14 @@ async def health_check(self) -> dict: Returns: dict with status and optional error message + + Note: + Returns unhealthy until initialize() has completed successfully. """ + # Not healthy until fully initialized + if not self._initialized: + return {"status": "unhealthy", "reason": "not_initialized"} + try: pool = await self._get_pool() async with pool.acquire() as conn: diff --git a/hindsight-api/hindsight_api/engine/retain/orchestrator.py b/hindsight-api/hindsight_api/engine/retain/orchestrator.py index 26ccbd4f..133d1090 100644 --- a/hindsight-api/hindsight_api/engine/retain/orchestrator.py +++ b/hindsight-api/hindsight_api/engine/retain/orchestrator.py @@ -106,9 +106,62 @@ async def retain_batch( ) if not extracted_facts: + # Still need to create document if document_id was provided + async with acquire_with_retry(pool) as conn: + async with conn.transaction(): + await fact_storage.ensure_bank_exists(conn, bank_id) + + # Handle document tracking even with no facts + if document_id: + combined_content = "\n".join([c.get("content", "") for c in contents_dicts]) + retain_params = {} + if contents_dicts: + first_item = contents_dicts[0] + if first_item.get("context"): + retain_params["context"] = first_item["context"] + if first_item.get("event_date"): + retain_params["event_date"] = ( + first_item["event_date"].isoformat() + if hasattr(first_item["event_date"], "isoformat") + else str(first_item["event_date"]) + ) + if first_item.get("metadata"): + retain_params["metadata"] = first_item["metadata"] + await fact_storage.handle_document_tracking( + conn, bank_id, document_id, combined_content, is_first_batch, retain_params + ) + else: + # Check for per-item document_ids + from collections import defaultdict + + contents_by_doc = defaultdict(list) + for idx, content_dict in enumerate(contents_dicts): + doc_id = content_dict.get("document_id") + if doc_id: + contents_by_doc[doc_id].append((idx, content_dict)) + + for doc_id, doc_contents in contents_by_doc.items(): + combined_content = "\n".join([c.get("content", "") for _, c in doc_contents]) + retain_params = {} + if doc_contents: + first_item = doc_contents[0][1] + if first_item.get("context"): + retain_params["context"] = first_item["context"] + if first_item.get("event_date"): + retain_params["event_date"] = ( + first_item["event_date"].isoformat() + if hasattr(first_item["event_date"], "isoformat") + else str(first_item["event_date"]) + ) + if first_item.get("metadata"): + retain_params["metadata"] = first_item["metadata"] + await fact_storage.handle_document_tracking( + conn, bank_id, doc_id, combined_content, is_first_batch, retain_params + ) + total_time = time.time() - start_time logger.info( - f"RETAIN_BATCH COMPLETE: 0 facts extracted from {len(contents)} contents in {total_time:.3f}s (nothing to store)" + f"RETAIN_BATCH COMPLETE: 0 facts extracted from {len(contents)} contents in {total_time:.3f}s (document tracked, no facts)" ) return [[] for _ in contents] diff --git a/hindsight-cli/.github/workflows/release.yml b/hindsight-cli/.github/workflows/release.yml deleted file mode 100644 index d02eadb1..00000000 --- a/hindsight-cli/.github/workflows/release.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Release - -on: - push: - tags: - - 'v*' - workflow_dispatch: - -jobs: - build: - name: Build ${{ matrix.target }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - artifact_name: memora - release_name: memora-linux-x86_64 - - os: ubuntu-latest - target: aarch64-unknown-linux-gnu - artifact_name: memora - release_name: memora-linux-arm64 - - os: macos-latest - target: x86_64-apple-darwin - artifact_name: memora - release_name: memora-macos-x86_64 - - os: macos-latest - target: aarch64-apple-darwin - artifact_name: memora - release_name: memora-macos-arm64 - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ matrix.target }} - - - name: Install cross-compilation tools (Linux ARM64) - if: matrix.target == 'aarch64-unknown-linux-gnu' - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu - - - name: Build - run: cargo build --release --target ${{ matrix.target }} - - - name: Strip binary (Linux) - if: runner.os == 'Linux' - run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }} - - - name: Strip binary (macOS) - if: runner.os == 'macOS' - run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }} - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.release_name }} - path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }} - - release: - name: Create Release - needs: build - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Download all artifacts - uses: actions/download-artifact@v4 - with: - path: artifacts - - - name: Create checksums - run: | - cd artifacts - for dir in */; do - cd "$dir" - sha256sum * > SHA256SUMS - cd .. - done - - - name: Create Release - uses: softprops/action-gh-release@v1 - with: - files: | - artifacts/memora-linux-x86_64/memora - artifacts/memora-linux-arm64/memora - artifacts/memora-macos-x86_64/memora - artifacts/memora-macos-arm64/memora - artifacts/*/SHA256SUMS - draft: false - prerelease: false - generate_release_notes: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/hindsight-cli/smoke-test.sh b/hindsight-cli/smoke-test.sh new file mode 100755 index 00000000..85dd9857 --- /dev/null +++ b/hindsight-cli/smoke-test.sh @@ -0,0 +1,128 @@ +#!/bin/bash +# CLI smoke test - verifies basic CLI functionality against a running API server +# +# Prerequisites: +# - hindsight CLI must be in PATH or HINDSIGHT_CLI env var set +# - API server must be running at HINDSIGHT_API_URL (default: http://localhost:8888) +# +# Usage: +# ./hindsight-cli/smoke-test.sh +# HINDSIGHT_CLI=/path/to/hindsight ./hindsight-cli/smoke-test.sh + +set -e + +# Configuration +HINDSIGHT_CLI="${HINDSIGHT_CLI:-hindsight}" +export HINDSIGHT_API_URL="${HINDSIGHT_API_URL:-http://localhost:8888}" +TEST_BANK="cli-smoke-test-$(date +%s)" + +echo "=== Hindsight CLI Smoke Test ===" +echo "CLI: $HINDSIGHT_CLI" +echo "API URL: $HINDSIGHT_API_URL" +echo "Test bank: $TEST_BANK" +echo "" + +# Helper function +run_test() { + local name="$1" + shift + echo -n "Testing: $name... " + if "$@" > /tmp/cli-test-output.txt 2>&1; then + echo "OK" + return 0 + else + echo "FAILED" + echo " Command: $*" + echo " Output:" + cat /tmp/cli-test-output.txt | sed 's/^/ /' + return 1 + fi +} + +run_test_output() { + local name="$1" + local expected="$2" + shift 2 + echo -n "Testing: $name... " + if "$@" > /tmp/cli-test-output.txt 2>&1; then + if grep -qi "$expected" /tmp/cli-test-output.txt; then + echo "OK" + return 0 + else + echo "FAILED (expected '$expected' not found)" + echo " Command: $*" + echo " Output:" + cat /tmp/cli-test-output.txt | sed 's/^/ /' + return 1 + fi + else + echo "FAILED" + echo " Command: $*" + echo " Output:" + cat /tmp/cli-test-output.txt | sed 's/^/ /' + return 1 + fi +} + +cleanup() { + echo "" + echo "Cleaning up test bank..." + "$HINDSIGHT_CLI" bank delete "$TEST_BANK" 2>/dev/null || true +} +trap cleanup EXIT + +FAILED=0 + +# Test 1: Version +run_test "version" "$HINDSIGHT_CLI" --version || FAILED=1 + +# Test 2: Help +run_test "help" "$HINDSIGHT_CLI" --help || FAILED=1 + +# Test 3: Configure help +run_test "configure help" "$HINDSIGHT_CLI" configure --help || FAILED=1 + +# Test 4: List banks (JSON output) +run_test "list banks" "$HINDSIGHT_CLI" bank list -o json || FAILED=1 + +# Test 5: Set bank name (creates the bank) +run_test "set bank name" "$HINDSIGHT_CLI" bank name "$TEST_BANK" "CLI Smoke Test Bank" || FAILED=1 + +# Test 6: Get bank disposition +run_test_output "get bank disposition" "CLI Smoke Test Bank" "$HINDSIGHT_CLI" bank disposition "$TEST_BANK" || FAILED=1 + +# Test 7: Retain memory +run_test "retain memory" "$HINDSIGHT_CLI" memory retain "$TEST_BANK" "Alice is a software engineer who loves Rust programming" || FAILED=1 + +# Test 8: Retain more memories +run_test "retain more memories" "$HINDSIGHT_CLI" memory retain "$TEST_BANK" "Bob is Alice's colleague who prefers Python" || FAILED=1 + +# Test 9: Recall memories +run_test_output "recall memories" "Alice" "$HINDSIGHT_CLI" memory recall "$TEST_BANK" "Who is Alice?" || FAILED=1 + +# Test 10: Reflect on memories +run_test_output "reflect" "Alice" "$HINDSIGHT_CLI" memory reflect "$TEST_BANK" "What do you know about Alice?" || FAILED=1 + +# Test 11: Get bank stats +run_test "bank stats" "$HINDSIGHT_CLI" bank stats "$TEST_BANK" || FAILED=1 + +# Test 12: List entities +run_test "list entities" "$HINDSIGHT_CLI" entity list "$TEST_BANK" || FAILED=1 + +# Test 13: List documents +run_test "list documents" "$HINDSIGHT_CLI" document list "$TEST_BANK" || FAILED=1 + +# Test 14: Clear memories +run_test "clear memories" "$HINDSIGHT_CLI" memory clear "$TEST_BANK" || FAILED=1 + +# Test 15: Delete bank +run_test "delete bank" "$HINDSIGHT_CLI" bank delete "$TEST_BANK" || FAILED=1 + +echo "" +if [ $FAILED -eq 0 ]; then + echo "=== All smoke tests passed! ===" + exit 0 +else + echo "=== Some smoke tests failed ===" + exit 1 +fi diff --git a/hindsight-cli/src/api.rs b/hindsight-cli/src/api.rs index 21753666..eb42e324 100644 --- a/hindsight-cli/src/api.rs +++ b/hindsight-cli/src/api.rs @@ -89,14 +89,14 @@ impl ApiClient { pub fn list_agents(&self, _verbose: bool) -> Result> { self.runtime.block_on(async { - let response = self.client.list_banks().await?; + let response = self.client.list_banks(None).await?; Ok(response.into_inner().banks) }) } pub fn get_profile(&self, agent_id: &str, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.get_bank_profile(agent_id).await?; + let response = self.client.get_bank_profile(agent_id, None).await?; Ok(response.into_inner()) }) } @@ -105,7 +105,9 @@ impl ApiClient { self.runtime.block_on(async { let response = self.client.get_agent_stats(agent_id).await?; let value = response.into_inner(); - let stats: AgentStats = serde_json::from_value(value)?; + // Convert to JSON Value first, then parse into our type + let json_value = serde_json::to_value(&value)?; + let stats: AgentStats = serde_json::from_value(json_value)?; Ok(stats) }) } @@ -117,7 +119,7 @@ impl ApiClient { background: None, disposition: None, }; - let response = self.client.create_or_update_bank(agent_id, &request).await?; + let response = self.client.create_or_update_bank(agent_id, None, &request).await?; Ok(response.into_inner()) }) } @@ -128,7 +130,7 @@ impl ApiClient { content: content.to_string(), update_disposition, }; - let response = self.client.add_bank_background(agent_id, &request).await?; + let response = self.client.add_bank_background(agent_id, None, &request).await?; Ok(response.into_inner()) }) } @@ -138,21 +140,21 @@ impl ApiClient { eprintln!("Request body: {}", serde_json::to_string_pretty(request).unwrap_or_default()); } self.runtime.block_on(async { - let response = self.client.recall_memories(agent_id, request).await?; + let response = self.client.recall_memories(agent_id, None, request).await?; Ok(response.into_inner()) }) } pub fn reflect(&self, agent_id: &str, request: &types::ReflectRequest, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.reflect(agent_id, request).await?; + let response = self.client.reflect(agent_id, None, request).await?; Ok(response.into_inner()) }) } pub fn retain(&self, agent_id: &str, request: &types::RetainRequest, _async_mode: bool, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.retain_memories(agent_id, request).await?; + let response = self.client.retain_memories(agent_id, None, request).await?; let result = response.into_inner(); Ok(MemoryPutResult { success: result.success, @@ -170,7 +172,7 @@ impl ApiClient { pub fn clear_memories(&self, agent_id: &str, fact_type: Option<&str>, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.clear_bank_memories(agent_id, fact_type).await?; + let response = self.client.clear_bank_memories(agent_id, None, Some(fact_type)).await?; Ok(response.into_inner()) }) } @@ -181,7 +183,8 @@ impl ApiClient { agent_id, limit.map(|l| l as i64), offset.map(|o| o as i64), - q + q, + None, ).await?; Ok(response.into_inner()) }) @@ -189,69 +192,79 @@ impl ApiClient { pub fn get_document(&self, agent_id: &str, document_id: &str, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.get_document(agent_id, document_id).await?; + let response = self.client.get_document(agent_id, document_id, None).await?; Ok(response.into_inner()) }) } pub fn delete_document(&self, agent_id: &str, document_id: &str, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.delete_document(agent_id, document_id).await?; + let response = self.client.delete_document(agent_id, document_id, None).await?; let value = response.into_inner(); - let result: types::DeleteResponse = serde_json::from_value(value)?; - Ok(result) + // Convert typed response to DeleteResponse + Ok(types::DeleteResponse { + deleted_count: Some(value.memory_units_deleted), + message: Some(value.message), + success: value.success, + }) }) } pub fn list_operations(&self, agent_id: &str, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.list_operations(agent_id).await?; + let response = self.client.list_operations(agent_id, None).await?; let value = response.into_inner(); - let ops: OperationsResponse = serde_json::from_value(value)?; + // Convert to JSON Value first, then parse into our type + let json_value = serde_json::to_value(&value)?; + let ops: OperationsResponse = serde_json::from_value(json_value)?; Ok(ops) }) } pub fn cancel_operation(&self, agent_id: &str, operation_id: &str, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.cancel_operation(agent_id, operation_id).await?; + let response = self.client.cancel_operation(agent_id, operation_id, None).await?; let value = response.into_inner(); - let result: types::DeleteResponse = serde_json::from_value(value)?; - Ok(result) + // Convert typed response to DeleteResponse + Ok(types::DeleteResponse { + deleted_count: None, + message: Some(value.message), + success: value.success, + }) }) } pub fn list_memories(&self, bank_id: &str, type_filter: Option<&str>, q: Option<&str>, limit: Option, offset: Option, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.list_memories(bank_id, limit, offset, q, type_filter).await?; + let response = self.client.list_memories(bank_id, limit, offset, q, type_filter, None).await?; Ok(response.into_inner()) }) } pub fn list_entities(&self, bank_id: &str, limit: Option, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.list_entities(bank_id, limit).await?; + let response = self.client.list_entities(bank_id, limit, None).await?; Ok(response.into_inner()) }) } pub fn get_entity(&self, bank_id: &str, entity_id: &str, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.get_entity(bank_id, entity_id).await?; + let response = self.client.get_entity(bank_id, entity_id, None).await?; Ok(response.into_inner()) }) } pub fn regenerate_entity(&self, bank_id: &str, entity_id: &str, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.regenerate_entity_observations(bank_id, entity_id).await?; + let response = self.client.regenerate_entity_observations(bank_id, entity_id, None).await?; Ok(response.into_inner()) }) } pub fn delete_bank(&self, bank_id: &str, _verbose: bool) -> Result { self.runtime.block_on(async { - let response = self.client.delete_bank(bank_id).await?; + let response = self.client.delete_bank(bank_id, None).await?; Ok(response.into_inner()) }) } diff --git a/hindsight-clients/python/.openapi-generator/FILES b/hindsight-clients/python/.openapi-generator/FILES index 6eda74f1..a16951aa 100644 --- a/hindsight-clients/python/.openapi-generator/FILES +++ b/hindsight-clients/python/.openapi-generator/FILES @@ -1,7 +1,11 @@ hindsight_client_api/__init__.py hindsight_client_api/api/__init__.py -hindsight_client_api/api/default_api.py +hindsight_client_api/api/banks_api.py +hindsight_client_api/api/documents_api.py +hindsight_client_api/api/entities_api.py +hindsight_client_api/api/memory_api.py hindsight_client_api/api/monitoring_api.py +hindsight_client_api/api/operations_api.py hindsight_client_api/api_client.py hindsight_client_api/api_response.py hindsight_client_api/configuration.py @@ -10,15 +14,20 @@ hindsight_client_api/docs/BackgroundResponse.md hindsight_client_api/docs/BankListItem.md hindsight_client_api/docs/BankListResponse.md hindsight_client_api/docs/BankProfileResponse.md +hindsight_client_api/docs/BankStatsResponse.md +hindsight_client_api/docs/BanksApi.md hindsight_client_api/docs/Budget.md +hindsight_client_api/docs/CancelOperationResponse.md hindsight_client_api/docs/ChunkData.md hindsight_client_api/docs/ChunkIncludeOptions.md hindsight_client_api/docs/ChunkResponse.md hindsight_client_api/docs/CreateBankRequest.md -hindsight_client_api/docs/DefaultApi.md +hindsight_client_api/docs/DeleteDocumentResponse.md hindsight_client_api/docs/DeleteResponse.md hindsight_client_api/docs/DispositionTraits.md hindsight_client_api/docs/DocumentResponse.md +hindsight_client_api/docs/DocumentsApi.md +hindsight_client_api/docs/EntitiesApi.md hindsight_client_api/docs/EntityDetailResponse.md hindsight_client_api/docs/EntityIncludeOptions.md hindsight_client_api/docs/EntityListItem.md @@ -30,8 +39,12 @@ hindsight_client_api/docs/HTTPValidationError.md hindsight_client_api/docs/IncludeOptions.md hindsight_client_api/docs/ListDocumentsResponse.md hindsight_client_api/docs/ListMemoryUnitsResponse.md +hindsight_client_api/docs/MemoryApi.md hindsight_client_api/docs/MemoryItem.md hindsight_client_api/docs/MonitoringApi.md +hindsight_client_api/docs/OperationResponse.md +hindsight_client_api/docs/OperationsApi.md +hindsight_client_api/docs/OperationsListResponse.md hindsight_client_api/docs/RecallRequest.md hindsight_client_api/docs/RecallResponse.md hindsight_client_api/docs/RecallResult.md @@ -51,11 +64,14 @@ hindsight_client_api/models/background_response.py hindsight_client_api/models/bank_list_item.py hindsight_client_api/models/bank_list_response.py hindsight_client_api/models/bank_profile_response.py +hindsight_client_api/models/bank_stats_response.py hindsight_client_api/models/budget.py +hindsight_client_api/models/cancel_operation_response.py hindsight_client_api/models/chunk_data.py hindsight_client_api/models/chunk_include_options.py hindsight_client_api/models/chunk_response.py hindsight_client_api/models/create_bank_request.py +hindsight_client_api/models/delete_document_response.py hindsight_client_api/models/delete_response.py hindsight_client_api/models/disposition_traits.py hindsight_client_api/models/document_response.py @@ -71,6 +87,8 @@ hindsight_client_api/models/include_options.py hindsight_client_api/models/list_documents_response.py hindsight_client_api/models/list_memory_units_response.py hindsight_client_api/models/memory_item.py +hindsight_client_api/models/operation_response.py +hindsight_client_api/models/operations_list_response.py hindsight_client_api/models/recall_request.py hindsight_client_api/models/recall_response.py hindsight_client_api/models/recall_result.py @@ -90,15 +108,20 @@ hindsight_client_api/test/test_background_response.py hindsight_client_api/test/test_bank_list_item.py hindsight_client_api/test/test_bank_list_response.py hindsight_client_api/test/test_bank_profile_response.py +hindsight_client_api/test/test_bank_stats_response.py +hindsight_client_api/test/test_banks_api.py hindsight_client_api/test/test_budget.py +hindsight_client_api/test/test_cancel_operation_response.py hindsight_client_api/test/test_chunk_data.py hindsight_client_api/test/test_chunk_include_options.py hindsight_client_api/test/test_chunk_response.py hindsight_client_api/test/test_create_bank_request.py -hindsight_client_api/test/test_default_api.py +hindsight_client_api/test/test_delete_document_response.py hindsight_client_api/test/test_delete_response.py hindsight_client_api/test/test_disposition_traits.py hindsight_client_api/test/test_document_response.py +hindsight_client_api/test/test_documents_api.py +hindsight_client_api/test/test_entities_api.py hindsight_client_api/test/test_entity_detail_response.py hindsight_client_api/test/test_entity_include_options.py hindsight_client_api/test/test_entity_list_item.py @@ -110,8 +133,12 @@ hindsight_client_api/test/test_http_validation_error.py hindsight_client_api/test/test_include_options.py hindsight_client_api/test/test_list_documents_response.py hindsight_client_api/test/test_list_memory_units_response.py +hindsight_client_api/test/test_memory_api.py hindsight_client_api/test/test_memory_item.py hindsight_client_api/test/test_monitoring_api.py +hindsight_client_api/test/test_operation_response.py +hindsight_client_api/test/test_operations_api.py +hindsight_client_api/test/test_operations_list_response.py hindsight_client_api/test/test_recall_request.py hindsight_client_api/test/test_recall_response.py hindsight_client_api/test/test_recall_result.py diff --git a/hindsight-clients/python/hindsight_client/hindsight_client.py b/hindsight-clients/python/hindsight_client/hindsight_client.py index fdc6ba3f..dc8312cf 100644 --- a/hindsight-clients/python/hindsight_client/hindsight_client.py +++ b/hindsight-clients/python/hindsight_client/hindsight_client.py @@ -10,7 +10,7 @@ from datetime import datetime import hindsight_client_api -from hindsight_client_api.api import default_api +from hindsight_client_api.api import memory_api, banks_api from hindsight_client_api.models import ( recall_request, retain_request, @@ -74,7 +74,8 @@ def __init__(self, base_url: str, api_key: Optional[str] = None, timeout: float """ config = hindsight_client_api.Configuration(host=base_url, access_token=api_key) self._api_client = hindsight_client_api.ApiClient(config) - self._api = default_api.DefaultApi(self._api_client) + self._memory_api = memory_api.MemoryApi(self._api_client) + self._banks_api = banks_api.BanksApi(self._api_client) def __enter__(self): """Context manager entry.""" @@ -168,7 +169,7 @@ def retain_batch( async_=retain_async, ) - return _run_async(self._api.retain_memories(bank_id, request_obj)) + return _run_async(self._memory_api.retain_memories(bank_id, request_obj)) def recall( self, @@ -220,7 +221,7 @@ def recall( include=include_opts, ) - return _run_async(self._api.recall_memories(bank_id, request_obj)) + return _run_async(self._memory_api.recall_memories(bank_id, request_obj)) def reflect( self, @@ -247,7 +248,7 @@ def reflect( context=context, ) - return _run_async(self._api.reflect(bank_id, request_obj)) + return _run_async(self._memory_api.reflect(bank_id, request_obj)) def list_memories( self, @@ -258,7 +259,7 @@ def list_memories( offset: int = 0, ) -> ListMemoryUnitsResponse: """List memory units with pagination.""" - return _run_async(self._api.list_memories( + return _run_async(self._memory_api.list_memories( bank_id=bank_id, type=type, q=search_query, @@ -286,7 +287,7 @@ def create_bank( disposition=disposition_obj, ) - return _run_async(self._api.create_or_update_bank(bank_id, request_obj)) + return _run_async(self._banks_api.create_or_update_bank(bank_id, request_obj)) # Async methods (native async, no _run_async wrapper) @@ -326,7 +327,7 @@ async def aretain_batch( async_=retain_async, ) - return await self._api.retain_memories(bank_id, request_obj) + return await self._memory_api.retain_memories(bank_id, request_obj) async def aretain( self, @@ -386,7 +387,7 @@ async def arecall( trace=False, ) - response = await self._api.recall_memories(bank_id, request_obj) + response = await self._memory_api.recall_memories(bank_id, request_obj) return response.results if hasattr(response, 'results') else [] async def areflect( @@ -414,4 +415,4 @@ async def areflect( context=context, ) - return await self._api.reflect(bank_id, request_obj) + return await self._memory_api.reflect(bank_id, request_obj) diff --git a/hindsight-clients/python/hindsight_client_api/__init__.py b/hindsight-clients/python/hindsight_client_api/__init__.py index ca68c56b..ae8bca63 100644 --- a/hindsight-clients/python/hindsight_client_api/__init__.py +++ b/hindsight-clients/python/hindsight_client_api/__init__.py @@ -7,7 +7,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,8 +18,12 @@ # Define package exports __all__ = [ + "BanksApi", + "DocumentsApi", + "EntitiesApi", + "MemoryApi", "MonitoringApi", - "DefaultApi", + "OperationsApi", "ApiResponse", "ApiClient", "Configuration", @@ -34,11 +38,14 @@ "BankListItem", "BankListResponse", "BankProfileResponse", + "BankStatsResponse", "Budget", + "CancelOperationResponse", "ChunkData", "ChunkIncludeOptions", "ChunkResponse", "CreateBankRequest", + "DeleteDocumentResponse", "DeleteResponse", "DispositionTraits", "DocumentResponse", @@ -54,6 +61,8 @@ "ListDocumentsResponse", "ListMemoryUnitsResponse", "MemoryItem", + "OperationResponse", + "OperationsListResponse", "RecallRequest", "RecallResponse", "RecallResult", @@ -69,8 +78,12 @@ ] # import apis into sdk package +from hindsight_client_api.api.banks_api import BanksApi as BanksApi +from hindsight_client_api.api.documents_api import DocumentsApi as DocumentsApi +from hindsight_client_api.api.entities_api import EntitiesApi as EntitiesApi +from hindsight_client_api.api.memory_api import MemoryApi as MemoryApi from hindsight_client_api.api.monitoring_api import MonitoringApi as MonitoringApi -from hindsight_client_api.api.default_api import DefaultApi as DefaultApi +from hindsight_client_api.api.operations_api import OperationsApi as OperationsApi # import ApiClient from hindsight_client_api.api_response import ApiResponse as ApiResponse @@ -89,11 +102,14 @@ from hindsight_client_api.models.bank_list_item import BankListItem as BankListItem from hindsight_client_api.models.bank_list_response import BankListResponse as BankListResponse from hindsight_client_api.models.bank_profile_response import BankProfileResponse as BankProfileResponse +from hindsight_client_api.models.bank_stats_response import BankStatsResponse as BankStatsResponse from hindsight_client_api.models.budget import Budget as Budget +from hindsight_client_api.models.cancel_operation_response import CancelOperationResponse as CancelOperationResponse from hindsight_client_api.models.chunk_data import ChunkData as ChunkData from hindsight_client_api.models.chunk_include_options import ChunkIncludeOptions as ChunkIncludeOptions from hindsight_client_api.models.chunk_response import ChunkResponse as ChunkResponse from hindsight_client_api.models.create_bank_request import CreateBankRequest as CreateBankRequest +from hindsight_client_api.models.delete_document_response import DeleteDocumentResponse as DeleteDocumentResponse from hindsight_client_api.models.delete_response import DeleteResponse as DeleteResponse from hindsight_client_api.models.disposition_traits import DispositionTraits as DispositionTraits from hindsight_client_api.models.document_response import DocumentResponse as DocumentResponse @@ -109,6 +125,8 @@ from hindsight_client_api.models.list_documents_response import ListDocumentsResponse as ListDocumentsResponse from hindsight_client_api.models.list_memory_units_response import ListMemoryUnitsResponse as ListMemoryUnitsResponse from hindsight_client_api.models.memory_item import MemoryItem as MemoryItem +from hindsight_client_api.models.operation_response import OperationResponse as OperationResponse +from hindsight_client_api.models.operations_list_response import OperationsListResponse as OperationsListResponse from hindsight_client_api.models.recall_request import RecallRequest as RecallRequest from hindsight_client_api.models.recall_response import RecallResponse as RecallResponse from hindsight_client_api.models.recall_result import RecallResult as RecallResult diff --git a/hindsight-clients/python/hindsight_client_api/api/__init__.py b/hindsight-clients/python/hindsight_client_api/api/__init__.py index 02b3d154..f06d12c6 100644 --- a/hindsight-clients/python/hindsight_client_api/api/__init__.py +++ b/hindsight-clients/python/hindsight_client_api/api/__init__.py @@ -1,6 +1,10 @@ # flake8: noqa # import apis into api package +from hindsight_client_api.api.banks_api import BanksApi +from hindsight_client_api.api.documents_api import DocumentsApi +from hindsight_client_api.api.entities_api import EntitiesApi +from hindsight_client_api.api.memory_api import MemoryApi from hindsight_client_api.api.monitoring_api import MonitoringApi -from hindsight_client_api.api.default_api import DefaultApi +from hindsight_client_api.api.operations_api import OperationsApi diff --git a/hindsight-clients/python/hindsight_client_api/api/banks_api.py b/hindsight-clients/python/hindsight_client_api/api/banks_api.py new file mode 100644 index 00000000..fce5eaa4 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/api/banks_api.py @@ -0,0 +1,2045 @@ +# coding: utf-8 + +""" + Hindsight HTTP API + + HTTP API for Hindsight + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import StrictStr +from typing import Optional +from hindsight_client_api.models.add_background_request import AddBackgroundRequest +from hindsight_client_api.models.background_response import BackgroundResponse +from hindsight_client_api.models.bank_list_response import BankListResponse +from hindsight_client_api.models.bank_profile_response import BankProfileResponse +from hindsight_client_api.models.bank_stats_response import BankStatsResponse +from hindsight_client_api.models.create_bank_request import CreateBankRequest +from hindsight_client_api.models.delete_response import DeleteResponse +from hindsight_client_api.models.update_disposition_request import UpdateDispositionRequest + +from hindsight_client_api.api_client import ApiClient, RequestSerialized +from hindsight_client_api.api_response import ApiResponse +from hindsight_client_api.rest import RESTResponseType + + +class BanksApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def add_bank_background( + self, + bank_id: StrictStr, + add_background_request: AddBackgroundRequest, + authorization: Optional[StrictStr] = None, + _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, + ) -> BackgroundResponse: + """Add/merge memory bank background + + Add new background information or merge with existing. LLM intelligently resolves conflicts, normalizes to first person, and optionally infers disposition traits. + + :param bank_id: (required) + :type bank_id: str + :param add_background_request: (required) + :type add_background_request: AddBackgroundRequest + :param authorization: + :type authorization: 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._add_bank_background_serialize( + bank_id=bank_id, + add_background_request=add_background_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BackgroundResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def add_bank_background_with_http_info( + self, + bank_id: StrictStr, + add_background_request: AddBackgroundRequest, + authorization: Optional[StrictStr] = None, + _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[BackgroundResponse]: + """Add/merge memory bank background + + Add new background information or merge with existing. LLM intelligently resolves conflicts, normalizes to first person, and optionally infers disposition traits. + + :param bank_id: (required) + :type bank_id: str + :param add_background_request: (required) + :type add_background_request: AddBackgroundRequest + :param authorization: + :type authorization: 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._add_bank_background_serialize( + bank_id=bank_id, + add_background_request=add_background_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BackgroundResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def add_bank_background_without_preload_content( + self, + bank_id: StrictStr, + add_background_request: AddBackgroundRequest, + authorization: Optional[StrictStr] = None, + _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: + """Add/merge memory bank background + + Add new background information or merge with existing. LLM intelligently resolves conflicts, normalizes to first person, and optionally infers disposition traits. + + :param bank_id: (required) + :type bank_id: str + :param add_background_request: (required) + :type add_background_request: AddBackgroundRequest + :param authorization: + :type authorization: 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._add_bank_background_serialize( + bank_id=bank_id, + add_background_request=add_background_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BackgroundResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _add_bank_background_serialize( + self, + bank_id, + add_background_request, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + if add_background_request is not None: + _body_params = add_background_request + + + # 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] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/default/banks/{bank_id}/background', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def create_or_update_bank( + self, + bank_id: StrictStr, + create_bank_request: CreateBankRequest, + authorization: Optional[StrictStr] = None, + _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, + ) -> BankProfileResponse: + """Create or update memory bank + + Create a new agent or update existing agent with disposition and background. Auto-fills missing fields with defaults. + + :param bank_id: (required) + :type bank_id: str + :param create_bank_request: (required) + :type create_bank_request: CreateBankRequest + :param authorization: + :type authorization: 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._create_or_update_bank_serialize( + bank_id=bank_id, + create_bank_request=create_bank_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankProfileResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_or_update_bank_with_http_info( + self, + bank_id: StrictStr, + create_bank_request: CreateBankRequest, + authorization: Optional[StrictStr] = None, + _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[BankProfileResponse]: + """Create or update memory bank + + Create a new agent or update existing agent with disposition and background. Auto-fills missing fields with defaults. + + :param bank_id: (required) + :type bank_id: str + :param create_bank_request: (required) + :type create_bank_request: CreateBankRequest + :param authorization: + :type authorization: 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._create_or_update_bank_serialize( + bank_id=bank_id, + create_bank_request=create_bank_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankProfileResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_or_update_bank_without_preload_content( + self, + bank_id: StrictStr, + create_bank_request: CreateBankRequest, + authorization: Optional[StrictStr] = None, + _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: + """Create or update memory bank + + Create a new agent or update existing agent with disposition and background. Auto-fills missing fields with defaults. + + :param bank_id: (required) + :type bank_id: str + :param create_bank_request: (required) + :type create_bank_request: CreateBankRequest + :param authorization: + :type authorization: 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._create_or_update_bank_serialize( + bank_id=bank_id, + create_bank_request=create_bank_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankProfileResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_or_update_bank_serialize( + self, + bank_id, + create_bank_request, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + if create_bank_request is not None: + _body_params = create_bank_request + + + # 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] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/default/banks/{bank_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 + async def delete_bank( + self, + bank_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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, + ) -> DeleteResponse: + """Delete memory bank + + Delete an entire memory bank including all memories, entities, documents, and the bank profile itself. This is a destructive operation that cannot be undone. + + :param bank_id: (required) + :type bank_id: str + :param authorization: + :type authorization: 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._delete_bank_serialize( + bank_id=bank_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_bank_with_http_info( + self, + bank_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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[DeleteResponse]: + """Delete memory bank + + Delete an entire memory bank including all memories, entities, documents, and the bank profile itself. This is a destructive operation that cannot be undone. + + :param bank_id: (required) + :type bank_id: str + :param authorization: + :type authorization: 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._delete_bank_serialize( + bank_id=bank_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_bank_without_preload_content( + self, + bank_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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: + """Delete memory bank + + Delete an entire memory bank including all memories, entities, documents, and the bank profile itself. This is a destructive operation that cannot be undone. + + :param bank_id: (required) + :type bank_id: str + :param authorization: + :type authorization: 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._delete_bank_serialize( + bank_id=bank_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_bank_serialize( + self, + bank_id, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/default/banks/{bank_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 + async def get_agent_stats( + self, + bank_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, + ) -> BankStatsResponse: + """Get statistics for memory bank + + Get statistics about nodes and links for a specific agent + + :param bank_id: (required) + :type bank_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_agent_stats_serialize( + bank_id=bank_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankStatsResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_agent_stats_with_http_info( + self, + bank_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[BankStatsResponse]: + """Get statistics for memory bank + + Get statistics about nodes and links for a specific agent + + :param bank_id: (required) + :type bank_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_agent_stats_serialize( + bank_id=bank_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankStatsResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_agent_stats_without_preload_content( + self, + bank_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 statistics for memory bank + + Get statistics about nodes and links for a specific agent + + :param bank_id: (required) + :type bank_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_agent_stats_serialize( + bank_id=bank_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankStatsResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_agent_stats_serialize( + self, + bank_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 bank_id is not None: + _path_params['bank_id'] = bank_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] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/banks/{bank_id}/stats', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_bank_profile( + self, + bank_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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, + ) -> BankProfileResponse: + """Get memory bank profile + + Get disposition traits and background for a memory bank. Auto-creates agent with defaults if not exists. + + :param bank_id: (required) + :type bank_id: str + :param authorization: + :type authorization: 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_bank_profile_serialize( + bank_id=bank_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankProfileResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_bank_profile_with_http_info( + self, + bank_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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[BankProfileResponse]: + """Get memory bank profile + + Get disposition traits and background for a memory bank. Auto-creates agent with defaults if not exists. + + :param bank_id: (required) + :type bank_id: str + :param authorization: + :type authorization: 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_bank_profile_serialize( + bank_id=bank_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankProfileResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_bank_profile_without_preload_content( + self, + bank_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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 memory bank profile + + Get disposition traits and background for a memory bank. Auto-creates agent with defaults if not exists. + + :param bank_id: (required) + :type bank_id: str + :param authorization: + :type authorization: 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_bank_profile_serialize( + bank_id=bank_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankProfileResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_bank_profile_serialize( + self, + bank_id, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/banks/{bank_id}/profile', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_banks( + self, + authorization: Optional[StrictStr] = None, + _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, + ) -> BankListResponse: + """List all memory banks + + Get a list of all agents with their profiles + + :param authorization: + :type authorization: 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._list_banks_serialize( + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankListResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_banks_with_http_info( + self, + authorization: Optional[StrictStr] = None, + _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[BankListResponse]: + """List all memory banks + + Get a list of all agents with their profiles + + :param authorization: + :type authorization: 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._list_banks_serialize( + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankListResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_banks_without_preload_content( + self, + authorization: Optional[StrictStr] = None, + _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: + """List all memory banks + + Get a list of all agents with their profiles + + :param authorization: + :type authorization: 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._list_banks_serialize( + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankListResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_banks_serialize( + self, + authorization, + _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 + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/banks', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_bank_disposition( + self, + bank_id: StrictStr, + update_disposition_request: UpdateDispositionRequest, + authorization: Optional[StrictStr] = None, + _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, + ) -> BankProfileResponse: + """Update memory bank disposition + + Update bank's disposition traits (skepticism, literalism, empathy) + + :param bank_id: (required) + :type bank_id: str + :param update_disposition_request: (required) + :type update_disposition_request: UpdateDispositionRequest + :param authorization: + :type authorization: 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._update_bank_disposition_serialize( + bank_id=bank_id, + update_disposition_request=update_disposition_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankProfileResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_bank_disposition_with_http_info( + self, + bank_id: StrictStr, + update_disposition_request: UpdateDispositionRequest, + authorization: Optional[StrictStr] = None, + _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[BankProfileResponse]: + """Update memory bank disposition + + Update bank's disposition traits (skepticism, literalism, empathy) + + :param bank_id: (required) + :type bank_id: str + :param update_disposition_request: (required) + :type update_disposition_request: UpdateDispositionRequest + :param authorization: + :type authorization: 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._update_bank_disposition_serialize( + bank_id=bank_id, + update_disposition_request=update_disposition_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankProfileResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def update_bank_disposition_without_preload_content( + self, + bank_id: StrictStr, + update_disposition_request: UpdateDispositionRequest, + authorization: Optional[StrictStr] = None, + _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: + """Update memory bank disposition + + Update bank's disposition traits (skepticism, literalism, empathy) + + :param bank_id: (required) + :type bank_id: str + :param update_disposition_request: (required) + :type update_disposition_request: UpdateDispositionRequest + :param authorization: + :type authorization: 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._update_bank_disposition_serialize( + bank_id=bank_id, + update_disposition_request=update_disposition_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankProfileResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_bank_disposition_serialize( + self, + bank_id, + update_disposition_request, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + if update_disposition_request is not None: + _body_params = update_disposition_request + + + # 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] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/default/banks/{bank_id}/profile', + 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 + ) + + diff --git a/hindsight-clients/python/hindsight_client_api/api/default_api.py b/hindsight-clients/python/hindsight_client_api/api/default_api.py deleted file mode 100644 index 5966fd53..00000000 --- a/hindsight-clients/python/hindsight_client_api/api/default_api.py +++ /dev/null @@ -1,5976 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - -import warnings -from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Any, Dict, List, Optional, Tuple, Union -from typing_extensions import Annotated - -from pydantic import Field, StrictInt, StrictStr -from typing import Any, Optional -from typing_extensions import Annotated -from hindsight_client_api.models.add_background_request import AddBackgroundRequest -from hindsight_client_api.models.background_response import BackgroundResponse -from hindsight_client_api.models.bank_list_response import BankListResponse -from hindsight_client_api.models.bank_profile_response import BankProfileResponse -from hindsight_client_api.models.chunk_response import ChunkResponse -from hindsight_client_api.models.create_bank_request import CreateBankRequest -from hindsight_client_api.models.delete_response import DeleteResponse -from hindsight_client_api.models.document_response import DocumentResponse -from hindsight_client_api.models.entity_detail_response import EntityDetailResponse -from hindsight_client_api.models.entity_list_response import EntityListResponse -from hindsight_client_api.models.graph_data_response import GraphDataResponse -from hindsight_client_api.models.list_documents_response import ListDocumentsResponse -from hindsight_client_api.models.list_memory_units_response import ListMemoryUnitsResponse -from hindsight_client_api.models.recall_request import RecallRequest -from hindsight_client_api.models.recall_response import RecallResponse -from hindsight_client_api.models.reflect_request import ReflectRequest -from hindsight_client_api.models.reflect_response import ReflectResponse -from hindsight_client_api.models.retain_request import RetainRequest -from hindsight_client_api.models.retain_response import RetainResponse -from hindsight_client_api.models.update_disposition_request import UpdateDispositionRequest - -from hindsight_client_api.api_client import ApiClient, RequestSerialized -from hindsight_client_api.api_response import ApiResponse -from hindsight_client_api.rest import RESTResponseType - - -class DefaultApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - - @validate_call - async def add_bank_background( - self, - bank_id: StrictStr, - add_background_request: AddBackgroundRequest, - _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, - ) -> BackgroundResponse: - """Add/merge memory bank background - - Add new background information or merge with existing. LLM intelligently resolves conflicts, normalizes to first person, and optionally infers disposition traits. - - :param bank_id: (required) - :type bank_id: str - :param add_background_request: (required) - :type add_background_request: AddBackgroundRequest - :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._add_bank_background_serialize( - bank_id=bank_id, - add_background_request=add_background_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BackgroundResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def add_bank_background_with_http_info( - self, - bank_id: StrictStr, - add_background_request: AddBackgroundRequest, - _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[BackgroundResponse]: - """Add/merge memory bank background - - Add new background information or merge with existing. LLM intelligently resolves conflicts, normalizes to first person, and optionally infers disposition traits. - - :param bank_id: (required) - :type bank_id: str - :param add_background_request: (required) - :type add_background_request: AddBackgroundRequest - :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._add_bank_background_serialize( - bank_id=bank_id, - add_background_request=add_background_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BackgroundResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def add_bank_background_without_preload_content( - self, - bank_id: StrictStr, - add_background_request: AddBackgroundRequest, - _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: - """Add/merge memory bank background - - Add new background information or merge with existing. LLM intelligently resolves conflicts, normalizes to first person, and optionally infers disposition traits. - - :param bank_id: (required) - :type bank_id: str - :param add_background_request: (required) - :type add_background_request: AddBackgroundRequest - :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._add_bank_background_serialize( - bank_id=bank_id, - add_background_request=add_background_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BackgroundResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _add_bank_background_serialize( - self, - bank_id, - add_background_request, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if add_background_request is not None: - _body_params = add_background_request - - - # 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] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/v1/default/banks/{bank_id}/background', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def cancel_operation( - self, - bank_id: StrictStr, - operation_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, - ) -> object: - """Cancel a pending async operation - - Cancel a pending async operation by removing it from the queue - - :param bank_id: (required) - :type bank_id: str - :param operation_id: (required) - :type operation_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._cancel_operation_serialize( - bank_id=bank_id, - operation_id=operation_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def cancel_operation_with_http_info( - self, - bank_id: StrictStr, - operation_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[object]: - """Cancel a pending async operation - - Cancel a pending async operation by removing it from the queue - - :param bank_id: (required) - :type bank_id: str - :param operation_id: (required) - :type operation_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._cancel_operation_serialize( - bank_id=bank_id, - operation_id=operation_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def cancel_operation_without_preload_content( - self, - bank_id: StrictStr, - operation_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: - """Cancel a pending async operation - - Cancel a pending async operation by removing it from the queue - - :param bank_id: (required) - :type bank_id: str - :param operation_id: (required) - :type operation_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._cancel_operation_serialize( - bank_id=bank_id, - operation_id=operation_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _cancel_operation_serialize( - self, - bank_id, - operation_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 bank_id is not None: - _path_params['bank_id'] = bank_id - if operation_id is not None: - _path_params['operation_id'] = operation_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] = [ - ] - - return self.api_client.param_serialize( - method='DELETE', - resource_path='/v1/default/banks/{bank_id}/operations/{operation_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 - async def clear_bank_memories( - self, - bank_id: StrictStr, - type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, experience, opinion)")] = None, - _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, - ) -> DeleteResponse: - """Clear memory bank memories - - Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved. - - :param bank_id: (required) - :type bank_id: str - :param type: Optional fact type filter (world, experience, opinion) - :type type: 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._clear_bank_memories_serialize( - bank_id=bank_id, - type=type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "DeleteResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def clear_bank_memories_with_http_info( - self, - bank_id: StrictStr, - type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, experience, opinion)")] = None, - _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[DeleteResponse]: - """Clear memory bank memories - - Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved. - - :param bank_id: (required) - :type bank_id: str - :param type: Optional fact type filter (world, experience, opinion) - :type type: 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._clear_bank_memories_serialize( - bank_id=bank_id, - type=type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "DeleteResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def clear_bank_memories_without_preload_content( - self, - bank_id: StrictStr, - type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, experience, opinion)")] = None, - _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: - """Clear memory bank memories - - Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved. - - :param bank_id: (required) - :type bank_id: str - :param type: Optional fact type filter (world, experience, opinion) - :type type: 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._clear_bank_memories_serialize( - bank_id=bank_id, - type=type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "DeleteResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _clear_bank_memories_serialize( - self, - bank_id, - type, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - if type is not None: - - _query_params.append(('type', type)) - - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - if 'Accept' not in _header_params: - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='DELETE', - resource_path='/v1/default/banks/{bank_id}/memories', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def create_or_update_bank( - self, - bank_id: StrictStr, - create_bank_request: CreateBankRequest, - _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, - ) -> BankProfileResponse: - """Create or update memory bank - - Create a new agent or update existing agent with disposition and background. Auto-fills missing fields with defaults. - - :param bank_id: (required) - :type bank_id: str - :param create_bank_request: (required) - :type create_bank_request: CreateBankRequest - :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._create_or_update_bank_serialize( - bank_id=bank_id, - create_bank_request=create_bank_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankProfileResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def create_or_update_bank_with_http_info( - self, - bank_id: StrictStr, - create_bank_request: CreateBankRequest, - _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[BankProfileResponse]: - """Create or update memory bank - - Create a new agent or update existing agent with disposition and background. Auto-fills missing fields with defaults. - - :param bank_id: (required) - :type bank_id: str - :param create_bank_request: (required) - :type create_bank_request: CreateBankRequest - :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._create_or_update_bank_serialize( - bank_id=bank_id, - create_bank_request=create_bank_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankProfileResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def create_or_update_bank_without_preload_content( - self, - bank_id: StrictStr, - create_bank_request: CreateBankRequest, - _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: - """Create or update memory bank - - Create a new agent or update existing agent with disposition and background. Auto-fills missing fields with defaults. - - :param bank_id: (required) - :type bank_id: str - :param create_bank_request: (required) - :type create_bank_request: CreateBankRequest - :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._create_or_update_bank_serialize( - bank_id=bank_id, - create_bank_request=create_bank_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankProfileResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _create_or_update_bank_serialize( - self, - bank_id, - create_bank_request, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if create_bank_request is not None: - _body_params = create_bank_request - - - # 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] = [ - ] - - return self.api_client.param_serialize( - method='PUT', - resource_path='/v1/default/banks/{bank_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 - async def delete_document( - self, - bank_id: StrictStr, - document_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, - ) -> object: - """Delete a document - - Delete a document and all its associated memory units and links. This will cascade delete: - The document itself - All memory units extracted from this document - All links (temporal, semantic, entity) associated with those memory units This operation cannot be undone. - - :param bank_id: (required) - :type bank_id: str - :param document_id: (required) - :type document_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._delete_document_serialize( - bank_id=bank_id, - document_id=document_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def delete_document_with_http_info( - self, - bank_id: StrictStr, - document_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[object]: - """Delete a document - - Delete a document and all its associated memory units and links. This will cascade delete: - The document itself - All memory units extracted from this document - All links (temporal, semantic, entity) associated with those memory units This operation cannot be undone. - - :param bank_id: (required) - :type bank_id: str - :param document_id: (required) - :type document_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._delete_document_serialize( - bank_id=bank_id, - document_id=document_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def delete_document_without_preload_content( - self, - bank_id: StrictStr, - document_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: - """Delete a document - - Delete a document and all its associated memory units and links. This will cascade delete: - The document itself - All memory units extracted from this document - All links (temporal, semantic, entity) associated with those memory units This operation cannot be undone. - - :param bank_id: (required) - :type bank_id: str - :param document_id: (required) - :type document_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._delete_document_serialize( - bank_id=bank_id, - document_id=document_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _delete_document_serialize( - self, - bank_id, - document_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 bank_id is not None: - _path_params['bank_id'] = bank_id - if document_id is not None: - _path_params['document_id'] = document_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] = [ - ] - - return self.api_client.param_serialize( - method='DELETE', - resource_path='/v1/default/banks/{bank_id}/documents/{document_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 - async def get_agent_stats( - self, - bank_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, - ) -> object: - """Get statistics for memory bank - - Get statistics about nodes and links for a specific agent - - :param bank_id: (required) - :type bank_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_agent_stats_serialize( - bank_id=bank_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def get_agent_stats_with_http_info( - self, - bank_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[object]: - """Get statistics for memory bank - - Get statistics about nodes and links for a specific agent - - :param bank_id: (required) - :type bank_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_agent_stats_serialize( - bank_id=bank_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def get_agent_stats_without_preload_content( - self, - bank_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 statistics for memory bank - - Get statistics about nodes and links for a specific agent - - :param bank_id: (required) - :type bank_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_agent_stats_serialize( - bank_id=bank_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_agent_stats_serialize( - self, - bank_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 bank_id is not None: - _path_params['bank_id'] = bank_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] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/banks/{bank_id}/stats', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def get_bank_profile( - self, - bank_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, - ) -> BankProfileResponse: - """Get memory bank profile - - Get disposition traits and background for a memory bank. Auto-creates agent with defaults if not exists. - - :param bank_id: (required) - :type bank_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_bank_profile_serialize( - bank_id=bank_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankProfileResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def get_bank_profile_with_http_info( - self, - bank_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[BankProfileResponse]: - """Get memory bank profile - - Get disposition traits and background for a memory bank. Auto-creates agent with defaults if not exists. - - :param bank_id: (required) - :type bank_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_bank_profile_serialize( - bank_id=bank_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankProfileResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def get_bank_profile_without_preload_content( - self, - bank_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 memory bank profile - - Get disposition traits and background for a memory bank. Auto-creates agent with defaults if not exists. - - :param bank_id: (required) - :type bank_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_bank_profile_serialize( - bank_id=bank_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankProfileResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_bank_profile_serialize( - self, - bank_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 bank_id is not None: - _path_params['bank_id'] = bank_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] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/banks/{bank_id}/profile', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def get_chunk( - self, - chunk_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, - ) -> ChunkResponse: - """Get chunk details - - Get a specific chunk by its ID - - :param chunk_id: (required) - :type chunk_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_chunk_serialize( - chunk_id=chunk_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ChunkResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def get_chunk_with_http_info( - self, - chunk_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[ChunkResponse]: - """Get chunk details - - Get a specific chunk by its ID - - :param chunk_id: (required) - :type chunk_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_chunk_serialize( - chunk_id=chunk_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ChunkResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def get_chunk_without_preload_content( - self, - chunk_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 chunk details - - Get a specific chunk by its ID - - :param chunk_id: (required) - :type chunk_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_chunk_serialize( - chunk_id=chunk_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ChunkResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_chunk_serialize( - self, - chunk_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 chunk_id is not None: - _path_params['chunk_id'] = chunk_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] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/chunks/{chunk_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 - async def get_document( - self, - bank_id: StrictStr, - document_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, - ) -> DocumentResponse: - """Get document details - - Get a specific document including its original text - - :param bank_id: (required) - :type bank_id: str - :param document_id: (required) - :type document_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_document_serialize( - bank_id=bank_id, - document_id=document_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "DocumentResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def get_document_with_http_info( - self, - bank_id: StrictStr, - document_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[DocumentResponse]: - """Get document details - - Get a specific document including its original text - - :param bank_id: (required) - :type bank_id: str - :param document_id: (required) - :type document_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_document_serialize( - bank_id=bank_id, - document_id=document_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "DocumentResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def get_document_without_preload_content( - self, - bank_id: StrictStr, - document_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 document details - - Get a specific document including its original text - - :param bank_id: (required) - :type bank_id: str - :param document_id: (required) - :type document_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_document_serialize( - bank_id=bank_id, - document_id=document_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "DocumentResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_document_serialize( - self, - bank_id, - document_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 bank_id is not None: - _path_params['bank_id'] = bank_id - if document_id is not None: - _path_params['document_id'] = document_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] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/banks/{bank_id}/documents/{document_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 - async def get_entity( - self, - bank_id: StrictStr, - entity_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, - ) -> EntityDetailResponse: - """Get entity details - - Get detailed information about an entity including observations (mental model). - - :param bank_id: (required) - :type bank_id: str - :param entity_id: (required) - :type entity_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_entity_serialize( - bank_id=bank_id, - entity_id=entity_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EntityDetailResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def get_entity_with_http_info( - self, - bank_id: StrictStr, - entity_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[EntityDetailResponse]: - """Get entity details - - Get detailed information about an entity including observations (mental model). - - :param bank_id: (required) - :type bank_id: str - :param entity_id: (required) - :type entity_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_entity_serialize( - bank_id=bank_id, - entity_id=entity_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EntityDetailResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def get_entity_without_preload_content( - self, - bank_id: StrictStr, - entity_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 entity details - - Get detailed information about an entity including observations (mental model). - - :param bank_id: (required) - :type bank_id: str - :param entity_id: (required) - :type entity_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_entity_serialize( - bank_id=bank_id, - entity_id=entity_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EntityDetailResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_entity_serialize( - self, - bank_id, - entity_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 bank_id is not None: - _path_params['bank_id'] = bank_id - if entity_id is not None: - _path_params['entity_id'] = entity_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] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/banks/{bank_id}/entities/{entity_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 - async def get_graph( - self, - bank_id: StrictStr, - type: Optional[StrictStr] = None, - _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, - ) -> GraphDataResponse: - """Get memory graph data - - Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items. - - :param bank_id: (required) - :type bank_id: str - :param type: - :type type: 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_graph_serialize( - bank_id=bank_id, - type=type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "GraphDataResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def get_graph_with_http_info( - self, - bank_id: StrictStr, - type: Optional[StrictStr] = None, - _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[GraphDataResponse]: - """Get memory graph data - - Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items. - - :param bank_id: (required) - :type bank_id: str - :param type: - :type type: 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_graph_serialize( - bank_id=bank_id, - type=type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "GraphDataResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def get_graph_without_preload_content( - self, - bank_id: StrictStr, - type: Optional[StrictStr] = None, - _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 memory graph data - - Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items. - - :param bank_id: (required) - :type bank_id: str - :param type: - :type type: 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_graph_serialize( - bank_id=bank_id, - type=type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "GraphDataResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_graph_serialize( - self, - bank_id, - type, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - if type is not None: - - _query_params.append(('type', type)) - - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - if 'Accept' not in _header_params: - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/banks/{bank_id}/graph', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def list_banks( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BankListResponse: - """List all memory banks - - Get a list of all agents with their profiles - - :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._list_banks_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankListResponse", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def list_banks_with_http_info( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BankListResponse]: - """List all memory banks - - Get a list of all agents with their profiles - - :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._list_banks_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankListResponse", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def list_banks_without_preload_content( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """List all memory banks - - Get a list of all agents with their profiles - - :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._list_banks_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankListResponse", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _list_banks_serialize( - self, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[ - str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] - ] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - if 'Accept' not in _header_params: - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/banks', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def list_documents( - self, - bank_id: StrictStr, - q: Optional[StrictStr] = None, - limit: Optional[StrictInt] = None, - offset: Optional[StrictInt] = None, - _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, - ) -> ListDocumentsResponse: - """List documents - - List documents with pagination and optional search. Documents are the source content from which memory units are extracted. - - :param bank_id: (required) - :type bank_id: str - :param q: - :type q: str - :param limit: - :type limit: int - :param offset: - :type offset: int - :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._list_documents_serialize( - bank_id=bank_id, - q=q, - limit=limit, - offset=offset, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ListDocumentsResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def list_documents_with_http_info( - self, - bank_id: StrictStr, - q: Optional[StrictStr] = None, - limit: Optional[StrictInt] = None, - offset: Optional[StrictInt] = None, - _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[ListDocumentsResponse]: - """List documents - - List documents with pagination and optional search. Documents are the source content from which memory units are extracted. - - :param bank_id: (required) - :type bank_id: str - :param q: - :type q: str - :param limit: - :type limit: int - :param offset: - :type offset: int - :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._list_documents_serialize( - bank_id=bank_id, - q=q, - limit=limit, - offset=offset, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ListDocumentsResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def list_documents_without_preload_content( - self, - bank_id: StrictStr, - q: Optional[StrictStr] = None, - limit: Optional[StrictInt] = None, - offset: Optional[StrictInt] = None, - _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: - """List documents - - List documents with pagination and optional search. Documents are the source content from which memory units are extracted. - - :param bank_id: (required) - :type bank_id: str - :param q: - :type q: str - :param limit: - :type limit: int - :param offset: - :type offset: int - :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._list_documents_serialize( - bank_id=bank_id, - q=q, - limit=limit, - offset=offset, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ListDocumentsResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _list_documents_serialize( - self, - bank_id, - q, - limit, - offset, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - if q is not None: - - _query_params.append(('q', q)) - - if limit is not None: - - _query_params.append(('limit', limit)) - - if offset is not None: - - _query_params.append(('offset', offset)) - - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - if 'Accept' not in _header_params: - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/banks/{bank_id}/documents', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def list_entities( - self, - bank_id: StrictStr, - limit: Annotated[Optional[StrictInt], Field(description="Maximum number of entities to return")] = None, - _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, - ) -> EntityListResponse: - """List entities - - List all entities (people, organizations, etc.) known by the bank, ordered by mention count. - - :param bank_id: (required) - :type bank_id: str - :param limit: Maximum number of entities to return - :type limit: int - :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._list_entities_serialize( - bank_id=bank_id, - limit=limit, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EntityListResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def list_entities_with_http_info( - self, - bank_id: StrictStr, - limit: Annotated[Optional[StrictInt], Field(description="Maximum number of entities to return")] = None, - _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[EntityListResponse]: - """List entities - - List all entities (people, organizations, etc.) known by the bank, ordered by mention count. - - :param bank_id: (required) - :type bank_id: str - :param limit: Maximum number of entities to return - :type limit: int - :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._list_entities_serialize( - bank_id=bank_id, - limit=limit, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EntityListResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def list_entities_without_preload_content( - self, - bank_id: StrictStr, - limit: Annotated[Optional[StrictInt], Field(description="Maximum number of entities to return")] = None, - _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: - """List entities - - List all entities (people, organizations, etc.) known by the bank, ordered by mention count. - - :param bank_id: (required) - :type bank_id: str - :param limit: Maximum number of entities to return - :type limit: int - :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._list_entities_serialize( - bank_id=bank_id, - limit=limit, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EntityListResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _list_entities_serialize( - self, - bank_id, - limit, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - if limit is not None: - - _query_params.append(('limit', limit)) - - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - if 'Accept' not in _header_params: - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/banks/{bank_id}/entities', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def list_memories( - self, - bank_id: StrictStr, - type: Optional[StrictStr] = None, - q: Optional[StrictStr] = None, - limit: Optional[StrictInt] = None, - offset: Optional[StrictInt] = None, - _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, - ) -> ListMemoryUnitsResponse: - """List memory units - - List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). - - :param bank_id: (required) - :type bank_id: str - :param type: - :type type: str - :param q: - :type q: str - :param limit: - :type limit: int - :param offset: - :type offset: int - :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._list_memories_serialize( - bank_id=bank_id, - type=type, - q=q, - limit=limit, - offset=offset, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ListMemoryUnitsResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def list_memories_with_http_info( - self, - bank_id: StrictStr, - type: Optional[StrictStr] = None, - q: Optional[StrictStr] = None, - limit: Optional[StrictInt] = None, - offset: Optional[StrictInt] = None, - _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[ListMemoryUnitsResponse]: - """List memory units - - List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). - - :param bank_id: (required) - :type bank_id: str - :param type: - :type type: str - :param q: - :type q: str - :param limit: - :type limit: int - :param offset: - :type offset: int - :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._list_memories_serialize( - bank_id=bank_id, - type=type, - q=q, - limit=limit, - offset=offset, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ListMemoryUnitsResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def list_memories_without_preload_content( - self, - bank_id: StrictStr, - type: Optional[StrictStr] = None, - q: Optional[StrictStr] = None, - limit: Optional[StrictInt] = None, - offset: Optional[StrictInt] = None, - _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: - """List memory units - - List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). - - :param bank_id: (required) - :type bank_id: str - :param type: - :type type: str - :param q: - :type q: str - :param limit: - :type limit: int - :param offset: - :type offset: int - :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._list_memories_serialize( - bank_id=bank_id, - type=type, - q=q, - limit=limit, - offset=offset, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ListMemoryUnitsResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _list_memories_serialize( - self, - bank_id, - type, - q, - limit, - offset, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - if type is not None: - - _query_params.append(('type', type)) - - if q is not None: - - _query_params.append(('q', q)) - - if limit is not None: - - _query_params.append(('limit', limit)) - - if offset is not None: - - _query_params.append(('offset', offset)) - - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - if 'Accept' not in _header_params: - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/banks/{bank_id}/memories/list', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def list_operations( - self, - bank_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, - ) -> object: - """List async operations - - Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations - - :param bank_id: (required) - :type bank_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._list_operations_serialize( - bank_id=bank_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def list_operations_with_http_info( - self, - bank_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[object]: - """List async operations - - Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations - - :param bank_id: (required) - :type bank_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._list_operations_serialize( - bank_id=bank_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def list_operations_without_preload_content( - self, - bank_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: - """List async operations - - Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations - - :param bank_id: (required) - :type bank_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._list_operations_serialize( - bank_id=bank_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "object", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _list_operations_serialize( - self, - bank_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 bank_id is not None: - _path_params['bank_id'] = bank_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] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/default/banks/{bank_id}/operations', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def recall_memories( - self, - bank_id: StrictStr, - recall_request: RecallRequest, - _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, - ) -> RecallResponse: - """Recall memory - - Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - 'world': General knowledge about people, places, events, and things that happen - 'experience': Memories about experience, conversations, actions taken, and tasks performed - 'opinion': The bank's formed beliefs, perspectives, and viewpoints Set include_entities=true to get entity observations alongside recall results. - - :param bank_id: (required) - :type bank_id: str - :param recall_request: (required) - :type recall_request: RecallRequest - :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._recall_memories_serialize( - bank_id=bank_id, - recall_request=recall_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "RecallResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def recall_memories_with_http_info( - self, - bank_id: StrictStr, - recall_request: RecallRequest, - _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[RecallResponse]: - """Recall memory - - Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - 'world': General knowledge about people, places, events, and things that happen - 'experience': Memories about experience, conversations, actions taken, and tasks performed - 'opinion': The bank's formed beliefs, perspectives, and viewpoints Set include_entities=true to get entity observations alongside recall results. - - :param bank_id: (required) - :type bank_id: str - :param recall_request: (required) - :type recall_request: RecallRequest - :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._recall_memories_serialize( - bank_id=bank_id, - recall_request=recall_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "RecallResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def recall_memories_without_preload_content( - self, - bank_id: StrictStr, - recall_request: RecallRequest, - _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: - """Recall memory - - Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - 'world': General knowledge about people, places, events, and things that happen - 'experience': Memories about experience, conversations, actions taken, and tasks performed - 'opinion': The bank's formed beliefs, perspectives, and viewpoints Set include_entities=true to get entity observations alongside recall results. - - :param bank_id: (required) - :type bank_id: str - :param recall_request: (required) - :type recall_request: RecallRequest - :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._recall_memories_serialize( - bank_id=bank_id, - recall_request=recall_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "RecallResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _recall_memories_serialize( - self, - bank_id, - recall_request, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if recall_request is not None: - _body_params = recall_request - - - # 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] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/v1/default/banks/{bank_id}/memories/recall', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def reflect( - self, - bank_id: StrictStr, - reflect_request: ReflectRequest, - _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, - ) -> ReflectResponse: - """Reflect and generate answer - - Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves experience (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions - - :param bank_id: (required) - :type bank_id: str - :param reflect_request: (required) - :type reflect_request: ReflectRequest - :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._reflect_serialize( - bank_id=bank_id, - reflect_request=reflect_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ReflectResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def reflect_with_http_info( - self, - bank_id: StrictStr, - reflect_request: ReflectRequest, - _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[ReflectResponse]: - """Reflect and generate answer - - Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves experience (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions - - :param bank_id: (required) - :type bank_id: str - :param reflect_request: (required) - :type reflect_request: ReflectRequest - :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._reflect_serialize( - bank_id=bank_id, - reflect_request=reflect_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ReflectResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def reflect_without_preload_content( - self, - bank_id: StrictStr, - reflect_request: ReflectRequest, - _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: - """Reflect and generate answer - - Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves experience (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions - - :param bank_id: (required) - :type bank_id: str - :param reflect_request: (required) - :type reflect_request: ReflectRequest - :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._reflect_serialize( - bank_id=bank_id, - reflect_request=reflect_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ReflectResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _reflect_serialize( - self, - bank_id, - reflect_request, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if reflect_request is not None: - _body_params = reflect_request - - - # 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] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/v1/default/banks/{bank_id}/reflect', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def regenerate_entity_observations( - self, - bank_id: StrictStr, - entity_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, - ) -> EntityDetailResponse: - """Regenerate entity observations - - Regenerate observations for an entity based on all facts mentioning it. - - :param bank_id: (required) - :type bank_id: str - :param entity_id: (required) - :type entity_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._regenerate_entity_observations_serialize( - bank_id=bank_id, - entity_id=entity_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EntityDetailResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def regenerate_entity_observations_with_http_info( - self, - bank_id: StrictStr, - entity_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[EntityDetailResponse]: - """Regenerate entity observations - - Regenerate observations for an entity based on all facts mentioning it. - - :param bank_id: (required) - :type bank_id: str - :param entity_id: (required) - :type entity_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._regenerate_entity_observations_serialize( - bank_id=bank_id, - entity_id=entity_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EntityDetailResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def regenerate_entity_observations_without_preload_content( - self, - bank_id: StrictStr, - entity_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: - """Regenerate entity observations - - Regenerate observations for an entity based on all facts mentioning it. - - :param bank_id: (required) - :type bank_id: str - :param entity_id: (required) - :type entity_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._regenerate_entity_observations_serialize( - bank_id=bank_id, - entity_id=entity_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EntityDetailResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _regenerate_entity_observations_serialize( - self, - bank_id, - entity_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 bank_id is not None: - _path_params['bank_id'] = bank_id - if entity_id is not None: - _path_params['entity_id'] = entity_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] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/v1/default/banks/{bank_id}/entities/{entity_id}/regenerate', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def retain_memories( - self, - bank_id: StrictStr, - retain_request: RetainRequest, - _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, - ) -> RetainResponse: - """Retain memories - - Retain memory items with automatic fact extraction. This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the async parameter. Features: - Efficient batch processing - Automatic fact extraction from natural language - Entity recognition and linking - Document tracking with automatic upsert (when document_id is provided on items) - Temporal and semantic linking - Optional asynchronous processing The system automatically: 1. Extracts semantic facts from the content 2. Generates embeddings 3. Deduplicates similar facts 4. Creates temporal, semantic, and entity links 5. Tracks document metadata When async=true: - Returns immediately after queuing the task - Processing happens in the background - Use the operations endpoint to monitor progress When async=false (default): - Waits for processing to complete - Returns after all memories are stored Note: If a memory item has a document_id that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). Items with the same document_id are grouped together for efficient processing. - - :param bank_id: (required) - :type bank_id: str - :param retain_request: (required) - :type retain_request: RetainRequest - :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._retain_memories_serialize( - bank_id=bank_id, - retain_request=retain_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "RetainResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def retain_memories_with_http_info( - self, - bank_id: StrictStr, - retain_request: RetainRequest, - _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[RetainResponse]: - """Retain memories - - Retain memory items with automatic fact extraction. This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the async parameter. Features: - Efficient batch processing - Automatic fact extraction from natural language - Entity recognition and linking - Document tracking with automatic upsert (when document_id is provided on items) - Temporal and semantic linking - Optional asynchronous processing The system automatically: 1. Extracts semantic facts from the content 2. Generates embeddings 3. Deduplicates similar facts 4. Creates temporal, semantic, and entity links 5. Tracks document metadata When async=true: - Returns immediately after queuing the task - Processing happens in the background - Use the operations endpoint to monitor progress When async=false (default): - Waits for processing to complete - Returns after all memories are stored Note: If a memory item has a document_id that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). Items with the same document_id are grouped together for efficient processing. - - :param bank_id: (required) - :type bank_id: str - :param retain_request: (required) - :type retain_request: RetainRequest - :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._retain_memories_serialize( - bank_id=bank_id, - retain_request=retain_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "RetainResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def retain_memories_without_preload_content( - self, - bank_id: StrictStr, - retain_request: RetainRequest, - _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: - """Retain memories - - Retain memory items with automatic fact extraction. This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the async parameter. Features: - Efficient batch processing - Automatic fact extraction from natural language - Entity recognition and linking - Document tracking with automatic upsert (when document_id is provided on items) - Temporal and semantic linking - Optional asynchronous processing The system automatically: 1. Extracts semantic facts from the content 2. Generates embeddings 3. Deduplicates similar facts 4. Creates temporal, semantic, and entity links 5. Tracks document metadata When async=true: - Returns immediately after queuing the task - Processing happens in the background - Use the operations endpoint to monitor progress When async=false (default): - Waits for processing to complete - Returns after all memories are stored Note: If a memory item has a document_id that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). Items with the same document_id are grouped together for efficient processing. - - :param bank_id: (required) - :type bank_id: str - :param retain_request: (required) - :type retain_request: RetainRequest - :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._retain_memories_serialize( - bank_id=bank_id, - retain_request=retain_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "RetainResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _retain_memories_serialize( - self, - bank_id, - retain_request, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if retain_request is not None: - _body_params = retain_request - - - # 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] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/v1/default/banks/{bank_id}/memories', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - async def update_bank_disposition( - self, - bank_id: StrictStr, - update_disposition_request: UpdateDispositionRequest, - _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, - ) -> BankProfileResponse: - """Update memory bank disposition - - Update bank's disposition traits (skepticism, literalism, empathy) - - :param bank_id: (required) - :type bank_id: str - :param update_disposition_request: (required) - :type update_disposition_request: UpdateDispositionRequest - :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._update_bank_disposition_serialize( - bank_id=bank_id, - update_disposition_request=update_disposition_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankProfileResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def update_bank_disposition_with_http_info( - self, - bank_id: StrictStr, - update_disposition_request: UpdateDispositionRequest, - _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[BankProfileResponse]: - """Update memory bank disposition - - Update bank's disposition traits (skepticism, literalism, empathy) - - :param bank_id: (required) - :type bank_id: str - :param update_disposition_request: (required) - :type update_disposition_request: UpdateDispositionRequest - :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._update_bank_disposition_serialize( - bank_id=bank_id, - update_disposition_request=update_disposition_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankProfileResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def update_bank_disposition_without_preload_content( - self, - bank_id: StrictStr, - update_disposition_request: UpdateDispositionRequest, - _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: - """Update memory bank disposition - - Update bank's disposition traits (skepticism, literalism, empathy) - - :param bank_id: (required) - :type bank_id: str - :param update_disposition_request: (required) - :type update_disposition_request: UpdateDispositionRequest - :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._update_bank_disposition_serialize( - bank_id=bank_id, - update_disposition_request=update_disposition_request, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "BankProfileResponse", - '422': "HTTPValidationError", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _update_bank_disposition_serialize( - self, - bank_id, - update_disposition_request, - _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 bank_id is not None: - _path_params['bank_id'] = bank_id - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if update_disposition_request is not None: - _body_params = update_disposition_request - - - # 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] = [ - ] - - return self.api_client.param_serialize( - method='PUT', - resource_path='/v1/default/banks/{bank_id}/profile', - 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 - ) - - diff --git a/hindsight-clients/python/hindsight_client_api/api/documents_api.py b/hindsight-clients/python/hindsight_client_api/api/documents_api.py new file mode 100644 index 00000000..bcb2aa2b --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/api/documents_api.py @@ -0,0 +1,1234 @@ +# coding: utf-8 + +""" + Hindsight HTTP API + + HTTP API for Hindsight + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import StrictInt, StrictStr +from typing import Optional +from hindsight_client_api.models.chunk_response import ChunkResponse +from hindsight_client_api.models.delete_document_response import DeleteDocumentResponse +from hindsight_client_api.models.document_response import DocumentResponse +from hindsight_client_api.models.list_documents_response import ListDocumentsResponse + +from hindsight_client_api.api_client import ApiClient, RequestSerialized +from hindsight_client_api.api_response import ApiResponse +from hindsight_client_api.rest import RESTResponseType + + +class DocumentsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def delete_document( + self, + bank_id: StrictStr, + document_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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, + ) -> DeleteDocumentResponse: + """Delete a document + + Delete a document and all its associated memory units and links. This will cascade delete: - The document itself - All memory units extracted from this document - All links (temporal, semantic, entity) associated with those memory units This operation cannot be undone. + + :param bank_id: (required) + :type bank_id: str + :param document_id: (required) + :type document_id: str + :param authorization: + :type authorization: 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._delete_document_serialize( + bank_id=bank_id, + document_id=document_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteDocumentResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_document_with_http_info( + self, + bank_id: StrictStr, + document_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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[DeleteDocumentResponse]: + """Delete a document + + Delete a document and all its associated memory units and links. This will cascade delete: - The document itself - All memory units extracted from this document - All links (temporal, semantic, entity) associated with those memory units This operation cannot be undone. + + :param bank_id: (required) + :type bank_id: str + :param document_id: (required) + :type document_id: str + :param authorization: + :type authorization: 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._delete_document_serialize( + bank_id=bank_id, + document_id=document_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteDocumentResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_document_without_preload_content( + self, + bank_id: StrictStr, + document_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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: + """Delete a document + + Delete a document and all its associated memory units and links. This will cascade delete: - The document itself - All memory units extracted from this document - All links (temporal, semantic, entity) associated with those memory units This operation cannot be undone. + + :param bank_id: (required) + :type bank_id: str + :param document_id: (required) + :type document_id: str + :param authorization: + :type authorization: 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._delete_document_serialize( + bank_id=bank_id, + document_id=document_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteDocumentResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_document_serialize( + self, + bank_id, + document_id, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + if document_id is not None: + _path_params['document_id'] = document_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/default/banks/{bank_id}/documents/{document_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 + async def get_chunk( + self, + chunk_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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, + ) -> ChunkResponse: + """Get chunk details + + Get a specific chunk by its ID + + :param chunk_id: (required) + :type chunk_id: str + :param authorization: + :type authorization: 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_chunk_serialize( + chunk_id=chunk_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChunkResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_chunk_with_http_info( + self, + chunk_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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[ChunkResponse]: + """Get chunk details + + Get a specific chunk by its ID + + :param chunk_id: (required) + :type chunk_id: str + :param authorization: + :type authorization: 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_chunk_serialize( + chunk_id=chunk_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChunkResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_chunk_without_preload_content( + self, + chunk_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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 chunk details + + Get a specific chunk by its ID + + :param chunk_id: (required) + :type chunk_id: str + :param authorization: + :type authorization: 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_chunk_serialize( + chunk_id=chunk_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChunkResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_chunk_serialize( + self, + chunk_id, + authorization, + _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 chunk_id is not None: + _path_params['chunk_id'] = chunk_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/chunks/{chunk_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 + async def get_document( + self, + bank_id: StrictStr, + document_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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, + ) -> DocumentResponse: + """Get document details + + Get a specific document including its original text + + :param bank_id: (required) + :type bank_id: str + :param document_id: (required) + :type document_id: str + :param authorization: + :type authorization: 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_document_serialize( + bank_id=bank_id, + document_id=document_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_document_with_http_info( + self, + bank_id: StrictStr, + document_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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[DocumentResponse]: + """Get document details + + Get a specific document including its original text + + :param bank_id: (required) + :type bank_id: str + :param document_id: (required) + :type document_id: str + :param authorization: + :type authorization: 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_document_serialize( + bank_id=bank_id, + document_id=document_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_document_without_preload_content( + self, + bank_id: StrictStr, + document_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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 document details + + Get a specific document including its original text + + :param bank_id: (required) + :type bank_id: str + :param document_id: (required) + :type document_id: str + :param authorization: + :type authorization: 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_document_serialize( + bank_id=bank_id, + document_id=document_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DocumentResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_document_serialize( + self, + bank_id, + document_id, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + if document_id is not None: + _path_params['document_id'] = document_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/banks/{bank_id}/documents/{document_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 + async def list_documents( + self, + bank_id: StrictStr, + q: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + offset: Optional[StrictInt] = None, + authorization: Optional[StrictStr] = None, + _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, + ) -> ListDocumentsResponse: + """List documents + + List documents with pagination and optional search. Documents are the source content from which memory units are extracted. + + :param bank_id: (required) + :type bank_id: str + :param q: + :type q: str + :param limit: + :type limit: int + :param offset: + :type offset: int + :param authorization: + :type authorization: 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._list_documents_serialize( + bank_id=bank_id, + q=q, + limit=limit, + offset=offset, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListDocumentsResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_documents_with_http_info( + self, + bank_id: StrictStr, + q: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + offset: Optional[StrictInt] = None, + authorization: Optional[StrictStr] = None, + _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[ListDocumentsResponse]: + """List documents + + List documents with pagination and optional search. Documents are the source content from which memory units are extracted. + + :param bank_id: (required) + :type bank_id: str + :param q: + :type q: str + :param limit: + :type limit: int + :param offset: + :type offset: int + :param authorization: + :type authorization: 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._list_documents_serialize( + bank_id=bank_id, + q=q, + limit=limit, + offset=offset, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListDocumentsResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_documents_without_preload_content( + self, + bank_id: StrictStr, + q: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + offset: Optional[StrictInt] = None, + authorization: Optional[StrictStr] = None, + _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: + """List documents + + List documents with pagination and optional search. Documents are the source content from which memory units are extracted. + + :param bank_id: (required) + :type bank_id: str + :param q: + :type q: str + :param limit: + :type limit: int + :param offset: + :type offset: int + :param authorization: + :type authorization: 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._list_documents_serialize( + bank_id=bank_id, + q=q, + limit=limit, + offset=offset, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListDocumentsResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_documents_serialize( + self, + bank_id, + q, + limit, + offset, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + if q is not None: + + _query_params.append(('q', q)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if offset is not None: + + _query_params.append(('offset', offset)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/banks/{bank_id}/documents', + 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 + ) + + diff --git a/hindsight-clients/python/hindsight_client_api/api/entities_api.py b/hindsight-clients/python/hindsight_client_api/api/entities_api.py new file mode 100644 index 00000000..9d710b56 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/api/entities_api.py @@ -0,0 +1,921 @@ +# coding: utf-8 + +""" + Hindsight HTTP API + + HTTP API for Hindsight + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from hindsight_client_api.models.entity_detail_response import EntityDetailResponse +from hindsight_client_api.models.entity_list_response import EntityListResponse + +from hindsight_client_api.api_client import ApiClient, RequestSerialized +from hindsight_client_api.api_response import ApiResponse +from hindsight_client_api.rest import RESTResponseType + + +class EntitiesApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def get_entity( + self, + bank_id: StrictStr, + entity_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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, + ) -> EntityDetailResponse: + """Get entity details + + Get detailed information about an entity including observations (mental model). + + :param bank_id: (required) + :type bank_id: str + :param entity_id: (required) + :type entity_id: str + :param authorization: + :type authorization: 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_entity_serialize( + bank_id=bank_id, + entity_id=entity_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EntityDetailResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_entity_with_http_info( + self, + bank_id: StrictStr, + entity_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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[EntityDetailResponse]: + """Get entity details + + Get detailed information about an entity including observations (mental model). + + :param bank_id: (required) + :type bank_id: str + :param entity_id: (required) + :type entity_id: str + :param authorization: + :type authorization: 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_entity_serialize( + bank_id=bank_id, + entity_id=entity_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EntityDetailResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_entity_without_preload_content( + self, + bank_id: StrictStr, + entity_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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 entity details + + Get detailed information about an entity including observations (mental model). + + :param bank_id: (required) + :type bank_id: str + :param entity_id: (required) + :type entity_id: str + :param authorization: + :type authorization: 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_entity_serialize( + bank_id=bank_id, + entity_id=entity_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EntityDetailResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_entity_serialize( + self, + bank_id, + entity_id, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + if entity_id is not None: + _path_params['entity_id'] = entity_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/banks/{bank_id}/entities/{entity_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 + async def list_entities( + self, + bank_id: StrictStr, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of entities to return")] = None, + authorization: Optional[StrictStr] = None, + _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, + ) -> EntityListResponse: + """List entities + + List all entities (people, organizations, etc.) known by the bank, ordered by mention count. + + :param bank_id: (required) + :type bank_id: str + :param limit: Maximum number of entities to return + :type limit: int + :param authorization: + :type authorization: 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._list_entities_serialize( + bank_id=bank_id, + limit=limit, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EntityListResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_entities_with_http_info( + self, + bank_id: StrictStr, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of entities to return")] = None, + authorization: Optional[StrictStr] = None, + _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[EntityListResponse]: + """List entities + + List all entities (people, organizations, etc.) known by the bank, ordered by mention count. + + :param bank_id: (required) + :type bank_id: str + :param limit: Maximum number of entities to return + :type limit: int + :param authorization: + :type authorization: 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._list_entities_serialize( + bank_id=bank_id, + limit=limit, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EntityListResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_entities_without_preload_content( + self, + bank_id: StrictStr, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of entities to return")] = None, + authorization: Optional[StrictStr] = None, + _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: + """List entities + + List all entities (people, organizations, etc.) known by the bank, ordered by mention count. + + :param bank_id: (required) + :type bank_id: str + :param limit: Maximum number of entities to return + :type limit: int + :param authorization: + :type authorization: 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._list_entities_serialize( + bank_id=bank_id, + limit=limit, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EntityListResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_entities_serialize( + self, + bank_id, + limit, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/banks/{bank_id}/entities', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def regenerate_entity_observations( + self, + bank_id: StrictStr, + entity_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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, + ) -> EntityDetailResponse: + """Regenerate entity observations + + Regenerate observations for an entity based on all facts mentioning it. + + :param bank_id: (required) + :type bank_id: str + :param entity_id: (required) + :type entity_id: str + :param authorization: + :type authorization: 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._regenerate_entity_observations_serialize( + bank_id=bank_id, + entity_id=entity_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EntityDetailResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def regenerate_entity_observations_with_http_info( + self, + bank_id: StrictStr, + entity_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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[EntityDetailResponse]: + """Regenerate entity observations + + Regenerate observations for an entity based on all facts mentioning it. + + :param bank_id: (required) + :type bank_id: str + :param entity_id: (required) + :type entity_id: str + :param authorization: + :type authorization: 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._regenerate_entity_observations_serialize( + bank_id=bank_id, + entity_id=entity_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EntityDetailResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def regenerate_entity_observations_without_preload_content( + self, + bank_id: StrictStr, + entity_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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: + """Regenerate entity observations + + Regenerate observations for an entity based on all facts mentioning it. + + :param bank_id: (required) + :type bank_id: str + :param entity_id: (required) + :type entity_id: str + :param authorization: + :type authorization: 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._regenerate_entity_observations_serialize( + bank_id=bank_id, + entity_id=entity_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EntityDetailResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _regenerate_entity_observations_serialize( + self, + bank_id, + entity_id, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + if entity_id is not None: + _path_params['entity_id'] = entity_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/default/banks/{bank_id}/entities/{entity_id}/regenerate', + 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 + ) + + diff --git a/hindsight-clients/python/hindsight_client_api/api/memory_api.py b/hindsight-clients/python/hindsight_client_api/api/memory_api.py new file mode 100644 index 00000000..618d721e --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/api/memory_api.py @@ -0,0 +1,1901 @@ +# coding: utf-8 + +""" + Hindsight HTTP API + + HTTP API for Hindsight + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from hindsight_client_api.models.delete_response import DeleteResponse +from hindsight_client_api.models.graph_data_response import GraphDataResponse +from hindsight_client_api.models.list_memory_units_response import ListMemoryUnitsResponse +from hindsight_client_api.models.recall_request import RecallRequest +from hindsight_client_api.models.recall_response import RecallResponse +from hindsight_client_api.models.reflect_request import ReflectRequest +from hindsight_client_api.models.reflect_response import ReflectResponse +from hindsight_client_api.models.retain_request import RetainRequest +from hindsight_client_api.models.retain_response import RetainResponse + +from hindsight_client_api.api_client import ApiClient, RequestSerialized +from hindsight_client_api.api_response import ApiResponse +from hindsight_client_api.rest import RESTResponseType + + +class MemoryApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def clear_bank_memories( + self, + bank_id: StrictStr, + type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, experience, opinion)")] = None, + authorization: Optional[StrictStr] = None, + _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, + ) -> DeleteResponse: + """Clear memory bank memories + + Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved. + + :param bank_id: (required) + :type bank_id: str + :param type: Optional fact type filter (world, experience, opinion) + :type type: str + :param authorization: + :type authorization: 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._clear_bank_memories_serialize( + bank_id=bank_id, + type=type, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def clear_bank_memories_with_http_info( + self, + bank_id: StrictStr, + type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, experience, opinion)")] = None, + authorization: Optional[StrictStr] = None, + _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[DeleteResponse]: + """Clear memory bank memories + + Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved. + + :param bank_id: (required) + :type bank_id: str + :param type: Optional fact type filter (world, experience, opinion) + :type type: str + :param authorization: + :type authorization: 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._clear_bank_memories_serialize( + bank_id=bank_id, + type=type, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def clear_bank_memories_without_preload_content( + self, + bank_id: StrictStr, + type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, experience, opinion)")] = None, + authorization: Optional[StrictStr] = None, + _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: + """Clear memory bank memories + + Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved. + + :param bank_id: (required) + :type bank_id: str + :param type: Optional fact type filter (world, experience, opinion) + :type type: str + :param authorization: + :type authorization: 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._clear_bank_memories_serialize( + bank_id=bank_id, + type=type, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _clear_bank_memories_serialize( + self, + bank_id, + type, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + if type is not None: + + _query_params.append(('type', type)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/default/banks/{bank_id}/memories', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_graph( + self, + bank_id: StrictStr, + type: Optional[StrictStr] = None, + authorization: Optional[StrictStr] = None, + _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, + ) -> GraphDataResponse: + """Get memory graph data + + Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items. + + :param bank_id: (required) + :type bank_id: str + :param type: + :type type: str + :param authorization: + :type authorization: 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_graph_serialize( + bank_id=bank_id, + type=type, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GraphDataResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_graph_with_http_info( + self, + bank_id: StrictStr, + type: Optional[StrictStr] = None, + authorization: Optional[StrictStr] = None, + _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[GraphDataResponse]: + """Get memory graph data + + Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items. + + :param bank_id: (required) + :type bank_id: str + :param type: + :type type: str + :param authorization: + :type authorization: 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_graph_serialize( + bank_id=bank_id, + type=type, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GraphDataResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def get_graph_without_preload_content( + self, + bank_id: StrictStr, + type: Optional[StrictStr] = None, + authorization: Optional[StrictStr] = None, + _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 memory graph data + + Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items. + + :param bank_id: (required) + :type bank_id: str + :param type: + :type type: str + :param authorization: + :type authorization: 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_graph_serialize( + bank_id=bank_id, + type=type, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GraphDataResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_graph_serialize( + self, + bank_id, + type, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + if type is not None: + + _query_params.append(('type', type)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/banks/{bank_id}/graph', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_memories( + self, + bank_id: StrictStr, + type: Optional[StrictStr] = None, + q: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + offset: Optional[StrictInt] = None, + authorization: Optional[StrictStr] = None, + _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, + ) -> ListMemoryUnitsResponse: + """List memory units + + List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). + + :param bank_id: (required) + :type bank_id: str + :param type: + :type type: str + :param q: + :type q: str + :param limit: + :type limit: int + :param offset: + :type offset: int + :param authorization: + :type authorization: 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._list_memories_serialize( + bank_id=bank_id, + type=type, + q=q, + limit=limit, + offset=offset, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListMemoryUnitsResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_memories_with_http_info( + self, + bank_id: StrictStr, + type: Optional[StrictStr] = None, + q: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + offset: Optional[StrictInt] = None, + authorization: Optional[StrictStr] = None, + _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[ListMemoryUnitsResponse]: + """List memory units + + List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). + + :param bank_id: (required) + :type bank_id: str + :param type: + :type type: str + :param q: + :type q: str + :param limit: + :type limit: int + :param offset: + :type offset: int + :param authorization: + :type authorization: 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._list_memories_serialize( + bank_id=bank_id, + type=type, + q=q, + limit=limit, + offset=offset, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListMemoryUnitsResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_memories_without_preload_content( + self, + bank_id: StrictStr, + type: Optional[StrictStr] = None, + q: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + offset: Optional[StrictInt] = None, + authorization: Optional[StrictStr] = None, + _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: + """List memory units + + List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). + + :param bank_id: (required) + :type bank_id: str + :param type: + :type type: str + :param q: + :type q: str + :param limit: + :type limit: int + :param offset: + :type offset: int + :param authorization: + :type authorization: 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._list_memories_serialize( + bank_id=bank_id, + type=type, + q=q, + limit=limit, + offset=offset, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListMemoryUnitsResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_memories_serialize( + self, + bank_id, + type, + q, + limit, + offset, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + if type is not None: + + _query_params.append(('type', type)) + + if q is not None: + + _query_params.append(('q', q)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if offset is not None: + + _query_params.append(('offset', offset)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/banks/{bank_id}/memories/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def recall_memories( + self, + bank_id: StrictStr, + recall_request: RecallRequest, + authorization: Optional[StrictStr] = None, + _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, + ) -> RecallResponse: + """Recall memory + + Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - `world`: General knowledge about people, places, events, and things that happen - `experience`: Memories about experience, conversations, actions taken, and tasks performed - `opinion`: The bank's formed beliefs, perspectives, and viewpoints Set `include_entities=true` to get entity observations alongside recall results. + + :param bank_id: (required) + :type bank_id: str + :param recall_request: (required) + :type recall_request: RecallRequest + :param authorization: + :type authorization: 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._recall_memories_serialize( + bank_id=bank_id, + recall_request=recall_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RecallResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def recall_memories_with_http_info( + self, + bank_id: StrictStr, + recall_request: RecallRequest, + authorization: Optional[StrictStr] = None, + _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[RecallResponse]: + """Recall memory + + Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - `world`: General knowledge about people, places, events, and things that happen - `experience`: Memories about experience, conversations, actions taken, and tasks performed - `opinion`: The bank's formed beliefs, perspectives, and viewpoints Set `include_entities=true` to get entity observations alongside recall results. + + :param bank_id: (required) + :type bank_id: str + :param recall_request: (required) + :type recall_request: RecallRequest + :param authorization: + :type authorization: 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._recall_memories_serialize( + bank_id=bank_id, + recall_request=recall_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RecallResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def recall_memories_without_preload_content( + self, + bank_id: StrictStr, + recall_request: RecallRequest, + authorization: Optional[StrictStr] = None, + _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: + """Recall memory + + Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - `world`: General knowledge about people, places, events, and things that happen - `experience`: Memories about experience, conversations, actions taken, and tasks performed - `opinion`: The bank's formed beliefs, perspectives, and viewpoints Set `include_entities=true` to get entity observations alongside recall results. + + :param bank_id: (required) + :type bank_id: str + :param recall_request: (required) + :type recall_request: RecallRequest + :param authorization: + :type authorization: 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._recall_memories_serialize( + bank_id=bank_id, + recall_request=recall_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RecallResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _recall_memories_serialize( + self, + bank_id, + recall_request, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + if recall_request is not None: + _body_params = recall_request + + + # 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] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/default/banks/{bank_id}/memories/recall', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def reflect( + self, + bank_id: StrictStr, + reflect_request: ReflectRequest, + authorization: Optional[StrictStr] = None, + _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, + ) -> ReflectResponse: + """Reflect and generate answer + + Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves experience (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions + + :param bank_id: (required) + :type bank_id: str + :param reflect_request: (required) + :type reflect_request: ReflectRequest + :param authorization: + :type authorization: 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._reflect_serialize( + bank_id=bank_id, + reflect_request=reflect_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReflectResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def reflect_with_http_info( + self, + bank_id: StrictStr, + reflect_request: ReflectRequest, + authorization: Optional[StrictStr] = None, + _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[ReflectResponse]: + """Reflect and generate answer + + Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves experience (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions + + :param bank_id: (required) + :type bank_id: str + :param reflect_request: (required) + :type reflect_request: ReflectRequest + :param authorization: + :type authorization: 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._reflect_serialize( + bank_id=bank_id, + reflect_request=reflect_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReflectResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def reflect_without_preload_content( + self, + bank_id: StrictStr, + reflect_request: ReflectRequest, + authorization: Optional[StrictStr] = None, + _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: + """Reflect and generate answer + + Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves experience (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions + + :param bank_id: (required) + :type bank_id: str + :param reflect_request: (required) + :type reflect_request: ReflectRequest + :param authorization: + :type authorization: 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._reflect_serialize( + bank_id=bank_id, + reflect_request=reflect_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReflectResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _reflect_serialize( + self, + bank_id, + reflect_request, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + if reflect_request is not None: + _body_params = reflect_request + + + # 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] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/default/banks/{bank_id}/reflect', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def retain_memories( + self, + bank_id: StrictStr, + retain_request: RetainRequest, + authorization: Optional[StrictStr] = None, + _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, + ) -> RetainResponse: + """Retain memories + + Retain memory items with automatic fact extraction. This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the `async` parameter. **Features:** - Efficient batch processing - Automatic fact extraction from natural language - Entity recognition and linking - Document tracking with automatic upsert (when document_id is provided) - Temporal and semantic linking - Optional asynchronous processing **The system automatically:** 1. Extracts semantic facts from the content 2. Generates embeddings 3. Deduplicates similar facts 4. Creates temporal, semantic, and entity links 5. Tracks document metadata **When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor progress. **When `async=false` (default):** Waits for processing to complete. **Note:** If a memory item has a `document_id` that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). + + :param bank_id: (required) + :type bank_id: str + :param retain_request: (required) + :type retain_request: RetainRequest + :param authorization: + :type authorization: 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._retain_memories_serialize( + bank_id=bank_id, + retain_request=retain_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RetainResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def retain_memories_with_http_info( + self, + bank_id: StrictStr, + retain_request: RetainRequest, + authorization: Optional[StrictStr] = None, + _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[RetainResponse]: + """Retain memories + + Retain memory items with automatic fact extraction. This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the `async` parameter. **Features:** - Efficient batch processing - Automatic fact extraction from natural language - Entity recognition and linking - Document tracking with automatic upsert (when document_id is provided) - Temporal and semantic linking - Optional asynchronous processing **The system automatically:** 1. Extracts semantic facts from the content 2. Generates embeddings 3. Deduplicates similar facts 4. Creates temporal, semantic, and entity links 5. Tracks document metadata **When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor progress. **When `async=false` (default):** Waits for processing to complete. **Note:** If a memory item has a `document_id` that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). + + :param bank_id: (required) + :type bank_id: str + :param retain_request: (required) + :type retain_request: RetainRequest + :param authorization: + :type authorization: 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._retain_memories_serialize( + bank_id=bank_id, + retain_request=retain_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RetainResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def retain_memories_without_preload_content( + self, + bank_id: StrictStr, + retain_request: RetainRequest, + authorization: Optional[StrictStr] = None, + _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: + """Retain memories + + Retain memory items with automatic fact extraction. This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the `async` parameter. **Features:** - Efficient batch processing - Automatic fact extraction from natural language - Entity recognition and linking - Document tracking with automatic upsert (when document_id is provided) - Temporal and semantic linking - Optional asynchronous processing **The system automatically:** 1. Extracts semantic facts from the content 2. Generates embeddings 3. Deduplicates similar facts 4. Creates temporal, semantic, and entity links 5. Tracks document metadata **When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor progress. **When `async=false` (default):** Waits for processing to complete. **Note:** If a memory item has a `document_id` that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). + + :param bank_id: (required) + :type bank_id: str + :param retain_request: (required) + :type retain_request: RetainRequest + :param authorization: + :type authorization: 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._retain_memories_serialize( + bank_id=bank_id, + retain_request=retain_request, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RetainResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _retain_memories_serialize( + self, + bank_id, + retain_request, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + if retain_request is not None: + _body_params = retain_request + + + # 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] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/default/banks/{bank_id}/memories', + 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 + ) + + diff --git a/hindsight-clients/python/hindsight_client_api/api/monitoring_api.py b/hindsight-clients/python/hindsight_client_api/api/monitoring_api.py index 6acc95f1..354c25af 100644 --- a/hindsight-clients/python/hindsight_client_api/api/monitoring_api.py +++ b/hindsight-clients/python/hindsight_client_api/api/monitoring_api.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/api/operations_api.py b/hindsight-clients/python/hindsight_client_api/api/operations_api.py new file mode 100644 index 00000000..e3d45110 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/api/operations_api.py @@ -0,0 +1,610 @@ +# coding: utf-8 + +""" + Hindsight HTTP API + + HTTP API for Hindsight + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import StrictStr +from typing import Optional +from hindsight_client_api.models.cancel_operation_response import CancelOperationResponse +from hindsight_client_api.models.operations_list_response import OperationsListResponse + +from hindsight_client_api.api_client import ApiClient, RequestSerialized +from hindsight_client_api.api_response import ApiResponse +from hindsight_client_api.rest import RESTResponseType + + +class OperationsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def cancel_operation( + self, + bank_id: StrictStr, + operation_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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, + ) -> CancelOperationResponse: + """Cancel a pending async operation + + Cancel a pending async operation by removing it from the queue + + :param bank_id: (required) + :type bank_id: str + :param operation_id: (required) + :type operation_id: str + :param authorization: + :type authorization: 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._cancel_operation_serialize( + bank_id=bank_id, + operation_id=operation_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CancelOperationResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def cancel_operation_with_http_info( + self, + bank_id: StrictStr, + operation_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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[CancelOperationResponse]: + """Cancel a pending async operation + + Cancel a pending async operation by removing it from the queue + + :param bank_id: (required) + :type bank_id: str + :param operation_id: (required) + :type operation_id: str + :param authorization: + :type authorization: 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._cancel_operation_serialize( + bank_id=bank_id, + operation_id=operation_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CancelOperationResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def cancel_operation_without_preload_content( + self, + bank_id: StrictStr, + operation_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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: + """Cancel a pending async operation + + Cancel a pending async operation by removing it from the queue + + :param bank_id: (required) + :type bank_id: str + :param operation_id: (required) + :type operation_id: str + :param authorization: + :type authorization: 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._cancel_operation_serialize( + bank_id=bank_id, + operation_id=operation_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CancelOperationResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _cancel_operation_serialize( + self, + bank_id, + operation_id, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + if operation_id is not None: + _path_params['operation_id'] = operation_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/default/banks/{bank_id}/operations/{operation_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 + async def list_operations( + self, + bank_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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, + ) -> OperationsListResponse: + """List async operations + + Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations + + :param bank_id: (required) + :type bank_id: str + :param authorization: + :type authorization: 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._list_operations_serialize( + bank_id=bank_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperationsListResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_operations_with_http_info( + self, + bank_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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[OperationsListResponse]: + """List async operations + + Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations + + :param bank_id: (required) + :type bank_id: str + :param authorization: + :type authorization: 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._list_operations_serialize( + bank_id=bank_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperationsListResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_operations_without_preload_content( + self, + bank_id: StrictStr, + authorization: Optional[StrictStr] = None, + _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: + """List async operations + + Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations + + :param bank_id: (required) + :type bank_id: str + :param authorization: + :type authorization: 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._list_operations_serialize( + bank_id=bank_id, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OperationsListResponse", + '422': "HTTPValidationError", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_operations_serialize( + self, + bank_id, + authorization, + _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 bank_id is not None: + _path_params['bank_id'] = bank_id + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/default/banks/{bank_id}/operations', + 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 + ) + + diff --git a/hindsight-clients/python/hindsight_client_api/api_client.py b/hindsight-clients/python/hindsight_client_api/api_client.py index 5d66fd88..3d5c1158 100644 --- a/hindsight-clients/python/hindsight_client_api/api_client.py +++ b/hindsight-clients/python/hindsight_client_api/api_client.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/configuration.py b/hindsight-clients/python/hindsight_client_api/configuration.py index 0ac03966..861590dd 100644 --- a/hindsight-clients/python/hindsight_client_api/configuration.py +++ b/hindsight-clients/python/hindsight_client_api/configuration.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -500,7 +500,7 @@ def to_debug_report(self) -> str: return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 1.0.0\n"\ + "Version of the API: 0.1.0\n"\ "SDK Package Version: 0.0.7".\ format(env=sys.platform, pyversion=sys.version) diff --git a/hindsight-clients/python/hindsight_client_api/docs/BankListItem.md b/hindsight-clients/python/hindsight_client_api/docs/BankListItem.md index 21633de4..b8070758 100644 --- a/hindsight-clients/python/hindsight_client_api/docs/BankListItem.md +++ b/hindsight-clients/python/hindsight_client_api/docs/BankListItem.md @@ -7,9 +7,9 @@ Bank list item with profile summary. Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **bank_id** | **str** | | -**name** | **str** | | +**name** | **str** | | [optional] **disposition** | [**DispositionTraits**](DispositionTraits.md) | | -**background** | **str** | | +**background** | **str** | | [optional] **created_at** | **str** | | [optional] **updated_at** | **str** | | [optional] diff --git a/hindsight-clients/python/hindsight_client_api/docs/BankStatsResponse.md b/hindsight-clients/python/hindsight_client_api/docs/BankStatsResponse.md new file mode 100644 index 00000000..64505971 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/docs/BankStatsResponse.md @@ -0,0 +1,39 @@ +# BankStatsResponse + +Response model for bank statistics endpoint. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bank_id** | **str** | | +**total_nodes** | **int** | | +**total_links** | **int** | | +**total_documents** | **int** | | +**nodes_by_fact_type** | **Dict[str, int]** | | +**links_by_link_type** | **Dict[str, int]** | | +**links_by_fact_type** | **Dict[str, int]** | | +**links_breakdown** | **Dict[str, Dict[str, int]]** | | +**pending_operations** | **int** | | +**failed_operations** | **int** | | + +## Example + +```python +from hindsight_client_api.models.bank_stats_response import BankStatsResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of BankStatsResponse from a JSON string +bank_stats_response_instance = BankStatsResponse.from_json(json) +# print the JSON string representation of the object +print(BankStatsResponse.to_json()) + +# convert the object into a dict +bank_stats_response_dict = bank_stats_response_instance.to_dict() +# create an instance of BankStatsResponse from a dict +bank_stats_response_from_dict = BankStatsResponse.from_dict(bank_stats_response_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/hindsight-clients/python/hindsight_client_api/docs/BanksApi.md b/hindsight-clients/python/hindsight_client_api/docs/BanksApi.md new file mode 100644 index 00000000..6a2618ab --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/docs/BanksApi.md @@ -0,0 +1,517 @@ +# hindsight_client_api.BanksApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_bank_background**](BanksApi.md#add_bank_background) | **POST** /v1/default/banks/{bank_id}/background | Add/merge memory bank background +[**create_or_update_bank**](BanksApi.md#create_or_update_bank) | **PUT** /v1/default/banks/{bank_id} | Create or update memory bank +[**delete_bank**](BanksApi.md#delete_bank) | **DELETE** /v1/default/banks/{bank_id} | Delete memory bank +[**get_agent_stats**](BanksApi.md#get_agent_stats) | **GET** /v1/default/banks/{bank_id}/stats | Get statistics for memory bank +[**get_bank_profile**](BanksApi.md#get_bank_profile) | **GET** /v1/default/banks/{bank_id}/profile | Get memory bank profile +[**list_banks**](BanksApi.md#list_banks) | **GET** /v1/default/banks | List all memory banks +[**update_bank_disposition**](BanksApi.md#update_bank_disposition) | **PUT** /v1/default/banks/{bank_id}/profile | Update memory bank disposition + + +# **add_bank_background** +> BackgroundResponse add_bank_background(bank_id, add_background_request, authorization=authorization) + +Add/merge memory bank background + +Add new background information or merge with existing. LLM intelligently resolves conflicts, normalizes to first person, and optionally infers disposition traits. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.add_background_request import AddBackgroundRequest +from hindsight_client_api.models.background_response import BackgroundResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.BanksApi(api_client) + bank_id = 'bank_id_example' # str | + add_background_request = hindsight_client_api.AddBackgroundRequest() # AddBackgroundRequest | + authorization = 'authorization_example' # str | (optional) + + try: + # Add/merge memory bank background + api_response = await api_instance.add_bank_background(bank_id, add_background_request, authorization=authorization) + print("The response of BanksApi->add_bank_background:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BanksApi->add_bank_background: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **add_background_request** | [**AddBackgroundRequest**](AddBackgroundRequest.md)| | + **authorization** | **str**| | [optional] + +### Return type + +[**BackgroundResponse**](BackgroundResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **create_or_update_bank** +> BankProfileResponse create_or_update_bank(bank_id, create_bank_request, authorization=authorization) + +Create or update memory bank + +Create a new agent or update existing agent with disposition and background. Auto-fills missing fields with defaults. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.bank_profile_response import BankProfileResponse +from hindsight_client_api.models.create_bank_request import CreateBankRequest +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.BanksApi(api_client) + bank_id = 'bank_id_example' # str | + create_bank_request = hindsight_client_api.CreateBankRequest() # CreateBankRequest | + authorization = 'authorization_example' # str | (optional) + + try: + # Create or update memory bank + api_response = await api_instance.create_or_update_bank(bank_id, create_bank_request, authorization=authorization) + print("The response of BanksApi->create_or_update_bank:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BanksApi->create_or_update_bank: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **create_bank_request** | [**CreateBankRequest**](CreateBankRequest.md)| | + **authorization** | **str**| | [optional] + +### Return type + +[**BankProfileResponse**](BankProfileResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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_bank** +> DeleteResponse delete_bank(bank_id, authorization=authorization) + +Delete memory bank + +Delete an entire memory bank including all memories, entities, documents, and the bank profile itself. This is a destructive operation that cannot be undone. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.delete_response import DeleteResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.BanksApi(api_client) + bank_id = 'bank_id_example' # str | + authorization = 'authorization_example' # str | (optional) + + try: + # Delete memory bank + api_response = await api_instance.delete_bank(bank_id, authorization=authorization) + print("The response of BanksApi->delete_bank:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BanksApi->delete_bank: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **authorization** | **str**| | [optional] + +### Return type + +[**DeleteResponse**](DeleteResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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_agent_stats** +> BankStatsResponse get_agent_stats(bank_id) + +Get statistics for memory bank + +Get statistics about nodes and links for a specific agent + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.bank_stats_response import BankStatsResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.BanksApi(api_client) + bank_id = 'bank_id_example' # str | + + try: + # Get statistics for memory bank + api_response = await api_instance.get_agent_stats(bank_id) + print("The response of BanksApi->get_agent_stats:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BanksApi->get_agent_stats: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + +### Return type + +[**BankStatsResponse**](BankStatsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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_bank_profile** +> BankProfileResponse get_bank_profile(bank_id, authorization=authorization) + +Get memory bank profile + +Get disposition traits and background for a memory bank. Auto-creates agent with defaults if not exists. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.bank_profile_response import BankProfileResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.BanksApi(api_client) + bank_id = 'bank_id_example' # str | + authorization = 'authorization_example' # str | (optional) + + try: + # Get memory bank profile + api_response = await api_instance.get_bank_profile(bank_id, authorization=authorization) + print("The response of BanksApi->get_bank_profile:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BanksApi->get_bank_profile: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **authorization** | **str**| | [optional] + +### Return type + +[**BankProfileResponse**](BankProfileResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **list_banks** +> BankListResponse list_banks(authorization=authorization) + +List all memory banks + +Get a list of all agents with their profiles + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.bank_list_response import BankListResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.BanksApi(api_client) + authorization = 'authorization_example' # str | (optional) + + try: + # List all memory banks + api_response = await api_instance.list_banks(authorization=authorization) + print("The response of BanksApi->list_banks:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BanksApi->list_banks: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | [optional] + +### Return type + +[**BankListResponse**](BankListResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **update_bank_disposition** +> BankProfileResponse update_bank_disposition(bank_id, update_disposition_request, authorization=authorization) + +Update memory bank disposition + +Update bank's disposition traits (skepticism, literalism, empathy) + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.bank_profile_response import BankProfileResponse +from hindsight_client_api.models.update_disposition_request import UpdateDispositionRequest +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.BanksApi(api_client) + bank_id = 'bank_id_example' # str | + update_disposition_request = hindsight_client_api.UpdateDispositionRequest() # UpdateDispositionRequest | + authorization = 'authorization_example' # str | (optional) + + try: + # Update memory bank disposition + api_response = await api_instance.update_bank_disposition(bank_id, update_disposition_request, authorization=authorization) + print("The response of BanksApi->update_bank_disposition:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BanksApi->update_bank_disposition: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **update_disposition_request** | [**UpdateDispositionRequest**](UpdateDispositionRequest.md)| | + **authorization** | **str**| | [optional] + +### Return type + +[**BankProfileResponse**](BankProfileResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + diff --git a/hindsight-clients/python/hindsight_client_api/docs/CancelOperationResponse.md b/hindsight-clients/python/hindsight_client_api/docs/CancelOperationResponse.md new file mode 100644 index 00000000..0015b5a1 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/docs/CancelOperationResponse.md @@ -0,0 +1,32 @@ +# CancelOperationResponse + +Response model for cancel operation endpoint. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | +**message** | **str** | | +**operation_id** | **str** | | + +## Example + +```python +from hindsight_client_api.models.cancel_operation_response import CancelOperationResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CancelOperationResponse from a JSON string +cancel_operation_response_instance = CancelOperationResponse.from_json(json) +# print the JSON string representation of the object +print(CancelOperationResponse.to_json()) + +# convert the object into a dict +cancel_operation_response_dict = cancel_operation_response_instance.to_dict() +# create an instance of CancelOperationResponse from a dict +cancel_operation_response_from_dict = CancelOperationResponse.from_dict(cancel_operation_response_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/hindsight-clients/python/hindsight_client_api/docs/DefaultApi.md b/hindsight-clients/python/hindsight_client_api/docs/DefaultApi.md deleted file mode 100644 index 4c1f033c..00000000 --- a/hindsight-clients/python/hindsight_client_api/docs/DefaultApi.md +++ /dev/null @@ -1,1568 +0,0 @@ -# hindsight_client_api.DefaultApi - -All URIs are relative to *http://localhost* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**add_bank_background**](DefaultApi.md#add_bank_background) | **POST** /v1/default/banks/{bank_id}/background | Add/merge memory bank background -[**cancel_operation**](DefaultApi.md#cancel_operation) | **DELETE** /v1/default/banks/{bank_id}/operations/{operation_id} | Cancel a pending async operation -[**clear_bank_memories**](DefaultApi.md#clear_bank_memories) | **DELETE** /v1/default/banks/{bank_id}/memories | Clear memory bank memories -[**create_or_update_bank**](DefaultApi.md#create_or_update_bank) | **PUT** /v1/default/banks/{bank_id} | Create or update memory bank -[**delete_document**](DefaultApi.md#delete_document) | **DELETE** /v1/default/banks/{bank_id}/documents/{document_id} | Delete a document -[**get_agent_stats**](DefaultApi.md#get_agent_stats) | **GET** /v1/default/banks/{bank_id}/stats | Get statistics for memory bank -[**get_bank_profile**](DefaultApi.md#get_bank_profile) | **GET** /v1/default/banks/{bank_id}/profile | Get memory bank profile -[**get_chunk**](DefaultApi.md#get_chunk) | **GET** /v1/default/chunks/{chunk_id} | Get chunk details -[**get_document**](DefaultApi.md#get_document) | **GET** /v1/default/banks/{bank_id}/documents/{document_id} | Get document details -[**get_entity**](DefaultApi.md#get_entity) | **GET** /v1/default/banks/{bank_id}/entities/{entity_id} | Get entity details -[**get_graph**](DefaultApi.md#get_graph) | **GET** /v1/default/banks/{bank_id}/graph | Get memory graph data -[**list_banks**](DefaultApi.md#list_banks) | **GET** /v1/default/banks | List all memory banks -[**list_documents**](DefaultApi.md#list_documents) | **GET** /v1/default/banks/{bank_id}/documents | List documents -[**list_entities**](DefaultApi.md#list_entities) | **GET** /v1/default/banks/{bank_id}/entities | List entities -[**list_memories**](DefaultApi.md#list_memories) | **GET** /v1/default/banks/{bank_id}/memories/list | List memory units -[**list_operations**](DefaultApi.md#list_operations) | **GET** /v1/default/banks/{bank_id}/operations | List async operations -[**recall_memories**](DefaultApi.md#recall_memories) | **POST** /v1/default/banks/{bank_id}/memories/recall | Recall memory -[**reflect**](DefaultApi.md#reflect) | **POST** /v1/default/banks/{bank_id}/reflect | Reflect and generate answer -[**regenerate_entity_observations**](DefaultApi.md#regenerate_entity_observations) | **POST** /v1/default/banks/{bank_id}/entities/{entity_id}/regenerate | Regenerate entity observations -[**retain_memories**](DefaultApi.md#retain_memories) | **POST** /v1/default/banks/{bank_id}/memories | Retain memories -[**update_bank_disposition**](DefaultApi.md#update_bank_disposition) | **PUT** /v1/default/banks/{bank_id}/profile | Update memory bank disposition - - -# **add_bank_background** -> BackgroundResponse add_bank_background(bank_id, add_background_request) - -Add/merge memory bank background - -Add new background information or merge with existing. LLM intelligently resolves conflicts, normalizes to first person, and optionally infers disposition traits. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.add_background_request import AddBackgroundRequest -from hindsight_client_api.models.background_response import BackgroundResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - add_background_request = hindsight_client_api.AddBackgroundRequest() # AddBackgroundRequest | - - try: - # Add/merge memory bank background - api_response = await api_instance.add_bank_background(bank_id, add_background_request) - print("The response of DefaultApi->add_bank_background:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->add_bank_background: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **add_background_request** | [**AddBackgroundRequest**](AddBackgroundRequest.md)| | - -### Return type - -[**BackgroundResponse**](BackgroundResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **cancel_operation** -> object cancel_operation(bank_id, operation_id) - -Cancel a pending async operation - -Cancel a pending async operation by removing it from the queue - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - operation_id = 'operation_id_example' # str | - - try: - # Cancel a pending async operation - api_response = await api_instance.cancel_operation(bank_id, operation_id) - print("The response of DefaultApi->cancel_operation:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->cancel_operation: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **operation_id** | **str**| | - -### Return type - -**object** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **clear_bank_memories** -> DeleteResponse clear_bank_memories(bank_id, type=type) - -Clear memory bank memories - -Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.delete_response import DeleteResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - type = 'type_example' # str | Optional fact type filter (world, experience, opinion) (optional) - - try: - # Clear memory bank memories - api_response = await api_instance.clear_bank_memories(bank_id, type=type) - print("The response of DefaultApi->clear_bank_memories:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->clear_bank_memories: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **type** | **str**| Optional fact type filter (world, experience, opinion) | [optional] - -### Return type - -[**DeleteResponse**](DeleteResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **create_or_update_bank** -> BankProfileResponse create_or_update_bank(bank_id, create_bank_request) - -Create or update memory bank - -Create a new agent or update existing agent with disposition and background. Auto-fills missing fields with defaults. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.bank_profile_response import BankProfileResponse -from hindsight_client_api.models.create_bank_request import CreateBankRequest -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - create_bank_request = hindsight_client_api.CreateBankRequest() # CreateBankRequest | - - try: - # Create or update memory bank - api_response = await api_instance.create_or_update_bank(bank_id, create_bank_request) - print("The response of DefaultApi->create_or_update_bank:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->create_or_update_bank: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **create_bank_request** | [**CreateBankRequest**](CreateBankRequest.md)| | - -### Return type - -[**BankProfileResponse**](BankProfileResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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_document** -> object delete_document(bank_id, document_id) - -Delete a document - -Delete a document and all its associated memory units and links. - -This will cascade delete: -- The document itself -- All memory units extracted from this document -- All links (temporal, semantic, entity) associated with those memory units - -This operation cannot be undone. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - document_id = 'document_id_example' # str | - - try: - # Delete a document - api_response = await api_instance.delete_document(bank_id, document_id) - print("The response of DefaultApi->delete_document:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->delete_document: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **document_id** | **str**| | - -### Return type - -**object** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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_agent_stats** -> object get_agent_stats(bank_id) - -Get statistics for memory bank - -Get statistics about nodes and links for a specific agent - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - - try: - # Get statistics for memory bank - api_response = await api_instance.get_agent_stats(bank_id) - print("The response of DefaultApi->get_agent_stats:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->get_agent_stats: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - -### Return type - -**object** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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_bank_profile** -> BankProfileResponse get_bank_profile(bank_id) - -Get memory bank profile - -Get disposition traits and background for a memory bank. Auto-creates agent with defaults if not exists. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.bank_profile_response import BankProfileResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - - try: - # Get memory bank profile - api_response = await api_instance.get_bank_profile(bank_id) - print("The response of DefaultApi->get_bank_profile:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->get_bank_profile: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - -### Return type - -[**BankProfileResponse**](BankProfileResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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_chunk** -> ChunkResponse get_chunk(chunk_id) - -Get chunk details - -Get a specific chunk by its ID - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.chunk_response import ChunkResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - chunk_id = 'chunk_id_example' # str | - - try: - # Get chunk details - api_response = await api_instance.get_chunk(chunk_id) - print("The response of DefaultApi->get_chunk:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->get_chunk: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **chunk_id** | **str**| | - -### Return type - -[**ChunkResponse**](ChunkResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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_document** -> DocumentResponse get_document(bank_id, document_id) - -Get document details - -Get a specific document including its original text - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.document_response import DocumentResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - document_id = 'document_id_example' # str | - - try: - # Get document details - api_response = await api_instance.get_document(bank_id, document_id) - print("The response of DefaultApi->get_document:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->get_document: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **document_id** | **str**| | - -### Return type - -[**DocumentResponse**](DocumentResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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_entity** -> EntityDetailResponse get_entity(bank_id, entity_id) - -Get entity details - -Get detailed information about an entity including observations (mental model). - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.entity_detail_response import EntityDetailResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - entity_id = 'entity_id_example' # str | - - try: - # Get entity details - api_response = await api_instance.get_entity(bank_id, entity_id) - print("The response of DefaultApi->get_entity:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->get_entity: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **entity_id** | **str**| | - -### Return type - -[**EntityDetailResponse**](EntityDetailResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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_graph** -> GraphDataResponse get_graph(bank_id, type=type) - -Get memory graph data - -Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.graph_data_response import GraphDataResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - type = 'type_example' # str | (optional) - - try: - # Get memory graph data - api_response = await api_instance.get_graph(bank_id, type=type) - print("The response of DefaultApi->get_graph:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->get_graph: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **type** | **str**| | [optional] - -### Return type - -[**GraphDataResponse**](GraphDataResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **list_banks** -> BankListResponse list_banks() - -List all memory banks - -Get a list of all agents with their profiles - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.bank_list_response import BankListResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - - try: - # List all memory banks - api_response = await api_instance.list_banks() - print("The response of DefaultApi->list_banks:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->list_banks: %s\n" % e) -``` - - - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**BankListResponse**](BankListResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **list_documents** -> ListDocumentsResponse list_documents(bank_id, q=q, limit=limit, offset=offset) - -List documents - -List documents with pagination and optional search. Documents are the source content from which memory units are extracted. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.list_documents_response import ListDocumentsResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - q = 'q_example' # str | (optional) - limit = 100 # int | (optional) (default to 100) - offset = 0 # int | (optional) (default to 0) - - try: - # List documents - api_response = await api_instance.list_documents(bank_id, q=q, limit=limit, offset=offset) - print("The response of DefaultApi->list_documents:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->list_documents: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **q** | **str**| | [optional] - **limit** | **int**| | [optional] [default to 100] - **offset** | **int**| | [optional] [default to 0] - -### Return type - -[**ListDocumentsResponse**](ListDocumentsResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **list_entities** -> EntityListResponse list_entities(bank_id, limit=limit) - -List entities - -List all entities (people, organizations, etc.) known by the bank, ordered by mention count. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.entity_list_response import EntityListResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - limit = 100 # int | Maximum number of entities to return (optional) (default to 100) - - try: - # List entities - api_response = await api_instance.list_entities(bank_id, limit=limit) - print("The response of DefaultApi->list_entities:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->list_entities: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **limit** | **int**| Maximum number of entities to return | [optional] [default to 100] - -### Return type - -[**EntityListResponse**](EntityListResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **list_memories** -> ListMemoryUnitsResponse list_memories(bank_id, type=type, q=q, limit=limit, offset=offset) - -List memory units - -List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.list_memory_units_response import ListMemoryUnitsResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - type = 'type_example' # str | (optional) - q = 'q_example' # str | (optional) - limit = 100 # int | (optional) (default to 100) - offset = 0 # int | (optional) (default to 0) - - try: - # List memory units - api_response = await api_instance.list_memories(bank_id, type=type, q=q, limit=limit, offset=offset) - print("The response of DefaultApi->list_memories:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->list_memories: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **type** | **str**| | [optional] - **q** | **str**| | [optional] - **limit** | **int**| | [optional] [default to 100] - **offset** | **int**| | [optional] [default to 0] - -### Return type - -[**ListMemoryUnitsResponse**](ListMemoryUnitsResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **list_operations** -> object list_operations(bank_id) - -List async operations - -Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - - try: - # List async operations - api_response = await api_instance.list_operations(bank_id) - print("The response of DefaultApi->list_operations:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->list_operations: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - -### Return type - -**object** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **recall_memories** -> RecallResponse recall_memories(bank_id, recall_request) - -Recall memory - -Recall memory using semantic similarity and spreading activation. - - The type parameter is optional and must be one of: - - 'world': General knowledge about people, places, events, and things that happen - - 'experience': Memories about experience, conversations, actions taken, and tasks performed - - 'opinion': The bank's formed beliefs, perspectives, and viewpoints - - Set include_entities=true to get entity observations alongside recall results. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.recall_request import RecallRequest -from hindsight_client_api.models.recall_response import RecallResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - recall_request = hindsight_client_api.RecallRequest() # RecallRequest | - - try: - # Recall memory - api_response = await api_instance.recall_memories(bank_id, recall_request) - print("The response of DefaultApi->recall_memories:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->recall_memories: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **recall_request** | [**RecallRequest**](RecallRequest.md)| | - -### Return type - -[**RecallResponse**](RecallResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **reflect** -> ReflectResponse reflect(bank_id, reflect_request) - -Reflect and generate answer - -Reflect and formulate an answer using bank identity, world facts, and opinions. - - This endpoint: - 1. Retrieves experience (conversations and events) - 2. Retrieves world facts relevant to the query - 3. Retrieves existing opinions (bank's perspectives) - 4. Uses LLM to formulate a contextual answer - 5. Extracts and stores any new opinions formed - 6. Returns plain text answer, the facts used, and new opinions - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.reflect_request import ReflectRequest -from hindsight_client_api.models.reflect_response import ReflectResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - reflect_request = hindsight_client_api.ReflectRequest() # ReflectRequest | - - try: - # Reflect and generate answer - api_response = await api_instance.reflect(bank_id, reflect_request) - print("The response of DefaultApi->reflect:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->reflect: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **reflect_request** | [**ReflectRequest**](ReflectRequest.md)| | - -### Return type - -[**ReflectResponse**](ReflectResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **regenerate_entity_observations** -> EntityDetailResponse regenerate_entity_observations(bank_id, entity_id) - -Regenerate entity observations - -Regenerate observations for an entity based on all facts mentioning it. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.entity_detail_response import EntityDetailResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - entity_id = 'entity_id_example' # str | - - try: - # Regenerate entity observations - api_response = await api_instance.regenerate_entity_observations(bank_id, entity_id) - print("The response of DefaultApi->regenerate_entity_observations:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->regenerate_entity_observations: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **entity_id** | **str**| | - -### Return type - -[**EntityDetailResponse**](EntityDetailResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **retain_memories** -> RetainResponse retain_memories(bank_id, retain_request) - -Retain memories - -Retain memory items with automatic fact extraction. - - This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing - via the async parameter. - - Features: - - Efficient batch processing - - Automatic fact extraction from natural language - - Entity recognition and linking - - Document tracking with automatic upsert (when document_id is provided on items) - - Temporal and semantic linking - - Optional asynchronous processing - - The system automatically: - 1. Extracts semantic facts from the content - 2. Generates embeddings - 3. Deduplicates similar facts - 4. Creates temporal, semantic, and entity links - 5. Tracks document metadata - - When async=true: - - Returns immediately after queuing the task - - Processing happens in the background - - Use the operations endpoint to monitor progress - - When async=false (default): - - Waits for processing to complete - - Returns after all memories are stored - - Note: If a memory item has a document_id that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). Items with the same document_id are grouped together for efficient processing. - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.retain_request import RetainRequest -from hindsight_client_api.models.retain_response import RetainResponse -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - retain_request = hindsight_client_api.RetainRequest() # RetainRequest | - - try: - # Retain memories - api_response = await api_instance.retain_memories(bank_id, retain_request) - print("The response of DefaultApi->retain_memories:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->retain_memories: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **retain_request** | [**RetainRequest**](RetainRequest.md)| | - -### Return type - -[**RetainResponse**](RetainResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - -# **update_bank_disposition** -> BankProfileResponse update_bank_disposition(bank_id, update_disposition_request) - -Update memory bank disposition - -Update bank's disposition traits (skepticism, literalism, empathy) - -### Example - - -```python -import hindsight_client_api -from hindsight_client_api.models.bank_profile_response import BankProfileResponse -from hindsight_client_api.models.update_disposition_request import UpdateDispositionRequest -from hindsight_client_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = hindsight_client_api.Configuration( - host = "http://localhost" -) - - -# Enter a context with an instance of the API client -async with hindsight_client_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = hindsight_client_api.DefaultApi(api_client) - bank_id = 'bank_id_example' # str | - update_disposition_request = hindsight_client_api.UpdateDispositionRequest() # UpdateDispositionRequest | - - try: - # Update memory bank disposition - api_response = await api_instance.update_bank_disposition(bank_id, update_disposition_request) - print("The response of DefaultApi->update_bank_disposition:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->update_bank_disposition: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bank_id** | **str**| | - **update_disposition_request** | [**UpdateDispositionRequest**](UpdateDispositionRequest.md)| | - -### Return type - -[**BankProfileResponse**](BankProfileResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful Response | - | -**422** | Validation Error | - | - -[[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) - diff --git a/hindsight-clients/python/hindsight_client_api/docs/DeleteDocumentResponse.md b/hindsight-clients/python/hindsight_client_api/docs/DeleteDocumentResponse.md new file mode 100644 index 00000000..34fd9abb --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/docs/DeleteDocumentResponse.md @@ -0,0 +1,33 @@ +# DeleteDocumentResponse + +Response model for delete document endpoint. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | +**message** | **str** | | +**document_id** | **str** | | +**memory_units_deleted** | **int** | | + +## Example + +```python +from hindsight_client_api.models.delete_document_response import DeleteDocumentResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of DeleteDocumentResponse from a JSON string +delete_document_response_instance = DeleteDocumentResponse.from_json(json) +# print the JSON string representation of the object +print(DeleteDocumentResponse.to_json()) + +# convert the object into a dict +delete_document_response_dict = delete_document_response_instance.to_dict() +# create an instance of DeleteDocumentResponse from a dict +delete_document_response_from_dict = DeleteDocumentResponse.from_dict(delete_document_response_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/hindsight-clients/python/hindsight_client_api/docs/DeleteResponse.md b/hindsight-clients/python/hindsight_client_api/docs/DeleteResponse.md index d9a10af3..c7be16b4 100644 --- a/hindsight-clients/python/hindsight_client_api/docs/DeleteResponse.md +++ b/hindsight-clients/python/hindsight_client_api/docs/DeleteResponse.md @@ -7,6 +7,8 @@ Response model for delete operations. Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **success** | **bool** | | +**message** | **str** | | [optional] +**deleted_count** | **int** | | [optional] ## Example diff --git a/hindsight-clients/python/hindsight_client_api/docs/DocumentsApi.md b/hindsight-clients/python/hindsight_client_api/docs/DocumentsApi.md new file mode 100644 index 00000000..69d6af33 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/docs/DocumentsApi.md @@ -0,0 +1,313 @@ +# hindsight_client_api.DocumentsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**delete_document**](DocumentsApi.md#delete_document) | **DELETE** /v1/default/banks/{bank_id}/documents/{document_id} | Delete a document +[**get_chunk**](DocumentsApi.md#get_chunk) | **GET** /v1/default/chunks/{chunk_id} | Get chunk details +[**get_document**](DocumentsApi.md#get_document) | **GET** /v1/default/banks/{bank_id}/documents/{document_id} | Get document details +[**list_documents**](DocumentsApi.md#list_documents) | **GET** /v1/default/banks/{bank_id}/documents | List documents + + +# **delete_document** +> DeleteDocumentResponse delete_document(bank_id, document_id, authorization=authorization) + +Delete a document + +Delete a document and all its associated memory units and links. + +This will cascade delete: +- The document itself +- All memory units extracted from this document +- All links (temporal, semantic, entity) associated with those memory units + +This operation cannot be undone. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.delete_document_response import DeleteDocumentResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.DocumentsApi(api_client) + bank_id = 'bank_id_example' # str | + document_id = 'document_id_example' # str | + authorization = 'authorization_example' # str | (optional) + + try: + # Delete a document + api_response = await api_instance.delete_document(bank_id, document_id, authorization=authorization) + print("The response of DocumentsApi->delete_document:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DocumentsApi->delete_document: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **document_id** | **str**| | + **authorization** | **str**| | [optional] + +### Return type + +[**DeleteDocumentResponse**](DeleteDocumentResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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_chunk** +> ChunkResponse get_chunk(chunk_id, authorization=authorization) + +Get chunk details + +Get a specific chunk by its ID + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.chunk_response import ChunkResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.DocumentsApi(api_client) + chunk_id = 'chunk_id_example' # str | + authorization = 'authorization_example' # str | (optional) + + try: + # Get chunk details + api_response = await api_instance.get_chunk(chunk_id, authorization=authorization) + print("The response of DocumentsApi->get_chunk:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DocumentsApi->get_chunk: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **chunk_id** | **str**| | + **authorization** | **str**| | [optional] + +### Return type + +[**ChunkResponse**](ChunkResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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_document** +> DocumentResponse get_document(bank_id, document_id, authorization=authorization) + +Get document details + +Get a specific document including its original text + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.document_response import DocumentResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.DocumentsApi(api_client) + bank_id = 'bank_id_example' # str | + document_id = 'document_id_example' # str | + authorization = 'authorization_example' # str | (optional) + + try: + # Get document details + api_response = await api_instance.get_document(bank_id, document_id, authorization=authorization) + print("The response of DocumentsApi->get_document:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DocumentsApi->get_document: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **document_id** | **str**| | + **authorization** | **str**| | [optional] + +### Return type + +[**DocumentResponse**](DocumentResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **list_documents** +> ListDocumentsResponse list_documents(bank_id, q=q, limit=limit, offset=offset, authorization=authorization) + +List documents + +List documents with pagination and optional search. Documents are the source content from which memory units are extracted. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.list_documents_response import ListDocumentsResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.DocumentsApi(api_client) + bank_id = 'bank_id_example' # str | + q = 'q_example' # str | (optional) + limit = 100 # int | (optional) (default to 100) + offset = 0 # int | (optional) (default to 0) + authorization = 'authorization_example' # str | (optional) + + try: + # List documents + api_response = await api_instance.list_documents(bank_id, q=q, limit=limit, offset=offset, authorization=authorization) + print("The response of DocumentsApi->list_documents:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DocumentsApi->list_documents: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **q** | **str**| | [optional] + **limit** | **int**| | [optional] [default to 100] + **offset** | **int**| | [optional] [default to 0] + **authorization** | **str**| | [optional] + +### Return type + +[**ListDocumentsResponse**](ListDocumentsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + diff --git a/hindsight-clients/python/hindsight_client_api/docs/EntitiesApi.md b/hindsight-clients/python/hindsight_client_api/docs/EntitiesApi.md new file mode 100644 index 00000000..5079a1ef --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/docs/EntitiesApi.md @@ -0,0 +1,230 @@ +# hindsight_client_api.EntitiesApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_entity**](EntitiesApi.md#get_entity) | **GET** /v1/default/banks/{bank_id}/entities/{entity_id} | Get entity details +[**list_entities**](EntitiesApi.md#list_entities) | **GET** /v1/default/banks/{bank_id}/entities | List entities +[**regenerate_entity_observations**](EntitiesApi.md#regenerate_entity_observations) | **POST** /v1/default/banks/{bank_id}/entities/{entity_id}/regenerate | Regenerate entity observations + + +# **get_entity** +> EntityDetailResponse get_entity(bank_id, entity_id, authorization=authorization) + +Get entity details + +Get detailed information about an entity including observations (mental model). + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.entity_detail_response import EntityDetailResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.EntitiesApi(api_client) + bank_id = 'bank_id_example' # str | + entity_id = 'entity_id_example' # str | + authorization = 'authorization_example' # str | (optional) + + try: + # Get entity details + api_response = await api_instance.get_entity(bank_id, entity_id, authorization=authorization) + print("The response of EntitiesApi->get_entity:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EntitiesApi->get_entity: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **entity_id** | **str**| | + **authorization** | **str**| | [optional] + +### Return type + +[**EntityDetailResponse**](EntityDetailResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **list_entities** +> EntityListResponse list_entities(bank_id, limit=limit, authorization=authorization) + +List entities + +List all entities (people, organizations, etc.) known by the bank, ordered by mention count. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.entity_list_response import EntityListResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.EntitiesApi(api_client) + bank_id = 'bank_id_example' # str | + limit = 100 # int | Maximum number of entities to return (optional) (default to 100) + authorization = 'authorization_example' # str | (optional) + + try: + # List entities + api_response = await api_instance.list_entities(bank_id, limit=limit, authorization=authorization) + print("The response of EntitiesApi->list_entities:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EntitiesApi->list_entities: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **limit** | **int**| Maximum number of entities to return | [optional] [default to 100] + **authorization** | **str**| | [optional] + +### Return type + +[**EntityListResponse**](EntityListResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **regenerate_entity_observations** +> EntityDetailResponse regenerate_entity_observations(bank_id, entity_id, authorization=authorization) + +Regenerate entity observations + +Regenerate observations for an entity based on all facts mentioning it. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.entity_detail_response import EntityDetailResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.EntitiesApi(api_client) + bank_id = 'bank_id_example' # str | + entity_id = 'entity_id_example' # str | + authorization = 'authorization_example' # str | (optional) + + try: + # Regenerate entity observations + api_response = await api_instance.regenerate_entity_observations(bank_id, entity_id, authorization=authorization) + print("The response of EntitiesApi->regenerate_entity_observations:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EntitiesApi->regenerate_entity_observations: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **entity_id** | **str**| | + **authorization** | **str**| | [optional] + +### Return type + +[**EntityDetailResponse**](EntityDetailResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + diff --git a/hindsight-clients/python/hindsight_client_api/docs/MemoryApi.md b/hindsight-clients/python/hindsight_client_api/docs/MemoryApi.md new file mode 100644 index 00000000..8432e842 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/docs/MemoryApi.md @@ -0,0 +1,499 @@ +# hindsight_client_api.MemoryApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**clear_bank_memories**](MemoryApi.md#clear_bank_memories) | **DELETE** /v1/default/banks/{bank_id}/memories | Clear memory bank memories +[**get_graph**](MemoryApi.md#get_graph) | **GET** /v1/default/banks/{bank_id}/graph | Get memory graph data +[**list_memories**](MemoryApi.md#list_memories) | **GET** /v1/default/banks/{bank_id}/memories/list | List memory units +[**recall_memories**](MemoryApi.md#recall_memories) | **POST** /v1/default/banks/{bank_id}/memories/recall | Recall memory +[**reflect**](MemoryApi.md#reflect) | **POST** /v1/default/banks/{bank_id}/reflect | Reflect and generate answer +[**retain_memories**](MemoryApi.md#retain_memories) | **POST** /v1/default/banks/{bank_id}/memories | Retain memories + + +# **clear_bank_memories** +> DeleteResponse clear_bank_memories(bank_id, type=type, authorization=authorization) + +Clear memory bank memories + +Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.delete_response import DeleteResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.MemoryApi(api_client) + bank_id = 'bank_id_example' # str | + type = 'type_example' # str | Optional fact type filter (world, experience, opinion) (optional) + authorization = 'authorization_example' # str | (optional) + + try: + # Clear memory bank memories + api_response = await api_instance.clear_bank_memories(bank_id, type=type, authorization=authorization) + print("The response of MemoryApi->clear_bank_memories:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MemoryApi->clear_bank_memories: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **type** | **str**| Optional fact type filter (world, experience, opinion) | [optional] + **authorization** | **str**| | [optional] + +### Return type + +[**DeleteResponse**](DeleteResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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_graph** +> GraphDataResponse get_graph(bank_id, type=type, authorization=authorization) + +Get memory graph data + +Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.graph_data_response import GraphDataResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.MemoryApi(api_client) + bank_id = 'bank_id_example' # str | + type = 'type_example' # str | (optional) + authorization = 'authorization_example' # str | (optional) + + try: + # Get memory graph data + api_response = await api_instance.get_graph(bank_id, type=type, authorization=authorization) + print("The response of MemoryApi->get_graph:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MemoryApi->get_graph: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **type** | **str**| | [optional] + **authorization** | **str**| | [optional] + +### Return type + +[**GraphDataResponse**](GraphDataResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **list_memories** +> ListMemoryUnitsResponse list_memories(bank_id, type=type, q=q, limit=limit, offset=offset, authorization=authorization) + +List memory units + +List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.list_memory_units_response import ListMemoryUnitsResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.MemoryApi(api_client) + bank_id = 'bank_id_example' # str | + type = 'type_example' # str | (optional) + q = 'q_example' # str | (optional) + limit = 100 # int | (optional) (default to 100) + offset = 0 # int | (optional) (default to 0) + authorization = 'authorization_example' # str | (optional) + + try: + # List memory units + api_response = await api_instance.list_memories(bank_id, type=type, q=q, limit=limit, offset=offset, authorization=authorization) + print("The response of MemoryApi->list_memories:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MemoryApi->list_memories: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **type** | **str**| | [optional] + **q** | **str**| | [optional] + **limit** | **int**| | [optional] [default to 100] + **offset** | **int**| | [optional] [default to 0] + **authorization** | **str**| | [optional] + +### Return type + +[**ListMemoryUnitsResponse**](ListMemoryUnitsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **recall_memories** +> RecallResponse recall_memories(bank_id, recall_request, authorization=authorization) + +Recall memory + +Recall memory using semantic similarity and spreading activation. + +The type parameter is optional and must be one of: +- `world`: General knowledge about people, places, events, and things that happen +- `experience`: Memories about experience, conversations, actions taken, and tasks performed +- `opinion`: The bank's formed beliefs, perspectives, and viewpoints + +Set `include_entities=true` to get entity observations alongside recall results. + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.recall_request import RecallRequest +from hindsight_client_api.models.recall_response import RecallResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.MemoryApi(api_client) + bank_id = 'bank_id_example' # str | + recall_request = hindsight_client_api.RecallRequest() # RecallRequest | + authorization = 'authorization_example' # str | (optional) + + try: + # Recall memory + api_response = await api_instance.recall_memories(bank_id, recall_request, authorization=authorization) + print("The response of MemoryApi->recall_memories:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MemoryApi->recall_memories: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **recall_request** | [**RecallRequest**](RecallRequest.md)| | + **authorization** | **str**| | [optional] + +### Return type + +[**RecallResponse**](RecallResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **reflect** +> ReflectResponse reflect(bank_id, reflect_request, authorization=authorization) + +Reflect and generate answer + +Reflect and formulate an answer using bank identity, world facts, and opinions. + +This endpoint: +1. Retrieves experience (conversations and events) +2. Retrieves world facts relevant to the query +3. Retrieves existing opinions (bank's perspectives) +4. Uses LLM to formulate a contextual answer +5. Extracts and stores any new opinions formed +6. Returns plain text answer, the facts used, and new opinions + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.reflect_request import ReflectRequest +from hindsight_client_api.models.reflect_response import ReflectResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.MemoryApi(api_client) + bank_id = 'bank_id_example' # str | + reflect_request = hindsight_client_api.ReflectRequest() # ReflectRequest | + authorization = 'authorization_example' # str | (optional) + + try: + # Reflect and generate answer + api_response = await api_instance.reflect(bank_id, reflect_request, authorization=authorization) + print("The response of MemoryApi->reflect:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MemoryApi->reflect: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **reflect_request** | [**ReflectRequest**](ReflectRequest.md)| | + **authorization** | **str**| | [optional] + +### Return type + +[**ReflectResponse**](ReflectResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **retain_memories** +> RetainResponse retain_memories(bank_id, retain_request, authorization=authorization) + +Retain memories + +Retain memory items with automatic fact extraction. + +This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the `async` parameter. + +**Features:** +- Efficient batch processing +- Automatic fact extraction from natural language +- Entity recognition and linking +- Document tracking with automatic upsert (when document_id is provided) +- Temporal and semantic linking +- Optional asynchronous processing + +**The system automatically:** +1. Extracts semantic facts from the content +2. Generates embeddings +3. Deduplicates similar facts +4. Creates temporal, semantic, and entity links +5. Tracks document metadata + +**When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor progress. + +**When `async=false` (default):** Waits for processing to complete. + +**Note:** If a memory item has a `document_id` that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.retain_request import RetainRequest +from hindsight_client_api.models.retain_response import RetainResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.MemoryApi(api_client) + bank_id = 'bank_id_example' # str | + retain_request = hindsight_client_api.RetainRequest() # RetainRequest | + authorization = 'authorization_example' # str | (optional) + + try: + # Retain memories + api_response = await api_instance.retain_memories(bank_id, retain_request, authorization=authorization) + print("The response of MemoryApi->retain_memories:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling MemoryApi->retain_memories: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **retain_request** | [**RetainRequest**](RetainRequest.md)| | + **authorization** | **str**| | [optional] + +### Return type + +[**RetainResponse**](RetainResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + diff --git a/hindsight-clients/python/hindsight_client_api/docs/OperationResponse.md b/hindsight-clients/python/hindsight_client_api/docs/OperationResponse.md new file mode 100644 index 00000000..fb985ab3 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/docs/OperationResponse.md @@ -0,0 +1,36 @@ +# OperationResponse + +Response model for a single async operation. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | +**task_type** | **str** | | +**items_count** | **int** | | +**document_id** | **str** | | +**created_at** | **str** | | +**status** | **str** | | +**error_message** | **str** | | + +## Example + +```python +from hindsight_client_api.models.operation_response import OperationResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of OperationResponse from a JSON string +operation_response_instance = OperationResponse.from_json(json) +# print the JSON string representation of the object +print(OperationResponse.to_json()) + +# convert the object into a dict +operation_response_dict = operation_response_instance.to_dict() +# create an instance of OperationResponse from a dict +operation_response_from_dict = OperationResponse.from_dict(operation_response_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/hindsight-clients/python/hindsight_client_api/docs/OperationsApi.md b/hindsight-clients/python/hindsight_client_api/docs/OperationsApi.md new file mode 100644 index 00000000..a8f91346 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/docs/OperationsApi.md @@ -0,0 +1,154 @@ +# hindsight_client_api.OperationsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**cancel_operation**](OperationsApi.md#cancel_operation) | **DELETE** /v1/default/banks/{bank_id}/operations/{operation_id} | Cancel a pending async operation +[**list_operations**](OperationsApi.md#list_operations) | **GET** /v1/default/banks/{bank_id}/operations | List async operations + + +# **cancel_operation** +> CancelOperationResponse cancel_operation(bank_id, operation_id, authorization=authorization) + +Cancel a pending async operation + +Cancel a pending async operation by removing it from the queue + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.cancel_operation_response import CancelOperationResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.OperationsApi(api_client) + bank_id = 'bank_id_example' # str | + operation_id = 'operation_id_example' # str | + authorization = 'authorization_example' # str | (optional) + + try: + # Cancel a pending async operation + api_response = await api_instance.cancel_operation(bank_id, operation_id, authorization=authorization) + print("The response of OperationsApi->cancel_operation:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OperationsApi->cancel_operation: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **operation_id** | **str**| | + **authorization** | **str**| | [optional] + +### Return type + +[**CancelOperationResponse**](CancelOperationResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + +# **list_operations** +> OperationsListResponse list_operations(bank_id, authorization=authorization) + +List async operations + +Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations + +### Example + + +```python +import hindsight_client_api +from hindsight_client_api.models.operations_list_response import OperationsListResponse +from hindsight_client_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = hindsight_client_api.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +async with hindsight_client_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = hindsight_client_api.OperationsApi(api_client) + bank_id = 'bank_id_example' # str | + authorization = 'authorization_example' # str | (optional) + + try: + # List async operations + api_response = await api_instance.list_operations(bank_id, authorization=authorization) + print("The response of OperationsApi->list_operations:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OperationsApi->list_operations: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **bank_id** | **str**| | + **authorization** | **str**| | [optional] + +### Return type + +[**OperationsListResponse**](OperationsListResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Validation Error | - | + +[[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) + diff --git a/hindsight-clients/python/hindsight_client_api/docs/OperationsListResponse.md b/hindsight-clients/python/hindsight_client_api/docs/OperationsListResponse.md new file mode 100644 index 00000000..13dbd891 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/docs/OperationsListResponse.md @@ -0,0 +1,31 @@ +# OperationsListResponse + +Response model for list operations endpoint. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bank_id** | **str** | | +**operations** | [**List[OperationResponse]**](OperationResponse.md) | | + +## Example + +```python +from hindsight_client_api.models.operations_list_response import OperationsListResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of OperationsListResponse from a JSON string +operations_list_response_instance = OperationsListResponse.from_json(json) +# print the JSON string representation of the object +print(OperationsListResponse.to_json()) + +# convert the object into a dict +operations_list_response_dict = operations_list_response_instance.to_dict() +# create an instance of OperationsListResponse from a dict +operations_list_response_from_dict = OperationsListResponse.from_dict(operations_list_response_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/hindsight-clients/python/hindsight_client_api/exceptions.py b/hindsight-clients/python/hindsight_client_api/exceptions.py index fd5a408b..be4a64fb 100644 --- a/hindsight-clients/python/hindsight_client_api/exceptions.py +++ b/hindsight-clients/python/hindsight_client_api/exceptions.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/__init__.py b/hindsight-clients/python/hindsight_client_api/models/__init__.py index 65f5a65c..0dde8e0c 100644 --- a/hindsight-clients/python/hindsight_client_api/models/__init__.py +++ b/hindsight-clients/python/hindsight_client_api/models/__init__.py @@ -6,7 +6,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,11 +18,14 @@ from hindsight_client_api.models.bank_list_item import BankListItem from hindsight_client_api.models.bank_list_response import BankListResponse from hindsight_client_api.models.bank_profile_response import BankProfileResponse +from hindsight_client_api.models.bank_stats_response import BankStatsResponse from hindsight_client_api.models.budget import Budget +from hindsight_client_api.models.cancel_operation_response import CancelOperationResponse from hindsight_client_api.models.chunk_data import ChunkData from hindsight_client_api.models.chunk_include_options import ChunkIncludeOptions from hindsight_client_api.models.chunk_response import ChunkResponse from hindsight_client_api.models.create_bank_request import CreateBankRequest +from hindsight_client_api.models.delete_document_response import DeleteDocumentResponse from hindsight_client_api.models.delete_response import DeleteResponse from hindsight_client_api.models.disposition_traits import DispositionTraits from hindsight_client_api.models.document_response import DocumentResponse @@ -38,6 +41,8 @@ from hindsight_client_api.models.list_documents_response import ListDocumentsResponse from hindsight_client_api.models.list_memory_units_response import ListMemoryUnitsResponse from hindsight_client_api.models.memory_item import MemoryItem +from hindsight_client_api.models.operation_response import OperationResponse +from hindsight_client_api.models.operations_list_response import OperationsListResponse from hindsight_client_api.models.recall_request import RecallRequest from hindsight_client_api.models.recall_response import RecallResponse from hindsight_client_api.models.recall_result import RecallResult diff --git a/hindsight-clients/python/hindsight_client_api/models/add_background_request.py b/hindsight-clients/python/hindsight_client_api/models/add_background_request.py index 67cd67b3..c6bcb42f 100644 --- a/hindsight-clients/python/hindsight_client_api/models/add_background_request.py +++ b/hindsight-clients/python/hindsight_client_api/models/add_background_request.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/background_response.py b/hindsight-clients/python/hindsight_client_api/models/background_response.py index 99f3780c..97382a68 100644 --- a/hindsight-clients/python/hindsight_client_api/models/background_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/background_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/bank_list_item.py b/hindsight-clients/python/hindsight_client_api/models/bank_list_item.py index 4dbff66f..14dbee9a 100644 --- a/hindsight-clients/python/hindsight_client_api/models/bank_list_item.py +++ b/hindsight-clients/python/hindsight_client_api/models/bank_list_item.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -28,9 +28,9 @@ class BankListItem(BaseModel): Bank list item with profile summary. """ # noqa: E501 bank_id: StrictStr - name: StrictStr + name: Optional[StrictStr] = None disposition: DispositionTraits - background: StrictStr + background: Optional[StrictStr] = None created_at: Optional[StrictStr] = None updated_at: Optional[StrictStr] = None __properties: ClassVar[List[str]] = ["bank_id", "name", "disposition", "background", "created_at", "updated_at"] @@ -77,6 +77,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of disposition if self.disposition: _dict['disposition'] = self.disposition.to_dict() + # set to None if name (nullable) is None + # and model_fields_set contains the field + if self.name is None and "name" in self.model_fields_set: + _dict['name'] = None + + # set to None if background (nullable) is None + # and model_fields_set contains the field + if self.background is None and "background" in self.model_fields_set: + _dict['background'] = None + # set to None if created_at (nullable) is None # and model_fields_set contains the field if self.created_at is None and "created_at" in self.model_fields_set: diff --git a/hindsight-clients/python/hindsight_client_api/models/bank_list_response.py b/hindsight-clients/python/hindsight_client_api/models/bank_list_response.py index b053334b..290ca1df 100644 --- a/hindsight-clients/python/hindsight_client_api/models/bank_list_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/bank_list_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/bank_profile_response.py b/hindsight-clients/python/hindsight_client_api/models/bank_profile_response.py index cae66e52..68d7fbc8 100644 --- a/hindsight-clients/python/hindsight_client_api/models/bank_profile_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/bank_profile_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/bank_stats_response.py b/hindsight-clients/python/hindsight_client_api/models/bank_stats_response.py new file mode 100644 index 00000000..c538ba07 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/models/bank_stats_response.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Hindsight HTTP API + + HTTP API for Hindsight + + The version of the OpenAPI document: 0.1.0 + 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 +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class BankStatsResponse(BaseModel): + """ + Response model for bank statistics endpoint. + """ # noqa: E501 + bank_id: StrictStr + total_nodes: StrictInt + total_links: StrictInt + total_documents: StrictInt + nodes_by_fact_type: Dict[str, StrictInt] + links_by_link_type: Dict[str, StrictInt] + links_by_fact_type: Dict[str, StrictInt] + links_breakdown: Dict[str, Dict[str, StrictInt]] + pending_operations: StrictInt + failed_operations: StrictInt + __properties: ClassVar[List[str]] = ["bank_id", "total_nodes", "total_links", "total_documents", "nodes_by_fact_type", "links_by_link_type", "links_by_fact_type", "links_breakdown", "pending_operations", "failed_operations"] + + 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 BankStatsResponse 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankStatsResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "bank_id": obj.get("bank_id"), + "total_nodes": obj.get("total_nodes"), + "total_links": obj.get("total_links"), + "total_documents": obj.get("total_documents"), + "nodes_by_fact_type": obj.get("nodes_by_fact_type"), + "links_by_link_type": obj.get("links_by_link_type"), + "links_by_fact_type": obj.get("links_by_fact_type"), + "links_breakdown": obj.get("links_breakdown"), + "pending_operations": obj.get("pending_operations"), + "failed_operations": obj.get("failed_operations") + }) + return _obj + + diff --git a/hindsight-clients/python/hindsight_client_api/models/budget.py b/hindsight-clients/python/hindsight_client_api/models/budget.py index b02b73ae..0a1f55d6 100644 --- a/hindsight-clients/python/hindsight_client_api/models/budget.py +++ b/hindsight-clients/python/hindsight_client_api/models/budget.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/cancel_operation_response.py b/hindsight-clients/python/hindsight_client_api/models/cancel_operation_response.py new file mode 100644 index 00000000..4bfe176e --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/models/cancel_operation_response.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Hindsight HTTP API + + HTTP API for Hindsight + + The version of the OpenAPI document: 0.1.0 + 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, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class CancelOperationResponse(BaseModel): + """ + Response model for cancel operation endpoint. + """ # noqa: E501 + success: StrictBool + message: StrictStr + operation_id: StrictStr + __properties: ClassVar[List[str]] = ["success", "message", "operation_id"] + + 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 CancelOperationResponse 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CancelOperationResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "success": obj.get("success"), + "message": obj.get("message"), + "operation_id": obj.get("operation_id") + }) + return _obj + + diff --git a/hindsight-clients/python/hindsight_client_api/models/chunk_data.py b/hindsight-clients/python/hindsight_client_api/models/chunk_data.py index 80fb1ca8..829c6cf0 100644 --- a/hindsight-clients/python/hindsight_client_api/models/chunk_data.py +++ b/hindsight-clients/python/hindsight_client_api/models/chunk_data.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/chunk_include_options.py b/hindsight-clients/python/hindsight_client_api/models/chunk_include_options.py index 2e702e6c..315de629 100644 --- a/hindsight-clients/python/hindsight_client_api/models/chunk_include_options.py +++ b/hindsight-clients/python/hindsight_client_api/models/chunk_include_options.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/chunk_response.py b/hindsight-clients/python/hindsight_client_api/models/chunk_response.py index c0aa2c49..3a2162cd 100644 --- a/hindsight-clients/python/hindsight_client_api/models/chunk_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/chunk_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/create_bank_request.py b/hindsight-clients/python/hindsight_client_api/models/create_bank_request.py index 1b3b8705..01445343 100644 --- a/hindsight-clients/python/hindsight_client_api/models/create_bank_request.py +++ b/hindsight-clients/python/hindsight_client_api/models/create_bank_request.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/delete_document_response.py b/hindsight-clients/python/hindsight_client_api/models/delete_document_response.py new file mode 100644 index 00000000..61223ef7 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/models/delete_document_response.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Hindsight HTTP API + + HTTP API for Hindsight + + The version of the OpenAPI document: 0.1.0 + 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, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class DeleteDocumentResponse(BaseModel): + """ + Response model for delete document endpoint. + """ # noqa: E501 + success: StrictBool + message: StrictStr + document_id: StrictStr + memory_units_deleted: StrictInt + __properties: ClassVar[List[str]] = ["success", "message", "document_id", "memory_units_deleted"] + + 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 DeleteDocumentResponse 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DeleteDocumentResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "success": obj.get("success"), + "message": obj.get("message"), + "document_id": obj.get("document_id"), + "memory_units_deleted": obj.get("memory_units_deleted") + }) + return _obj + + diff --git a/hindsight-clients/python/hindsight_client_api/models/delete_response.py b/hindsight-clients/python/hindsight_client_api/models/delete_response.py index 6287c7f9..b78261af 100644 --- a/hindsight-clients/python/hindsight_client_api/models/delete_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/delete_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -17,8 +17,8 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool -from typing import Any, ClassVar, Dict, List +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self @@ -27,7 +27,9 @@ class DeleteResponse(BaseModel): Response model for delete operations. """ # noqa: E501 success: StrictBool - __properties: ClassVar[List[str]] = ["success"] + message: Optional[StrictStr] = None + deleted_count: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["success", "message", "deleted_count"] model_config = ConfigDict( populate_by_name=True, @@ -68,6 +70,16 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + # set to None if deleted_count (nullable) is None + # and model_fields_set contains the field + if self.deleted_count is None and "deleted_count" in self.model_fields_set: + _dict['deleted_count'] = None + return _dict @classmethod @@ -80,7 +92,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "success": obj.get("success") + "success": obj.get("success"), + "message": obj.get("message"), + "deleted_count": obj.get("deleted_count") }) return _obj diff --git a/hindsight-clients/python/hindsight_client_api/models/disposition_traits.py b/hindsight-clients/python/hindsight_client_api/models/disposition_traits.py index cf858051..970a3ccd 100644 --- a/hindsight-clients/python/hindsight_client_api/models/disposition_traits.py +++ b/hindsight-clients/python/hindsight_client_api/models/disposition_traits.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/document_response.py b/hindsight-clients/python/hindsight_client_api/models/document_response.py index 081cc8cb..e5efa476 100644 --- a/hindsight-clients/python/hindsight_client_api/models/document_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/document_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/entity_detail_response.py b/hindsight-clients/python/hindsight_client_api/models/entity_detail_response.py index 33c6f329..b2302a33 100644 --- a/hindsight-clients/python/hindsight_client_api/models/entity_detail_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/entity_detail_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/entity_include_options.py b/hindsight-clients/python/hindsight_client_api/models/entity_include_options.py index d7bfa08a..461a24a0 100644 --- a/hindsight-clients/python/hindsight_client_api/models/entity_include_options.py +++ b/hindsight-clients/python/hindsight_client_api/models/entity_include_options.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/entity_list_item.py b/hindsight-clients/python/hindsight_client_api/models/entity_list_item.py index 3c8face1..9f9008af 100644 --- a/hindsight-clients/python/hindsight_client_api/models/entity_list_item.py +++ b/hindsight-clients/python/hindsight_client_api/models/entity_list_item.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/entity_list_response.py b/hindsight-clients/python/hindsight_client_api/models/entity_list_response.py index 792f9f9b..a638247b 100644 --- a/hindsight-clients/python/hindsight_client_api/models/entity_list_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/entity_list_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/entity_observation_response.py b/hindsight-clients/python/hindsight_client_api/models/entity_observation_response.py index 7c3a77ac..88bdc1d9 100644 --- a/hindsight-clients/python/hindsight_client_api/models/entity_observation_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/entity_observation_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/entity_state_response.py b/hindsight-clients/python/hindsight_client_api/models/entity_state_response.py index 93ee13d2..b85c1cf7 100644 --- a/hindsight-clients/python/hindsight_client_api/models/entity_state_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/entity_state_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/graph_data_response.py b/hindsight-clients/python/hindsight_client_api/models/graph_data_response.py index e2263142..60d1e229 100644 --- a/hindsight-clients/python/hindsight_client_api/models/graph_data_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/graph_data_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/http_validation_error.py b/hindsight-clients/python/hindsight_client_api/models/http_validation_error.py index 7039acae..a6ecb091 100644 --- a/hindsight-clients/python/hindsight_client_api/models/http_validation_error.py +++ b/hindsight-clients/python/hindsight_client_api/models/http_validation_error.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/include_options.py b/hindsight-clients/python/hindsight_client_api/models/include_options.py index affb1420..962a9d91 100644 --- a/hindsight-clients/python/hindsight_client_api/models/include_options.py +++ b/hindsight-clients/python/hindsight_client_api/models/include_options.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/list_documents_response.py b/hindsight-clients/python/hindsight_client_api/models/list_documents_response.py index 846b0b71..2750c290 100644 --- a/hindsight-clients/python/hindsight_client_api/models/list_documents_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/list_documents_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/list_memory_units_response.py b/hindsight-clients/python/hindsight_client_api/models/list_memory_units_response.py index 0f86644d..6bd421eb 100644 --- a/hindsight-clients/python/hindsight_client_api/models/list_memory_units_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/list_memory_units_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/memory_item.py b/hindsight-clients/python/hindsight_client_api/models/memory_item.py index f8ba77a6..9fe7507c 100644 --- a/hindsight-clients/python/hindsight_client_api/models/memory_item.py +++ b/hindsight-clients/python/hindsight_client_api/models/memory_item.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/operation_response.py b/hindsight-clients/python/hindsight_client_api/models/operation_response.py new file mode 100644 index 00000000..efb432f4 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/models/operation_response.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Hindsight HTTP API + + HTTP API for Hindsight + + The version of the OpenAPI document: 0.1.0 + 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class OperationResponse(BaseModel): + """ + Response model for a single async operation. + """ # noqa: E501 + id: StrictStr + task_type: StrictStr + items_count: StrictInt + document_id: Optional[StrictStr] + created_at: StrictStr + status: StrictStr + error_message: Optional[StrictStr] + __properties: ClassVar[List[str]] = ["id", "task_type", "items_count", "document_id", "created_at", "status", "error_message"] + + 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 OperationResponse 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if document_id (nullable) is None + # and model_fields_set contains the field + if self.document_id is None and "document_id" in self.model_fields_set: + _dict['document_id'] = None + + # set to None if error_message (nullable) is None + # and model_fields_set contains the field + if self.error_message is None and "error_message" in self.model_fields_set: + _dict['error_message'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OperationResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "task_type": obj.get("task_type"), + "items_count": obj.get("items_count"), + "document_id": obj.get("document_id"), + "created_at": obj.get("created_at"), + "status": obj.get("status"), + "error_message": obj.get("error_message") + }) + return _obj + + diff --git a/hindsight-clients/python/hindsight_client_api/models/operations_list_response.py b/hindsight-clients/python/hindsight_client_api/models/operations_list_response.py new file mode 100644 index 00000000..df753d96 --- /dev/null +++ b/hindsight-clients/python/hindsight_client_api/models/operations_list_response.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Hindsight HTTP API + + HTTP API for Hindsight + + The version of the OpenAPI document: 0.1.0 + 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, StrictStr +from typing import Any, ClassVar, Dict, List +from hindsight_client_api.models.operation_response import OperationResponse +from typing import Optional, Set +from typing_extensions import Self + +class OperationsListResponse(BaseModel): + """ + Response model for list operations endpoint. + """ # noqa: E501 + bank_id: StrictStr + operations: List[OperationResponse] + __properties: ClassVar[List[str]] = ["bank_id", "operations"] + + 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 OperationsListResponse 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. + """ + excluded_fields: Set[str] = set([ + ]) + + _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 operations (list) + _items = [] + if self.operations: + for _item_operations in self.operations: + if _item_operations: + _items.append(_item_operations.to_dict()) + _dict['operations'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OperationsListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "bank_id": obj.get("bank_id"), + "operations": [OperationResponse.from_dict(_item) for _item in obj["operations"]] if obj.get("operations") is not None else None + }) + return _obj + + diff --git a/hindsight-clients/python/hindsight_client_api/models/recall_request.py b/hindsight-clients/python/hindsight_client_api/models/recall_request.py index ba3a8bfc..2ed62d02 100644 --- a/hindsight-clients/python/hindsight_client_api/models/recall_request.py +++ b/hindsight-clients/python/hindsight_client_api/models/recall_request.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/recall_response.py b/hindsight-clients/python/hindsight_client_api/models/recall_response.py index ef784258..7e8674a9 100644 --- a/hindsight-clients/python/hindsight_client_api/models/recall_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/recall_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/recall_result.py b/hindsight-clients/python/hindsight_client_api/models/recall_result.py index 7f28d283..069efe87 100644 --- a/hindsight-clients/python/hindsight_client_api/models/recall_result.py +++ b/hindsight-clients/python/hindsight_client_api/models/recall_result.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/reflect_fact.py b/hindsight-clients/python/hindsight_client_api/models/reflect_fact.py index bf1e8c05..28e96afb 100644 --- a/hindsight-clients/python/hindsight_client_api/models/reflect_fact.py +++ b/hindsight-clients/python/hindsight_client_api/models/reflect_fact.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/reflect_include_options.py b/hindsight-clients/python/hindsight_client_api/models/reflect_include_options.py index bb0eb392..4c0eb223 100644 --- a/hindsight-clients/python/hindsight_client_api/models/reflect_include_options.py +++ b/hindsight-clients/python/hindsight_client_api/models/reflect_include_options.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/reflect_request.py b/hindsight-clients/python/hindsight_client_api/models/reflect_request.py index b058920e..d45aacd4 100644 --- a/hindsight-clients/python/hindsight_client_api/models/reflect_request.py +++ b/hindsight-clients/python/hindsight_client_api/models/reflect_request.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/reflect_response.py b/hindsight-clients/python/hindsight_client_api/models/reflect_response.py index 5c2284ab..d9b32bb6 100644 --- a/hindsight-clients/python/hindsight_client_api/models/reflect_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/reflect_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/retain_request.py b/hindsight-clients/python/hindsight_client_api/models/retain_request.py index 30d401c9..0e5a9023 100644 --- a/hindsight-clients/python/hindsight_client_api/models/retain_request.py +++ b/hindsight-clients/python/hindsight_client_api/models/retain_request.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/retain_response.py b/hindsight-clients/python/hindsight_client_api/models/retain_response.py index 97df1c76..3ca9de2f 100644 --- a/hindsight-clients/python/hindsight_client_api/models/retain_response.py +++ b/hindsight-clients/python/hindsight_client_api/models/retain_response.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/update_disposition_request.py b/hindsight-clients/python/hindsight_client_api/models/update_disposition_request.py index be4aed2c..314dd8ae 100644 --- a/hindsight-clients/python/hindsight_client_api/models/update_disposition_request.py +++ b/hindsight-clients/python/hindsight_client_api/models/update_disposition_request.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/validation_error.py b/hindsight-clients/python/hindsight_client_api/models/validation_error.py index c5edd6c6..aeecfe62 100644 --- a/hindsight-clients/python/hindsight_client_api/models/validation_error.py +++ b/hindsight-clients/python/hindsight_client_api/models/validation_error.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/models/validation_error_loc_inner.py b/hindsight-clients/python/hindsight_client_api/models/validation_error_loc_inner.py index 060def4e..60bd175b 100644 --- a/hindsight-clients/python/hindsight_client_api/models/validation_error_loc_inner.py +++ b/hindsight-clients/python/hindsight_client_api/models/validation_error_loc_inner.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/rest.py b/hindsight-clients/python/hindsight_client_api/rest.py index e39244e5..f2b05460 100644 --- a/hindsight-clients/python/hindsight_client_api/rest.py +++ b/hindsight-clients/python/hindsight_client_api/rest.py @@ -5,7 +5,7 @@ HTTP API for Hindsight - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/hindsight-clients/python/hindsight_client_api/test/__init__.py b/hindsight-clients/python/hindsight_client_api/test/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/hindsight-clients/python/hindsight_client_api/test/test_add_background_request.py b/hindsight-clients/python/hindsight_client_api/test/test_add_background_request.py deleted file mode 100644 index 51583643..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_add_background_request.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.add_background_request import AddBackgroundRequest - -class TestAddBackgroundRequest(unittest.TestCase): - """AddBackgroundRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> AddBackgroundRequest: - """Test AddBackgroundRequest - 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 `AddBackgroundRequest` - """ - model = AddBackgroundRequest() - if include_optional: - return AddBackgroundRequest( - content = '', - update_disposition = True - ) - else: - return AddBackgroundRequest( - content = '', - ) - """ - - def testAddBackgroundRequest(self): - """Test AddBackgroundRequest""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_background_response.py b/hindsight-clients/python/hindsight_client_api/test/test_background_response.py deleted file mode 100644 index d48a57de..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_background_response.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.background_response import BackgroundResponse - -class TestBackgroundResponse(unittest.TestCase): - """BackgroundResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> BackgroundResponse: - """Test BackgroundResponse - 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 `BackgroundResponse` - """ - model = BackgroundResponse() - if include_optional: - return BackgroundResponse( - background = '', - disposition = {empathy=3, literalism=3, skepticism=3} - ) - else: - return BackgroundResponse( - background = '', - ) - """ - - def testBackgroundResponse(self): - """Test BackgroundResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_bank_list_item.py b/hindsight-clients/python/hindsight_client_api/test/test_bank_list_item.py deleted file mode 100644 index a8b0a4f3..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_bank_list_item.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.bank_list_item import BankListItem - -class TestBankListItem(unittest.TestCase): - """BankListItem unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> BankListItem: - """Test BankListItem - 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 `BankListItem` - """ - model = BankListItem() - if include_optional: - return BankListItem( - bank_id = '', - name = '', - disposition = {empathy=3, literalism=3, skepticism=3}, - background = '', - created_at = '', - updated_at = '' - ) - else: - return BankListItem( - bank_id = '', - name = '', - disposition = {empathy=3, literalism=3, skepticism=3}, - background = '', - ) - """ - - def testBankListItem(self): - """Test BankListItem""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_bank_list_response.py b/hindsight-clients/python/hindsight_client_api/test/test_bank_list_response.py deleted file mode 100644 index 3b7fc4b8..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_bank_list_response.py +++ /dev/null @@ -1,68 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.bank_list_response import BankListResponse - -class TestBankListResponse(unittest.TestCase): - """BankListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> BankListResponse: - """Test BankListResponse - 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 `BankListResponse` - """ - model = BankListResponse() - if include_optional: - return BankListResponse( - banks = [ - hindsight_client_api.models.bank_list_item.BankListItem( - bank_id = '', - name = '', - disposition = {empathy=3, literalism=3, skepticism=3}, - background = '', - created_at = '', - updated_at = '', ) - ] - ) - else: - return BankListResponse( - banks = [ - hindsight_client_api.models.bank_list_item.BankListItem( - bank_id = '', - name = '', - disposition = {empathy=3, literalism=3, skepticism=3}, - background = '', - created_at = '', - updated_at = '', ) - ], - ) - """ - - def testBankListResponse(self): - """Test BankListResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_bank_profile_response.py b/hindsight-clients/python/hindsight_client_api/test/test_bank_profile_response.py deleted file mode 100644 index 8874401d..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_bank_profile_response.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.bank_profile_response import BankProfileResponse - -class TestBankProfileResponse(unittest.TestCase): - """BankProfileResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> BankProfileResponse: - """Test BankProfileResponse - 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 `BankProfileResponse` - """ - model = BankProfileResponse() - if include_optional: - return BankProfileResponse( - bank_id = '', - name = '', - disposition = {empathy=3, literalism=3, skepticism=3}, - background = '' - ) - else: - return BankProfileResponse( - bank_id = '', - name = '', - disposition = {empathy=3, literalism=3, skepticism=3}, - background = '', - ) - """ - - def testBankProfileResponse(self): - """Test BankProfileResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_budget.py b/hindsight-clients/python/hindsight_client_api/test/test_budget.py deleted file mode 100644 index 74f58ccf..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_budget.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.budget import Budget - -class TestBudget(unittest.TestCase): - """Budget unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testBudget(self): - """Test Budget""" - # inst = Budget() - -if __name__ == '__main__': - unittest.main() diff --git a/hindsight-clients/python/hindsight_client_api/test/test_chunk_data.py b/hindsight-clients/python/hindsight_client_api/test/test_chunk_data.py deleted file mode 100644 index 44934587..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_chunk_data.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.chunk_data import ChunkData - -class TestChunkData(unittest.TestCase): - """ChunkData unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ChunkData: - """Test ChunkData - 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 `ChunkData` - """ - model = ChunkData() - if include_optional: - return ChunkData( - id = '', - text = '', - chunk_index = 56, - truncated = True - ) - else: - return ChunkData( - id = '', - text = '', - chunk_index = 56, - ) - """ - - def testChunkData(self): - """Test ChunkData""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_chunk_include_options.py b/hindsight-clients/python/hindsight_client_api/test/test_chunk_include_options.py deleted file mode 100644 index 5ee877d6..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_chunk_include_options.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.chunk_include_options import ChunkIncludeOptions - -class TestChunkIncludeOptions(unittest.TestCase): - """ChunkIncludeOptions unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ChunkIncludeOptions: - """Test ChunkIncludeOptions - 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 `ChunkIncludeOptions` - """ - model = ChunkIncludeOptions() - if include_optional: - return ChunkIncludeOptions( - max_tokens = 56 - ) - else: - return ChunkIncludeOptions( - ) - """ - - def testChunkIncludeOptions(self): - """Test ChunkIncludeOptions""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_chunk_response.py b/hindsight-clients/python/hindsight_client_api/test/test_chunk_response.py deleted file mode 100644 index 1f29c403..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_chunk_response.py +++ /dev/null @@ -1,62 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.chunk_response import ChunkResponse - -class TestChunkResponse(unittest.TestCase): - """ChunkResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ChunkResponse: - """Test ChunkResponse - 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 `ChunkResponse` - """ - model = ChunkResponse() - if include_optional: - return ChunkResponse( - chunk_id = '', - document_id = '', - bank_id = '', - chunk_index = 56, - chunk_text = '', - created_at = '' - ) - else: - return ChunkResponse( - chunk_id = '', - document_id = '', - bank_id = '', - chunk_index = 56, - chunk_text = '', - created_at = '', - ) - """ - - def testChunkResponse(self): - """Test ChunkResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_create_bank_request.py b/hindsight-clients/python/hindsight_client_api/test/test_create_bank_request.py deleted file mode 100644 index 0e7d8157..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_create_bank_request.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.create_bank_request import CreateBankRequest - -class TestCreateBankRequest(unittest.TestCase): - """CreateBankRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> CreateBankRequest: - """Test CreateBankRequest - 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 `CreateBankRequest` - """ - model = CreateBankRequest() - if include_optional: - return CreateBankRequest( - name = '', - disposition = {empathy=3, literalism=3, skepticism=3}, - background = '' - ) - else: - return CreateBankRequest( - ) - """ - - def testCreateBankRequest(self): - """Test CreateBankRequest""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_default_api.py b/hindsight-clients/python/hindsight_client_api/test/test_default_api.py deleted file mode 100644 index a61b0756..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_default_api.py +++ /dev/null @@ -1,178 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.api.default_api import DefaultApi - - -class TestDefaultApi(unittest.IsolatedAsyncioTestCase): - """DefaultApi unit test stubs""" - - async def asyncSetUp(self) -> None: - self.api = DefaultApi() - - async def asyncTearDown(self) -> None: - await self.api.api_client.close() - - async def test_add_bank_background(self) -> None: - """Test case for add_bank_background - - Add/merge memory bank background - """ - pass - - async def test_cancel_operation(self) -> None: - """Test case for cancel_operation - - Cancel a pending async operation - """ - pass - - async def test_clear_bank_memories(self) -> None: - """Test case for clear_bank_memories - - Clear memory bank memories - """ - pass - - async def test_create_or_update_bank(self) -> None: - """Test case for create_or_update_bank - - Create or update memory bank - """ - pass - - async def test_delete_document(self) -> None: - """Test case for delete_document - - Delete a document - """ - pass - - async def test_get_agent_stats(self) -> None: - """Test case for get_agent_stats - - Get statistics for memory bank - """ - pass - - async def test_get_bank_profile(self) -> None: - """Test case for get_bank_profile - - Get memory bank profile - """ - pass - - async def test_get_chunk(self) -> None: - """Test case for get_chunk - - Get chunk details - """ - pass - - async def test_get_document(self) -> None: - """Test case for get_document - - Get document details - """ - pass - - async def test_get_entity(self) -> None: - """Test case for get_entity - - Get entity details - """ - pass - - async def test_get_graph(self) -> None: - """Test case for get_graph - - Get memory graph data - """ - pass - - async def test_list_banks(self) -> None: - """Test case for list_banks - - List all memory banks - """ - pass - - async def test_list_documents(self) -> None: - """Test case for list_documents - - List documents - """ - pass - - async def test_list_entities(self) -> None: - """Test case for list_entities - - List entities - """ - pass - - async def test_list_memories(self) -> None: - """Test case for list_memories - - List memory units - """ - pass - - async def test_list_operations(self) -> None: - """Test case for list_operations - - List async operations - """ - pass - - async def test_recall_memories(self) -> None: - """Test case for recall_memories - - Recall memory - """ - pass - - async def test_reflect(self) -> None: - """Test case for reflect - - Reflect and generate answer - """ - pass - - async def test_regenerate_entity_observations(self) -> None: - """Test case for regenerate_entity_observations - - Regenerate entity observations - """ - pass - - async def test_retain_memories(self) -> None: - """Test case for retain_memories - - Retain memories - """ - pass - - async def test_update_bank_disposition(self) -> None: - """Test case for update_bank_disposition - - Update memory bank disposition - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/hindsight-clients/python/hindsight_client_api/test/test_delete_response.py b/hindsight-clients/python/hindsight_client_api/test/test_delete_response.py deleted file mode 100644 index 55d5394e..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_delete_response.py +++ /dev/null @@ -1,52 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.delete_response import DeleteResponse - -class TestDeleteResponse(unittest.TestCase): - """DeleteResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> DeleteResponse: - """Test DeleteResponse - 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 `DeleteResponse` - """ - model = DeleteResponse() - if include_optional: - return DeleteResponse( - success = True - ) - else: - return DeleteResponse( - success = True, - ) - """ - - def testDeleteResponse(self): - """Test DeleteResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_disposition_traits.py b/hindsight-clients/python/hindsight_client_api/test/test_disposition_traits.py deleted file mode 100644 index fbc7fd1b..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_disposition_traits.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.disposition_traits import DispositionTraits - -class TestDispositionTraits(unittest.TestCase): - """DispositionTraits unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> DispositionTraits: - """Test DispositionTraits - 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 `DispositionTraits` - """ - model = DispositionTraits() - if include_optional: - return DispositionTraits( - skepticism = 1.0, - literalism = 1.0, - empathy = 1.0 - ) - else: - return DispositionTraits( - skepticism = 1.0, - literalism = 1.0, - empathy = 1.0, - ) - """ - - def testDispositionTraits(self): - """Test DispositionTraits""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_document_response.py b/hindsight-clients/python/hindsight_client_api/test/test_document_response.py deleted file mode 100644 index 5b62d1fb..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_document_response.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.document_response import DocumentResponse - -class TestDocumentResponse(unittest.TestCase): - """DocumentResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> DocumentResponse: - """Test DocumentResponse - 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 `DocumentResponse` - """ - model = DocumentResponse() - if include_optional: - return DocumentResponse( - id = '', - bank_id = '', - original_text = '', - content_hash = '', - created_at = '', - updated_at = '', - memory_unit_count = 56 - ) - else: - return DocumentResponse( - id = '', - bank_id = '', - original_text = '', - content_hash = '', - created_at = '', - updated_at = '', - memory_unit_count = 56, - ) - """ - - def testDocumentResponse(self): - """Test DocumentResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_entity_detail_response.py b/hindsight-clients/python/hindsight_client_api/test/test_entity_detail_response.py deleted file mode 100644 index 1cfec805..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_entity_detail_response.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.entity_detail_response import EntityDetailResponse - -class TestEntityDetailResponse(unittest.TestCase): - """EntityDetailResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> EntityDetailResponse: - """Test EntityDetailResponse - 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 `EntityDetailResponse` - """ - model = EntityDetailResponse() - if include_optional: - return EntityDetailResponse( - id = '', - canonical_name = '', - mention_count = 56, - first_seen = '', - last_seen = '', - metadata = { - 'key' : null - }, - observations = [ - hindsight_client_api.models.entity_observation_response.EntityObservationResponse( - text = '', - mentioned_at = '', ) - ] - ) - else: - return EntityDetailResponse( - id = '', - canonical_name = '', - mention_count = 56, - observations = [ - hindsight_client_api.models.entity_observation_response.EntityObservationResponse( - text = '', - mentioned_at = '', ) - ], - ) - """ - - def testEntityDetailResponse(self): - """Test EntityDetailResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_entity_include_options.py b/hindsight-clients/python/hindsight_client_api/test/test_entity_include_options.py deleted file mode 100644 index 37be2d49..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_entity_include_options.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.entity_include_options import EntityIncludeOptions - -class TestEntityIncludeOptions(unittest.TestCase): - """EntityIncludeOptions unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> EntityIncludeOptions: - """Test EntityIncludeOptions - 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 `EntityIncludeOptions` - """ - model = EntityIncludeOptions() - if include_optional: - return EntityIncludeOptions( - max_tokens = 56 - ) - else: - return EntityIncludeOptions( - ) - """ - - def testEntityIncludeOptions(self): - """Test EntityIncludeOptions""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_entity_list_item.py b/hindsight-clients/python/hindsight_client_api/test/test_entity_list_item.py deleted file mode 100644 index 9bc91368..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_entity_list_item.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.entity_list_item import EntityListItem - -class TestEntityListItem(unittest.TestCase): - """EntityListItem unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> EntityListItem: - """Test EntityListItem - 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 `EntityListItem` - """ - model = EntityListItem() - if include_optional: - return EntityListItem( - id = '', - canonical_name = '', - mention_count = 56, - first_seen = '', - last_seen = '', - metadata = { - 'key' : null - } - ) - else: - return EntityListItem( - id = '', - canonical_name = '', - mention_count = 56, - ) - """ - - def testEntityListItem(self): - """Test EntityListItem""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_entity_list_response.py b/hindsight-clients/python/hindsight_client_api/test/test_entity_list_response.py deleted file mode 100644 index fc876b5b..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_entity_list_response.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.entity_list_response import EntityListResponse - -class TestEntityListResponse(unittest.TestCase): - """EntityListResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> EntityListResponse: - """Test EntityListResponse - 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 `EntityListResponse` - """ - model = EntityListResponse() - if include_optional: - return EntityListResponse( - items = [ - {canonical_name=John, first_seen=2024-01-15T10:30:00Z, id=123e4567-e89b-12d3-a456-426614174000, last_seen=2024-02-01T14:00:00Z, mention_count=15} - ] - ) - else: - return EntityListResponse( - items = [ - {canonical_name=John, first_seen=2024-01-15T10:30:00Z, id=123e4567-e89b-12d3-a456-426614174000, last_seen=2024-02-01T14:00:00Z, mention_count=15} - ], - ) - """ - - def testEntityListResponse(self): - """Test EntityListResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_entity_observation_response.py b/hindsight-clients/python/hindsight_client_api/test/test_entity_observation_response.py deleted file mode 100644 index 31a6bda6..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_entity_observation_response.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.entity_observation_response import EntityObservationResponse - -class TestEntityObservationResponse(unittest.TestCase): - """EntityObservationResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> EntityObservationResponse: - """Test EntityObservationResponse - 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 `EntityObservationResponse` - """ - model = EntityObservationResponse() - if include_optional: - return EntityObservationResponse( - text = '', - mentioned_at = '' - ) - else: - return EntityObservationResponse( - text = '', - ) - """ - - def testEntityObservationResponse(self): - """Test EntityObservationResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_entity_state_response.py b/hindsight-clients/python/hindsight_client_api/test/test_entity_state_response.py deleted file mode 100644 index 9327a43e..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_entity_state_response.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.entity_state_response import EntityStateResponse - -class TestEntityStateResponse(unittest.TestCase): - """EntityStateResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> EntityStateResponse: - """Test EntityStateResponse - 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 `EntityStateResponse` - """ - model = EntityStateResponse() - if include_optional: - return EntityStateResponse( - entity_id = '', - canonical_name = '', - observations = [ - hindsight_client_api.models.entity_observation_response.EntityObservationResponse( - text = '', - mentioned_at = '', ) - ] - ) - else: - return EntityStateResponse( - entity_id = '', - canonical_name = '', - observations = [ - hindsight_client_api.models.entity_observation_response.EntityObservationResponse( - text = '', - mentioned_at = '', ) - ], - ) - """ - - def testEntityStateResponse(self): - """Test EntityStateResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_graph_data_response.py b/hindsight-clients/python/hindsight_client_api/test/test_graph_data_response.py deleted file mode 100644 index bbeeeb38..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_graph_data_response.py +++ /dev/null @@ -1,82 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.graph_data_response import GraphDataResponse - -class TestGraphDataResponse(unittest.TestCase): - """GraphDataResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> GraphDataResponse: - """Test GraphDataResponse - 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 `GraphDataResponse` - """ - model = GraphDataResponse() - if include_optional: - return GraphDataResponse( - nodes = [ - { - 'key' : null - } - ], - edges = [ - { - 'key' : null - } - ], - table_rows = [ - { - 'key' : null - } - ], - total_units = 56 - ) - else: - return GraphDataResponse( - nodes = [ - { - 'key' : null - } - ], - edges = [ - { - 'key' : null - } - ], - table_rows = [ - { - 'key' : null - } - ], - total_units = 56, - ) - """ - - def testGraphDataResponse(self): - """Test GraphDataResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_http_validation_error.py b/hindsight-clients/python/hindsight_client_api/test/test_http_validation_error.py deleted file mode 100644 index ba84bc2d..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_http_validation_error.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.http_validation_error import HTTPValidationError - -class TestHTTPValidationError(unittest.TestCase): - """HTTPValidationError unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> HTTPValidationError: - """Test HTTPValidationError - 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 `HTTPValidationError` - """ - model = HTTPValidationError() - if include_optional: - return HTTPValidationError( - detail = [ - hindsight_client_api.models.validation_error.ValidationError( - loc = [ - null - ], - msg = '', - type = '', ) - ] - ) - else: - return HTTPValidationError( - ) - """ - - def testHTTPValidationError(self): - """Test HTTPValidationError""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_include_options.py b/hindsight-clients/python/hindsight_client_api/test/test_include_options.py deleted file mode 100644 index 9ea4976b..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_include_options.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.include_options import IncludeOptions - -class TestIncludeOptions(unittest.TestCase): - """IncludeOptions unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> IncludeOptions: - """Test IncludeOptions - 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 `IncludeOptions` - """ - model = IncludeOptions() - if include_optional: - return IncludeOptions( - entities = hindsight_client_api.models.entity_include_options.EntityIncludeOptions( - max_tokens = 56, ), - chunks = hindsight_client_api.models.chunk_include_options.ChunkIncludeOptions( - max_tokens = 56, ) - ) - else: - return IncludeOptions( - ) - """ - - def testIncludeOptions(self): - """Test IncludeOptions""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_list_documents_response.py b/hindsight-clients/python/hindsight_client_api/test/test_list_documents_response.py deleted file mode 100644 index 89981838..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_list_documents_response.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.list_documents_response import ListDocumentsResponse - -class TestListDocumentsResponse(unittest.TestCase): - """ListDocumentsResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ListDocumentsResponse: - """Test ListDocumentsResponse - 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 `ListDocumentsResponse` - """ - model = ListDocumentsResponse() - if include_optional: - return ListDocumentsResponse( - items = [ - { - 'key' : null - } - ], - total = 56, - limit = 56, - offset = 56 - ) - else: - return ListDocumentsResponse( - items = [ - { - 'key' : null - } - ], - total = 56, - limit = 56, - offset = 56, - ) - """ - - def testListDocumentsResponse(self): - """Test ListDocumentsResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_list_memory_units_response.py b/hindsight-clients/python/hindsight_client_api/test/test_list_memory_units_response.py deleted file mode 100644 index e3e9fcef..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_list_memory_units_response.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.list_memory_units_response import ListMemoryUnitsResponse - -class TestListMemoryUnitsResponse(unittest.TestCase): - """ListMemoryUnitsResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ListMemoryUnitsResponse: - """Test ListMemoryUnitsResponse - 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 `ListMemoryUnitsResponse` - """ - model = ListMemoryUnitsResponse() - if include_optional: - return ListMemoryUnitsResponse( - items = [ - { - 'key' : null - } - ], - total = 56, - limit = 56, - offset = 56 - ) - else: - return ListMemoryUnitsResponse( - items = [ - { - 'key' : null - } - ], - total = 56, - limit = 56, - offset = 56, - ) - """ - - def testListMemoryUnitsResponse(self): - """Test ListMemoryUnitsResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_memory_item.py b/hindsight-clients/python/hindsight_client_api/test/test_memory_item.py deleted file mode 100644 index d15b01d0..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_memory_item.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.memory_item import MemoryItem - -class TestMemoryItem(unittest.TestCase): - """MemoryItem unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> MemoryItem: - """Test MemoryItem - 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 `MemoryItem` - """ - model = MemoryItem() - if include_optional: - return MemoryItem( - content = '', - timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - context = '', - metadata = { - 'key' : '' - }, - document_id = '' - ) - else: - return MemoryItem( - content = '', - ) - """ - - def testMemoryItem(self): - """Test MemoryItem""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_monitoring_api.py b/hindsight-clients/python/hindsight_client_api/test/test_monitoring_api.py deleted file mode 100644 index 4985c298..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_monitoring_api.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.api.monitoring_api import MonitoringApi - - -class TestMonitoringApi(unittest.IsolatedAsyncioTestCase): - """MonitoringApi unit test stubs""" - - async def asyncSetUp(self) -> None: - self.api = MonitoringApi() - - async def asyncTearDown(self) -> None: - await self.api.api_client.close() - - async def test_health_endpoint_health_get(self) -> None: - """Test case for health_endpoint_health_get - - Health check endpoint - """ - pass - - async def test_metrics_endpoint_metrics_get(self) -> None: - """Test case for metrics_endpoint_metrics_get - - Prometheus metrics endpoint - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/hindsight-clients/python/hindsight_client_api/test/test_recall_request.py b/hindsight-clients/python/hindsight_client_api/test/test_recall_request.py deleted file mode 100644 index 8a6c7836..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_recall_request.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.recall_request import RecallRequest - -class TestRecallRequest(unittest.TestCase): - """RecallRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> RecallRequest: - """Test RecallRequest - 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 `RecallRequest` - """ - model = RecallRequest() - if include_optional: - return RecallRequest( - query = '', - types = [ - '' - ], - budget = 'low', - max_tokens = 56, - trace = True, - query_timestamp = '', - include = hindsight_client_api.models.include_options.IncludeOptions( - entities = hindsight_client_api.models.entity_include_options.EntityIncludeOptions( - max_tokens = 56, ), - chunks = hindsight_client_api.models.chunk_include_options.ChunkIncludeOptions( - max_tokens = 56, ), ) - ) - else: - return RecallRequest( - query = '', - ) - """ - - def testRecallRequest(self): - """Test RecallRequest""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_recall_response.py b/hindsight-clients/python/hindsight_client_api/test/test_recall_response.py deleted file mode 100644 index 73ee05da..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_recall_response.py +++ /dev/null @@ -1,76 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.recall_response import RecallResponse - -class TestRecallResponse(unittest.TestCase): - """RecallResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> RecallResponse: - """Test RecallResponse - 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 `RecallResponse` - """ - model = RecallResponse() - if include_optional: - return RecallResponse( - results = [ - {chunk_id=456e7890-e12b-34d5-a678-901234567890, context=work info, document_id=session_abc123, entities=[Alice, Google], id=123e4567-e89b-12d3-a456-426614174000, mentioned_at=2024-01-15T10:30:00Z, metadata={source=slack}, occurred_end=2024-01-15T10:30:00Z, occurred_start=2024-01-15T10:30:00Z, text=Alice works at Google on the AI team, type=world} - ], - trace = { - 'key' : null - }, - entities = { - 'key' : hindsight_client_api.models.entity_state_response.EntityStateResponse( - entity_id = '', - canonical_name = '', - observations = [ - hindsight_client_api.models.entity_observation_response.EntityObservationResponse( - text = '', - mentioned_at = '', ) - ], ) - }, - chunks = { - 'key' : hindsight_client_api.models.chunk_data.ChunkData( - id = '', - text = '', - chunk_index = 56, - truncated = True, ) - } - ) - else: - return RecallResponse( - results = [ - {chunk_id=456e7890-e12b-34d5-a678-901234567890, context=work info, document_id=session_abc123, entities=[Alice, Google], id=123e4567-e89b-12d3-a456-426614174000, mentioned_at=2024-01-15T10:30:00Z, metadata={source=slack}, occurred_end=2024-01-15T10:30:00Z, occurred_start=2024-01-15T10:30:00Z, text=Alice works at Google on the AI team, type=world} - ], - ) - """ - - def testRecallResponse(self): - """Test RecallResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_recall_result.py b/hindsight-clients/python/hindsight_client_api/test/test_recall_result.py deleted file mode 100644 index 1928b2e3..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_recall_result.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.recall_result import RecallResult - -class TestRecallResult(unittest.TestCase): - """RecallResult unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> RecallResult: - """Test RecallResult - 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 `RecallResult` - """ - model = RecallResult() - if include_optional: - return RecallResult( - id = '', - text = '', - type = '', - entities = [ - '' - ], - context = '', - occurred_start = '', - occurred_end = '', - mentioned_at = '', - document_id = '', - metadata = { - 'key' : '' - }, - chunk_id = '' - ) - else: - return RecallResult( - id = '', - text = '', - ) - """ - - def testRecallResult(self): - """Test RecallResult""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_reflect_fact.py b/hindsight-clients/python/hindsight_client_api/test/test_reflect_fact.py deleted file mode 100644 index 51be3578..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_reflect_fact.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.reflect_fact import ReflectFact - -class TestReflectFact(unittest.TestCase): - """ReflectFact unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ReflectFact: - """Test ReflectFact - 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 `ReflectFact` - """ - model = ReflectFact() - if include_optional: - return ReflectFact( - id = '', - text = '', - type = '', - context = '', - occurred_start = '', - occurred_end = '' - ) - else: - return ReflectFact( - text = '', - ) - """ - - def testReflectFact(self): - """Test ReflectFact""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_reflect_include_options.py b/hindsight-clients/python/hindsight_client_api/test/test_reflect_include_options.py deleted file mode 100644 index 0cb68878..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_reflect_include_options.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.reflect_include_options import ReflectIncludeOptions - -class TestReflectIncludeOptions(unittest.TestCase): - """ReflectIncludeOptions unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ReflectIncludeOptions: - """Test ReflectIncludeOptions - 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 `ReflectIncludeOptions` - """ - model = ReflectIncludeOptions() - if include_optional: - return ReflectIncludeOptions( - facts = hindsight_client_api.models.facts_include_options.FactsIncludeOptions() - ) - else: - return ReflectIncludeOptions( - ) - """ - - def testReflectIncludeOptions(self): - """Test ReflectIncludeOptions""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_reflect_request.py b/hindsight-clients/python/hindsight_client_api/test/test_reflect_request.py deleted file mode 100644 index 1c5e58a8..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_reflect_request.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.reflect_request import ReflectRequest - -class TestReflectRequest(unittest.TestCase): - """ReflectRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ReflectRequest: - """Test ReflectRequest - 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 `ReflectRequest` - """ - model = ReflectRequest() - if include_optional: - return ReflectRequest( - query = '', - budget = 'low', - context = '', - include = hindsight_client_api.models.reflect_include_options.ReflectIncludeOptions( - facts = hindsight_client_api.models.facts_include_options.FactsIncludeOptions(), ) - ) - else: - return ReflectRequest( - query = '', - ) - """ - - def testReflectRequest(self): - """Test ReflectRequest""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_reflect_response.py b/hindsight-clients/python/hindsight_client_api/test/test_reflect_response.py deleted file mode 100644 index 1fadf037..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_reflect_response.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.reflect_response import ReflectResponse - -class TestReflectResponse(unittest.TestCase): - """ReflectResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ReflectResponse: - """Test ReflectResponse - 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 `ReflectResponse` - """ - model = ReflectResponse() - if include_optional: - return ReflectResponse( - text = '', - based_on = [ - {context=healthcare discussion, id=123e4567-e89b-12d3-a456-426614174000, occurred_end=2024-01-15T10:30:00Z, occurred_start=2024-01-15T10:30:00Z, text=AI is used in healthcare, type=world} - ] - ) - else: - return ReflectResponse( - text = '', - ) - """ - - def testReflectResponse(self): - """Test ReflectResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_retain_request.py b/hindsight-clients/python/hindsight_client_api/test/test_retain_request.py deleted file mode 100644 index be36ece7..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_retain_request.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.retain_request import RetainRequest - -class TestRetainRequest(unittest.TestCase): - """RetainRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> RetainRequest: - """Test RetainRequest - 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 `RetainRequest` - """ - model = RetainRequest() - if include_optional: - return RetainRequest( - items = [ - {content=Alice mentioned she's working on a new ML model, context=team meeting, document_id=meeting_notes_2024_01_15, metadata={channel=engineering, source=slack}, timestamp=2024-01-15T10:30:00Z} - ], - var_async = True - ) - else: - return RetainRequest( - items = [ - {content=Alice mentioned she's working on a new ML model, context=team meeting, document_id=meeting_notes_2024_01_15, metadata={channel=engineering, source=slack}, timestamp=2024-01-15T10:30:00Z} - ], - ) - """ - - def testRetainRequest(self): - """Test RetainRequest""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_retain_response.py b/hindsight-clients/python/hindsight_client_api/test/test_retain_response.py deleted file mode 100644 index fd6a9599..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_retain_response.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.retain_response import RetainResponse - -class TestRetainResponse(unittest.TestCase): - """RetainResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> RetainResponse: - """Test RetainResponse - 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 `RetainResponse` - """ - model = RetainResponse() - if include_optional: - return RetainResponse( - success = True, - bank_id = '', - items_count = 56, - var_async = True - ) - else: - return RetainResponse( - success = True, - bank_id = '', - items_count = 56, - var_async = True, - ) - """ - - def testRetainResponse(self): - """Test RetainResponse""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_update_disposition_request.py b/hindsight-clients/python/hindsight_client_api/test/test_update_disposition_request.py deleted file mode 100644 index 228f019d..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_update_disposition_request.py +++ /dev/null @@ -1,52 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.update_disposition_request import UpdateDispositionRequest - -class TestUpdateDispositionRequest(unittest.TestCase): - """UpdateDispositionRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> UpdateDispositionRequest: - """Test UpdateDispositionRequest - 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 `UpdateDispositionRequest` - """ - model = UpdateDispositionRequest() - if include_optional: - return UpdateDispositionRequest( - disposition = {empathy=3, literalism=3, skepticism=3} - ) - else: - return UpdateDispositionRequest( - disposition = {empathy=3, literalism=3, skepticism=3}, - ) - """ - - def testUpdateDispositionRequest(self): - """Test UpdateDispositionRequest""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_validation_error.py b/hindsight-clients/python/hindsight_client_api/test/test_validation_error.py deleted file mode 100644 index 282d9525..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_validation_error.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.validation_error import ValidationError - -class TestValidationError(unittest.TestCase): - """ValidationError unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ValidationError: - """Test ValidationError - 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 `ValidationError` - """ - model = ValidationError() - if include_optional: - return ValidationError( - loc = [ - null - ], - msg = '', - type = '' - ) - else: - return ValidationError( - loc = [ - null - ], - msg = '', - type = '', - ) - """ - - def testValidationError(self): - """Test ValidationError""" - # 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/hindsight-clients/python/hindsight_client_api/test/test_validation_error_loc_inner.py b/hindsight-clients/python/hindsight_client_api/test/test_validation_error_loc_inner.py deleted file mode 100644 index 78863c80..00000000 --- a/hindsight-clients/python/hindsight_client_api/test/test_validation_error_loc_inner.py +++ /dev/null @@ -1,50 +0,0 @@ -# coding: utf-8 - -""" - Hindsight HTTP API - - HTTP API for Hindsight - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from hindsight_client_api.models.validation_error_loc_inner import ValidationErrorLocInner - -class TestValidationErrorLocInner(unittest.TestCase): - """ValidationErrorLocInner unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ValidationErrorLocInner: - """Test ValidationErrorLocInner - 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 `ValidationErrorLocInner` - """ - model = ValidationErrorLocInner() - if include_optional: - return ValidationErrorLocInner( - ) - else: - return ValidationErrorLocInner( - ) - """ - - def testValidationErrorLocInner(self): - """Test ValidationErrorLocInner""" - # 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/hindsight-clients/python/openapi-generator-config.yaml b/hindsight-clients/python/openapi-generator-config.yaml index 33e378e7..1dcf7ff2 100644 --- a/hindsight-clients/python/openapi-generator-config.yaml +++ b/hindsight-clients/python/openapi-generator-config.yaml @@ -3,3 +3,7 @@ projectName: hindsight-client packageVersion: 0.0.7 library: asyncio generateSourceCodeOnly: true +# Don't generate auto tests - we have our own integration tests +globalProperties: + apiTests: false + modelTests: false diff --git a/hindsight-clients/python/tests/test_main_operations.py b/hindsight-clients/python/tests/test_main_operations.py index fd7f42b5..a82373e9 100644 --- a/hindsight-clients/python/tests/test_main_operations.py +++ b/hindsight-clients/python/tests/test_main_operations.py @@ -248,3 +248,99 @@ def test_complete_workflow(self, client): ) assert reflect_response.text is not None assert len(reflect_response.text) > 0 + + +class TestBankStats: + """Tests for bank statistics endpoint.""" + + @pytest.fixture(autouse=True) + def setup_memories(self, client, bank_id): + """Setup: Store some test memories.""" + client.retain_batch( + bank_id=bank_id, + items=[ + {"content": "Alice likes Python programming"}, + {"content": "Bob enjoys hiking in the mountains"}, + ], + retain_async=False, + ) + + @pytest.mark.asyncio + async def test_get_bank_stats(self, client, bank_id): + """Test getting bank statistics.""" + from hindsight_client_api import ApiClient, Configuration + from hindsight_client_api.api import BanksApi + + config = Configuration(host=HINDSIGHT_API_URL) + api_client = ApiClient(config) + api = BanksApi(api_client) + stats = await api.get_agent_stats(bank_id=bank_id) + + assert stats is not None + assert stats.bank_id == bank_id + assert stats.total_nodes >= 0 + assert stats.total_links >= 0 + assert stats.total_documents >= 0 + assert isinstance(stats.nodes_by_fact_type, dict) + assert isinstance(stats.links_by_link_type, dict) + + +class TestOperations: + """Tests for operations endpoints.""" + + @pytest.mark.asyncio + async def test_list_operations(self, client, bank_id): + """Test listing operations.""" + from hindsight_client_api import ApiClient, Configuration + from hindsight_client_api.api import OperationsApi + + # First create an async operation using aretain_batch + await client.aretain_batch( + bank_id=bank_id, + items=[{"content": "Test content for async operation"}], + retain_async=True, + ) + + config = Configuration(host=HINDSIGHT_API_URL) + api_client = ApiClient(config) + api = OperationsApi(api_client) + response = await api.list_operations(bank_id=bank_id) + + assert response is not None + assert response.bank_id == bank_id + assert isinstance(response.operations, list) + + +class TestDocuments: + """Tests for document endpoints.""" + + def test_delete_document(self, client, bank_id): + """Test deleting a document.""" + import asyncio + from hindsight_client_api import ApiClient, Configuration + from hindsight_client_api.api import DocumentsApi + + # First create a document using sync retain + doc_id = f"test-doc-{uuid.uuid4().hex[:8]}" + client.retain( + bank_id=bank_id, + content="Test document content for deletion", + document_id=doc_id, + ) + + # Use async API for delete (run in event loop) + async def do_delete(): + config = Configuration(host=HINDSIGHT_API_URL) + api_client = ApiClient(config) + api = DocumentsApi(api_client) + + # Try to delete + response = await api.delete_document(bank_id=bank_id, document_id=doc_id) + return response + + response = asyncio.get_event_loop().run_until_complete(do_delete()) + + assert response is not None + assert response.success is True + assert response.document_id == doc_id + assert response.memory_units_deleted >= 0 diff --git a/hindsight-clients/rust/Cargo.lock b/hindsight-clients/rust/Cargo.lock index d3056117..4c479b05 100644 --- a/hindsight-clients/rust/Cargo.lock +++ b/hindsight-clients/rust/Cargo.lock @@ -74,9 +74,9 @@ checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "bytes" @@ -86,9 +86,9 @@ checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" [[package]] name = "cc" -version = "1.2.49" +version = "1.2.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" +checksum = "9f50d563227a1c37cc0a263f64eca3334388c01c5e4c4861a9def205c614383c" dependencies = [ "find-msvc-tools", "shlex", @@ -350,6 +350,7 @@ dependencies = [ "prettyplease", "progenitor", "progenitor-client", + "regex", "reqwest", "serde", "serde_json", @@ -636,9 +637,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "7ee5b5339afb4c41626dde77b7a611bd4f2c202b897852b4bcf5d03eddc61010" [[package]] name = "js-sys" @@ -999,9 +1000,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.25" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6eff9328d40131d43bd911d42d79eb6a47312002a4daefc9e37f17e74a7701a" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64", "bytes", @@ -1056,9 +1057,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ "bitflags", "errno", @@ -1082,9 +1083,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c" +checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282" dependencies = [ "zeroize", ] @@ -1108,9 +1109,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "62049b2877bf12821e8f9ad256ee38fdc31db7387ec2d3b3f403024de2034aea" [[package]] name = "schannel" @@ -1229,9 +1230,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "217ca874ae0207aac254aa02c957ded05585a90892cc8d87f9e5fa49669dadd8" dependencies = [ "itoa", "memchr", @@ -1573,9 +1574,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-core", @@ -1583,9 +1584,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", ] diff --git a/hindsight-clients/rust/Cargo.toml b/hindsight-clients/rust/Cargo.toml index c35eff1b..b5ff5c5a 100644 --- a/hindsight-clients/rust/Cargo.toml +++ b/hindsight-clients/rust/Cargo.toml @@ -38,3 +38,4 @@ serde_json = "1.0" syn = "2.0" prettyplease = "0.2" openapiv3 = "2.2" +regex = "1.10" diff --git a/hindsight-clients/rust/build.rs b/hindsight-clients/rust/build.rs index cd43f90d..80910a95 100644 --- a/hindsight-clients/rust/build.rs +++ b/hindsight-clients/rust/build.rs @@ -118,10 +118,30 @@ fn main() { let syntax_tree = syn::parse2(tokens) .expect("Failed to parse generated tokens"); - let formatted = prettyplease::unparse(&syntax_tree); + let mut formatted = prettyplease::unparse(&syntax_tree); + + // Fix progenitor bug with optional header parameters + // The generated code tries to call .to_string() on Option<&str> which doesn't work + // We need to unwrap the Option first + formatted = fix_optional_header_params(&formatted); fs::write(&dest_path, formatted) .expect("Failed to write generated client code"); println!("Generated client at: {}", dest_path.display()); } + +/// Fix progenitor's generated code for optional header parameters +/// Replaces patterns like `value.to_string().try_into()?` where value is Option<&str> +/// with `value.unwrap_or_default().to_string().try_into()?` +fn fix_optional_header_params(code: &str) -> String { + use regex::Regex; + + // Pattern: header_map.append("authorization", value.to_string().try_into()?); + // Should become: header_map.append("authorization", value.unwrap_or_default().to_string().try_into()?); + let re = Regex::new(r#"header_map\.append\("authorization", value\.to_string\(\)\.try_into\(\)\?\)"#) + .expect("Invalid regex"); + + re.replace_all(code, r#"header_map.append("authorization", value.unwrap_or_default().to_string().try_into()?)"#) + .to_string() +} diff --git a/hindsight-clients/rust/src/lib.rs b/hindsight-clients/rust/src/lib.rs index d5f74cd9..4d727c24 100644 --- a/hindsight-clients/rust/src/lib.rs +++ b/hindsight-clients/rust/src/lib.rs @@ -12,8 +12,8 @@ //! let client = Client::new("http://localhost:8888"); //! //! // List memory banks -//! let banks = client.list_banks().await?; -//! println!("Found {} banks", banks.into_inner().len()); +//! let banks = client.list_banks(None).await?; +//! println!("Found {} banks", banks.into_inner().banks.len()); //! //! Ok(()) //! } @@ -48,7 +48,7 @@ mod tests { ..Default::default() }; let create_response = client - .create_or_update_bank(&bank_id, &create_request) + .create_or_update_bank(&bank_id, None, &create_request) .await .expect("Failed to create bank"); assert_eq!(create_response.into_inner().bank_id, bank_id); @@ -74,7 +74,7 @@ mod tests { ], }; let retain_response = client - .retain_memories(&bank_id, &retain_request) + .retain_memories(&bank_id, None, &retain_request) .await .expect("Failed to retain memories"); assert!(retain_response.into_inner().success); @@ -90,7 +90,7 @@ mod tests { types: None, }; let recall_response = client - .recall_memories(&bank_id, &recall_request) + .recall_memories(&bank_id, None, &recall_request) .await .expect("Failed to recall memories"); let recall_result = recall_response.into_inner(); @@ -104,13 +104,13 @@ mod tests { include: None, }; let reflect_response = client - .reflect(&bank_id, &reflect_request) + .reflect(&bank_id, None, &reflect_request) .await .expect("Failed to reflect"); let reflect_result = reflect_response.into_inner(); assert!(!reflect_result.text.is_empty(), "Reflect should return some text"); // Cleanup: delete the test bank's memories - let _ = client.clear_bank_memories(&bank_id, None).await; + let _ = client.clear_bank_memories(&bank_id, None, None).await; } } diff --git a/hindsight-clients/typescript/generated/client.gen.ts b/hindsight-clients/typescript/generated/client.gen.ts index cab3c701..00d5f625 100644 --- a/hindsight-clients/typescript/generated/client.gen.ts +++ b/hindsight-clients/typescript/generated/client.gen.ts @@ -1,7 +1,12 @@ // This file is auto-generated by @hey-api/openapi-ts -import { type ClientOptions, type Config, createClient, createConfig } from './client'; -import type { ClientOptions as ClientOptions2 } from './types.gen'; +import { + type ClientOptions, + type Config, + createClient, + createConfig, +} from "./client"; +import type { ClientOptions as ClientOptions2 } from "./types.gen"; /** * The `createClientConfig()` function will be called on client initialization @@ -11,6 +16,8 @@ import type { ClientOptions as ClientOptions2 } from './types.gen'; * `setConfig()`. This is useful for example if you're using Next.js * to ensure your client always has the correct values. */ -export type CreateClientConfig = (override?: Config) => Config & T>; +export type CreateClientConfig = ( + override?: Config, +) => Config & T>; export const client = createClient(createConfig()); diff --git a/hindsight-clients/typescript/generated/client/client.gen.ts b/hindsight-clients/typescript/generated/client/client.gen.ts index c2a5190c..3b3191b5 100644 --- a/hindsight-clients/typescript/generated/client/client.gen.ts +++ b/hindsight-clients/typescript/generated/client/client.gen.ts @@ -1,14 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createSseClient } from '../core/serverSentEvents.gen'; -import type { HttpMethod } from '../core/types.gen'; -import { getValidRequestBody } from '../core/utils.gen'; +import { createSseClient } from "../core/serverSentEvents.gen"; +import type { HttpMethod } from "../core/types.gen"; +import { getValidRequestBody } from "../core/utils.gen"; import type { Client, Config, RequestOptions, ResolvedRequestOptions, -} from './types.gen'; +} from "./types.gen"; import { buildUrl, createConfig, @@ -17,9 +17,9 @@ import { mergeConfigs, mergeHeaders, setAuthParams, -} from './utils.gen'; +} from "./utils.gen"; -type ReqInit = Omit & { +type ReqInit = Omit & { body?: any; headers: ReturnType; }; @@ -66,8 +66,8 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.serializedBody === '') { - opts.headers.delete('Content-Type'); + if (opts.body === undefined || opts.serializedBody === "") { + opts.headers.delete("Content-Type"); } const url = buildUrl(opts); @@ -75,11 +75,11 @@ export const createClient = (config: Config = {}): Client => { return { opts, url }; }; - const request: Client['request'] = async (options) => { + const request: Client["request"] = async (options) => { // @ts-expect-error const { opts, url } = await beforeRequest(options); const requestInit: ReqInit = { - redirect: 'follow', + redirect: "follow", ...opts, body: getValidRequestBody(opts), }; @@ -121,7 +121,7 @@ export const createClient = (config: Config = {}): Client => { } // Return error response - return opts.responseStyle === 'data' + return opts.responseStyle === "data" ? undefined : { error: finalError, @@ -143,33 +143,33 @@ export const createClient = (config: Config = {}): Client => { if (response.ok) { const parseAs = - (opts.parseAs === 'auto' - ? getParseAs(response.headers.get('Content-Type')) - : opts.parseAs) ?? 'json'; + (opts.parseAs === "auto" + ? getParseAs(response.headers.get("Content-Type")) + : opts.parseAs) ?? "json"; if ( response.status === 204 || - response.headers.get('Content-Length') === '0' + response.headers.get("Content-Length") === "0" ) { let emptyData: any; switch (parseAs) { - case 'arrayBuffer': - case 'blob': - case 'text': + case "arrayBuffer": + case "blob": + case "text": emptyData = await response[parseAs](); break; - case 'formData': + case "formData": emptyData = new FormData(); break; - case 'stream': + case "stream": emptyData = response.body; break; - case 'json': + case "json": default: emptyData = {}; break; } - return opts.responseStyle === 'data' + return opts.responseStyle === "data" ? emptyData : { data: emptyData, @@ -179,15 +179,15 @@ export const createClient = (config: Config = {}): Client => { let data: any; switch (parseAs) { - case 'arrayBuffer': - case 'blob': - case 'formData': - case 'json': - case 'text': + case "arrayBuffer": + case "blob": + case "formData": + case "json": + case "text": data = await response[parseAs](); break; - case 'stream': - return opts.responseStyle === 'data' + case "stream": + return opts.responseStyle === "data" ? response.body : { data: response.body, @@ -195,7 +195,7 @@ export const createClient = (config: Config = {}): Client => { }; } - if (parseAs === 'json') { + if (parseAs === "json") { if (opts.responseValidator) { await opts.responseValidator(data); } @@ -205,7 +205,7 @@ export const createClient = (config: Config = {}): Client => { } } - return opts.responseStyle === 'data' + return opts.responseStyle === "data" ? data : { data, @@ -238,7 +238,7 @@ export const createClient = (config: Config = {}): Client => { } // TODO: we probably want to return error and improve types - return opts.responseStyle === 'data' + return opts.responseStyle === "data" ? undefined : { error: finalError, @@ -273,29 +273,29 @@ export const createClient = (config: Config = {}): Client => { return { buildUrl, - connect: makeMethodFn('CONNECT'), - delete: makeMethodFn('DELETE'), - get: makeMethodFn('GET'), + connect: makeMethodFn("CONNECT"), + delete: makeMethodFn("DELETE"), + get: makeMethodFn("GET"), getConfig, - head: makeMethodFn('HEAD'), + head: makeMethodFn("HEAD"), interceptors, - options: makeMethodFn('OPTIONS'), - patch: makeMethodFn('PATCH'), - post: makeMethodFn('POST'), - put: makeMethodFn('PUT'), + options: makeMethodFn("OPTIONS"), + patch: makeMethodFn("PATCH"), + post: makeMethodFn("POST"), + put: makeMethodFn("PUT"), request, setConfig, sse: { - connect: makeSseFn('CONNECT'), - delete: makeSseFn('DELETE'), - get: makeSseFn('GET'), - head: makeSseFn('HEAD'), - options: makeSseFn('OPTIONS'), - patch: makeSseFn('PATCH'), - post: makeSseFn('POST'), - put: makeSseFn('PUT'), - trace: makeSseFn('TRACE'), + connect: makeSseFn("CONNECT"), + delete: makeSseFn("DELETE"), + get: makeSseFn("GET"), + head: makeSseFn("HEAD"), + options: makeSseFn("OPTIONS"), + patch: makeSseFn("PATCH"), + post: makeSseFn("POST"), + put: makeSseFn("PUT"), + trace: makeSseFn("TRACE"), }, - trace: makeMethodFn('TRACE'), + trace: makeMethodFn("TRACE"), } as Client; }; diff --git a/hindsight-clients/typescript/generated/client/index.ts b/hindsight-clients/typescript/generated/client/index.ts index b295edec..4602312a 100644 --- a/hindsight-clients/typescript/generated/client/index.ts +++ b/hindsight-clients/typescript/generated/client/index.ts @@ -1,15 +1,15 @@ // This file is auto-generated by @hey-api/openapi-ts -export type { Auth } from '../core/auth.gen'; -export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +export type { Auth } from "../core/auth.gen"; +export type { QuerySerializerOptions } from "../core/bodySerializer.gen"; export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, -} from '../core/bodySerializer.gen'; -export { buildClientParams } from '../core/params.gen'; -export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; -export { createClient } from './client.gen'; +} from "../core/bodySerializer.gen"; +export { buildClientParams } from "../core/params.gen"; +export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen"; +export { createClient } from "./client.gen"; export type { Client, ClientOptions, @@ -21,5 +21,5 @@ export type { ResolvedRequestOptions, ResponseStyle, TDataShape, -} from './types.gen'; -export { createConfig, mergeHeaders } from './utils.gen'; +} from "./types.gen"; +export { createConfig, mergeHeaders } from "./utils.gen"; diff --git a/hindsight-clients/typescript/generated/client/types.gen.ts b/hindsight-clients/typescript/generated/client/types.gen.ts index b4a499cc..55c405ba 100644 --- a/hindsight-clients/typescript/generated/client/types.gen.ts +++ b/hindsight-clients/typescript/generated/client/types.gen.ts @@ -1,25 +1,24 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Auth } from '../core/auth.gen'; +import type { Auth } from "../core/auth.gen"; import type { ServerSentEventsOptions, ServerSentEventsResult, -} from '../core/serverSentEvents.gen'; +} from "../core/serverSentEvents.gen"; import type { Client as CoreClient, Config as CoreConfig, -} from '../core/types.gen'; -import type { Middleware } from './utils.gen'; +} from "../core/types.gen"; +import type { Middleware } from "./utils.gen"; -export type ResponseStyle = 'data' | 'fields'; +export type ResponseStyle = "data" | "fields"; export interface Config - extends Omit, - CoreConfig { + extends Omit, CoreConfig { /** * Base URL for all requests made by this client. */ - baseUrl?: T['baseUrl']; + baseUrl?: T["baseUrl"]; /** * Fetch API implementation. You can use this option to provide a custom * fetch instance. @@ -43,13 +42,13 @@ export interface Config * @default 'auto' */ parseAs?: - | 'arrayBuffer' - | 'auto' - | 'blob' - | 'formData' - | 'json' - | 'stream' - | 'text'; + | "arrayBuffer" + | "auto" + | "blob" + | "formData" + | "json" + | "stream" + | "text"; /** * Should we return only data or multiple fields (data, error, response, etc.)? * @@ -61,25 +60,27 @@ export interface Config * * @default false */ - throwOnError?: T['throwOnError']; + throwOnError?: T["throwOnError"]; } export interface RequestOptions< TData = unknown, - TResponseStyle extends ResponseStyle = 'fields', + TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string, -> extends Config<{ +> + extends + Config<{ responseStyle: TResponseStyle; throwOnError: ThrowOnError; }>, Pick< ServerSentEventsOptions, - | 'onSseError' - | 'onSseEvent' - | 'sseDefaultRetryDelay' - | 'sseMaxRetryAttempts' - | 'sseMaxRetryDelay' + | "onSseError" + | "onSseEvent" + | "sseDefaultRetryDelay" + | "sseMaxRetryAttempts" + | "sseMaxRetryDelay" > { /** * Any body that you want to add to your request. @@ -97,7 +98,7 @@ export interface RequestOptions< } export interface ResolvedRequestOptions< - TResponseStyle extends ResponseStyle = 'fields', + TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string, > extends RequestOptions { @@ -108,10 +109,10 @@ export type RequestResult< TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, - TResponseStyle extends ResponseStyle = 'fields', + TResponseStyle extends ResponseStyle = "fields", > = ThrowOnError extends true ? Promise< - TResponseStyle extends 'data' + TResponseStyle extends "data" ? TData extends Record ? TData[keyof TData] : TData @@ -124,7 +125,7 @@ export type RequestResult< } > : Promise< - TResponseStyle extends 'data' + TResponseStyle extends "data" ? | (TData extends Record ? TData[keyof TData] @@ -159,30 +160,30 @@ type MethodFn = < TData = unknown, TError = unknown, ThrowOnError extends boolean = false, - TResponseStyle extends ResponseStyle = 'fields', + TResponseStyle extends ResponseStyle = "fields", >( - options: Omit, 'method'>, + options: Omit, "method">, ) => RequestResult; type SseFn = < TData = unknown, TError = unknown, ThrowOnError extends boolean = false, - TResponseStyle extends ResponseStyle = 'fields', + TResponseStyle extends ResponseStyle = "fields", >( - options: Omit, 'method'>, + options: Omit, "method">, ) => Promise>; type RequestFn = < TData = unknown, TError = unknown, ThrowOnError extends boolean = false, - TResponseStyle extends ResponseStyle = 'fields', + TResponseStyle extends ResponseStyle = "fields", >( - options: Omit, 'method'> & + options: Omit, "method"> & Pick< Required>, - 'method' + "method" >, ) => RequestResult; @@ -233,9 +234,9 @@ export type Options< TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, - TResponseStyle extends ResponseStyle = 'fields', + TResponseStyle extends ResponseStyle = "fields", > = OmitKeys< RequestOptions, - 'body' | 'path' | 'query' | 'url' + "body" | "path" | "query" | "url" > & - ([TData] extends [never] ? unknown : Omit); + ([TData] extends [never] ? unknown : Omit); diff --git a/hindsight-clients/typescript/generated/client/utils.gen.ts b/hindsight-clients/typescript/generated/client/utils.gen.ts index 4c48a9ee..e49267e2 100644 --- a/hindsight-clients/typescript/generated/client/utils.gen.ts +++ b/hindsight-clients/typescript/generated/client/utils.gen.ts @@ -1,15 +1,20 @@ // This file is auto-generated by @hey-api/openapi-ts -import { getAuthToken } from '../core/auth.gen'; -import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; -import { jsonBodySerializer } from '../core/bodySerializer.gen'; +import { getAuthToken } from "../core/auth.gen"; +import type { QuerySerializerOptions } from "../core/bodySerializer.gen"; +import { jsonBodySerializer } from "../core/bodySerializer.gen"; import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam, -} from '../core/pathSerializer.gen'; -import { getUrl } from '../core/utils.gen'; -import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; +} from "../core/pathSerializer.gen"; +import { getUrl } from "../core/utils.gen"; +import type { + Client, + ClientOptions, + Config, + RequestOptions, +} from "./types.gen"; export const createQuerySerializer = ({ parameters = {}, @@ -17,7 +22,7 @@ export const createQuerySerializer = ({ }: QuerySerializerOptions = {}) => { const querySerializer = (queryParams: T) => { const search: string[] = []; - if (queryParams && typeof queryParams === 'object') { + if (queryParams && typeof queryParams === "object") { for (const name in queryParams) { const value = queryParams[name]; @@ -32,17 +37,17 @@ export const createQuerySerializer = ({ allowReserved: options.allowReserved, explode: true, name, - style: 'form', + style: "form", value, ...options.array, }); if (serializedArray) search.push(serializedArray); - } else if (typeof value === 'object') { + } else if (typeof value === "object") { const serializedObject = serializeObjectParam({ allowReserved: options.allowReserved, explode: true, name, - style: 'deepObject', + style: "deepObject", value: value as Record, ...options.object, }); @@ -57,7 +62,7 @@ export const createQuerySerializer = ({ } } } - return search.join('&'); + return search.join("&"); }; return querySerializer; }; @@ -67,47 +72,47 @@ export const createQuerySerializer = ({ */ export const getParseAs = ( contentType: string | null, -): Exclude => { +): Exclude => { if (!contentType) { // If no Content-Type header is provided, the best we can do is return the raw response body, // which is effectively the same as the 'stream' option. - return 'stream'; + return "stream"; } - const cleanContent = contentType.split(';')[0]?.trim(); + const cleanContent = contentType.split(";")[0]?.trim(); if (!cleanContent) { return; } if ( - cleanContent.startsWith('application/json') || - cleanContent.endsWith('+json') + cleanContent.startsWith("application/json") || + cleanContent.endsWith("+json") ) { - return 'json'; + return "json"; } - if (cleanContent === 'multipart/form-data') { - return 'formData'; + if (cleanContent === "multipart/form-data") { + return "formData"; } if ( - ['application/', 'audio/', 'image/', 'video/'].some((type) => + ["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type), ) ) { - return 'blob'; + return "blob"; } - if (cleanContent.startsWith('text/')) { - return 'text'; + if (cleanContent.startsWith("text/")) { + return "text"; } return; }; const checkForExistence = ( - options: Pick & { + options: Pick & { headers: Headers; }, name?: string, @@ -118,7 +123,7 @@ const checkForExistence = ( if ( options.headers.has(name) || options.query?.[name] || - options.headers.get('Cookie')?.includes(`${name}=`) + options.headers.get("Cookie")?.includes(`${name}=`) ) { return true; } @@ -128,8 +133,8 @@ const checkForExistence = ( export const setAuthParams = async ({ security, ...options -}: Pick, 'security'> & - Pick & { +}: Pick, "security"> & + Pick & { headers: Headers; }) => { for (const auth of security) { @@ -143,19 +148,19 @@ export const setAuthParams = async ({ continue; } - const name = auth.name ?? 'Authorization'; + const name = auth.name ?? "Authorization"; switch (auth.in) { - case 'query': + case "query": if (!options.query) { options.query = {}; } options.query[name] = token; break; - case 'cookie': - options.headers.append('Cookie', `${name}=${token}`); + case "cookie": + options.headers.append("Cookie", `${name}=${token}`); break; - case 'header': + case "header": default: options.headers.set(name, token); break; @@ -163,13 +168,13 @@ export const setAuthParams = async ({ } }; -export const buildUrl: Client['buildUrl'] = (options) => +export const buildUrl: Client["buildUrl"] = (options) => getUrl({ baseUrl: options.baseUrl as string, path: options.path, query: options.query, querySerializer: - typeof options.querySerializer === 'function' + typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer), url: options.url, @@ -177,7 +182,7 @@ export const buildUrl: Client['buildUrl'] = (options) => export const mergeConfigs = (a: Config, b: Config): Config => { const config = { ...a, ...b }; - if (config.baseUrl?.endsWith('/')) { + if (config.baseUrl?.endsWith("/")) { config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); } config.headers = mergeHeaders(a.headers, b.headers); @@ -193,7 +198,7 @@ const headersEntries = (headers: Headers): Array<[string, string]> => { }; export const mergeHeaders = ( - ...headers: Array['headers'] | undefined> + ...headers: Array["headers"] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { @@ -218,7 +223,7 @@ export const mergeHeaders = ( // content value in OpenAPI specification is 'application/json' mergedHeaders.set( key, - typeof value === 'object' ? JSON.stringify(value) : (value as string), + typeof value === "object" ? JSON.stringify(value) : (value as string), ); } } @@ -264,7 +269,7 @@ class Interceptors { } getInterceptorIndex(id: number | Interceptor): number { - if (typeof id === 'number') { + if (typeof id === "number") { return this.fns[id] ? id : -1; } return this.fns.indexOf(id); @@ -309,16 +314,16 @@ const defaultQuerySerializer = createQuerySerializer({ allowReserved: false, array: { explode: true, - style: 'form', + style: "form", }, object: { explode: true, - style: 'deepObject', + style: "deepObject", }, }); const defaultHeaders = { - 'Content-Type': 'application/json', + "Content-Type": "application/json", }; export const createConfig = ( @@ -326,7 +331,7 @@ export const createConfig = ( ): Config & T> => ({ ...jsonBodySerializer, headers: defaultHeaders, - parseAs: 'auto', + parseAs: "auto", querySerializer: defaultQuerySerializer, ...override, }); diff --git a/hindsight-clients/typescript/generated/core/auth.gen.ts b/hindsight-clients/typescript/generated/core/auth.gen.ts index f8a73266..3d741151 100644 --- a/hindsight-clients/typescript/generated/core/auth.gen.ts +++ b/hindsight-clients/typescript/generated/core/auth.gen.ts @@ -8,15 +8,15 @@ export interface Auth { * * @default 'header' */ - in?: 'header' | 'query' | 'cookie'; + in?: "header" | "query" | "cookie"; /** * Header or query parameter name. * * @default 'Authorization' */ name?: string; - scheme?: 'basic' | 'bearer'; - type: 'apiKey' | 'http'; + scheme?: "basic" | "bearer"; + type: "apiKey" | "http"; } export const getAuthToken = async ( @@ -24,17 +24,17 @@ export const getAuthToken = async ( callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, ): Promise => { const token = - typeof callback === 'function' ? await callback(auth) : callback; + typeof callback === "function" ? await callback(auth) : callback; if (!token) { return; } - if (auth.scheme === 'bearer') { + if (auth.scheme === "bearer") { return `Bearer ${token}`; } - if (auth.scheme === 'basic') { + if (auth.scheme === "basic") { return `Basic ${btoa(token)}`; } diff --git a/hindsight-clients/typescript/generated/core/bodySerializer.gen.ts b/hindsight-clients/typescript/generated/core/bodySerializer.gen.ts index 552b50f7..2ed9d6d4 100644 --- a/hindsight-clients/typescript/generated/core/bodySerializer.gen.ts +++ b/hindsight-clients/typescript/generated/core/bodySerializer.gen.ts @@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions, -} from './pathSerializer.gen'; +} from "./pathSerializer.gen"; export type QuerySerializer = (query: Record) => string; @@ -29,7 +29,7 @@ const serializeFormDataPair = ( key: string, value: unknown, ): void => { - if (typeof value === 'string' || value instanceof Blob) { + if (typeof value === "string" || value instanceof Blob) { data.append(key, value); } else if (value instanceof Date) { data.append(key, value.toISOString()); @@ -43,7 +43,7 @@ const serializeUrlSearchParamsPair = ( key: string, value: unknown, ): void => { - if (typeof value === 'string') { + if (typeof value === "string") { data.append(key, value); } else { data.append(key, JSON.stringify(value)); @@ -74,7 +74,7 @@ export const formDataBodySerializer = { export const jsonBodySerializer = { bodySerializer: (body: T): string => JSON.stringify(body, (_key, value) => - typeof value === 'bigint' ? value.toString() : value, + typeof value === "bigint" ? value.toString() : value, ), }; diff --git a/hindsight-clients/typescript/generated/core/params.gen.ts b/hindsight-clients/typescript/generated/core/params.gen.ts index 602715c4..fb9f992a 100644 --- a/hindsight-clients/typescript/generated/core/params.gen.ts +++ b/hindsight-clients/typescript/generated/core/params.gen.ts @@ -1,10 +1,10 @@ // This file is auto-generated by @hey-api/openapi-ts -type Slot = 'body' | 'headers' | 'path' | 'query'; +type Slot = "body" | "headers" | "path" | "query"; export type Field = | { - in: Exclude; + in: Exclude; /** * Field name. This is the name we want the user to see and use. */ @@ -16,7 +16,7 @@ export type Field = map?: string; } | { - in: Extract; + in: Extract; /** * Key isn't required for bodies. */ @@ -43,10 +43,10 @@ export interface Fields { export type FieldsConfig = ReadonlyArray; const extraPrefixesMap: Record = { - $body_: 'body', - $headers_: 'headers', - $path_: 'path', - $query_: 'query', + $body_: "body", + $headers_: "headers", + $path_: "path", + $query_: "query", }; const extraPrefixes = Object.entries(extraPrefixesMap); @@ -68,14 +68,14 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { } for (const config of fields) { - if ('in' in config) { + if ("in" in config) { if (config.key) { map.set(config.key, { in: config.in, map: config.map, }); } - } else if ('key' in config) { + } else if ("key" in config) { map.set(config.key, { map: config.map, }); @@ -96,7 +96,7 @@ interface Params { const stripEmptySlots = (params: Params) => { for (const [slot, value] of Object.entries(params)) { - if (value && typeof value === 'object' && !Object.keys(value).length) { + if (value && typeof value === "object" && !Object.keys(value).length) { delete params[slot as Slot]; } } @@ -126,7 +126,7 @@ export const buildClientParams = ( continue; } - if ('in' in config) { + if ("in" in config) { if (config.key) { const field = map.get(config.key)!; const name = field.map || config.key; @@ -157,7 +157,7 @@ export const buildClientParams = ( (params[slot] as Record)[ key.slice(prefix.length) ] = value; - } else if ('allowExtra' in config && config.allowExtra) { + } else if ("allowExtra" in config && config.allowExtra) { for (const [slot, allowed] of Object.entries(config.allowExtra)) { if (allowed) { (params[slot as Slot] as Record)[key] = value; diff --git a/hindsight-clients/typescript/generated/core/pathSerializer.gen.ts b/hindsight-clients/typescript/generated/core/pathSerializer.gen.ts index 8d999310..52457e0c 100644 --- a/hindsight-clients/typescript/generated/core/pathSerializer.gen.ts +++ b/hindsight-clients/typescript/generated/core/pathSerializer.gen.ts @@ -1,8 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts interface SerializeOptions - extends SerializePrimitiveOptions, - SerializerOptions {} + extends SerializePrimitiveOptions, SerializerOptions {} interface SerializePrimitiveOptions { allowReserved?: boolean; @@ -17,10 +16,10 @@ export interface SerializerOptions { style: T; } -export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; +export type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited"; export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; -type MatrixStyle = 'label' | 'matrix' | 'simple'; -export type ObjectStyle = 'form' | 'deepObject'; +type MatrixStyle = "label" | "matrix" | "simple"; +export type ObjectStyle = "form" | "deepObject"; type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; interface SerializePrimitiveParam extends SerializePrimitiveOptions { @@ -29,40 +28,40 @@ interface SerializePrimitiveParam extends SerializePrimitiveOptions { export const separatorArrayExplode = (style: ArraySeparatorStyle) => { switch (style) { - case 'label': - return '.'; - case 'matrix': - return ';'; - case 'simple': - return ','; + case "label": + return "."; + case "matrix": + return ";"; + case "simple": + return ","; default: - return '&'; + return "&"; } }; export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { switch (style) { - case 'form': - return ','; - case 'pipeDelimited': - return '|'; - case 'spaceDelimited': - return '%20'; + case "form": + return ","; + case "pipeDelimited": + return "|"; + case "spaceDelimited": + return "%20"; default: - return ','; + return ","; } }; export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { switch (style) { - case 'label': - return '.'; - case 'matrix': - return ';'; - case 'simple': - return ','; + case "label": + return "."; + case "matrix": + return ";"; + case "simple": + return ","; default: - return '&'; + return "&"; } }; @@ -80,11 +79,11 @@ export const serializeArrayParam = ({ allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) ).join(separatorArrayNoExplode(style)); switch (style) { - case 'label': + case "label": return `.${joinedValues}`; - case 'matrix': + case "matrix": return `;${name}=${joinedValues}`; - case 'simple': + case "simple": return joinedValues; default: return `${name}=${joinedValues}`; @@ -94,7 +93,7 @@ export const serializeArrayParam = ({ const separator = separatorArrayExplode(style); const joinedValues = value .map((v) => { - if (style === 'label' || style === 'simple') { + if (style === "label" || style === "simple") { return allowReserved ? v : encodeURIComponent(v as string); } @@ -105,7 +104,7 @@ export const serializeArrayParam = ({ }); }) .join(separator); - return style === 'label' || style === 'matrix' + return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues; }; @@ -116,12 +115,12 @@ export const serializePrimitiveParam = ({ value, }: SerializePrimitiveParam) => { if (value === undefined || value === null) { - return ''; + return ""; } - if (typeof value === 'object') { + if (typeof value === "object") { throw new Error( - 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', + "Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.", ); } @@ -143,7 +142,7 @@ export const serializeObjectParam = ({ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; } - if (style !== 'deepObject' && !explode) { + if (style !== "deepObject" && !explode) { let values: string[] = []; Object.entries(value).forEach(([key, v]) => { values = [ @@ -152,13 +151,13 @@ export const serializeObjectParam = ({ allowReserved ? (v as string) : encodeURIComponent(v as string), ]; }); - const joinedValues = values.join(','); + const joinedValues = values.join(","); switch (style) { - case 'form': + case "form": return `${name}=${joinedValues}`; - case 'label': + case "label": return `.${joinedValues}`; - case 'matrix': + case "matrix": return `;${name}=${joinedValues}`; default: return joinedValues; @@ -170,12 +169,12 @@ export const serializeObjectParam = ({ .map(([key, v]) => serializePrimitiveParam({ allowReserved, - name: style === 'deepObject' ? `${name}[${key}]` : key, + name: style === "deepObject" ? `${name}[${key}]` : key, value: v as string, }), ) .join(separator); - return style === 'label' || style === 'matrix' + return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues; }; diff --git a/hindsight-clients/typescript/generated/core/queryKeySerializer.gen.ts b/hindsight-clients/typescript/generated/core/queryKeySerializer.gen.ts index d3bb6839..0713164c 100644 --- a/hindsight-clients/typescript/generated/core/queryKeySerializer.gen.ts +++ b/hindsight-clients/typescript/generated/core/queryKeySerializer.gen.ts @@ -17,12 +17,12 @@ export type JsonValue = export const queryKeyJsonReplacer = (_key: string, value: unknown) => { if ( value === undefined || - typeof value === 'function' || - typeof value === 'symbol' + typeof value === "function" || + typeof value === "symbol" ) { return undefined; } - if (typeof value === 'bigint') { + if (typeof value === "bigint") { return value.toString(); } if (value instanceof Date) { @@ -50,7 +50,7 @@ export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { * Detects plain objects (including objects with a null prototype). */ const isPlainObject = (value: unknown): value is Record => { - if (value === null || typeof value !== 'object') { + if (value === null || typeof value !== "object") { return false; } const prototype = Object.getPrototypeOf(value as object); @@ -94,22 +94,22 @@ export const serializeQueryKeyValue = ( } if ( - typeof value === 'string' || - typeof value === 'number' || - typeof value === 'boolean' + typeof value === "string" || + typeof value === "number" || + typeof value === "boolean" ) { return value; } if ( value === undefined || - typeof value === 'function' || - typeof value === 'symbol' + typeof value === "function" || + typeof value === "symbol" ) { return undefined; } - if (typeof value === 'bigint') { + if (typeof value === "bigint") { return value.toString(); } @@ -122,7 +122,7 @@ export const serializeQueryKeyValue = ( } if ( - typeof URLSearchParams !== 'undefined' && + typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams ) { return serializeSearchParams(value); diff --git a/hindsight-clients/typescript/generated/core/serverSentEvents.gen.ts b/hindsight-clients/typescript/generated/core/serverSentEvents.gen.ts index f8fd78e2..06ae8809 100644 --- a/hindsight-clients/typescript/generated/core/serverSentEvents.gen.ts +++ b/hindsight-clients/typescript/generated/core/serverSentEvents.gen.ts @@ -1,12 +1,12 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Config } from './types.gen'; +import type { Config } from "./types.gen"; export type ServerSentEventsOptions = Omit< RequestInit, - 'method' + "method" > & - Pick & { + Pick & { /** * Fetch API implementation. You can use this option to provide a custom * fetch instance. @@ -35,7 +35,7 @@ export type ServerSentEventsOptions = Omit< * @returns Nothing (void). */ onSseEvent?: (event: StreamEvent) => void; - serializedBody?: RequestInit['body']; + serializedBody?: RequestInit["body"]; /** * Default retry delay in milliseconds. * @@ -121,12 +121,12 @@ export const createSseClient = ({ : new Headers(options.headers as Record | undefined); if (lastEventId !== undefined) { - headers.set('Last-Event-ID', lastEventId); + headers.set("Last-Event-ID", lastEventId); } try { const requestInit: RequestInit = { - redirect: 'follow', + redirect: "follow", ...options, body: options.serializedBody, headers, @@ -146,13 +146,13 @@ export const createSseClient = ({ `SSE failed: ${response.status} ${response.statusText}`, ); - if (!response.body) throw new Error('No body in SSE response'); + if (!response.body) throw new Error("No body in SSE response"); const reader = response.body .pipeThrough(new TextDecoderStream()) .getReader(); - let buffer = ''; + let buffer = ""; const abortHandler = () => { try { @@ -162,7 +162,7 @@ export const createSseClient = ({ } }; - signal.addEventListener('abort', abortHandler); + signal.addEventListener("abort", abortHandler); try { while (true) { @@ -170,24 +170,24 @@ export const createSseClient = ({ if (done) break; buffer += value; - const chunks = buffer.split('\n\n'); - buffer = chunks.pop() ?? ''; + const chunks = buffer.split("\n\n"); + buffer = chunks.pop() ?? ""; for (const chunk of chunks) { - const lines = chunk.split('\n'); + const lines = chunk.split("\n"); const dataLines: Array = []; let eventName: string | undefined; for (const line of lines) { - if (line.startsWith('data:')) { - dataLines.push(line.replace(/^data:\s*/, '')); - } else if (line.startsWith('event:')) { - eventName = line.replace(/^event:\s*/, ''); - } else if (line.startsWith('id:')) { - lastEventId = line.replace(/^id:\s*/, ''); - } else if (line.startsWith('retry:')) { + if (line.startsWith("data:")) { + dataLines.push(line.replace(/^data:\s*/, "")); + } else if (line.startsWith("event:")) { + eventName = line.replace(/^event:\s*/, ""); + } else if (line.startsWith("id:")) { + lastEventId = line.replace(/^id:\s*/, ""); + } else if (line.startsWith("retry:")) { const parsed = Number.parseInt( - line.replace(/^retry:\s*/, ''), + line.replace(/^retry:\s*/, ""), 10, ); if (!Number.isNaN(parsed)) { @@ -200,7 +200,7 @@ export const createSseClient = ({ let parsedJson = false; if (dataLines.length) { - const rawData = dataLines.join('\n'); + const rawData = dataLines.join("\n"); try { data = JSON.parse(rawData); parsedJson = true; @@ -232,7 +232,7 @@ export const createSseClient = ({ } } } finally { - signal.removeEventListener('abort', abortHandler); + signal.removeEventListener("abort", abortHandler); reader.releaseLock(); } diff --git a/hindsight-clients/typescript/generated/core/types.gen.ts b/hindsight-clients/typescript/generated/core/types.gen.ts index 643c070c..6b23d10b 100644 --- a/hindsight-clients/typescript/generated/core/types.gen.ts +++ b/hindsight-clients/typescript/generated/core/types.gen.ts @@ -1,22 +1,22 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Auth, AuthToken } from './auth.gen'; +import type { Auth, AuthToken } from "./auth.gen"; import type { BodySerializer, QuerySerializer, QuerySerializerOptions, -} from './bodySerializer.gen'; +} from "./bodySerializer.gen"; export type HttpMethod = - | 'connect' - | 'delete' - | 'get' - | 'head' - | 'options' - | 'patch' - | 'post' - | 'put' - | 'trace'; + | "connect" + | "delete" + | "get" + | "head" + | "options" + | "patch" + | "post" + | "put" + | "trace"; export type Client< RequestFn = never, @@ -56,7 +56,7 @@ export interface Config { * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} */ headers?: - | RequestInit['headers'] + | RequestInit["headers"] | Record< string, | string diff --git a/hindsight-clients/typescript/generated/core/utils.gen.ts b/hindsight-clients/typescript/generated/core/utils.gen.ts index 0b5389d0..80fbfff2 100644 --- a/hindsight-clients/typescript/generated/core/utils.gen.ts +++ b/hindsight-clients/typescript/generated/core/utils.gen.ts @@ -1,12 +1,12 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from "./bodySerializer.gen"; import { type ArraySeparatorStyle, serializeArrayParam, serializeObjectParam, serializePrimitiveParam, -} from './pathSerializer.gen'; +} from "./pathSerializer.gen"; export interface PathSerializer { path: Record; @@ -22,19 +22,19 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { for (const match of matches) { let explode = false; let name = match.substring(1, match.length - 1); - let style: ArraySeparatorStyle = 'simple'; + let style: ArraySeparatorStyle = "simple"; - if (name.endsWith('*')) { + if (name.endsWith("*")) { explode = true; name = name.substring(0, name.length - 1); } - if (name.startsWith('.')) { + if (name.startsWith(".")) { name = name.substring(1); - style = 'label'; - } else if (name.startsWith(';')) { + style = "label"; + } else if (name.startsWith(";")) { name = name.substring(1); - style = 'matrix'; + style = "matrix"; } const value = path[name]; @@ -51,7 +51,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { continue; } - if (typeof value === 'object') { + if (typeof value === "object") { url = url.replace( match, serializeObjectParam({ @@ -65,7 +65,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { continue; } - if (style === 'matrix') { + if (style === "matrix") { url = url.replace( match, `;${serializePrimitiveParam({ @@ -77,7 +77,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { } const replaceValue = encodeURIComponent( - style === 'label' ? `.${value as string}` : (value as string), + style === "label" ? `.${value as string}` : (value as string), ); url = url.replace(match, replaceValue); } @@ -98,13 +98,13 @@ export const getUrl = ({ querySerializer: QuerySerializer; url: string; }) => { - const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; - let url = (baseUrl ?? '') + pathUrl; + const pathUrl = _url.startsWith("/") ? _url : `/${_url}`; + let url = (baseUrl ?? "") + pathUrl; if (path) { url = defaultPathSerializer({ path, url }); } - let search = query ? querySerializer(query) : ''; - if (search.startsWith('?')) { + let search = query ? querySerializer(query) : ""; + if (search.startsWith("?")) { search = search.substring(1); } if (search) { @@ -122,15 +122,15 @@ export function getValidRequestBody(options: { const isSerializedBody = hasBody && options.bodySerializer; if (isSerializedBody) { - if ('serializedBody' in options) { + if ("serializedBody" in options) { const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + options.serializedBody !== undefined && options.serializedBody !== ""; return hasSerializedBody ? options.serializedBody : null; } // not all clients implement a serializedBody property (i.e. client-axios) - return options.body !== '' ? options.body : null; + return options.body !== "" ? options.body : null; } // plain/text body diff --git a/hindsight-clients/typescript/generated/index.ts b/hindsight-clients/typescript/generated/index.ts index c352c104..7a716924 100644 --- a/hindsight-clients/typescript/generated/index.ts +++ b/hindsight-clients/typescript/generated/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export type * from './types.gen'; -export * from './sdk.gen'; +export type * from "./types.gen"; +export * from "./sdk.gen"; diff --git a/hindsight-clients/typescript/generated/sdk.gen.ts b/hindsight-clients/typescript/generated/sdk.gen.ts index 9c5689c5..86cea5dd 100644 --- a/hindsight-clients/typescript/generated/sdk.gen.ts +++ b/hindsight-clients/typescript/generated/sdk.gen.ts @@ -1,21 +1,95 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Client, Options as Options2, TDataShape } from './client'; -import { client } from './client.gen'; -import type { AddBankBackgroundData, AddBankBackgroundErrors, AddBankBackgroundResponses, CancelOperationData, CancelOperationErrors, CancelOperationResponses, ClearBankMemoriesData, ClearBankMemoriesErrors, ClearBankMemoriesResponses, CreateOrUpdateBankData, CreateOrUpdateBankErrors, CreateOrUpdateBankResponses, DeleteDocumentData, DeleteDocumentErrors, DeleteDocumentResponses, GetAgentStatsData, GetAgentStatsErrors, GetAgentStatsResponses, GetBankProfileData, GetBankProfileErrors, GetBankProfileResponses, GetChunkData, GetChunkErrors, GetChunkResponses, GetDocumentData, GetDocumentErrors, GetDocumentResponses, GetEntityData, GetEntityErrors, GetEntityResponses, GetGraphData, GetGraphErrors, GetGraphResponses, HealthEndpointHealthGetData, HealthEndpointHealthGetResponses, ListBanksData, ListBanksResponses, ListDocumentsData, ListDocumentsErrors, ListDocumentsResponses, ListEntitiesData, ListEntitiesErrors, ListEntitiesResponses, ListMemoriesData, ListMemoriesErrors, ListMemoriesResponses, ListOperationsData, ListOperationsErrors, ListOperationsResponses, MetricsEndpointMetricsGetData, MetricsEndpointMetricsGetResponses, RecallMemoriesData, RecallMemoriesErrors, RecallMemoriesResponses, ReflectData, ReflectErrors, ReflectResponses, RegenerateEntityObservationsData, RegenerateEntityObservationsErrors, RegenerateEntityObservationsResponses, RetainMemoriesData, RetainMemoriesErrors, RetainMemoriesResponses, UpdateBankDispositionData, UpdateBankDispositionErrors, UpdateBankDispositionResponses } from './types.gen'; +import type { Client, Options as Options2, TDataShape } from "./client"; +import { client } from "./client.gen"; +import type { + AddBankBackgroundData, + AddBankBackgroundErrors, + AddBankBackgroundResponses, + CancelOperationData, + CancelOperationErrors, + CancelOperationResponses, + ClearBankMemoriesData, + ClearBankMemoriesErrors, + ClearBankMemoriesResponses, + CreateOrUpdateBankData, + CreateOrUpdateBankErrors, + CreateOrUpdateBankResponses, + DeleteBankData, + DeleteBankErrors, + DeleteBankResponses, + DeleteDocumentData, + DeleteDocumentErrors, + DeleteDocumentResponses, + GetAgentStatsData, + GetAgentStatsErrors, + GetAgentStatsResponses, + GetBankProfileData, + GetBankProfileErrors, + GetBankProfileResponses, + GetChunkData, + GetChunkErrors, + GetChunkResponses, + GetDocumentData, + GetDocumentErrors, + GetDocumentResponses, + GetEntityData, + GetEntityErrors, + GetEntityResponses, + GetGraphData, + GetGraphErrors, + GetGraphResponses, + HealthEndpointHealthGetData, + HealthEndpointHealthGetResponses, + ListBanksData, + ListBanksErrors, + ListBanksResponses, + ListDocumentsData, + ListDocumentsErrors, + ListDocumentsResponses, + ListEntitiesData, + ListEntitiesErrors, + ListEntitiesResponses, + ListMemoriesData, + ListMemoriesErrors, + ListMemoriesResponses, + ListOperationsData, + ListOperationsErrors, + ListOperationsResponses, + MetricsEndpointMetricsGetData, + MetricsEndpointMetricsGetResponses, + RecallMemoriesData, + RecallMemoriesErrors, + RecallMemoriesResponses, + ReflectData, + ReflectErrors, + ReflectResponses, + RegenerateEntityObservationsData, + RegenerateEntityObservationsErrors, + RegenerateEntityObservationsResponses, + RetainMemoriesData, + RetainMemoriesErrors, + RetainMemoriesResponses, + UpdateBankDispositionData, + UpdateBankDispositionErrors, + UpdateBankDispositionResponses, +} from "./types.gen"; -export type Options = Options2 & { - /** - * You can provide a client instance returned by `createClient()` instead of - * individual options. This might be also useful if you want to implement a - * custom client. - */ - client?: Client; - /** - * You can pass arbitrary values through the `meta` object. This can be - * used to access values that aren't defined as part of the SDK function. - */ - meta?: Record; +export type Options< + TData extends TDataShape = TDataShape, + ThrowOnError extends boolean = boolean, +> = Options2 & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; }; /** @@ -23,28 +97,56 @@ export type Options(options?: Options) => (options?.client ?? client).get({ url: '/health', ...options }); +export const healthEndpointHealthGet = ( + options?: Options, +) => + (options?.client ?? client).get< + HealthEndpointHealthGetResponses, + unknown, + ThrowOnError + >({ url: "/health", ...options }); /** * Prometheus metrics endpoint * * Exports metrics in Prometheus format for scraping */ -export const metricsEndpointMetricsGet = (options?: Options) => (options?.client ?? client).get({ url: '/metrics', ...options }); +export const metricsEndpointMetricsGet = ( + options?: Options, +) => + (options?.client ?? client).get< + MetricsEndpointMetricsGetResponses, + unknown, + ThrowOnError + >({ url: "/metrics", ...options }); /** * Get memory graph data * * Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items. */ -export const getGraph = (options: Options) => (options.client ?? client).get({ url: '/v1/default/banks/{bank_id}/graph', ...options }); +export const getGraph = ( + options: Options, +) => + (options.client ?? client).get< + GetGraphResponses, + GetGraphErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/graph", ...options }); /** * List memory units * * List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). */ -export const listMemories = (options: Options) => (options.client ?? client).get({ url: '/v1/default/banks/{bank_id}/memories/list', ...options }); +export const listMemories = ( + options: Options, +) => + (options.client ?? client).get< + ListMemoriesResponses, + ListMemoriesErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/memories/list", ...options }); /** * Recall memory @@ -52,20 +154,27 @@ export const listMemories = (options: Opti * Recall memory using semantic similarity and spreading activation. * * The type parameter is optional and must be one of: - * - 'world': General knowledge about people, places, events, and things that happen - * - 'experience': Memories about experience, conversations, actions taken, and tasks performed - * - 'opinion': The bank's formed beliefs, perspectives, and viewpoints + * - `world`: General knowledge about people, places, events, and things that happen + * - `experience`: Memories about experience, conversations, actions taken, and tasks performed + * - `opinion`: The bank's formed beliefs, perspectives, and viewpoints * - * Set include_entities=true to get entity observations alongside recall results. + * Set `include_entities=true` to get entity observations alongside recall results. */ -export const recallMemories = (options: Options) => (options.client ?? client).post({ - url: '/v1/default/banks/{bank_id}/memories/recall', +export const recallMemories = ( + options: Options, +) => + (options.client ?? client).post< + RecallMemoriesResponses, + RecallMemoriesErrors, + ThrowOnError + >({ + url: "/v1/default/banks/{bank_id}/memories/recall", ...options, headers: { - 'Content-Type': 'application/json', - ...options.headers - } -}); + "Content-Type": "application/json", + ...options.headers, + }, + }); /** * Reflect and generate answer @@ -80,56 +189,110 @@ export const recallMemories = (options: Op * 5. Extracts and stores any new opinions formed * 6. Returns plain text answer, the facts used, and new opinions */ -export const reflect = (options: Options) => (options.client ?? client).post({ - url: '/v1/default/banks/{bank_id}/reflect', +export const reflect = ( + options: Options, +) => + (options.client ?? client).post< + ReflectResponses, + ReflectErrors, + ThrowOnError + >({ + url: "/v1/default/banks/{bank_id}/reflect", ...options, headers: { - 'Content-Type': 'application/json', - ...options.headers - } -}); + "Content-Type": "application/json", + ...options.headers, + }, + }); /** * List all memory banks * * Get a list of all agents with their profiles */ -export const listBanks = (options?: Options) => (options?.client ?? client).get({ url: '/v1/default/banks', ...options }); +export const listBanks = ( + options?: Options, +) => + (options?.client ?? client).get< + ListBanksResponses, + ListBanksErrors, + ThrowOnError + >({ url: "/v1/default/banks", ...options }); /** * Get statistics for memory bank * * Get statistics about nodes and links for a specific agent */ -export const getAgentStats = (options: Options) => (options.client ?? client).get({ url: '/v1/default/banks/{bank_id}/stats', ...options }); +export const getAgentStats = ( + options: Options, +) => + (options.client ?? client).get< + GetAgentStatsResponses, + GetAgentStatsErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/stats", ...options }); /** * List entities * * List all entities (people, organizations, etc.) known by the bank, ordered by mention count. */ -export const listEntities = (options: Options) => (options.client ?? client).get({ url: '/v1/default/banks/{bank_id}/entities', ...options }); +export const listEntities = ( + options: Options, +) => + (options.client ?? client).get< + ListEntitiesResponses, + ListEntitiesErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/entities", ...options }); /** * Get entity details * * Get detailed information about an entity including observations (mental model). */ -export const getEntity = (options: Options) => (options.client ?? client).get({ url: '/v1/default/banks/{bank_id}/entities/{entity_id}', ...options }); +export const getEntity = ( + options: Options, +) => + (options.client ?? client).get< + GetEntityResponses, + GetEntityErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/entities/{entity_id}", ...options }); /** * Regenerate entity observations * * Regenerate observations for an entity based on all facts mentioning it. */ -export const regenerateEntityObservations = (options: Options) => (options.client ?? client).post({ url: '/v1/default/banks/{bank_id}/entities/{entity_id}/regenerate', ...options }); +export const regenerateEntityObservations = < + ThrowOnError extends boolean = false, +>( + options: Options, +) => + (options.client ?? client).post< + RegenerateEntityObservationsResponses, + RegenerateEntityObservationsErrors, + ThrowOnError + >({ + url: "/v1/default/banks/{bank_id}/entities/{entity_id}/regenerate", + ...options, + }); /** * List documents * * List documents with pagination and optional search. Documents are the source content from which memory units are extracted. */ -export const listDocuments = (options: Options) => (options.client ?? client).get({ url: '/v1/default/banks/{bank_id}/documents', ...options }); +export const listDocuments = ( + options: Options, +) => + (options.client ?? client).get< + ListDocumentsResponses, + ListDocumentsErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/documents", ...options }); /** * Delete a document @@ -143,131 +306,219 @@ export const listDocuments = (options: Opt * * This operation cannot be undone. */ -export const deleteDocument = (options: Options) => (options.client ?? client).delete({ url: '/v1/default/banks/{bank_id}/documents/{document_id}', ...options }); +export const deleteDocument = ( + options: Options, +) => + (options.client ?? client).delete< + DeleteDocumentResponses, + DeleteDocumentErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/documents/{document_id}", ...options }); /** * Get document details * * Get a specific document including its original text */ -export const getDocument = (options: Options) => (options.client ?? client).get({ url: '/v1/default/banks/{bank_id}/documents/{document_id}', ...options }); +export const getDocument = ( + options: Options, +) => + (options.client ?? client).get< + GetDocumentResponses, + GetDocumentErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/documents/{document_id}", ...options }); /** * Get chunk details * * Get a specific chunk by its ID */ -export const getChunk = (options: Options) => (options.client ?? client).get({ url: '/v1/default/chunks/{chunk_id}', ...options }); +export const getChunk = ( + options: Options, +) => + (options.client ?? client).get< + GetChunkResponses, + GetChunkErrors, + ThrowOnError + >({ url: "/v1/default/chunks/{chunk_id}", ...options }); /** * List async operations * * Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations */ -export const listOperations = (options: Options) => (options.client ?? client).get({ url: '/v1/default/banks/{bank_id}/operations', ...options }); +export const listOperations = ( + options: Options, +) => + (options.client ?? client).get< + ListOperationsResponses, + ListOperationsErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/operations", ...options }); /** * Cancel a pending async operation * * Cancel a pending async operation by removing it from the queue */ -export const cancelOperation = (options: Options) => (options.client ?? client).delete({ url: '/v1/default/banks/{bank_id}/operations/{operation_id}', ...options }); +export const cancelOperation = ( + options: Options, +) => + (options.client ?? client).delete< + CancelOperationResponses, + CancelOperationErrors, + ThrowOnError + >({ + url: "/v1/default/banks/{bank_id}/operations/{operation_id}", + ...options, + }); /** * Get memory bank profile * * Get disposition traits and background for a memory bank. Auto-creates agent with defaults if not exists. */ -export const getBankProfile = (options: Options) => (options.client ?? client).get({ url: '/v1/default/banks/{bank_id}/profile', ...options }); +export const getBankProfile = ( + options: Options, +) => + (options.client ?? client).get< + GetBankProfileResponses, + GetBankProfileErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/profile", ...options }); /** * Update memory bank disposition * * Update bank's disposition traits (skepticism, literalism, empathy) */ -export const updateBankDisposition = (options: Options) => (options.client ?? client).put({ - url: '/v1/default/banks/{bank_id}/profile', +export const updateBankDisposition = ( + options: Options, +) => + (options.client ?? client).put< + UpdateBankDispositionResponses, + UpdateBankDispositionErrors, + ThrowOnError + >({ + url: "/v1/default/banks/{bank_id}/profile", ...options, headers: { - 'Content-Type': 'application/json', - ...options.headers - } -}); + "Content-Type": "application/json", + ...options.headers, + }, + }); /** * Add/merge memory bank background * * Add new background information or merge with existing. LLM intelligently resolves conflicts, normalizes to first person, and optionally infers disposition traits. */ -export const addBankBackground = (options: Options) => (options.client ?? client).post({ - url: '/v1/default/banks/{bank_id}/background', +export const addBankBackground = ( + options: Options, +) => + (options.client ?? client).post< + AddBankBackgroundResponses, + AddBankBackgroundErrors, + ThrowOnError + >({ + url: "/v1/default/banks/{bank_id}/background", ...options, headers: { - 'Content-Type': 'application/json', - ...options.headers - } -}); + "Content-Type": "application/json", + ...options.headers, + }, + }); + +/** + * Delete memory bank + * + * Delete an entire memory bank including all memories, entities, documents, and the bank profile itself. This is a destructive operation that cannot be undone. + */ +export const deleteBank = ( + options: Options, +) => + (options.client ?? client).delete< + DeleteBankResponses, + DeleteBankErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}", ...options }); /** * Create or update memory bank * * Create a new agent or update existing agent with disposition and background. Auto-fills missing fields with defaults. */ -export const createOrUpdateBank = (options: Options) => (options.client ?? client).put({ - url: '/v1/default/banks/{bank_id}', +export const createOrUpdateBank = ( + options: Options, +) => + (options.client ?? client).put< + CreateOrUpdateBankResponses, + CreateOrUpdateBankErrors, + ThrowOnError + >({ + url: "/v1/default/banks/{bank_id}", ...options, headers: { - 'Content-Type': 'application/json', - ...options.headers - } -}); + "Content-Type": "application/json", + ...options.headers, + }, + }); /** * Clear memory bank memories * * Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved. */ -export const clearBankMemories = (options: Options) => (options.client ?? client).delete({ url: '/v1/default/banks/{bank_id}/memories', ...options }); +export const clearBankMemories = ( + options: Options, +) => + (options.client ?? client).delete< + ClearBankMemoriesResponses, + ClearBankMemoriesErrors, + ThrowOnError + >({ url: "/v1/default/banks/{bank_id}/memories", ...options }); /** * Retain memories * * Retain memory items with automatic fact extraction. * - * This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing - * via the async parameter. + * This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the `async` parameter. * - * Features: + * **Features:** * - Efficient batch processing * - Automatic fact extraction from natural language * - Entity recognition and linking - * - Document tracking with automatic upsert (when document_id is provided on items) + * - Document tracking with automatic upsert (when document_id is provided) * - Temporal and semantic linking * - Optional asynchronous processing * - * The system automatically: + * **The system automatically:** * 1. Extracts semantic facts from the content * 2. Generates embeddings * 3. Deduplicates similar facts * 4. Creates temporal, semantic, and entity links * 5. Tracks document metadata * - * When async=true: - * - Returns immediately after queuing the task - * - Processing happens in the background - * - Use the operations endpoint to monitor progress + * **When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor progress. * - * When async=false (default): - * - Waits for processing to complete - * - Returns after all memories are stored + * **When `async=false` (default):** Waits for processing to complete. * - * Note: If a memory item has a document_id that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). Items with the same document_id are grouped together for efficient processing. + * **Note:** If a memory item has a `document_id` that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). */ -export const retainMemories = (options: Options) => (options.client ?? client).post({ - url: '/v1/default/banks/{bank_id}/memories', +export const retainMemories = ( + options: Options, +) => + (options.client ?? client).post< + RetainMemoriesResponses, + RetainMemoriesErrors, + ThrowOnError + >({ + url: "/v1/default/banks/{bank_id}/memories", ...options, headers: { - 'Content-Type': 'application/json', - ...options.headers - } -}); + "Content-Type": "application/json", + ...options.headers, + }, + }); diff --git a/hindsight-clients/typescript/generated/types.gen.ts b/hindsight-clients/typescript/generated/types.gen.ts index 9464e7c0..e4629425 100644 --- a/hindsight-clients/typescript/generated/types.gen.ts +++ b/hindsight-clients/typescript/generated/types.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts export type ClientOptions = { - baseUrl: `${string}://${string}` | (string & {}); + baseUrl: `${string}://${string}` | (string & {}); }; /** @@ -10,18 +10,18 @@ export type ClientOptions = { * Request model for adding/merging background information. */ export type AddBackgroundRequest = { - /** - * Content - * - * New background information to add or merge - */ - content: string; - /** - * Update Disposition - * - * If true, infer disposition traits from the merged background (default: true) - */ - update_disposition?: boolean; + /** + * Content + * + * New background information to add or merge + */ + content: string; + /** + * Update Disposition + * + * If true, infer disposition traits from the merged background (default: true) + */ + update_disposition?: boolean; }; /** @@ -30,11 +30,11 @@ export type AddBackgroundRequest = { * Response model for background update. */ export type BackgroundResponse = { - /** - * Background - */ - background: string; - disposition?: DispositionTraits | null; + /** + * Background + */ + background: string; + disposition?: DispositionTraits | null; }; /** @@ -43,27 +43,27 @@ export type BackgroundResponse = { * Bank list item with profile summary. */ export type BankListItem = { - /** - * Bank Id - */ - bank_id: string; - /** - * Name - */ - name: string; - disposition: DispositionTraits; - /** - * Background - */ - background: string; - /** - * Created At - */ - created_at?: string | null; - /** - * Updated At - */ - updated_at?: string | null; + /** + * Bank Id + */ + bank_id: string; + /** + * Name + */ + name?: string | null; + disposition: DispositionTraits; + /** + * Background + */ + background?: string | null; + /** + * Created At + */ + created_at?: string | null; + /** + * Updated At + */ + updated_at?: string | null; }; /** @@ -72,10 +72,10 @@ export type BankListItem = { * Response model for listing all banks. */ export type BankListResponse = { - /** - * Banks - */ - banks: Array; + /** + * Banks + */ + banks: Array; }; /** @@ -84,19 +84,77 @@ export type BankListResponse = { * Response model for bank profile. */ export type BankProfileResponse = { - /** - * Bank Id - */ - bank_id: string; - /** - * Name - */ - name: string; - disposition: DispositionTraits; - /** - * Background - */ - background: string; + /** + * Bank Id + */ + bank_id: string; + /** + * Name + */ + name: string; + disposition: DispositionTraits; + /** + * Background + */ + background: string; +}; + +/** + * BankStatsResponse + * + * Response model for bank statistics endpoint. + */ +export type BankStatsResponse = { + /** + * Bank Id + */ + bank_id: string; + /** + * Total Nodes + */ + total_nodes: number; + /** + * Total Links + */ + total_links: number; + /** + * Total Documents + */ + total_documents: number; + /** + * Nodes By Fact Type + */ + nodes_by_fact_type: { + [key: string]: number; + }; + /** + * Links By Link Type + */ + links_by_link_type: { + [key: string]: number; + }; + /** + * Links By Fact Type + */ + links_by_fact_type: { + [key: string]: number; + }; + /** + * Links Breakdown + */ + links_breakdown: { + [key: string]: { + [key: string]: number; + }; + }; + /** + * Pending Operations + */ + pending_operations: number; + /** + * Failed Operations + */ + failed_operations: number; }; /** @@ -104,7 +162,27 @@ export type BankProfileResponse = { * * Budget levels for recall/reflect operations. */ -export type Budget = 'low' | 'mid' | 'high'; +export type Budget = "low" | "mid" | "high"; + +/** + * CancelOperationResponse + * + * Response model for cancel operation endpoint. + */ +export type CancelOperationResponse = { + /** + * Success + */ + success: boolean; + /** + * Message + */ + message: string; + /** + * Operation Id + */ + operation_id: string; +}; /** * ChunkData @@ -112,24 +190,24 @@ export type Budget = 'low' | 'mid' | 'high'; * Chunk data for a single chunk. */ export type ChunkData = { - /** - * Id - */ - id: string; - /** - * Text - */ - text: string; - /** - * Chunk Index - */ - chunk_index: number; - /** - * Truncated - * - * Whether the chunk text was truncated due to token limits - */ - truncated?: boolean; + /** + * Id + */ + id: string; + /** + * Text + */ + text: string; + /** + * Chunk Index + */ + chunk_index: number; + /** + * Truncated + * + * Whether the chunk text was truncated due to token limits + */ + truncated?: boolean; }; /** @@ -138,12 +216,12 @@ export type ChunkData = { * Options for including chunks in recall results. */ export type ChunkIncludeOptions = { - /** - * Max Tokens - * - * Maximum tokens for chunks (chunks may be truncated) - */ - max_tokens?: number; + /** + * Max Tokens + * + * Maximum tokens for chunks (chunks may be truncated) + */ + max_tokens?: number; }; /** @@ -152,30 +230,30 @@ export type ChunkIncludeOptions = { * Response model for get chunk endpoint. */ export type ChunkResponse = { - /** - * Chunk Id - */ - chunk_id: string; - /** - * Document Id - */ - document_id: string; - /** - * Bank Id - */ - bank_id: string; - /** - * Chunk Index - */ - chunk_index: number; - /** - * Chunk Text - */ - chunk_text: string; - /** - * Created At - */ - created_at: string; + /** + * Chunk Id + */ + chunk_id: string; + /** + * Document Id + */ + document_id: string; + /** + * Bank Id + */ + bank_id: string; + /** + * Chunk Index + */ + chunk_index: number; + /** + * Chunk Text + */ + chunk_text: string; + /** + * Created At + */ + created_at: string; }; /** @@ -184,15 +262,39 @@ export type ChunkResponse = { * Request model for creating/updating a bank. */ export type CreateBankRequest = { - /** - * Name - */ - name?: string | null; - disposition?: DispositionTraits | null; - /** - * Background - */ - background?: string | null; + /** + * Name + */ + name?: string | null; + disposition?: DispositionTraits | null; + /** + * Background + */ + background?: string | null; +}; + +/** + * DeleteDocumentResponse + * + * Response model for delete document endpoint. + */ +export type DeleteDocumentResponse = { + /** + * Success + */ + success: boolean; + /** + * Message + */ + message: string; + /** + * Document Id + */ + document_id: string; + /** + * Memory Units Deleted + */ + memory_units_deleted: number; }; /** @@ -201,10 +303,18 @@ export type CreateBankRequest = { * Response model for delete operations. */ export type DeleteResponse = { - /** - * Success - */ - success: boolean; + /** + * Success + */ + success: boolean; + /** + * Message + */ + message?: string | null; + /** + * Deleted Count + */ + deleted_count?: number | null; }; /** @@ -213,24 +323,24 @@ export type DeleteResponse = { * Disposition traits that influence how memories are formed and interpreted. */ export type DispositionTraits = { - /** - * Skepticism - * - * How skeptical vs trusting (1=trusting, 5=skeptical) - */ - skepticism: number; - /** - * Literalism - * - * How literally to interpret information (1=flexible, 5=literal) - */ - literalism: number; - /** - * Empathy - * - * How much to consider emotional context (1=detached, 5=empathetic) - */ - empathy: number; + /** + * Skepticism + * + * How skeptical vs trusting (1=trusting, 5=skeptical) + */ + skepticism: number; + /** + * Literalism + * + * How literally to interpret information (1=flexible, 5=literal) + */ + literalism: number; + /** + * Empathy + * + * How much to consider emotional context (1=detached, 5=empathetic) + */ + empathy: number; }; /** @@ -239,34 +349,34 @@ export type DispositionTraits = { * Response model for get document endpoint. */ export type DocumentResponse = { - /** - * Id - */ - id: string; - /** - * Bank Id - */ - bank_id: string; - /** - * Original Text - */ - original_text: string; - /** - * Content Hash - */ - content_hash: string | null; - /** - * Created At - */ - created_at: string; - /** - * Updated At - */ - updated_at: string; - /** - * Memory Unit Count - */ - memory_unit_count: number; + /** + * Id + */ + id: string; + /** + * Bank Id + */ + bank_id: string; + /** + * Original Text + */ + original_text: string; + /** + * Content Hash + */ + content_hash: string | null; + /** + * Created At + */ + created_at: string; + /** + * Updated At + */ + updated_at: string; + /** + * Memory Unit Count + */ + memory_unit_count: number; }; /** @@ -275,36 +385,36 @@ export type DocumentResponse = { * Response model for entity detail endpoint. */ export type EntityDetailResponse = { - /** - * Id - */ - id: string; - /** - * Canonical Name - */ - canonical_name: string; - /** - * Mention Count - */ - mention_count: number; - /** - * First Seen - */ - first_seen?: string | null; - /** - * Last Seen - */ - last_seen?: string | null; - /** - * Metadata - */ - metadata?: { - [key: string]: unknown; - } | null; - /** - * Observations - */ - observations: Array; + /** + * Id + */ + id: string; + /** + * Canonical Name + */ + canonical_name: string; + /** + * Mention Count + */ + mention_count: number; + /** + * First Seen + */ + first_seen?: string | null; + /** + * Last Seen + */ + last_seen?: string | null; + /** + * Metadata + */ + metadata?: { + [key: string]: unknown; + } | null; + /** + * Observations + */ + observations: Array; }; /** @@ -313,12 +423,12 @@ export type EntityDetailResponse = { * Options for including entity observations in recall results. */ export type EntityIncludeOptions = { - /** - * Max Tokens - * - * Maximum tokens for entity observations - */ - max_tokens?: number; + /** + * Max Tokens + * + * Maximum tokens for entity observations + */ + max_tokens?: number; }; /** @@ -327,32 +437,32 @@ export type EntityIncludeOptions = { * Entity list item with summary. */ export type EntityListItem = { - /** - * Id - */ - id: string; - /** - * Canonical Name - */ - canonical_name: string; - /** - * Mention Count - */ - mention_count: number; - /** - * First Seen - */ - first_seen?: string | null; - /** - * Last Seen - */ - last_seen?: string | null; - /** - * Metadata - */ - metadata?: { - [key: string]: unknown; - } | null; + /** + * Id + */ + id: string; + /** + * Canonical Name + */ + canonical_name: string; + /** + * Mention Count + */ + mention_count: number; + /** + * First Seen + */ + first_seen?: string | null; + /** + * Last Seen + */ + last_seen?: string | null; + /** + * Metadata + */ + metadata?: { + [key: string]: unknown; + } | null; }; /** @@ -361,10 +471,10 @@ export type EntityListItem = { * Response model for entity list endpoint. */ export type EntityListResponse = { - /** - * Items - */ - items: Array; + /** + * Items + */ + items: Array; }; /** @@ -373,14 +483,14 @@ export type EntityListResponse = { * An observation about an entity. */ export type EntityObservationResponse = { - /** - * Text - */ - text: string; - /** - * Mentioned At - */ - mentioned_at?: string | null; + /** + * Text + */ + text: string; + /** + * Mentioned At + */ + mentioned_at?: string | null; }; /** @@ -389,18 +499,18 @@ export type EntityObservationResponse = { * Current mental model of an entity. */ export type EntityStateResponse = { - /** - * Entity Id - */ - entity_id: string; - /** - * Canonical Name - */ - canonical_name: string; - /** - * Observations - */ - observations: Array; + /** + * Entity Id + */ + entity_id: string; + /** + * Canonical Name + */ + canonical_name: string; + /** + * Observations + */ + observations: Array; }; /** @@ -409,7 +519,7 @@ export type EntityStateResponse = { * Options for including facts (based_on) in reflect results. */ export type FactsIncludeOptions = { - [key: string]: unknown; + [key: string]: unknown; }; /** @@ -418,38 +528,38 @@ export type FactsIncludeOptions = { * Response model for graph data endpoint. */ export type GraphDataResponse = { - /** - * Nodes - */ - nodes: Array<{ - [key: string]: unknown; - }>; - /** - * Edges - */ - edges: Array<{ - [key: string]: unknown; - }>; - /** - * Table Rows - */ - table_rows: Array<{ - [key: string]: unknown; - }>; - /** - * Total Units - */ - total_units: number; + /** + * Nodes + */ + nodes: Array<{ + [key: string]: unknown; + }>; + /** + * Edges + */ + edges: Array<{ + [key: string]: unknown; + }>; + /** + * Table Rows + */ + table_rows: Array<{ + [key: string]: unknown; + }>; + /** + * Total Units + */ + total_units: number; }; /** * HTTPValidationError */ export type HttpValidationError = { - /** - * Detail - */ - detail?: Array; + /** + * Detail + */ + detail?: Array; }; /** @@ -458,14 +568,14 @@ export type HttpValidationError = { * Options for including additional data in recall results. */ export type IncludeOptions = { - /** - * Include entity observations. Set to null to disable entity inclusion. - */ - entities?: EntityIncludeOptions | null; - /** - * Include raw chunks. Set to {} to enable, null to disable (default: disabled). - */ - chunks?: ChunkIncludeOptions | null; + /** + * Include entity observations. Set to null to disable entity inclusion. + */ + entities?: EntityIncludeOptions | null; + /** + * Include raw chunks. Set to {} to enable, null to disable (default: disabled). + */ + chunks?: ChunkIncludeOptions | null; }; /** @@ -474,24 +584,24 @@ export type IncludeOptions = { * Response model for list documents endpoint. */ export type ListDocumentsResponse = { - /** - * Items - */ - items: Array<{ - [key: string]: unknown; - }>; - /** - * Total - */ - total: number; - /** - * Limit - */ - limit: number; - /** - * Offset - */ - offset: number; + /** + * Items + */ + items: Array<{ + [key: string]: unknown; + }>; + /** + * Total + */ + total: number; + /** + * Limit + */ + limit: number; + /** + * Offset + */ + offset: number; }; /** @@ -500,24 +610,24 @@ export type ListDocumentsResponse = { * Response model for list memory units endpoint. */ export type ListMemoryUnitsResponse = { - /** - * Items - */ - items: Array<{ - [key: string]: unknown; - }>; - /** - * Total - */ - total: number; - /** - * Limit - */ - limit: number; - /** - * Offset - */ - offset: number; + /** + * Items + */ + items: Array<{ + [key: string]: unknown; + }>; + /** + * Total + */ + total: number; + /** + * Limit + */ + limit: number; + /** + * Offset + */ + offset: number; }; /** @@ -526,30 +636,82 @@ export type ListMemoryUnitsResponse = { * Single memory item for retain. */ export type MemoryItem = { - /** - * Content - */ - content: string; - /** - * Timestamp - */ - timestamp?: string | null; - /** - * Context - */ - context?: string | null; - /** - * Metadata - */ - metadata?: { - [key: string]: string; - } | null; - /** - * Document Id - * - * Optional document ID for this memory item. - */ - document_id?: string | null; + /** + * Content + */ + content: string; + /** + * Timestamp + */ + timestamp?: string | null; + /** + * Context + */ + context?: string | null; + /** + * Metadata + */ + metadata?: { + [key: string]: string; + } | null; + /** + * Document Id + * + * Optional document ID for this memory item. + */ + document_id?: string | null; +}; + +/** + * OperationResponse + * + * Response model for a single async operation. + */ +export type OperationResponse = { + /** + * Id + */ + id: string; + /** + * Task Type + */ + task_type: string; + /** + * Items Count + */ + items_count: number; + /** + * Document Id + */ + document_id: string | null; + /** + * Created At + */ + created_at: string; + /** + * Status + */ + status: string; + /** + * Error Message + */ + error_message: string | null; +}; + +/** + * OperationsListResponse + * + * Response model for list operations endpoint. + */ +export type OperationsListResponse = { + /** + * Bank Id + */ + bank_id: string; + /** + * Operations + */ + operations: Array; }; /** @@ -558,35 +720,35 @@ export type MemoryItem = { * Request model for recall endpoint. */ export type RecallRequest = { - /** - * Query - */ - query: string; - /** - * Types - * - * List of fact types to recall (defaults to all if not specified) - */ - types?: Array | null; - budget?: Budget; - /** - * Max Tokens - */ - max_tokens?: number; - /** - * Trace - */ - trace?: boolean; - /** - * Query Timestamp - * - * ISO format date string (e.g., '2023-05-30T23:40:00') - */ - query_timestamp?: string | null; - /** - * Options for including additional data (entities are included by default) - */ - include?: IncludeOptions; + /** + * Query + */ + query: string; + /** + * Types + * + * List of fact types to recall (defaults to all if not specified) + */ + types?: Array | null; + budget?: Budget; + /** + * Max Tokens + */ + max_tokens?: number; + /** + * Trace + */ + trace?: boolean; + /** + * Query Timestamp + * + * ISO format date string (e.g., '2023-05-30T23:40:00') + */ + query_timestamp?: string | null; + /** + * Options for including additional data (entities are included by default) + */ + include?: IncludeOptions; }; /** @@ -595,32 +757,32 @@ export type RecallRequest = { * Response model for recall endpoints. */ export type RecallResponse = { - /** - * Results - */ - results: Array; - /** - * Trace - */ - trace?: { - [key: string]: unknown; - } | null; - /** - * Entities - * - * Entity states for entities mentioned in results - */ - entities?: { - [key: string]: EntityStateResponse; - } | null; - /** - * Chunks - * - * Chunks for facts, keyed by chunk_id - */ - chunks?: { - [key: string]: ChunkData; - } | null; + /** + * Results + */ + results: Array; + /** + * Trace + */ + trace?: { + [key: string]: unknown; + } | null; + /** + * Entities + * + * Entity states for entities mentioned in results + */ + entities?: { + [key: string]: EntityStateResponse; + } | null; + /** + * Chunks + * + * Chunks for facts, keyed by chunk_id + */ + chunks?: { + [key: string]: ChunkData; + } | null; }; /** @@ -629,52 +791,52 @@ export type RecallResponse = { * Single recall result item. */ export type RecallResult = { - /** - * Id - */ - id: string; - /** - * Text - */ - text: string; - /** - * Type - */ - type?: string | null; - /** - * Entities - */ - entities?: Array | null; - /** - * Context - */ - context?: string | null; - /** - * Occurred Start - */ - occurred_start?: string | null; - /** - * Occurred End - */ - occurred_end?: string | null; - /** - * Mentioned At - */ - mentioned_at?: string | null; - /** - * Document Id - */ - document_id?: string | null; - /** - * Metadata - */ - metadata?: { - [key: string]: string; - } | null; - /** - * Chunk Id - */ - chunk_id?: string | null; + /** + * Id + */ + id: string; + /** + * Text + */ + text: string; + /** + * Type + */ + type?: string | null; + /** + * Entities + */ + entities?: Array | null; + /** + * Context + */ + context?: string | null; + /** + * Occurred Start + */ + occurred_start?: string | null; + /** + * Occurred End + */ + occurred_end?: string | null; + /** + * Mentioned At + */ + mentioned_at?: string | null; + /** + * Document Id + */ + document_id?: string | null; + /** + * Metadata + */ + metadata?: { + [key: string]: string; + } | null; + /** + * Chunk Id + */ + chunk_id?: string | null; }; /** @@ -683,30 +845,30 @@ export type RecallResult = { * A fact used in think response. */ export type ReflectFact = { - /** - * Id - */ - id?: string | null; - /** - * Text - */ - text: string; - /** - * Type - */ - type?: string | null; - /** - * Context - */ - context?: string | null; - /** - * Occurred Start - */ - occurred_start?: string | null; - /** - * Occurred End - */ - occurred_end?: string | null; + /** + * Id + */ + id?: string | null; + /** + * Text + */ + text: string; + /** + * Type + */ + type?: string | null; + /** + * Context + */ + context?: string | null; + /** + * Occurred Start + */ + occurred_start?: string | null; + /** + * Occurred End + */ + occurred_end?: string | null; }; /** @@ -715,10 +877,10 @@ export type ReflectFact = { * Options for including additional data in reflect results. */ export type ReflectIncludeOptions = { - /** - * Include facts that the answer is based on. Set to {} to enable, null to disable (default: disabled). - */ - facts?: FactsIncludeOptions | null; + /** + * Include facts that the answer is based on. Set to {} to enable, null to disable (default: disabled). + */ + facts?: FactsIncludeOptions | null; }; /** @@ -727,19 +889,19 @@ export type ReflectIncludeOptions = { * Request model for reflect endpoint. */ export type ReflectRequest = { - /** - * Query - */ - query: string; - budget?: Budget; - /** - * Context - */ - context?: string | null; - /** - * Options for including additional data (disabled by default) - */ - include?: ReflectIncludeOptions; + /** + * Query + */ + query: string; + budget?: Budget; + /** + * Context + */ + context?: string | null; + /** + * Options for including additional data (disabled by default) + */ + include?: ReflectIncludeOptions; }; /** @@ -748,14 +910,14 @@ export type ReflectRequest = { * Response model for think endpoint. */ export type ReflectResponse = { - /** - * Text - */ - text: string; - /** - * Based On - */ - based_on?: Array; + /** + * Text + */ + text: string; + /** + * Based On + */ + based_on?: Array; }; /** @@ -764,16 +926,16 @@ export type ReflectResponse = { * Request model for retain endpoint. */ export type RetainRequest = { - /** - * Items - */ - items: Array; - /** - * Async - * - * If true, process asynchronously in background. If false, wait for completion (default: false) - */ - async?: boolean; + /** + * Items + */ + items: Array; + /** + * Async + * + * If true, process asynchronously in background. If false, wait for completion (default: false) + */ + async?: boolean; }; /** @@ -782,24 +944,24 @@ export type RetainRequest = { * Response model for retain endpoint. */ export type RetainResponse = { - /** - * Success - */ - success: boolean; - /** - * Bank Id - */ - bank_id: string; - /** - * Items Count - */ - items_count: number; - /** - * Async - * - * Whether the operation was processed asynchronously - */ - async: boolean; + /** + * Success + */ + success: boolean; + /** + * Bank Id + */ + bank_id: string; + /** + * Items Count + */ + items_count: number; + /** + * Async + * + * Whether the operation was processed asynchronously + */ + async: boolean; }; /** @@ -808,728 +970,928 @@ export type RetainResponse = { * Request model for updating disposition traits. */ export type UpdateDispositionRequest = { - disposition: DispositionTraits; + disposition: DispositionTraits; }; /** * ValidationError */ export type ValidationError = { - /** - * Location - */ - loc: Array; - /** - * Message - */ - msg: string; - /** - * Error Type - */ - type: string; + /** + * Location + */ + loc: Array; + /** + * Message + */ + msg: string; + /** + * Error Type + */ + type: string; }; export type HealthEndpointHealthGetData = { - body?: never; - path?: never; - query?: never; - url: '/health'; + body?: never; + path?: never; + query?: never; + url: "/health"; }; export type HealthEndpointHealthGetResponses = { - /** - * Successful Response - */ - 200: unknown; + /** + * Successful Response + */ + 200: unknown; }; export type MetricsEndpointMetricsGetData = { - body?: never; - path?: never; - query?: never; - url: '/metrics'; + body?: never; + path?: never; + query?: never; + url: "/metrics"; }; export type MetricsEndpointMetricsGetResponses = { - /** - * Successful Response - */ - 200: unknown; + /** + * Successful Response + */ + 200: unknown; }; export type GetGraphData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: { - /** - * Type - */ - type?: string | null; - }; - url: '/v1/default/banks/{bank_id}/graph'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: { + /** + * Type + */ + type?: string | null; + }; + url: "/v1/default/banks/{bank_id}/graph"; }; export type GetGraphErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; export type GetGraphError = GetGraphErrors[keyof GetGraphErrors]; export type GetGraphResponses = { - /** - * Successful Response - */ - 200: GraphDataResponse; + /** + * Successful Response + */ + 200: GraphDataResponse; }; export type GetGraphResponse = GetGraphResponses[keyof GetGraphResponses]; export type ListMemoriesData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: { - /** - * Type - */ - type?: string | null; - /** - * Q - */ - q?: string | null; - /** - * Limit - */ - limit?: number; - /** - * Offset - */ - offset?: number; - }; - url: '/v1/default/banks/{bank_id}/memories/list'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: { + /** + * Type + */ + type?: string | null; + /** + * Q + */ + q?: string | null; + /** + * Limit + */ + limit?: number; + /** + * Offset + */ + offset?: number; + }; + url: "/v1/default/banks/{bank_id}/memories/list"; }; export type ListMemoriesErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; export type ListMemoriesError = ListMemoriesErrors[keyof ListMemoriesErrors]; export type ListMemoriesResponses = { - /** - * Successful Response - */ - 200: ListMemoryUnitsResponse; + /** + * Successful Response + */ + 200: ListMemoryUnitsResponse; }; -export type ListMemoriesResponse = ListMemoriesResponses[keyof ListMemoriesResponses]; +export type ListMemoriesResponse = + ListMemoriesResponses[keyof ListMemoriesResponses]; export type RecallMemoriesData = { - body: RecallRequest; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/memories/recall'; + body: RecallRequest; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/memories/recall"; }; export type RecallMemoriesErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; -export type RecallMemoriesError = RecallMemoriesErrors[keyof RecallMemoriesErrors]; +export type RecallMemoriesError = + RecallMemoriesErrors[keyof RecallMemoriesErrors]; export type RecallMemoriesResponses = { - /** - * Successful Response - */ - 200: RecallResponse; + /** + * Successful Response + */ + 200: RecallResponse; }; -export type RecallMemoriesResponse = RecallMemoriesResponses[keyof RecallMemoriesResponses]; +export type RecallMemoriesResponse = + RecallMemoriesResponses[keyof RecallMemoriesResponses]; export type ReflectData = { - body: ReflectRequest; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/reflect'; + body: ReflectRequest; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/reflect"; }; export type ReflectErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; export type ReflectError = ReflectErrors[keyof ReflectErrors]; export type ReflectResponses = { - /** - * Successful Response - */ - 200: ReflectResponse; + /** + * Successful Response + */ + 200: ReflectResponse; }; export type ReflectResponse2 = ReflectResponses[keyof ReflectResponses]; export type ListBanksData = { - body?: never; - path?: never; - query?: never; - url: '/v1/default/banks'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path?: never; + query?: never; + url: "/v1/default/banks"; +}; + +export type ListBanksErrors = { + /** + * Validation Error + */ + 422: HttpValidationError; }; +export type ListBanksError = ListBanksErrors[keyof ListBanksErrors]; + export type ListBanksResponses = { - /** - * Successful Response - */ - 200: BankListResponse; + /** + * Successful Response + */ + 200: BankListResponse; }; export type ListBanksResponse = ListBanksResponses[keyof ListBanksResponses]; export type GetAgentStatsData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/stats'; + body?: never; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/stats"; }; export type GetAgentStatsErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; export type GetAgentStatsError = GetAgentStatsErrors[keyof GetAgentStatsErrors]; export type GetAgentStatsResponses = { - /** - * Successful Response - */ - 200: unknown; + /** + * Successful Response + */ + 200: BankStatsResponse; }; +export type GetAgentStatsResponse = + GetAgentStatsResponses[keyof GetAgentStatsResponses]; + export type ListEntitiesData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: { - /** - * Limit - * - * Maximum number of entities to return - */ - limit?: number; - }; - url: '/v1/default/banks/{bank_id}/entities'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: { + /** + * Limit + * + * Maximum number of entities to return + */ + limit?: number; + }; + url: "/v1/default/banks/{bank_id}/entities"; }; export type ListEntitiesErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; export type ListEntitiesError = ListEntitiesErrors[keyof ListEntitiesErrors]; export type ListEntitiesResponses = { - /** - * Successful Response - */ - 200: EntityListResponse; + /** + * Successful Response + */ + 200: EntityListResponse; }; -export type ListEntitiesResponse = ListEntitiesResponses[keyof ListEntitiesResponses]; +export type ListEntitiesResponse = + ListEntitiesResponses[keyof ListEntitiesResponses]; export type GetEntityData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - /** - * Entity Id - */ - entity_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/entities/{entity_id}'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + /** + * Entity Id + */ + entity_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/entities/{entity_id}"; }; export type GetEntityErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; export type GetEntityError = GetEntityErrors[keyof GetEntityErrors]; export type GetEntityResponses = { - /** - * Successful Response - */ - 200: EntityDetailResponse; + /** + * Successful Response + */ + 200: EntityDetailResponse; }; export type GetEntityResponse = GetEntityResponses[keyof GetEntityResponses]; export type RegenerateEntityObservationsData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - /** - * Entity Id - */ - entity_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/entities/{entity_id}/regenerate'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + /** + * Entity Id + */ + entity_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/entities/{entity_id}/regenerate"; }; export type RegenerateEntityObservationsErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; -export type RegenerateEntityObservationsError = RegenerateEntityObservationsErrors[keyof RegenerateEntityObservationsErrors]; +export type RegenerateEntityObservationsError = + RegenerateEntityObservationsErrors[keyof RegenerateEntityObservationsErrors]; export type RegenerateEntityObservationsResponses = { - /** - * Successful Response - */ - 200: EntityDetailResponse; + /** + * Successful Response + */ + 200: EntityDetailResponse; }; -export type RegenerateEntityObservationsResponse = RegenerateEntityObservationsResponses[keyof RegenerateEntityObservationsResponses]; +export type RegenerateEntityObservationsResponse = + RegenerateEntityObservationsResponses[keyof RegenerateEntityObservationsResponses]; export type ListDocumentsData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: { - /** - * Q - */ - q?: string | null; - /** - * Limit - */ - limit?: number; - /** - * Offset - */ - offset?: number; - }; - url: '/v1/default/banks/{bank_id}/documents'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: { + /** + * Q + */ + q?: string | null; + /** + * Limit + */ + limit?: number; + /** + * Offset + */ + offset?: number; + }; + url: "/v1/default/banks/{bank_id}/documents"; }; export type ListDocumentsErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; export type ListDocumentsError = ListDocumentsErrors[keyof ListDocumentsErrors]; export type ListDocumentsResponses = { - /** - * Successful Response - */ - 200: ListDocumentsResponse; + /** + * Successful Response + */ + 200: ListDocumentsResponse; }; -export type ListDocumentsResponse2 = ListDocumentsResponses[keyof ListDocumentsResponses]; +export type ListDocumentsResponse2 = + ListDocumentsResponses[keyof ListDocumentsResponses]; export type DeleteDocumentData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - /** - * Document Id - */ - document_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/documents/{document_id}'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + /** + * Document Id + */ + document_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/documents/{document_id}"; }; export type DeleteDocumentErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; -export type DeleteDocumentError = DeleteDocumentErrors[keyof DeleteDocumentErrors]; +export type DeleteDocumentError = + DeleteDocumentErrors[keyof DeleteDocumentErrors]; export type DeleteDocumentResponses = { - /** - * Successful Response - */ - 200: unknown; + /** + * Successful Response + */ + 200: DeleteDocumentResponse; }; +export type DeleteDocumentResponse2 = + DeleteDocumentResponses[keyof DeleteDocumentResponses]; + export type GetDocumentData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - /** - * Document Id - */ - document_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/documents/{document_id}'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + /** + * Document Id + */ + document_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/documents/{document_id}"; }; export type GetDocumentErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; export type GetDocumentError = GetDocumentErrors[keyof GetDocumentErrors]; export type GetDocumentResponses = { - /** - * Successful Response - */ - 200: DocumentResponse; + /** + * Successful Response + */ + 200: DocumentResponse; }; -export type GetDocumentResponse = GetDocumentResponses[keyof GetDocumentResponses]; +export type GetDocumentResponse = + GetDocumentResponses[keyof GetDocumentResponses]; export type GetChunkData = { - body?: never; - path: { - /** - * Chunk Id - */ - chunk_id: string; - }; - query?: never; - url: '/v1/default/chunks/{chunk_id}'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Chunk Id + */ + chunk_id: string; + }; + query?: never; + url: "/v1/default/chunks/{chunk_id}"; }; export type GetChunkErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; export type GetChunkError = GetChunkErrors[keyof GetChunkErrors]; export type GetChunkResponses = { - /** - * Successful Response - */ - 200: ChunkResponse; + /** + * Successful Response + */ + 200: ChunkResponse; }; export type GetChunkResponse = GetChunkResponses[keyof GetChunkResponses]; export type ListOperationsData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/operations'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/operations"; }; export type ListOperationsErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; -export type ListOperationsError = ListOperationsErrors[keyof ListOperationsErrors]; +export type ListOperationsError = + ListOperationsErrors[keyof ListOperationsErrors]; export type ListOperationsResponses = { - /** - * Successful Response - */ - 200: unknown; + /** + * Successful Response + */ + 200: OperationsListResponse; }; +export type ListOperationsResponse = + ListOperationsResponses[keyof ListOperationsResponses]; + export type CancelOperationData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - /** - * Operation Id - */ - operation_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/operations/{operation_id}'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + /** + * Operation Id + */ + operation_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/operations/{operation_id}"; }; export type CancelOperationErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; -export type CancelOperationError = CancelOperationErrors[keyof CancelOperationErrors]; +export type CancelOperationError = + CancelOperationErrors[keyof CancelOperationErrors]; export type CancelOperationResponses = { - /** - * Successful Response - */ - 200: unknown; + /** + * Successful Response + */ + 200: CancelOperationResponse; }; +export type CancelOperationResponse2 = + CancelOperationResponses[keyof CancelOperationResponses]; + export type GetBankProfileData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/profile'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/profile"; }; export type GetBankProfileErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; -export type GetBankProfileError = GetBankProfileErrors[keyof GetBankProfileErrors]; +export type GetBankProfileError = + GetBankProfileErrors[keyof GetBankProfileErrors]; export type GetBankProfileResponses = { - /** - * Successful Response - */ - 200: BankProfileResponse; + /** + * Successful Response + */ + 200: BankProfileResponse; }; -export type GetBankProfileResponse = GetBankProfileResponses[keyof GetBankProfileResponses]; +export type GetBankProfileResponse = + GetBankProfileResponses[keyof GetBankProfileResponses]; export type UpdateBankDispositionData = { - body: UpdateDispositionRequest; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/profile'; + body: UpdateDispositionRequest; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/profile"; }; export type UpdateBankDispositionErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; -export type UpdateBankDispositionError = UpdateBankDispositionErrors[keyof UpdateBankDispositionErrors]; +export type UpdateBankDispositionError = + UpdateBankDispositionErrors[keyof UpdateBankDispositionErrors]; export type UpdateBankDispositionResponses = { - /** - * Successful Response - */ - 200: BankProfileResponse; + /** + * Successful Response + */ + 200: BankProfileResponse; }; -export type UpdateBankDispositionResponse = UpdateBankDispositionResponses[keyof UpdateBankDispositionResponses]; +export type UpdateBankDispositionResponse = + UpdateBankDispositionResponses[keyof UpdateBankDispositionResponses]; export type AddBankBackgroundData = { - body: AddBackgroundRequest; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/background'; + body: AddBackgroundRequest; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/background"; }; export type AddBankBackgroundErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; -export type AddBankBackgroundError = AddBankBackgroundErrors[keyof AddBankBackgroundErrors]; +export type AddBankBackgroundError = + AddBankBackgroundErrors[keyof AddBankBackgroundErrors]; export type AddBankBackgroundResponses = { + /** + * Successful Response + */ + 200: BackgroundResponse; +}; + +export type AddBankBackgroundResponse = + AddBankBackgroundResponses[keyof AddBankBackgroundResponses]; + +export type DeleteBankData = { + body?: never; + headers?: { /** - * Successful Response + * Authorization */ - 200: BackgroundResponse; + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}"; }; -export type AddBankBackgroundResponse = AddBankBackgroundResponses[keyof AddBankBackgroundResponses]; +export type DeleteBankErrors = { + /** + * Validation Error + */ + 422: HttpValidationError; +}; -export type CreateOrUpdateBankData = { - body: CreateBankRequest; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}'; +export type DeleteBankError = DeleteBankErrors[keyof DeleteBankErrors]; + +export type DeleteBankResponses = { + /** + * Successful Response + */ + 200: DeleteResponse; }; -export type CreateOrUpdateBankErrors = { +export type DeleteBankResponse = DeleteBankResponses[keyof DeleteBankResponses]; + +export type CreateOrUpdateBankData = { + body: CreateBankRequest; + headers?: { /** - * Validation Error + * Authorization */ - 422: HttpValidationError; + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}"; }; -export type CreateOrUpdateBankError = CreateOrUpdateBankErrors[keyof CreateOrUpdateBankErrors]; +export type CreateOrUpdateBankErrors = { + /** + * Validation Error + */ + 422: HttpValidationError; +}; + +export type CreateOrUpdateBankError = + CreateOrUpdateBankErrors[keyof CreateOrUpdateBankErrors]; export type CreateOrUpdateBankResponses = { - /** - * Successful Response - */ - 200: BankProfileResponse; + /** + * Successful Response + */ + 200: BankProfileResponse; }; -export type CreateOrUpdateBankResponse = CreateOrUpdateBankResponses[keyof CreateOrUpdateBankResponses]; +export type CreateOrUpdateBankResponse = + CreateOrUpdateBankResponses[keyof CreateOrUpdateBankResponses]; export type ClearBankMemoriesData = { - body?: never; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: { - /** - * Type - * - * Optional fact type filter (world, experience, opinion) - */ - type?: string | null; - }; - url: '/v1/default/banks/{bank_id}/memories'; + body?: never; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: { + /** + * Type + * + * Optional fact type filter (world, experience, opinion) + */ + type?: string | null; + }; + url: "/v1/default/banks/{bank_id}/memories"; }; export type ClearBankMemoriesErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; -export type ClearBankMemoriesError = ClearBankMemoriesErrors[keyof ClearBankMemoriesErrors]; +export type ClearBankMemoriesError = + ClearBankMemoriesErrors[keyof ClearBankMemoriesErrors]; export type ClearBankMemoriesResponses = { - /** - * Successful Response - */ - 200: DeleteResponse; + /** + * Successful Response + */ + 200: DeleteResponse; }; -export type ClearBankMemoriesResponse = ClearBankMemoriesResponses[keyof ClearBankMemoriesResponses]; +export type ClearBankMemoriesResponse = + ClearBankMemoriesResponses[keyof ClearBankMemoriesResponses]; export type RetainMemoriesData = { - body: RetainRequest; - path: { - /** - * Bank Id - */ - bank_id: string; - }; - query?: never; - url: '/v1/default/banks/{bank_id}/memories'; + body: RetainRequest; + headers?: { + /** + * Authorization + */ + authorization?: string | null; + }; + path: { + /** + * Bank Id + */ + bank_id: string; + }; + query?: never; + url: "/v1/default/banks/{bank_id}/memories"; }; export type RetainMemoriesErrors = { - /** - * Validation Error - */ - 422: HttpValidationError; + /** + * Validation Error + */ + 422: HttpValidationError; }; -export type RetainMemoriesError = RetainMemoriesErrors[keyof RetainMemoriesErrors]; +export type RetainMemoriesError = + RetainMemoriesErrors[keyof RetainMemoriesErrors]; export type RetainMemoriesResponses = { - /** - * Successful Response - */ - 200: RetainResponse; + /** + * Successful Response + */ + 200: RetainResponse; }; -export type RetainMemoriesResponse = RetainMemoriesResponses[keyof RetainMemoriesResponses]; +export type RetainMemoriesResponse = + RetainMemoriesResponses[keyof RetainMemoriesResponses]; diff --git a/hindsight-clients/typescript/src/index.ts b/hindsight-clients/typescript/src/index.ts index 4c4cf061..4078a473 100644 --- a/hindsight-clients/typescript/src/index.ts +++ b/hindsight-clients/typescript/src/index.ts @@ -78,9 +78,9 @@ export class HindsightClient { async retain( bankId: string, content: string, - options?: { timestamp?: Date | string; context?: string; metadata?: Record; async?: boolean } + options?: { timestamp?: Date | string; context?: string; metadata?: Record; documentId?: string; async?: boolean } ): Promise { - const item: { content: string; timestamp?: string; context?: string; metadata?: Record } = { content }; + const item: { content: string; timestamp?: string; context?: string; metadata?: Record; document_id?: string } = { content }; if (options?.timestamp) { item.timestamp = options.timestamp instanceof Date @@ -93,6 +93,9 @@ export class HindsightClient { if (options?.metadata) { item.metadata = options.metadata; } + if (options?.documentId) { + item.document_id = options.documentId; + } const response = await sdk.retainMemories({ client: this.client, diff --git a/hindsight-clients/typescript/tests/main_operations.test.ts b/hindsight-clients/typescript/tests/main_operations.test.ts index 35a23b89..cc65ce6c 100644 --- a/hindsight-clients/typescript/tests/main_operations.test.ts +++ b/hindsight-clients/typescript/tests/main_operations.test.ts @@ -216,3 +216,199 @@ describe('TestEndToEndWorkflow', () => { expect(reflectResponse.text!.length).toBeGreaterThan(0); }); }); + +describe('TestBankProfile', () => { + test('get bank profile', async () => { + const bankId = randomBankId(); + + // Create bank with background + await client.createBank(bankId, { + name: 'Test Agent', + background: 'I am a helpful assistant for testing.', + }); + + // Get bank profile + const profile = await client.getBankProfile(bankId); + + expect(profile).not.toBeNull(); + expect(profile.bank_id).toBe(bankId); + expect(profile.name).toBe('Test Agent'); + expect(profile.background).toBe('I am a helpful assistant for testing.'); + }); +}); + +describe('TestBankStats', () => { + let bankId: string; + + beforeAll(async () => { + bankId = randomBankId(); + // Setup: Store some test memories + await client.retainBatch(bankId, [ + { content: 'Alice likes Python programming' }, + { content: 'Bob enjoys hiking in the mountains' }, + ]); + }); + + test('get bank stats', async () => { + const { sdk, createClient, createConfig } = await import('../src'); + const apiClient = createClient(createConfig({ baseUrl: HINDSIGHT_API_URL })); + + const { data: stats } = await sdk.getAgentStats({ + client: apiClient, + path: { bank_id: bankId }, + }); + + expect(stats).not.toBeNull(); + expect(stats!.bank_id).toBe(bankId); + expect(stats!.total_nodes).toBeGreaterThanOrEqual(0); + expect(stats!.total_links).toBeGreaterThanOrEqual(0); + expect(stats!.total_documents).toBeGreaterThanOrEqual(0); + expect(typeof stats!.nodes_by_fact_type).toBe('object'); + expect(typeof stats!.links_by_link_type).toBe('object'); + }); +}); + +describe('TestOperations', () => { + test('list operations', async () => { + const bankId = randomBankId(); + const { sdk, createClient, createConfig } = await import('../src'); + + // First create an async operation + await client.retain(bankId, 'Test content for async operation', { + async: true, + }); + + const apiClient = createClient(createConfig({ baseUrl: HINDSIGHT_API_URL })); + const { data: response } = await sdk.listOperations({ + client: apiClient, + path: { bank_id: bankId }, + }); + + expect(response).not.toBeNull(); + expect(response!.bank_id).toBe(bankId); + expect(Array.isArray(response!.operations)).toBe(true); + }); +}); + +describe('TestDocuments', () => { + test('delete document', async () => { + const bankId = randomBankId(); + const docId = `test-doc-${Math.random().toString(36).slice(2, 10)}`; + const { sdk, createClient, createConfig } = await import('../src'); + + // First create a document + const retainResponse = await client.retain(bankId, 'Test document content for deletion', { + documentId: docId, + }); + expect(retainResponse.success).toBe(true); + + const apiClient = createClient(createConfig({ baseUrl: HINDSIGHT_API_URL })); + const { data: response } = await sdk.deleteDocument({ + client: apiClient, + path: { bank_id: bankId, document_id: docId }, + }); + + expect(response).not.toBeNull(); + expect(response!.success).toBe(true); + expect(response!.document_id).toBe(docId); + expect(response!.memory_units_deleted).toBeGreaterThanOrEqual(0); + }); + + test('get document', async () => { + const bankId = randomBankId(); + const docId = `test-doc-${Math.random().toString(36).slice(2, 10)}`; + const { sdk, createClient, createConfig } = await import('../src'); + + // First create a document + await client.retain(bankId, 'Test document content for retrieval', { + documentId: docId, + }); + + const apiClient = createClient(createConfig({ baseUrl: HINDSIGHT_API_URL })); + const { data: document } = await sdk.getDocument({ + client: apiClient, + path: { bank_id: bankId, document_id: docId }, + }); + + expect(document).not.toBeNull(); + expect(document!.id).toBe(docId); + expect(document!.original_text).toContain('Test document content'); + }); +}); + +describe('TestEntities', () => { + let bankId: string; + + beforeAll(async () => { + bankId = randomBankId(); + // Create memories that will generate entities + await client.retainBatch(bankId, [ + { content: 'Alice works at Google as a software engineer' }, + { content: 'Bob is friends with Alice and works at Microsoft' }, + ]); + }); + + test('list entities', async () => { + const { sdk, createClient, createConfig } = await import('../src'); + const apiClient = createClient(createConfig({ baseUrl: HINDSIGHT_API_URL })); + + const { data: response } = await sdk.listEntities({ + client: apiClient, + path: { bank_id: bankId }, + }); + + expect(response).not.toBeNull(); + expect(response!.items).toBeDefined(); + expect(Array.isArray(response!.items)).toBe(true); + }); + + test('get entity', async () => { + const { sdk, createClient, createConfig } = await import('../src'); + const apiClient = createClient(createConfig({ baseUrl: HINDSIGHT_API_URL })); + + // First list entities to get an ID + const { data: listResponse } = await sdk.listEntities({ + client: apiClient, + path: { bank_id: bankId }, + }); + + if (listResponse?.items && listResponse.items.length > 0) { + const entityId = listResponse.items[0].id; + + const { data: entity } = await sdk.getEntity({ + client: apiClient, + path: { bank_id: bankId, entity_id: entityId }, + }); + + expect(entity).not.toBeNull(); + expect(entity!.id).toBe(entityId); + } + }); +}); + +describe('TestDeleteBank', () => { + test('delete bank', async () => { + const bankId = randomBankId(); + const { sdk, createClient, createConfig } = await import('../src'); + + // First create a bank with some data + await client.createBank(bankId, { + name: 'Bank to delete', + background: 'This bank will be deleted', + }); + await client.retain(bankId, 'Some memory to store'); + + const apiClient = createClient(createConfig({ baseUrl: HINDSIGHT_API_URL })); + const { data: response } = await sdk.deleteBank({ + client: apiClient, + path: { bank_id: bankId }, + }); + + expect(response).not.toBeNull(); + expect(response!.success).toBe(true); + + // Verify bank data is deleted - memories should be gone + const memories = await client.listMemories(bankId); + expect(memories.total).toBe(0); + }); +}); diff --git a/hindsight-docs/docs/changelog/index.md b/hindsight-docs/docs/changelog/index.md index b4a72bf7..95ebdc2c 100644 --- a/hindsight-docs/docs/changelog/index.md +++ b/hindsight-docs/docs/changelog/index.md @@ -8,6 +8,39 @@ This changelog highlights user-facing changes only. Internal maintenance, CI/CD, For full release details, see [GitHub Releases](https://github.com/vectorize-io/hindsight/releases). +## [0.1.14](https://github.com/vectorize-io/hindsight/releases/tag/v0.1.14) + +**Bug Fixes** + +- Fixes the embedded “get-skill” installer so installing skills works correctly. ([`0b352d1`](https://github.com/vectorize-io/hindsight/commit/0b352d1)) + +## [0.1.13](https://github.com/vectorize-io/hindsight/releases/tag/v0.1.13) + +**Improvements** + +- Improve reliability by surfacing task handler failures so retries can occur when processing fails. ([`904ea4d`](https://github.com/vectorize-io/hindsight/commit/904ea4d)) +- Revamp the hindsight-embed component architecture, including a new daemon/client model and CLI updates for embedding workflows. ([`e6511e7`](https://github.com/vectorize-io/hindsight/commit/e6511e7)) + +**Bug Fixes** + +- Fix memory retention so timestamps are correctly taken into account. ([`234d426`](https://github.com/vectorize-io/hindsight/commit/234d426)) + +## [0.1.12](https://github.com/vectorize-io/hindsight/releases/tag/v0.1.12) + +**Features** + +- Added an extensions system for plugging in new operations/skills (including built-in tenant support). ([`2a0c490`](https://github.com/vectorize-io/hindsight/commit/2a0c490)) +- Introduced the hindsight-embed tool and a native agentic skill for embedding/agent workflows. ([`da44a5e`](https://github.com/vectorize-io/hindsight/commit/da44a5e)) + +**Improvements** + +- Improved reliability when parsing LLM JSON by retrying on parse errors and adding clearer diagnostics. ([`a831a7b`](https://github.com/vectorize-io/hindsight/commit/a831a7b)) + +**Bug Fixes** + +- Fixed structured-output support for Ollama-based LLM providers. ([`32bca12`](https://github.com/vectorize-io/hindsight/commit/32bca12)) +- Adjusted LLM validation to cap max completion tokens at 100 to prevent validation failures. ([`b94b5cf`](https://github.com/vectorize-io/hindsight/commit/b94b5cf)) + ## [0.1.11](https://github.com/vectorize-io/hindsight/releases/tag/v0.1.11) **Bug Fixes** diff --git a/hindsight-docs/docs/developer/api/documents.mdx b/hindsight-docs/docs/developer/api/documents.mdx index bf5bc90c..d25cbabb 100644 --- a/hindsight-docs/docs/developer/api/documents.mdx +++ b/hindsight-docs/docs/developer/api/documents.mdx @@ -107,6 +107,30 @@ hindsight document get my-bank meeting-2024-03-15 +## Delete Document + +Remove a document and all its associated memories: + + + + + + + + + + +```bash +hindsight document delete my-bank meeting-2024-03-15 +``` + + + + +:::warning +Deleting a document permanently removes all memories extracted from it. This action cannot be undone. +::: + ## Document Response Format ```json diff --git a/hindsight-docs/examples/api/documents.mjs b/hindsight-docs/examples/api/documents.mjs index be6ba1be..3042f1b3 100644 --- a/hindsight-docs/examples/api/documents.mjs +++ b/hindsight-docs/examples/api/documents.mjs @@ -60,6 +60,17 @@ console.log(`Created: ${doc.created_at}`); // [/docs:document-get] +// [docs:document-delete] +// Delete document and all its memories +const { data: deleteResult } = await sdk.deleteDocument({ + client: apiClient, + path: { bank_id: 'my-bank', document_id: 'meeting-2024-03-15' } +}); + +console.log(`Deleted ${deleteResult.memory_units_deleted} memories`); +// [/docs:document-delete] + + // ============================================================================= // Cleanup (not shown in docs) // ============================================================================= diff --git a/hindsight-docs/examples/api/documents.py b/hindsight-docs/examples/api/documents.py index 58c2e668..1b008649 100644 --- a/hindsight-docs/examples/api/documents.py +++ b/hindsight-docs/examples/api/documents.py @@ -60,12 +60,12 @@ # [docs:document-get] import asyncio from hindsight_client_api import ApiClient, Configuration -from hindsight_client_api.api import DefaultApi +from hindsight_client_api.api import DocumentsApi async def get_document_example(): config = Configuration(host="http://localhost:8888") api_client = ApiClient(config) - api = DefaultApi(api_client) + api = DocumentsApi(api_client) # Get document to expand context from recall results doc = await api.get_document( @@ -82,6 +82,27 @@ async def get_document_example(): # [/docs:document-get] +# [docs:document-delete] +from hindsight_client_api import ApiClient, Configuration +from hindsight_client_api.api import DocumentsApi + +async def delete_document_example(): + config = Configuration(host="http://localhost:8888") + api_client = ApiClient(config) + api = DocumentsApi(api_client) + + # Delete document and all its memories + result = await api.delete_document( + bank_id="my-bank", + document_id="meeting-2024-03-15" + ) + + print(f"Deleted {result.memory_units_deleted} memories") + +asyncio.run(delete_document_example()) +# [/docs:document-delete] + + # ============================================================================= # Cleanup (not shown in docs) # ============================================================================= diff --git a/hindsight-docs/openapi.json b/hindsight-docs/openapi.json index fe0f2ec3..2eec09fd 100644 --- a/hindsight-docs/openapi.json +++ b/hindsight-docs/openapi.json @@ -86,6 +86,22 @@ ], "title": "Type" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -181,6 +197,22 @@ "default": 0, "title": "Offset" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -224,6 +256,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -277,6 +325,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -321,6 +385,24 @@ "summary": "List all memory banks", "description": "Get a list of all agents with their profiles", "operationId": "list_banks", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } + } + ], "responses": { "200": { "description": "Successful Response", @@ -331,6 +413,16 @@ } } } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } } } } @@ -359,7 +451,9 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/BankStatsResponse" + } } } }, @@ -405,6 +499,22 @@ "title": "Limit" }, "description": "Maximum number of entities to return" + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -457,6 +567,22 @@ "type": "string", "title": "Entity Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -509,6 +635,22 @@ "type": "string", "title": "Entity Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -588,6 +730,22 @@ "default": 0, "title": "Offset" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -640,6 +798,22 @@ "type": "string", "title": "Document Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -690,6 +864,22 @@ "type": "string", "title": "Document Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -697,7 +887,9 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/DeleteDocumentResponse" + } } } }, @@ -731,6 +923,22 @@ "type": "string", "title": "Chunk Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -774,6 +982,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -781,7 +1005,9 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/OperationsListResponse" + } } } }, @@ -824,6 +1050,22 @@ "type": "string", "title": "Operation Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -831,7 +1073,9 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/CancelOperationResponse" + } } } }, @@ -865,6 +1109,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -906,6 +1166,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -959,6 +1235,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -1012,6 +1304,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -1063,6 +1371,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -1106,6 +1430,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -1175,6 +1515,22 @@ "title": "Type" }, "description": "Optional fact type filter (world, experience, opinion)" + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -1394,6 +1750,110 @@ "name": "Alice" } }, + "BankStatsResponse": { + "properties": { + "bank_id": { + "type": "string", + "title": "Bank Id" + }, + "total_nodes": { + "type": "integer", + "title": "Total Nodes" + }, + "total_links": { + "type": "integer", + "title": "Total Links" + }, + "total_documents": { + "type": "integer", + "title": "Total Documents" + }, + "nodes_by_fact_type": { + "additionalProperties": { + "type": "integer" + }, + "type": "object", + "title": "Nodes By Fact Type" + }, + "links_by_link_type": { + "additionalProperties": { + "type": "integer" + }, + "type": "object", + "title": "Links By Link Type" + }, + "links_by_fact_type": { + "additionalProperties": { + "type": "integer" + }, + "type": "object", + "title": "Links By Fact Type" + }, + "links_breakdown": { + "additionalProperties": { + "additionalProperties": { + "type": "integer" + }, + "type": "object" + }, + "type": "object", + "title": "Links Breakdown" + }, + "pending_operations": { + "type": "integer", + "title": "Pending Operations" + }, + "failed_operations": { + "type": "integer", + "title": "Failed Operations" + } + }, + "type": "object", + "required": [ + "bank_id", + "total_nodes", + "total_links", + "total_documents", + "nodes_by_fact_type", + "links_by_link_type", + "links_by_fact_type", + "links_breakdown", + "pending_operations", + "failed_operations" + ], + "title": "BankStatsResponse", + "description": "Response model for bank statistics endpoint.", + "example": { + "bank_id": "user123", + "failed_operations": 0, + "links_breakdown": { + "fact": { + "entity": 40, + "semantic": 60, + "temporal": 100 + } + }, + "links_by_fact_type": { + "fact": 200, + "observation": 40, + "preference": 60 + }, + "links_by_link_type": { + "entity": 50, + "semantic": 100, + "temporal": 150 + }, + "nodes_by_fact_type": { + "fact": 100, + "observation": 20, + "preference": 30 + }, + "pending_operations": 2, + "total_documents": 10, + "total_links": 300, + "total_nodes": 150 + } + }, "Budget": { "type": "string", "enum": [ @@ -1404,6 +1864,35 @@ "title": "Budget", "description": "Budget levels for recall/reflect operations." }, + "CancelOperationResponse": { + "properties": { + "success": { + "type": "boolean", + "title": "Success" + }, + "message": { + "type": "string", + "title": "Message" + }, + "operation_id": { + "type": "string", + "title": "Operation Id" + } + }, + "type": "object", + "required": [ + "success", + "message", + "operation_id" + ], + "title": "CancelOperationResponse", + "description": "Response model for cancel operation endpoint.", + "example": { + "message": "Operation 550e8400-e29b-41d4-a716-446655440000 cancelled", + "operation_id": "550e8400-e29b-41d4-a716-446655440000", + "success": true + } + }, "ChunkData": { "properties": { "id": { @@ -1542,6 +2031,41 @@ "name": "Alice" } }, + "DeleteDocumentResponse": { + "properties": { + "success": { + "type": "boolean", + "title": "Success" + }, + "message": { + "type": "string", + "title": "Message" + }, + "document_id": { + "type": "string", + "title": "Document Id" + }, + "memory_units_deleted": { + "type": "integer", + "title": "Memory Units Deleted" + } + }, + "type": "object", + "required": [ + "success", + "message", + "document_id", + "memory_units_deleted" + ], + "title": "DeleteDocumentResponse", + "description": "Response model for delete document endpoint.", + "example": { + "document_id": "session_1", + "memory_units_deleted": 5, + "message": "Document 'session_1' and 5 associated memory units deleted successfully", + "success": true + } + }, "DeleteResponse": { "properties": { "success": { @@ -2212,6 +2736,106 @@ "timestamp": "2024-01-15T10:30:00Z" } }, + "OperationResponse": { + "properties": { + "id": { + "type": "string", + "title": "Id" + }, + "task_type": { + "type": "string", + "title": "Task Type" + }, + "items_count": { + "type": "integer", + "title": "Items Count" + }, + "document_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Document Id" + }, + "created_at": { + "type": "string", + "title": "Created At" + }, + "status": { + "type": "string", + "title": "Status" + }, + "error_message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Error Message" + } + }, + "type": "object", + "required": [ + "id", + "task_type", + "items_count", + "document_id", + "created_at", + "status", + "error_message" + ], + "title": "OperationResponse", + "description": "Response model for a single async operation.", + "example": { + "created_at": "2024-01-15T10:30:00Z", + "document_id": "meeting-notes-2024", + "id": "550e8400-e29b-41d4-a716-446655440000", + "items_count": 5, + "status": "pending", + "task_type": "retain" + } + }, + "OperationsListResponse": { + "properties": { + "bank_id": { + "type": "string", + "title": "Bank Id" + }, + "operations": { + "items": { + "$ref": "#/components/schemas/OperationResponse" + }, + "type": "array", + "title": "Operations" + } + }, + "type": "object", + "required": [ + "bank_id", + "operations" + ], + "title": "OperationsListResponse", + "description": "Response model for list operations endpoint.", + "example": { + "bank_id": "user123", + "operations": [ + { + "created_at": "2024-01-15T10:30:00Z", + "id": "550e8400-e29b-41d4-a716-446655440000", + "items_count": 5, + "status": "pending", + "task_type": "retain" + } + ] + } + }, "RecallRequest": { "properties": { "query": { diff --git a/hindsight-docs/static/get-skill b/hindsight-docs/static/get-skill index 51d03a45..b3171387 100755 --- a/hindsight-docs/static/get-skill +++ b/hindsight-docs/static/get-skill @@ -197,9 +197,9 @@ if [ -z "$APP" ]; then if [ -t 0 ] || [ -e /dev/tty ]; then echo -e "${DIM}Select your AI coding assistant:${NC}" echo "" - echo " ${BOLD}1)${NC} Claude Code" - echo " ${BOLD}2)${NC} OpenCode" - echo " ${BOLD}3)${NC} Codex CLI" + echo -e " ${BOLD}1)${NC} Claude Code" + echo -e " ${BOLD}2)${NC} OpenCode" + echo -e " ${BOLD}3)${NC} Codex CLI" echo "" # Use /dev/tty for input if stdin is piped if [ -t 0 ]; then @@ -244,11 +244,12 @@ print_success "Python/uvx available" print_step "Configuring LLM provider" # Install/run hindsight-embed configure +# Redirect stdin from /dev/tty to avoid "not a terminal" warnings if command -v uvx &> /dev/null; then - uvx hindsight-embed configure + uvx hindsight-embed configure ", file=sys.stderr) + print(" HINDSIGHT_EMBED_LLM_API_KEY=", file=sys.stderr) print(f" HINDSIGHT_EMBED_LLM_PROVIDER={provider} # optional, default: openai", file=sys.stderr) print(f" HINDSIGHT_EMBED_LLM_MODEL= # optional, default: {default_model}", file=sys.stderr) return 1 @@ -150,7 +152,7 @@ def _do_configure_from_env(): with open(CONFIG_FILE, "w") as f: f.write("# Hindsight Embed Configuration\n") - f.write(f"# Generated by hindsight-embed configure (non-interactive)\n\n") + f.write("# Generated by hindsight-embed configure (non-interactive)\n\n") f.write(f"HINDSIGHT_EMBED_LLM_PROVIDER={provider}\n") f.write(f"HINDSIGHT_EMBED_LLM_MODEL={model}\n") f.write(f"HINDSIGHT_EMBED_BANK_ID={bank_id}\n") @@ -196,12 +198,46 @@ def _prompt_text(prompt: str, default: str = "") -> str | None: def _prompt_password(prompt: str) -> str | None: - """Simple password prompt.""" - import getpass + """Simple password prompt that works with /dev/tty.""" + import termios + import tty + + # Read password with echo disabled (works because sys.stdin is already /dev/tty) + fd = sys.stdin.fileno() + print(f"\033[1m{prompt}\033[0m: ", end="", flush=True) try: - return getpass.getpass(f"\033[1m{prompt}\033[0m: ") + old_settings = termios.tcgetattr(fd) + try: + tty.setraw(fd, termios.TCSADRAIN) + # Read character by character until newline + password = [] + while True: + ch = sys.stdin.read(1) + if ch in ("\n", "\r"): + break + elif ch == "\x7f": # Backspace + if password: + password.pop() + # Erase character on screen + sys.stdout.write("\b \b") + sys.stdout.flush() + elif ch == "\x03": # Ctrl+C + raise KeyboardInterrupt + elif ch >= " ": # Printable character + password.append(ch) + print() # Newline after password + return "".join(password) + finally: + termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) except (EOFError, KeyboardInterrupt): + print() return None + except Exception: + # Fallback to simple input if termios fails + try: + return input("") + except (EOFError, KeyboardInterrupt): + return None def _prompt_confirm(prompt: str, default: bool = True) -> bool | None: @@ -211,7 +247,7 @@ def _prompt_confirm(prompt: str, default: bool = True) -> bool | None: response = input(f"\033[1m{prompt}\033[0m {suffix}: ").strip().lower() if not response: return default - return response in ('y', 'yes') + return response in ("y", "yes") except (EOFError, KeyboardInterrupt): return None @@ -281,7 +317,7 @@ def _do_configure_interactive(): with open(CONFIG_FILE, "w") as f: f.write("# Hindsight Embed Configuration\n") - f.write(f"# Generated by hindsight-embed configure\n\n") + f.write("# Generated by hindsight-embed configure\n\n") f.write(f"HINDSIGHT_EMBED_LLM_PROVIDER={provider}\n") f.write(f"HINDSIGHT_EMBED_LLM_MODEL={model}\n") f.write(f"HINDSIGHT_EMBED_BANK_ID={bank_id}\n") @@ -327,6 +363,7 @@ def _do_configure_interactive(): def do_daemon(args, config: dict, logger): """Handle daemon subcommands.""" from pathlib import Path + from . import daemon_client daemon_log_path = Path.home() / ".hindsight" / "daemon.log" @@ -386,6 +423,7 @@ def do_daemon(args, config: dict, logger): if args.follow: # Follow mode - like tail -f import subprocess + try: subprocess.run(["tail", "-f", str(daemon_log_path)]) except KeyboardInterrupt: @@ -396,7 +434,7 @@ def do_daemon(args, config: dict, logger): try: with open(daemon_log_path) as f: lines = f.readlines() - for line in lines[-args.lines:]: + for line in lines[-args.lines :]: print(line, end="") return 0 except Exception as e: diff --git a/hindsight-embed/hindsight_embed/daemon_client.py b/hindsight-embed/hindsight_embed/daemon_client.py index b7ea08d8..1437122f 100644 --- a/hindsight-embed/hindsight_embed/daemon_client.py +++ b/hindsight-embed/hindsight_embed/daemon_client.py @@ -6,6 +6,7 @@ import logging import os +import shlex import subprocess import time from pathlib import Path @@ -72,10 +73,7 @@ def _start_daemon(config: dict) -> bool: # Use pg0 database specific to bank bank_id = config.get("bank_id", "default") env["HINDSIGHT_API_DATABASE_URL"] = f"pg0://hindsight-embed-{bank_id}" - - # Optimization flags for faster startup - env["HINDSIGHT_API_SKIP_LLM_VERIFICATION"] = "true" - env["HINDSIGHT_API_LOG_LEVEL"] = "warning" + env["HINDSIGHT_API_LOG_LEVEL"] = "info" cmd = _find_hindsight_api_command() + ["--daemon", "--idle-timeout", str(DAEMON_IDLE_TIMEOUT)] @@ -83,21 +81,20 @@ def _start_daemon(config: dict) -> bool: log_dir = Path.home() / ".hindsight" log_dir.mkdir(parents=True, exist_ok=True) daemon_log = log_dir / "daemon.log" - daemon_stderr = log_dir / "daemon.stderr" print(f"Starting daemon with command: {' '.join(cmd)}", file=sys.stderr) print(f" Log file: {daemon_log}", file=sys.stderr) try: - # Start daemon in background, but capture initial stderr for debugging - with open(daemon_stderr, "w") as stderr_file: - process = subprocess.Popen( - cmd, - env=env, - stdout=subprocess.DEVNULL, - stderr=stderr_file, - start_new_session=True, - ) + # Start daemon with shell redirection (works across forks) + # The >> appends to log file, 2>&1 redirects stderr to stdout + shell_cmd = f"{' '.join(cmd)} >> {shlex.quote(str(daemon_log))} 2>&1" + subprocess.Popen( + shell_cmd, + shell=True, + env=env, + start_new_session=True, + ) # Wait for daemon to be ready # Note: With --daemon flag, the parent process forks and exits immediately (code 0). @@ -107,8 +104,17 @@ def _start_daemon(config: dict) -> bool: last_check_time = start_time while time.time() - start_time < DAEMON_STARTUP_TIMEOUT: if _is_daemon_running(): - logger.info("Daemon started successfully") - return True + # Health check passed - but daemon might crash during initialization + # Wait a moment and verify it's still healthy (stability check) + print(" Daemon responding, verifying stability...", file=sys.stderr) + time.sleep(2) + if _is_daemon_running(): + logger.info("Daemon started successfully") + return True + else: + # Daemon crashed after initial health check + print(" Daemon crashed during initialization", file=sys.stderr) + break # Periodically log progress if time.time() - last_check_time > 5: @@ -118,16 +124,14 @@ def _start_daemon(config: dict) -> bool: time.sleep(0.5) - logger.error("Daemon failed to start within timeout") - # Show logs on timeout + logger.error("Daemon failed to start") + # Show logs on failure if daemon_log.exists(): log_content = daemon_log.read_text() if log_content: - print(f"Daemon log:\n{log_content[-2000:]}", file=sys.stderr) # Last 2000 chars - if daemon_stderr.exists(): - stderr_content = daemon_stderr.read_text() - if stderr_content: - print(f"Daemon stderr:\n{stderr_content}", file=sys.stderr) + # Show last 3000 chars of log + print(f"\n Daemon log ({daemon_log}):", file=sys.stderr) + print(f"{log_content[-3000:]}", file=sys.stderr) return False except FileNotFoundError as e: @@ -155,7 +159,7 @@ def ensure_daemon_running(config: dict) -> bool: def stop_daemon() -> bool: - """Stop the running daemon.""" + """Stop the running daemon and wait for it to fully stop.""" # Try to kill by PID from lockfile lockfile = Path.home() / ".hindsight" / "daemon.lock" if lockfile.exists(): @@ -168,10 +172,16 @@ def stop_daemon() -> bool: try: os.kill(pid, 0) except OSError: - return True + break # Process exited except (ValueError, OSError): pass + # Wait for health check to fail (daemon fully stopped) + for _ in range(30): # Wait up to 3 seconds + if not _is_daemon_running(): + return True + time.sleep(0.1) + return not _is_daemon_running() diff --git a/hindsight-embed/pyproject.toml b/hindsight-embed/pyproject.toml index e07b3b35..ee2285e4 100644 --- a/hindsight-embed/pyproject.toml +++ b/hindsight-embed/pyproject.toml @@ -17,3 +17,45 @@ hindsight-embed = "hindsight_embed.cli:main" [tool.hatch.build.targets.wheel] packages = ["hindsight_embed"] + +[dependency-groups] +dev = [ + "ruff>=0.8.0", + "ty>=0.0.1", +] + +[tool.ruff] +line-length = 120 +target-version = "py311" +exclude = [ + "tests/", +] + +[tool.ruff.lint] +select = [ + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # Pyflakes + "I", # isort +] +ignore = [ + "E501", # line too long (handled by formatter) + "E402", # module import not at top of file + "F401", # unused import (too noisy during development) + "F841", # unused variable (too noisy during development) +] + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" + +[tool.ty] +# Type checking configuration + +[tool.ty.environment] +python-version = "3.11" + +[tool.ty.rules] +# Disable noisy rules while keeping important ones +invalid-argument-type = "ignore" +invalid-return-type = "ignore" diff --git a/openapi.json b/openapi.json index fe0f2ec3..2eec09fd 100644 --- a/openapi.json +++ b/openapi.json @@ -86,6 +86,22 @@ ], "title": "Type" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -181,6 +197,22 @@ "default": 0, "title": "Offset" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -224,6 +256,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -277,6 +325,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -321,6 +385,24 @@ "summary": "List all memory banks", "description": "Get a list of all agents with their profiles", "operationId": "list_banks", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } + } + ], "responses": { "200": { "description": "Successful Response", @@ -331,6 +413,16 @@ } } } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + } } } } @@ -359,7 +451,9 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/BankStatsResponse" + } } } }, @@ -405,6 +499,22 @@ "title": "Limit" }, "description": "Maximum number of entities to return" + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -457,6 +567,22 @@ "type": "string", "title": "Entity Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -509,6 +635,22 @@ "type": "string", "title": "Entity Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -588,6 +730,22 @@ "default": 0, "title": "Offset" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -640,6 +798,22 @@ "type": "string", "title": "Document Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -690,6 +864,22 @@ "type": "string", "title": "Document Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -697,7 +887,9 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/DeleteDocumentResponse" + } } } }, @@ -731,6 +923,22 @@ "type": "string", "title": "Chunk Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -774,6 +982,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -781,7 +1005,9 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/OperationsListResponse" + } } } }, @@ -824,6 +1050,22 @@ "type": "string", "title": "Operation Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -831,7 +1073,9 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/CancelOperationResponse" + } } } }, @@ -865,6 +1109,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -906,6 +1166,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -959,6 +1235,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -1012,6 +1304,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -1063,6 +1371,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -1106,6 +1430,22 @@ "type": "string", "title": "Bank Id" } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "requestBody": { @@ -1175,6 +1515,22 @@ "title": "Type" }, "description": "Optional fact type filter (world, experience, opinion)" + }, + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Authorization" + } } ], "responses": { @@ -1394,6 +1750,110 @@ "name": "Alice" } }, + "BankStatsResponse": { + "properties": { + "bank_id": { + "type": "string", + "title": "Bank Id" + }, + "total_nodes": { + "type": "integer", + "title": "Total Nodes" + }, + "total_links": { + "type": "integer", + "title": "Total Links" + }, + "total_documents": { + "type": "integer", + "title": "Total Documents" + }, + "nodes_by_fact_type": { + "additionalProperties": { + "type": "integer" + }, + "type": "object", + "title": "Nodes By Fact Type" + }, + "links_by_link_type": { + "additionalProperties": { + "type": "integer" + }, + "type": "object", + "title": "Links By Link Type" + }, + "links_by_fact_type": { + "additionalProperties": { + "type": "integer" + }, + "type": "object", + "title": "Links By Fact Type" + }, + "links_breakdown": { + "additionalProperties": { + "additionalProperties": { + "type": "integer" + }, + "type": "object" + }, + "type": "object", + "title": "Links Breakdown" + }, + "pending_operations": { + "type": "integer", + "title": "Pending Operations" + }, + "failed_operations": { + "type": "integer", + "title": "Failed Operations" + } + }, + "type": "object", + "required": [ + "bank_id", + "total_nodes", + "total_links", + "total_documents", + "nodes_by_fact_type", + "links_by_link_type", + "links_by_fact_type", + "links_breakdown", + "pending_operations", + "failed_operations" + ], + "title": "BankStatsResponse", + "description": "Response model for bank statistics endpoint.", + "example": { + "bank_id": "user123", + "failed_operations": 0, + "links_breakdown": { + "fact": { + "entity": 40, + "semantic": 60, + "temporal": 100 + } + }, + "links_by_fact_type": { + "fact": 200, + "observation": 40, + "preference": 60 + }, + "links_by_link_type": { + "entity": 50, + "semantic": 100, + "temporal": 150 + }, + "nodes_by_fact_type": { + "fact": 100, + "observation": 20, + "preference": 30 + }, + "pending_operations": 2, + "total_documents": 10, + "total_links": 300, + "total_nodes": 150 + } + }, "Budget": { "type": "string", "enum": [ @@ -1404,6 +1864,35 @@ "title": "Budget", "description": "Budget levels for recall/reflect operations." }, + "CancelOperationResponse": { + "properties": { + "success": { + "type": "boolean", + "title": "Success" + }, + "message": { + "type": "string", + "title": "Message" + }, + "operation_id": { + "type": "string", + "title": "Operation Id" + } + }, + "type": "object", + "required": [ + "success", + "message", + "operation_id" + ], + "title": "CancelOperationResponse", + "description": "Response model for cancel operation endpoint.", + "example": { + "message": "Operation 550e8400-e29b-41d4-a716-446655440000 cancelled", + "operation_id": "550e8400-e29b-41d4-a716-446655440000", + "success": true + } + }, "ChunkData": { "properties": { "id": { @@ -1542,6 +2031,41 @@ "name": "Alice" } }, + "DeleteDocumentResponse": { + "properties": { + "success": { + "type": "boolean", + "title": "Success" + }, + "message": { + "type": "string", + "title": "Message" + }, + "document_id": { + "type": "string", + "title": "Document Id" + }, + "memory_units_deleted": { + "type": "integer", + "title": "Memory Units Deleted" + } + }, + "type": "object", + "required": [ + "success", + "message", + "document_id", + "memory_units_deleted" + ], + "title": "DeleteDocumentResponse", + "description": "Response model for delete document endpoint.", + "example": { + "document_id": "session_1", + "memory_units_deleted": 5, + "message": "Document 'session_1' and 5 associated memory units deleted successfully", + "success": true + } + }, "DeleteResponse": { "properties": { "success": { @@ -2212,6 +2736,106 @@ "timestamp": "2024-01-15T10:30:00Z" } }, + "OperationResponse": { + "properties": { + "id": { + "type": "string", + "title": "Id" + }, + "task_type": { + "type": "string", + "title": "Task Type" + }, + "items_count": { + "type": "integer", + "title": "Items Count" + }, + "document_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Document Id" + }, + "created_at": { + "type": "string", + "title": "Created At" + }, + "status": { + "type": "string", + "title": "Status" + }, + "error_message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Error Message" + } + }, + "type": "object", + "required": [ + "id", + "task_type", + "items_count", + "document_id", + "created_at", + "status", + "error_message" + ], + "title": "OperationResponse", + "description": "Response model for a single async operation.", + "example": { + "created_at": "2024-01-15T10:30:00Z", + "document_id": "meeting-notes-2024", + "id": "550e8400-e29b-41d4-a716-446655440000", + "items_count": 5, + "status": "pending", + "task_type": "retain" + } + }, + "OperationsListResponse": { + "properties": { + "bank_id": { + "type": "string", + "title": "Bank Id" + }, + "operations": { + "items": { + "$ref": "#/components/schemas/OperationResponse" + }, + "type": "array", + "title": "Operations" + } + }, + "type": "object", + "required": [ + "bank_id", + "operations" + ], + "title": "OperationsListResponse", + "description": "Response model for list operations endpoint.", + "example": { + "bank_id": "user123", + "operations": [ + { + "created_at": "2024-01-15T10:30:00Z", + "id": "550e8400-e29b-41d4-a716-446655440000", + "items_count": 5, + "status": "pending", + "task_type": "retain" + } + ] + } + }, "RecallRequest": { "properties": { "query": { diff --git a/scripts/hooks/lint.sh b/scripts/hooks/lint.sh index 11b4566d..c7058043 100755 --- a/scripts/hooks/lint.sh +++ b/scripts/hooks/lint.sh @@ -47,6 +47,11 @@ run_task "ruff-dev-check" "$REPO_ROOT/hindsight-dev" "uv run ruff check --fix ." run_task "ruff-dev-format" "$REPO_ROOT/hindsight-dev" "uv run ruff format ." run_task "ty-dev" "$REPO_ROOT/hindsight-dev" "uv run ty check hindsight_dev benchmarks" +# Python hindsight-embed tasks +run_task "ruff-embed-check" "$REPO_ROOT/hindsight-embed" "uv run ruff check --fix ." +run_task "ruff-embed-format" "$REPO_ROOT/hindsight-embed" "uv run ruff format ." +run_task "ty-embed" "$REPO_ROOT/hindsight-embed" "uv run ty check hindsight_embed" + # Wait for all tasks to complete for pid in "${PIDS[@]}"; do wait "$pid" 2>/dev/null || true diff --git a/scripts/release.sh b/scripts/release.sh index 026a2e51..3e474dcf 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -145,7 +145,7 @@ fi # Commit changes print_info "Committing version changes..." git add -A -git commit -m "Release v$VERSION +git commit --no-verify -m "Release v$VERSION - Update version to $VERSION in all components - Python packages: hindsight-api, hindsight-dev, hindsight-all, hindsight-litellm diff --git a/uv.lock b/uv.lock index 3fc3c065..753319dc 100644 --- a/uv.lock +++ b/uv.lock @@ -1292,7 +1292,7 @@ wheels = [ [[package]] name = "hindsight-all" -version = "0.1.13" +version = "0.1.14" source = { editable = "hindsight" } dependencies = [ { name = "hindsight-api" }, @@ -1316,7 +1316,7 @@ provides-extras = ["test"] [[package]] name = "hindsight-api" -version = "0.1.13" +version = "0.1.14" source = { editable = "hindsight-api" } dependencies = [ { name = "alembic" }, @@ -1422,7 +1422,7 @@ dev = [ [[package]] name = "hindsight-client" -version = "0.1.13" +version = "0.1.14" source = { editable = "hindsight-clients/python" } dependencies = [ { name = "aiohttp" }, @@ -1456,7 +1456,7 @@ provides-extras = ["test"] [[package]] name = "hindsight-dev" -version = "0.1.13" +version = "0.1.14" source = { editable = "hindsight-dev" } dependencies = [ { name = "hindsight-api" }, @@ -1497,9 +1497,21 @@ dependencies = [ { name = "httpx" }, ] +[package.dev-dependencies] +dev = [ + { name = "ruff" }, + { name = "ty" }, +] + [package.metadata] requires-dist = [{ name = "httpx", specifier = ">=0.27.0" }] +[package.metadata.requires-dev] +dev = [ + { name = "ruff", specifier = ">=0.8.0" }, + { name = "ty", specifier = ">=0.0.1" }, +] + [[package]] name = "httpcore" version = "1.0.9"