diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 9ebbe69..7bab976 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -16,13 +16,39 @@ Individual commands: - **Type checker**: `poetry run mypy .` — strict mode with `warn_unused_ignores` - **Tests**: `poetry run pytest tests/ -q` +## Quality gates (must pass to report completion) + +- **ALL tests must pass with ZERO failures. No exceptions.** CI/CD runs the full test suite on every PR. A test failure blocks the build. +- **ALL lint checks (including mypy) must pass with ZERO errors.** Run `make lint` — all files, not just ones you modified. +- **Do not dismiss test or lint failures as pre-existing or unrelated.** The `main` branch CI/CD is green. Any failure on a feature branch was caused by changes on that branch. +- **CRITICAL — NEVER INVESTIGATE ERROR ORIGIN OR BLAME**: When a lint, type-check, or test error appears, **fix it immediately**. Do NOT run `git blame` or use git history to argue that an error is "pre-existing" or not your responsibility. Tools like `git diff`, `git log`, and `git show` may be used to understand and review changes, but never to avoid fixing an error. There is no scenario where knowing the origin of an error changes what you must do: **fix it**. +- **CRITICAL — NEVER PIPE TEST OR LINT OUTPUT**: Do not append `| tail`, `| head`, `| grep`, or any pipe to `pytest`, `make lint`, `make test`, or similar commands. Piping hides errors. Use pytest flags like `--tb=short -q` to reduce verbosity — never pipe. + ## Key Rules - Always run `poetry run black .` after making changes — CI will fail if formatting differs. - When fixing a type issue, remove the corresponding `# type: ignore` comment or mypy will error on the unused suppression. - Do NOT edit files under `seclai/_generated/` — they are auto-generated from the OpenAPI spec. - The OpenAPI spec at `openapi/seclai.openapi.json` is shared identically with `seclai-go`. Changes must be synced to both repos. +- OpenAPI specs are generated from the main `seclai` app repo. Description or endpoint changes made here must also be applied upstream, or they will be overwritten on the next generation. +- `.github/copilot-instructions.md` shares common sections (quality gates, git rules, editing rules, self-correction rules) across all SDK repos. When updating shared rules, apply the same change to all repos: `seclai-python`, `seclai-javascript`, `seclai-go`, `seclai-csharp`, `seclai-cli`, `seclai-mcp`. - Use the existing virtualenv (`poetry run ...`); do not create or reconfigure Python environments. +- **CRITICAL — USE EXISTING VIRTUAL ENV**: The workspace Python virtual environment is already set up. Reuse with `poetry run ...`; do **not** create, activate, or reconfigure another environment unless the user explicitly asks. +- **CRITICAL — NEVER CALL PYTHON ENVIRONMENT TOOLS**: Do not call `configure_python_environment`, `activate_python_environment_tools`, or any similar environment-management tool unless the user explicitly asks. +- Do not run ad-hoc Python snippets; add tests instead. + +## Git rules + +- **NEVER use `git stash`.** Use `git diff`, `git log`, or `git show` instead. +- Do not run `git checkout` to switch branches, `git reset`, or any other destructive git operation without explicit user approval. + +## Editing rules + +- Do not use CLI text tools (sed/awk). Use the editor-based patch tool. + +## Self-correction rules + +- **NEVER promise to "do better" without updating these instruction files.** If a recurring mistake is identified, edit this file with a concrete rule that prevents the mistake. Do that FIRST, then continue work. ## Architecture Notes diff --git a/openapi/seclai.openapi.json b/openapi/seclai.openapi.json index a20fe19..69be258 100644 --- a/openapi/seclai.openapi.json +++ b/openapi/seclai.openapi.json @@ -7,7 +7,6 @@ "name": "X-Account-Id", "required": false, "schema": { - "format": "uuid", "type": "string" } } @@ -107,6 +106,114 @@ "title": "AgentEvaluationTier", "type": "string" }, + "AgentExportResponse": { + "description": "Portable JSON snapshot of an agent definition.", + "properties": { + "agent": { + "additionalProperties": true, + "description": "Agent metadata and full definition. Keys: name, description, schema_version, definition, default_evaluation_tier, evaluation_mode, sampling_config, max_retries, retry_on_failure, prompt_model_auto_upgrade_strategy, prompt_model_auto_rollback_enabled, prompt_model_auto_rollback_triggers, created_at, updated_at.", + "title": "Agent", + "type": "object" + }, + "alert_configs": { + "anyOf": [ + { + "items": { + "additionalProperties": true, + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Alert configurations.", + "title": "Alert Configs" + }, + "dependencies": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "description": "Resolved dependency manifest. Keys: knowledge_bases, memory_banks, source_connections, agents, users \u2014 each a list of {id, name, description, \u2026}.", + "title": "Dependencies" + }, + "evaluation_criteria": { + "anyOf": [ + { + "items": { + "additionalProperties": true, + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Evaluation criteria for agent steps.", + "title": "Evaluation Criteria" + }, + "export_version": { + "description": "Schema version of the export format (currently \"2\").", + "title": "Export Version", + "type": "string" + }, + "exported_at": { + "description": "ISO-8601 timestamp of when the export was generated.", + "title": "Exported At", + "type": "string" + }, + "governance_policies": { + "anyOf": [ + { + "items": { + "additionalProperties": true, + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "description": "Agent-scoped governance policies.", + "title": "Governance Policies" + }, + "software_version": { + "description": "Application version that produced this export.", + "title": "Software Version", + "type": "string" + }, + "trigger": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "description": "Trigger configuration with schedules.", + "title": "Trigger" + } + }, + "required": [ + "export_version", + "exported_at", + "software_version", + "agent" + ], + "title": "AgentExportResponse", + "type": "object" + }, "AgentRunAttemptResponse": { "properties": { "duration": { @@ -354,6 +461,18 @@ "description": "Timestamp when the step attempt ended.", "title": "Ended At" }, + "input": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Input provided to the step, if any.", + "title": "Input" + }, "output": { "anyOf": [ { @@ -404,6 +523,7 @@ "agent_step_id", "step_type", "status", + "input", "output", "output_content_type", "started_at", @@ -8871,6 +8991,64 @@ ] } }, + "/agents/{agent_id}/export": { + "get": { + "description": "Export an agent definition as a portable JSON snapshot.\n\nThe response contains the full definition, trigger configuration with schedules, alert configs, evaluation criteria, agent-scoped governance policies, and a resolved dependency manifest that maps every referenced external entity UUID to its human-readable name.\n\nResponse shape:\n- `export_version`: schema version (currently `\"2\"`)\n- `exported_at`: ISO-8601 timestamp\n- `agent`: name, description, schema_version, definition, timestamps\n- `trigger`: trigger type, input template, schedules\n- `alert_configs`: alert type, thresholds, recipients\n- `evaluation_criteria`: evaluation settings per step\n- `governance_policies`: agent-scoped governance policies\n- `dependencies`: knowledge_bases, memory_banks, source_connections, agents, users\n\nQuery params:\n- `download` (default true): when true, sets `Content-Disposition: attachment` so clients treat the response as a file download.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token.\n- When using OAuth, you may target a different organization account with `X-Account-Id`; for API keys, the key's account is always used.\n- You can only export agents belonging to the resolved account.", + "operationId": "export_agent_api_agents__agent_id__export_get", + "parameters": [ + { + "in": "path", + "name": "agent_id", + "required": true, + "schema": { + "title": "Agent Id", + "type": "string" + } + }, + { + "description": "Return as file download", + "in": "query", + "name": "download", + "required": false, + "schema": { + "default": true, + "description": "Return as file download", + "title": "Download", + "type": "boolean" + } + }, + { + "$ref": "#/components/parameters/X-Account-Id" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AgentExportResponse" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Export agent definition", + "tags": [ + "agents" + ] + } + }, "/agents/{agent_id}/input-uploads/{upload_id}": { "get": { "description": "Poll the processing status of a file upload created via `POST /agents/{agent_id}/upload-input`.\n\nPossible `status` values: `processing`, `ready`, `failed`.\n\nAuth & scoping:\n- Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's account.", @@ -11290,7 +11468,7 @@ }, "/me": { "get": { - "description": "Returns the authenticated user's personal account ID and a list of organisations they belong to. Each organisation entry includes the organisation's own id, display name, and account_id. Useful for CLI tooling that needs to let the user pick an org context.", + "description": "Returns the authenticated user's personal account ID and a list of organizations they belong to. Each organization entry includes the organization's id, name, and account_id. Useful for CLI tooling that needs to let the user pick an organization context.", "operationId": "get_me_api_me_get", "parameters": [ { diff --git a/poetry.lock b/poetry.lock index c392d4f..22352b0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -990,6 +990,18 @@ rich = ">=10.11.0" shellingham = ">=1.3.0" typing-extensions = ">=3.7.4.3" +[[package]] +name = "types-python-dateutil" +version = "2.9.0.20260402" +description = "Typing stubs for python-dateutil" +optional = false +python-versions = ">=3.10" +groups = ["dev"] +files = [ + {file = "types_python_dateutil-2.9.0.20260402-py3-none-any.whl", hash = "sha256:7827e6a9c93587cc18e766944254d1351a2396262e4abe1510cbbd7601c5e01f"}, + {file = "types_python_dateutil-2.9.0.20260402.tar.gz", hash = "sha256:a980142b9966713acb382c467e35c5cc4208a2f91b10b8d785a0ae6765df6c0b"}, +] + [[package]] name = "typing-extensions" version = "4.15.0" @@ -1020,4 +1032,4 @@ typing-extensions = ">=4.12.0" [metadata] lock-version = "2.1" python-versions = ">=3.11,<4.0" -content-hash = "a010defeb9129616dd41f70ff275ec16b0fc60156aaef6b340bda2112ff24d2b" +content-hash = "9109c39e7824730d7072e4af4f88715b042ac3fff80bad5913f93dffe09d61a5" diff --git a/pyproject.toml b/pyproject.toml index 1a622c7..6316e44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,6 +109,7 @@ mypy = ">=1,<2" black = ">=24,<26" openapi-python-client = ">=0.25,<1" pdoc = ">=14,<15" +types-python-dateutil = "^2.9.0.20260402" [tool.pytest.ini_options] addopts = [ diff --git a/seclai/_generated/api/agent_evaluations/__init__.py b/seclai/_generated/api/agent_evaluations/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/agent_evaluations/create_evaluation_criteria_api_agents_agent_id_evaluation_criteria_post.py b/seclai/_generated/api/agent_evaluations/create_evaluation_criteria_api_agents_agent_id_evaluation_criteria_post.py new file mode 100644 index 0000000..70e2e11 --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/create_evaluation_criteria_api_agents_agent_id_evaluation_criteria_post.py @@ -0,0 +1,229 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_evaluation_criteria_request import CreateEvaluationCriteriaRequest +from ...models.evaluation_criteria_response import EvaluationCriteriaResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + body: CreateEvaluationCriteriaRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/agents/{agent_id}/evaluation-criteria".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> EvaluationCriteriaResponse | HTTPValidationError | None: + if response.status_code == 201: + response_201 = EvaluationCriteriaResponse.from_dict(response.json()) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[EvaluationCriteriaResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: CreateEvaluationCriteriaRequest, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationCriteriaResponse | HTTPValidationError]: + """Create Evaluation Criteria + + Create new step evaluation settings for an agent. + + The evaluation mode, retry settings, and sample frequency are inherited + from the agent and stored on the criteria row for historical reference. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (CreateEvaluationCriteriaRequest): Request body for creating an evaluation criteria. + + The evaluation mode, retry settings, and sample frequency are set at the + agent level, not per-criteria. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationCriteriaResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: CreateEvaluationCriteriaRequest, + x_account_id: str | Unset = UNSET, +) -> EvaluationCriteriaResponse | HTTPValidationError | None: + """Create Evaluation Criteria + + Create new step evaluation settings for an agent. + + The evaluation mode, retry settings, and sample frequency are inherited + from the agent and stored on the criteria row for historical reference. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (CreateEvaluationCriteriaRequest): Request body for creating an evaluation criteria. + + The evaluation mode, retry settings, and sample frequency are set at the + agent level, not per-criteria. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationCriteriaResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: CreateEvaluationCriteriaRequest, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationCriteriaResponse | HTTPValidationError]: + """Create Evaluation Criteria + + Create new step evaluation settings for an agent. + + The evaluation mode, retry settings, and sample frequency are inherited + from the agent and stored on the criteria row for historical reference. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (CreateEvaluationCriteriaRequest): Request body for creating an evaluation criteria. + + The evaluation mode, retry settings, and sample frequency are set at the + agent level, not per-criteria. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationCriteriaResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: CreateEvaluationCriteriaRequest, + x_account_id: str | Unset = UNSET, +) -> EvaluationCriteriaResponse | HTTPValidationError | None: + """Create Evaluation Criteria + + Create new step evaluation settings for an agent. + + The evaluation mode, retry settings, and sample frequency are inherited + from the agent and stored on the criteria row for historical reference. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (CreateEvaluationCriteriaRequest): Request body for creating an evaluation criteria. + + The evaluation mode, retry settings, and sample frequency are set at the + agent level, not per-criteria. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationCriteriaResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/create_evaluation_result_api_agents_evaluation_criteria_criteria_id_results_post.py b/seclai/_generated/api/agent_evaluations/create_evaluation_result_api_agents_evaluation_criteria_criteria_id_results_post.py new file mode 100644 index 0000000..b50797e --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/create_evaluation_result_api_agents_evaluation_criteria_criteria_id_results_post.py @@ -0,0 +1,221 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_evaluation_result_request import CreateEvaluationResultRequest +from ...models.evaluation_result_response import EvaluationResultResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + criteria_id: str, + *, + body: CreateEvaluationResultRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/agents/evaluation-criteria/{criteria_id}/results".format( + criteria_id=quote(str(criteria_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> EvaluationResultResponse | HTTPValidationError | None: + if response.status_code == 201: + response_201 = EvaluationResultResponse.from_dict(response.json()) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[EvaluationResultResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + body: CreateEvaluationResultRequest, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationResultResponse | HTTPValidationError]: + """Create Evaluation Result + + Record an evaluation result for a criteria. + + Use this endpoint to push results from external test harnesses, CI/CD + pipelines, or custom evaluation logic. Each result is linked to an + agent run and optionally a specific step run. + + Args: + criteria_id (str): + x_account_id (str | Unset): + body (CreateEvaluationResultRequest): Request body for recording an evaluation result. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationResultResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + body: CreateEvaluationResultRequest, + x_account_id: str | Unset = UNSET, +) -> EvaluationResultResponse | HTTPValidationError | None: + """Create Evaluation Result + + Record an evaluation result for a criteria. + + Use this endpoint to push results from external test harnesses, CI/CD + pipelines, or custom evaluation logic. Each result is linked to an + agent run and optionally a specific step run. + + Args: + criteria_id (str): + x_account_id (str | Unset): + body (CreateEvaluationResultRequest): Request body for recording an evaluation result. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationResultResponse | HTTPValidationError + """ + + return sync_detailed( + criteria_id=criteria_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + body: CreateEvaluationResultRequest, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationResultResponse | HTTPValidationError]: + """Create Evaluation Result + + Record an evaluation result for a criteria. + + Use this endpoint to push results from external test harnesses, CI/CD + pipelines, or custom evaluation logic. Each result is linked to an + agent run and optionally a specific step run. + + Args: + criteria_id (str): + x_account_id (str | Unset): + body (CreateEvaluationResultRequest): Request body for recording an evaluation result. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationResultResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + body: CreateEvaluationResultRequest, + x_account_id: str | Unset = UNSET, +) -> EvaluationResultResponse | HTTPValidationError | None: + """Create Evaluation Result + + Record an evaluation result for a criteria. + + Use this endpoint to push results from external test harnesses, CI/CD + pipelines, or custom evaluation logic. Each result is linked to an + agent run and optionally a specific step run. + + Args: + criteria_id (str): + x_account_id (str | Unset): + body (CreateEvaluationResultRequest): Request body for recording an evaluation result. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationResultResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + criteria_id=criteria_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/delete_evaluation_criteria_api_agents_evaluation_criteria_criteria_id_delete.py b/seclai/_generated/api/agent_evaluations/delete_evaluation_criteria_api_agents_evaluation_criteria_criteria_id_delete.py new file mode 100644 index 0000000..817438c --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/delete_evaluation_criteria_api_agents_evaluation_criteria_criteria_id_delete.py @@ -0,0 +1,197 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + criteria_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/agents/evaluation-criteria/{criteria_id}".format( + criteria_id=quote(str(criteria_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete Evaluation Criteria + + Delete an evaluation criteria and all associated evaluation results. + + This action is permanent and cannot be undone. All historical result + records tied to the criteria are removed as well. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete Evaluation Criteria + + Delete an evaluation criteria and all associated evaluation results. + + This action is permanent and cannot be undone. All historical result + records tied to the criteria are removed as well. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + criteria_id=criteria_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete Evaluation Criteria + + Delete an evaluation criteria and all associated evaluation results. + + This action is permanent and cannot be undone. All historical result + records tied to the criteria are removed as well. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete Evaluation Criteria + + Delete an evaluation criteria and all associated evaluation results. + + This action is permanent and cannot be undone. All historical result + records tied to the criteria are removed as well. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + criteria_id=criteria_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/get_evaluation_criteria_api_agents_evaluation_criteria_criteria_id_get.py b/seclai/_generated/api/agent_evaluations/get_evaluation_criteria_api_agents_evaluation_criteria_criteria_id_get.py new file mode 100644 index 0000000..3c2afa6 --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/get_evaluation_criteria_api_agents_evaluation_criteria_criteria_id_get.py @@ -0,0 +1,199 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.evaluation_criteria_response import EvaluationCriteriaResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + criteria_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/evaluation-criteria/{criteria_id}".format( + criteria_id=quote(str(criteria_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> EvaluationCriteriaResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = EvaluationCriteriaResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[EvaluationCriteriaResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationCriteriaResponse | HTTPValidationError]: + """Get Evaluation Criteria + + Get a single evaluation criteria by ID. + + Returns the full criteria configuration including type-specific fields, + current enabled state, and a summary of recent evaluation results. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationCriteriaResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> EvaluationCriteriaResponse | HTTPValidationError | None: + """Get Evaluation Criteria + + Get a single evaluation criteria by ID. + + Returns the full criteria configuration including type-specific fields, + current enabled state, and a summary of recent evaluation results. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationCriteriaResponse | HTTPValidationError + """ + + return sync_detailed( + criteria_id=criteria_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationCriteriaResponse | HTTPValidationError]: + """Get Evaluation Criteria + + Get a single evaluation criteria by ID. + + Returns the full criteria configuration including type-specific fields, + current enabled state, and a summary of recent evaluation results. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationCriteriaResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> EvaluationCriteriaResponse | HTTPValidationError | None: + """Get Evaluation Criteria + + Get a single evaluation criteria by ID. + + Returns the full criteria configuration including type-specific fields, + current enabled state, and a summary of recent evaluation results. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationCriteriaResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + criteria_id=criteria_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/get_evaluation_summary_api_agents_evaluation_criteria_criteria_id_summary_get.py b/seclai/_generated/api/agent_evaluations/get_evaluation_summary_api_agents_evaluation_criteria_criteria_id_summary_get.py new file mode 100644 index 0000000..3d9bbf9 --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/get_evaluation_summary_api_agents_evaluation_criteria_criteria_id_summary_get.py @@ -0,0 +1,199 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.evaluation_result_summary_response import EvaluationResultSummaryResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + criteria_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/evaluation-criteria/{criteria_id}/summary".format( + criteria_id=quote(str(criteria_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> EvaluationResultSummaryResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = EvaluationResultSummaryResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[EvaluationResultSummaryResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationResultSummaryResponse | HTTPValidationError]: + """Get Evaluation Summary + + Get an aggregated summary of evaluation results for a criteria. + + Returns total, passed, failed, error, and flagged counts alongside the + average score, giving a quick overview of how the criteria is performing. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationResultSummaryResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> EvaluationResultSummaryResponse | HTTPValidationError | None: + """Get Evaluation Summary + + Get an aggregated summary of evaluation results for a criteria. + + Returns total, passed, failed, error, and flagged counts alongside the + average score, giving a quick overview of how the criteria is performing. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationResultSummaryResponse | HTTPValidationError + """ + + return sync_detailed( + criteria_id=criteria_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationResultSummaryResponse | HTTPValidationError]: + """Get Evaluation Summary + + Get an aggregated summary of evaluation results for a criteria. + + Returns total, passed, failed, error, and flagged counts alongside the + average score, giving a quick overview of how the criteria is performing. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationResultSummaryResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> EvaluationResultSummaryResponse | HTTPValidationError | None: + """Get Evaluation Summary + + Get an aggregated summary of evaluation results for a criteria. + + Returns total, passed, failed, error, and flagged counts alongside the + average score, giving a quick overview of how the criteria is performing. + + Args: + criteria_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationResultSummaryResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + criteria_id=criteria_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/get_non_manual_evaluation_summary_api_agents_evaluation_results_non_manual_summary_get.py b/seclai/_generated/api/agent_evaluations/get_non_manual_evaluation_summary_api_agents_evaluation_results_non_manual_summary_get.py new file mode 100644 index 0000000..31f6ef4 --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/get_non_manual_evaluation_summary_api_agents_evaluation_results_non_manual_summary_get.py @@ -0,0 +1,245 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.non_manual_evaluation_summary_response import ( + NonManualEvaluationSummaryResponse, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + days: int | Unset = 30, + start_date: None | str | Unset = UNSET, + end_date: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["days"] = days + + json_start_date: None | str | Unset + if isinstance(start_date, Unset): + json_start_date = UNSET + else: + json_start_date = start_date + params["start_date"] = json_start_date + + json_end_date: None | str | Unset + if isinstance(end_date, Unset): + json_end_date = UNSET + else: + json_end_date = end_date + params["end_date"] = json_end_date + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/evaluation-results/non-manual-summary", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | NonManualEvaluationSummaryResponse | None: + if response.status_code == 200: + response_200 = NonManualEvaluationSummaryResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | NonManualEvaluationSummaryResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + days: int | Unset = 30, + start_date: None | str | Unset = UNSET, + end_date: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | NonManualEvaluationSummaryResponse]: + """Get Non Manual Evaluation Summary + + Get account-level evaluation summary for API key clients. + + Returns aggregated pass/fail/flagged counts and pass rates for each evaluation mode (eval_and_retry, + sample_and_flag). + + Args: + days (int | Unset): Default: 30. + start_date (None | str | Unset): + end_date (None | str | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | NonManualEvaluationSummaryResponse] + """ + + kwargs = _get_kwargs( + days=days, + start_date=start_date, + end_date=end_date, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + days: int | Unset = 30, + start_date: None | str | Unset = UNSET, + end_date: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | NonManualEvaluationSummaryResponse | None: + """Get Non Manual Evaluation Summary + + Get account-level evaluation summary for API key clients. + + Returns aggregated pass/fail/flagged counts and pass rates for each evaluation mode (eval_and_retry, + sample_and_flag). + + Args: + days (int | Unset): Default: 30. + start_date (None | str | Unset): + end_date (None | str | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | NonManualEvaluationSummaryResponse + """ + + return sync_detailed( + client=client, + days=days, + start_date=start_date, + end_date=end_date, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + days: int | Unset = 30, + start_date: None | str | Unset = UNSET, + end_date: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | NonManualEvaluationSummaryResponse]: + """Get Non Manual Evaluation Summary + + Get account-level evaluation summary for API key clients. + + Returns aggregated pass/fail/flagged counts and pass rates for each evaluation mode (eval_and_retry, + sample_and_flag). + + Args: + days (int | Unset): Default: 30. + start_date (None | str | Unset): + end_date (None | str | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | NonManualEvaluationSummaryResponse] + """ + + kwargs = _get_kwargs( + days=days, + start_date=start_date, + end_date=end_date, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + days: int | Unset = 30, + start_date: None | str | Unset = UNSET, + end_date: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | NonManualEvaluationSummaryResponse | None: + """Get Non Manual Evaluation Summary + + Get account-level evaluation summary for API key clients. + + Returns aggregated pass/fail/flagged counts and pass rates for each evaluation mode (eval_and_retry, + sample_and_flag). + + Args: + days (int | Unset): Default: 30. + start_date (None | str | Unset): + end_date (None | str | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | NonManualEvaluationSummaryResponse + """ + + return ( + await asyncio_detailed( + client=client, + days=days, + start_date=start_date, + end_date=end_date, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/list_agent_evaluation_results_api_agents_agent_id_evaluation_results_get.py b/seclai/_generated/api/agent_evaluations/list_agent_evaluation_results_api_agents_agent_id_evaluation_results_get.py new file mode 100644 index 0000000..194b68e --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/list_agent_evaluation_results_api_agents_agent_id_evaluation_results_get.py @@ -0,0 +1,333 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.evaluation_result_with_criteria_list_response import ( + EvaluationResultWithCriteriaListResponse, +) +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + status: None | str | Unset = UNSET, + step: None | str | Unset = UNSET, + flagged_only: bool | Unset = False, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + json_status: None | str | Unset + if isinstance(status, Unset): + json_status = UNSET + else: + json_status = status + params["status"] = json_status + + json_step: None | str | Unset + if isinstance(step, Unset): + json_step = UNSET + else: + json_step = step + params["step"] = json_step + + params["flagged_only"] = flagged_only + + json_time_from: None | str | Unset + if isinstance(time_from, Unset): + json_time_from = UNSET + else: + json_time_from = time_from + params["time_from"] = json_time_from + + json_time_to: None | str | Unset + if isinstance(time_to, Unset): + json_time_to = UNSET + else: + json_time_to = time_to + params["time_to"] = json_time_to + + params["page"] = page + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/{agent_id}/evaluation-results".format( + agent_id=quote(str(agent_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> EvaluationResultWithCriteriaListResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = EvaluationResultWithCriteriaListResponse.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[EvaluationResultWithCriteriaListResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + step: None | str | Unset = UNSET, + flagged_only: bool | Unset = False, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationResultWithCriteriaListResponse | HTTPValidationError]: + """List Agent Evaluation Results + + List evaluation results across all criteria configured on an agent. + + Returns a paginated list of evaluation results with optional filtering by status, criteria, and date + range. Results include score, pass/fail status, and details. + + Args: + agent_id (str): + status (None | str | Unset): + step (None | str | Unset): + flagged_only (bool | Unset): Default: False. + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationResultWithCriteriaListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + status=status, + step=step, + flagged_only=flagged_only, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + step: None | str | Unset = UNSET, + flagged_only: bool | Unset = False, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> EvaluationResultWithCriteriaListResponse | HTTPValidationError | None: + """List Agent Evaluation Results + + List evaluation results across all criteria configured on an agent. + + Returns a paginated list of evaluation results with optional filtering by status, criteria, and date + range. Results include score, pass/fail status, and details. + + Args: + agent_id (str): + status (None | str | Unset): + step (None | str | Unset): + flagged_only (bool | Unset): Default: False. + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationResultWithCriteriaListResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + status=status, + step=step, + flagged_only=flagged_only, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + step: None | str | Unset = UNSET, + flagged_only: bool | Unset = False, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationResultWithCriteriaListResponse | HTTPValidationError]: + """List Agent Evaluation Results + + List evaluation results across all criteria configured on an agent. + + Returns a paginated list of evaluation results with optional filtering by status, criteria, and date + range. Results include score, pass/fail status, and details. + + Args: + agent_id (str): + status (None | str | Unset): + step (None | str | Unset): + flagged_only (bool | Unset): Default: False. + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationResultWithCriteriaListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + status=status, + step=step, + flagged_only=flagged_only, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + step: None | str | Unset = UNSET, + flagged_only: bool | Unset = False, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> EvaluationResultWithCriteriaListResponse | HTTPValidationError | None: + """List Agent Evaluation Results + + List evaluation results across all criteria configured on an agent. + + Returns a paginated list of evaluation results with optional filtering by status, criteria, and date + range. Results include score, pass/fail status, and details. + + Args: + agent_id (str): + status (None | str | Unset): + step (None | str | Unset): + flagged_only (bool | Unset): Default: False. + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationResultWithCriteriaListResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + status=status, + step=step, + flagged_only=flagged_only, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/list_compatible_runs_api_agents_evaluation_criteria_criteria_id_compatible_runs_get.py b/seclai/_generated/api/agent_evaluations/list_compatible_runs_api_agents_evaluation_criteria_criteria_id_compatible_runs_get.py new file mode 100644 index 0000000..d66514d --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/list_compatible_runs_api_agents_evaluation_criteria_criteria_id_compatible_runs_get.py @@ -0,0 +1,257 @@ +import datetime +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.compatible_run_list_response import CompatibleRunListResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + criteria_id: str, + *, + page: int | Unset = 1, + limit: int | Unset = 20, + started_after: datetime.datetime | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["page"] = page + + params["limit"] = limit + + json_started_after: None | str | Unset + if isinstance(started_after, Unset): + json_started_after = UNSET + elif isinstance(started_after, datetime.datetime): + json_started_after = started_after.isoformat() + else: + json_started_after = started_after + params["started_after"] = json_started_after + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/evaluation-criteria/{criteria_id}/compatible-runs".format( + criteria_id=quote(str(criteria_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> CompatibleRunListResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = CompatibleRunListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[CompatibleRunListResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + started_after: datetime.datetime | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[CompatibleRunListResponse | HTTPValidationError]: + """List Compatible Runs + + List agent runs that have a completed step matching the criteria's target step. + + Returns runs whose step output can be used for testing or replaying the + evaluation criteria. Results are ordered newest-first and paginated. + + Args: + criteria_id (str): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + started_after (datetime.datetime | None | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CompatibleRunListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + page=page, + limit=limit, + started_after=started_after, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + started_after: datetime.datetime | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> CompatibleRunListResponse | HTTPValidationError | None: + """List Compatible Runs + + List agent runs that have a completed step matching the criteria's target step. + + Returns runs whose step output can be used for testing or replaying the + evaluation criteria. Results are ordered newest-first and paginated. + + Args: + criteria_id (str): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + started_after (datetime.datetime | None | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CompatibleRunListResponse | HTTPValidationError + """ + + return sync_detailed( + criteria_id=criteria_id, + client=client, + page=page, + limit=limit, + started_after=started_after, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + started_after: datetime.datetime | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[CompatibleRunListResponse | HTTPValidationError]: + """List Compatible Runs + + List agent runs that have a completed step matching the criteria's target step. + + Returns runs whose step output can be used for testing or replaying the + evaluation criteria. Results are ordered newest-first and paginated. + + Args: + criteria_id (str): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + started_after (datetime.datetime | None | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CompatibleRunListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + page=page, + limit=limit, + started_after=started_after, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + started_after: datetime.datetime | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> CompatibleRunListResponse | HTTPValidationError | None: + """List Compatible Runs + + List agent runs that have a completed step matching the criteria's target step. + + Returns runs whose step output can be used for testing or replaying the + evaluation criteria. Results are ordered newest-first and paginated. + + Args: + criteria_id (str): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + started_after (datetime.datetime | None | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CompatibleRunListResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + criteria_id=criteria_id, + client=client, + page=page, + limit=limit, + started_after=started_after, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/list_evaluation_criteria_api_agents_agent_id_evaluation_criteria_get.py b/seclai/_generated/api/agent_evaluations/list_evaluation_criteria_api_agents_agent_id_evaluation_criteria_get.py new file mode 100644 index 0000000..59dda3d --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/list_evaluation_criteria_api_agents_agent_id_evaluation_criteria_get.py @@ -0,0 +1,210 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.evaluation_criteria_response import EvaluationCriteriaResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/{agent_id}/evaluation-criteria".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | list[EvaluationCriteriaResponse] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = EvaluationCriteriaResponse.from_dict( + response_200_item_data + ) + + response_200.append(response_200_item) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | list[EvaluationCriteriaResponse]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | list[EvaluationCriteriaResponse]]: + """List Evaluation Criteria + + List all evaluation criteria configured for an agent. + + Returns every criteria with its type, configuration, and a summary of + results (pass / fail counts). Criteria can be filtered client-side by + type or enabled status. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | list[EvaluationCriteriaResponse]] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | list[EvaluationCriteriaResponse] | None: + """List Evaluation Criteria + + List all evaluation criteria configured for an agent. + + Returns every criteria with its type, configuration, and a summary of + results (pass / fail counts). Criteria can be filtered client-side by + type or enabled status. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | list[EvaluationCriteriaResponse] + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | list[EvaluationCriteriaResponse]]: + """List Evaluation Criteria + + List all evaluation criteria configured for an agent. + + Returns every criteria with its type, configuration, and a summary of + results (pass / fail counts). Criteria can be filtered client-side by + type or enabled status. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | list[EvaluationCriteriaResponse]] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | list[EvaluationCriteriaResponse] | None: + """List Evaluation Criteria + + List all evaluation criteria configured for an agent. + + Returns every criteria with its type, configuration, and a summary of + results (pass / fail counts). Criteria can be filtered client-side by + type or enabled status. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | list[EvaluationCriteriaResponse] + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/list_evaluation_results_api_agents_evaluation_criteria_criteria_id_results_get.py b/seclai/_generated/api/agent_evaluations/list_evaluation_results_api_agents_evaluation_criteria_criteria_id_results_get.py new file mode 100644 index 0000000..80f4271 --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/list_evaluation_results_api_agents_evaluation_criteria_criteria_id_results_get.py @@ -0,0 +1,313 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.evaluation_result_list_response import EvaluationResultListResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + criteria_id: str, + *, + status: None | str | Unset = UNSET, + flagged_only: bool | Unset = False, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + json_status: None | str | Unset + if isinstance(status, Unset): + json_status = UNSET + else: + json_status = status + params["status"] = json_status + + params["flagged_only"] = flagged_only + + json_time_from: None | str | Unset + if isinstance(time_from, Unset): + json_time_from = UNSET + else: + json_time_from = time_from + params["time_from"] = json_time_from + + json_time_to: None | str | Unset + if isinstance(time_to, Unset): + json_time_to = UNSET + else: + json_time_to = time_to + params["time_to"] = json_time_to + + params["page"] = page + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/evaluation-criteria/{criteria_id}/results".format( + criteria_id=quote(str(criteria_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> EvaluationResultListResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = EvaluationResultListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[EvaluationResultListResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + flagged_only: bool | Unset = False, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationResultListResponse | HTTPValidationError]: + """List Evaluation Results + + List evaluation results for a criteria with optional filtering. + + Supports filtering by status (pending, passed, failed, skipped, error), + flagged-only mode, and an optional time range. Results are paginated + with configurable page size. + + Args: + criteria_id (str): + status (None | str | Unset): + flagged_only (bool | Unset): Default: False. + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationResultListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + status=status, + flagged_only=flagged_only, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + flagged_only: bool | Unset = False, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> EvaluationResultListResponse | HTTPValidationError | None: + """List Evaluation Results + + List evaluation results for a criteria with optional filtering. + + Supports filtering by status (pending, passed, failed, skipped, error), + flagged-only mode, and an optional time range. Results are paginated + with configurable page size. + + Args: + criteria_id (str): + status (None | str | Unset): + flagged_only (bool | Unset): Default: False. + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationResultListResponse | HTTPValidationError + """ + + return sync_detailed( + criteria_id=criteria_id, + client=client, + status=status, + flagged_only=flagged_only, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + flagged_only: bool | Unset = False, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationResultListResponse | HTTPValidationError]: + """List Evaluation Results + + List evaluation results for a criteria with optional filtering. + + Supports filtering by status (pending, passed, failed, skipped, error), + flagged-only mode, and an optional time range. Results are paginated + with configurable page size. + + Args: + criteria_id (str): + status (None | str | Unset): + flagged_only (bool | Unset): Default: False. + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationResultListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + status=status, + flagged_only=flagged_only, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + flagged_only: bool | Unset = False, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> EvaluationResultListResponse | HTTPValidationError | None: + """List Evaluation Results + + List evaluation results for a criteria with optional filtering. + + Supports filtering by status (pending, passed, failed, skipped, error), + flagged-only mode, and an optional time range. Results are paginated + with configurable page size. + + Args: + criteria_id (str): + status (None | str | Unset): + flagged_only (bool | Unset): Default: False. + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationResultListResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + criteria_id=criteria_id, + client=client, + status=status, + flagged_only=flagged_only, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/list_evaluation_runs_api_agents_agent_id_evaluation_runs_get.py b/seclai/_generated/api/agent_evaluations/list_evaluation_runs_api_agents_agent_id_evaluation_runs_get.py new file mode 100644 index 0000000..88beaff --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/list_evaluation_runs_api_agents_agent_id_evaluation_runs_get.py @@ -0,0 +1,316 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.evaluation_run_summary_list_response import ( + EvaluationRunSummaryListResponse, +) +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + status: None | str | Unset = UNSET, + step: None | str | Unset = UNSET, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + json_status: None | str | Unset + if isinstance(status, Unset): + json_status = UNSET + else: + json_status = status + params["status"] = json_status + + json_step: None | str | Unset + if isinstance(step, Unset): + json_step = UNSET + else: + json_step = step + params["step"] = json_step + + json_time_from: None | str | Unset + if isinstance(time_from, Unset): + json_time_from = UNSET + else: + json_time_from = time_from + params["time_from"] = json_time_from + + json_time_to: None | str | Unset + if isinstance(time_to, Unset): + json_time_to = UNSET + else: + json_time_to = time_to + params["time_to"] = json_time_to + + params["page"] = page + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/{agent_id}/evaluation-runs".format( + agent_id=quote(str(agent_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> EvaluationRunSummaryListResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = EvaluationRunSummaryListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[EvaluationRunSummaryListResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + step: None | str | Unset = UNSET, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationRunSummaryListResponse | HTTPValidationError]: + """List Evaluation Runs + + List evaluation results grouped by agent run. + + Returns paginated per-run summaries with pass/fail counts and optional + filtering by evaluation outcome, step, or date range. + + Args: + agent_id (str): + status (None | str | Unset): + step (None | str | Unset): + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationRunSummaryListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + status=status, + step=step, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + step: None | str | Unset = UNSET, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> EvaluationRunSummaryListResponse | HTTPValidationError | None: + """List Evaluation Runs + + List evaluation results grouped by agent run. + + Returns paginated per-run summaries with pass/fail counts and optional + filtering by evaluation outcome, step, or date range. + + Args: + agent_id (str): + status (None | str | Unset): + step (None | str | Unset): + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationRunSummaryListResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + status=status, + step=step, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + step: None | str | Unset = UNSET, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationRunSummaryListResponse | HTTPValidationError]: + """List Evaluation Runs + + List evaluation results grouped by agent run. + + Returns paginated per-run summaries with pass/fail counts and optional + filtering by evaluation outcome, step, or date range. + + Args: + agent_id (str): + status (None | str | Unset): + step (None | str | Unset): + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationRunSummaryListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + status=status, + step=step, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + status: None | str | Unset = UNSET, + step: None | str | Unset = UNSET, + time_from: None | str | Unset = UNSET, + time_to: None | str | Unset = UNSET, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> EvaluationRunSummaryListResponse | HTTPValidationError | None: + """List Evaluation Runs + + List evaluation results grouped by agent run. + + Returns paginated per-run summaries with pass/fail counts and optional + filtering by evaluation outcome, step, or date range. + + Args: + agent_id (str): + status (None | str | Unset): + step (None | str | Unset): + time_from (None | str | Unset): + time_to (None | str | Unset): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationRunSummaryListResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + status=status, + step=step, + time_from=time_from, + time_to=time_to, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/list_run_evaluation_results_api_agents_agent_id_runs_run_id_evaluation_results_get.py b/seclai/_generated/api/agent_evaluations/list_run_evaluation_results_api_agents_agent_id_runs_run_id_evaluation_results_get.py new file mode 100644 index 0000000..ba4dfb7 --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/list_run_evaluation_results_api_agents_agent_id_runs_run_id_evaluation_results_get.py @@ -0,0 +1,222 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.evaluation_result_with_criteria_response import ( + EvaluationResultWithCriteriaResponse, +) +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + run_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/{agent_id}/runs/{run_id}/evaluation-results".format( + agent_id=quote(str(agent_id), safe=""), + run_id=quote(str(run_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | list[EvaluationResultWithCriteriaResponse] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = EvaluationResultWithCriteriaResponse.from_dict( + response_200_item_data + ) + + response_200.append(response_200_item) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | list[EvaluationResultWithCriteriaResponse]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + run_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | list[EvaluationResultWithCriteriaResponse]]: + """List Run Evaluation Results + + List all evaluation results recorded for a specific agent run. + + Returns results across all evaluation criteria for the given run, + useful for getting a complete quality snapshot of a single execution. + + Args: + agent_id (str): + run_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | list[EvaluationResultWithCriteriaResponse]] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + run_id=run_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + run_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | list[EvaluationResultWithCriteriaResponse] | None: + """List Run Evaluation Results + + List all evaluation results recorded for a specific agent run. + + Returns results across all evaluation criteria for the given run, + useful for getting a complete quality snapshot of a single execution. + + Args: + agent_id (str): + run_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | list[EvaluationResultWithCriteriaResponse] + """ + + return sync_detailed( + agent_id=agent_id, + run_id=run_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + run_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | list[EvaluationResultWithCriteriaResponse]]: + """List Run Evaluation Results + + List all evaluation results recorded for a specific agent run. + + Returns results across all evaluation criteria for the given run, + useful for getting a complete quality snapshot of a single execution. + + Args: + agent_id (str): + run_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | list[EvaluationResultWithCriteriaResponse]] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + run_id=run_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + run_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | list[EvaluationResultWithCriteriaResponse] | None: + """List Run Evaluation Results + + List all evaluation results recorded for a specific agent run. + + Returns results across all evaluation criteria for the given run, + useful for getting a complete quality snapshot of a single execution. + + Args: + agent_id (str): + run_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | list[EvaluationResultWithCriteriaResponse] + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + run_id=run_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/test_draft_evaluation_api_agents_agent_id_evaluation_criteria_test_draft_post.py b/seclai/_generated/api/agent_evaluations/test_draft_evaluation_api_agents_agent_id_evaluation_criteria_test_draft_post.py new file mode 100644 index 0000000..436014b --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/test_draft_evaluation_api_agents_agent_id_evaluation_criteria_test_draft_post.py @@ -0,0 +1,237 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.test_draft_evaluation_request import TestDraftEvaluationRequest +from ...models.test_draft_evaluation_response import TestDraftEvaluationResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + body: TestDraftEvaluationRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/agents/{agent_id}/evaluation-criteria/test-draft".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | TestDraftEvaluationResponse | None: + if response.status_code == 200: + response_200 = TestDraftEvaluationResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | TestDraftEvaluationResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: TestDraftEvaluationRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | TestDraftEvaluationResponse]: + """Test Draft Evaluation + + Run an ephemeral evaluation against provided step output without persisting results. + + Use this to interactively test evaluation prompts and expectation + configurations while editing criteria. No credits are consumed because + the result is not recorded. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (TestDraftEvaluationRequest): Request body for ephemeral (non-persisted) evaluation + testing. + + Provide either ``step_output`` (raw text) **or** ``agent_step_run_id`` + (to load output from storage). Exactly one must be supplied. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | TestDraftEvaluationResponse] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: TestDraftEvaluationRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | TestDraftEvaluationResponse | None: + """Test Draft Evaluation + + Run an ephemeral evaluation against provided step output without persisting results. + + Use this to interactively test evaluation prompts and expectation + configurations while editing criteria. No credits are consumed because + the result is not recorded. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (TestDraftEvaluationRequest): Request body for ephemeral (non-persisted) evaluation + testing. + + Provide either ``step_output`` (raw text) **or** ``agent_step_run_id`` + (to load output from storage). Exactly one must be supplied. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | TestDraftEvaluationResponse + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: TestDraftEvaluationRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | TestDraftEvaluationResponse]: + """Test Draft Evaluation + + Run an ephemeral evaluation against provided step output without persisting results. + + Use this to interactively test evaluation prompts and expectation + configurations while editing criteria. No credits are consumed because + the result is not recorded. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (TestDraftEvaluationRequest): Request body for ephemeral (non-persisted) evaluation + testing. + + Provide either ``step_output`` (raw text) **or** ``agent_step_run_id`` + (to load output from storage). Exactly one must be supplied. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | TestDraftEvaluationResponse] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: TestDraftEvaluationRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | TestDraftEvaluationResponse | None: + """Test Draft Evaluation + + Run an ephemeral evaluation against provided step output without persisting results. + + Use this to interactively test evaluation prompts and expectation + configurations while editing criteria. No credits are consumed because + the result is not recorded. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (TestDraftEvaluationRequest): Request body for ephemeral (non-persisted) evaluation + testing. + + Provide either ``step_output`` (raw text) **or** ``agent_step_run_id`` + (to load output from storage). Exactly one must be supplied. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | TestDraftEvaluationResponse + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agent_evaluations/update_evaluation_criteria_api_agents_evaluation_criteria_criteria_id_patch.py b/seclai/_generated/api/agent_evaluations/update_evaluation_criteria_api_agents_evaluation_criteria_criteria_id_patch.py new file mode 100644 index 0000000..466797f --- /dev/null +++ b/seclai/_generated/api/agent_evaluations/update_evaluation_criteria_api_agents_evaluation_criteria_criteria_id_patch.py @@ -0,0 +1,229 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.evaluation_criteria_response import EvaluationCriteriaResponse +from ...models.http_validation_error import HTTPValidationError +from ...models.update_evaluation_criteria_request import UpdateEvaluationCriteriaRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + criteria_id: str, + *, + body: UpdateEvaluationCriteriaRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/agents/evaluation-criteria/{criteria_id}".format( + criteria_id=quote(str(criteria_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> EvaluationCriteriaResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = EvaluationCriteriaResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[EvaluationCriteriaResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateEvaluationCriteriaRequest, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationCriteriaResponse | HTTPValidationError]: + """Update Evaluation Criteria + + Update an evaluation criteria. + + Accepts a partial update – only the fields included in the request body + are modified. Use this to toggle enabled/disabled, change the + evaluation prompt, adjust retries, or rename the criteria. + + Args: + criteria_id (str): + x_account_id (str | Unset): + body (UpdateEvaluationCriteriaRequest): Request body for updating an evaluation criteria. + + Retry settings and sample frequency are set at the agent level. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationCriteriaResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateEvaluationCriteriaRequest, + x_account_id: str | Unset = UNSET, +) -> EvaluationCriteriaResponse | HTTPValidationError | None: + """Update Evaluation Criteria + + Update an evaluation criteria. + + Accepts a partial update – only the fields included in the request body + are modified. Use this to toggle enabled/disabled, change the + evaluation prompt, adjust retries, or rename the criteria. + + Args: + criteria_id (str): + x_account_id (str | Unset): + body (UpdateEvaluationCriteriaRequest): Request body for updating an evaluation criteria. + + Retry settings and sample frequency are set at the agent level. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationCriteriaResponse | HTTPValidationError + """ + + return sync_detailed( + criteria_id=criteria_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateEvaluationCriteriaRequest, + x_account_id: str | Unset = UNSET, +) -> Response[EvaluationCriteriaResponse | HTTPValidationError]: + """Update Evaluation Criteria + + Update an evaluation criteria. + + Accepts a partial update – only the fields included in the request body + are modified. Use this to toggle enabled/disabled, change the + evaluation prompt, adjust retries, or rename the criteria. + + Args: + criteria_id (str): + x_account_id (str | Unset): + body (UpdateEvaluationCriteriaRequest): Request body for updating an evaluation criteria. + + Retry settings and sample frequency are set at the agent level. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EvaluationCriteriaResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + criteria_id=criteria_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + criteria_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateEvaluationCriteriaRequest, + x_account_id: str | Unset = UNSET, +) -> EvaluationCriteriaResponse | HTTPValidationError | None: + """Update Evaluation Criteria + + Update an evaluation criteria. + + Accepts a partial update – only the fields included in the request body + are modified. Use this to toggle enabled/disabled, change the + evaluation prompt, adjust retries, or rename the criteria. + + Args: + criteria_id (str): + x_account_id (str | Unset): + body (UpdateEvaluationCriteriaRequest): Request body for updating an evaluation criteria. + + Retry settings and sample frequency are set at the agent level. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EvaluationCriteriaResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + criteria_id=criteria_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/api_get_agent_input_upload_status_api_agents_agent_id_input_uploads_upload_id_get.py b/seclai/_generated/api/agents/api_get_agent_input_upload_status_api_agents_agent_id_input_uploads_upload_id_get.py new file mode 100644 index 0000000..5dcd3e7 --- /dev/null +++ b/seclai/_generated/api/agents/api_get_agent_input_upload_status_api_agents_agent_id_input_uploads_upload_id_get.py @@ -0,0 +1,225 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.upload_agent_input_api_response import UploadAgentInputApiResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + upload_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/{agent_id}/input-uploads/{upload_id}".format( + agent_id=quote(str(agent_id), safe=""), + upload_id=quote(str(upload_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | UploadAgentInputApiResponse | None: + if response.status_code == 200: + response_200 = UploadAgentInputApiResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | UploadAgentInputApiResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + upload_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | UploadAgentInputApiResponse]: + """Get upload status + + Poll the processing status of a file upload created via `POST /agents/{agent_id}/upload-input`. + + Possible `status` values: `processing`, `ready`, `failed`. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + agent_id (str): + upload_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | UploadAgentInputApiResponse] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + upload_id=upload_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + upload_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | UploadAgentInputApiResponse | None: + """Get upload status + + Poll the processing status of a file upload created via `POST /agents/{agent_id}/upload-input`. + + Possible `status` values: `processing`, `ready`, `failed`. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + agent_id (str): + upload_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | UploadAgentInputApiResponse + """ + + return sync_detailed( + agent_id=agent_id, + upload_id=upload_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + upload_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | UploadAgentInputApiResponse]: + """Get upload status + + Poll the processing status of a file upload created via `POST /agents/{agent_id}/upload-input`. + + Possible `status` values: `processing`, `ready`, `failed`. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + agent_id (str): + upload_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | UploadAgentInputApiResponse] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + upload_id=upload_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + upload_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | UploadAgentInputApiResponse | None: + """Get upload status + + Poll the processing status of a file upload created via `POST /agents/{agent_id}/upload-input`. + + Possible `status` values: `processing`, `ready`, `failed`. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + agent_id (str): + upload_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | UploadAgentInputApiResponse + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + upload_id=upload_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/api_upload_agent_input_api_agents_agent_id_upload_input_post.py b/seclai/_generated/api/agents/api_upload_agent_input_api_agents_agent_id_upload_input_post.py new file mode 100644 index 0000000..661601e --- /dev/null +++ b/seclai/_generated/api/agents/api_upload_agent_input_api_agents_agent_id_upload_input_post.py @@ -0,0 +1,251 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.upload_agent_input_api_response import UploadAgentInputApiResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/agents/{agent_id}/upload-input".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | UploadAgentInputApiResponse | None: + if response.status_code == 202: + response_202 = UploadAgentInputApiResponse.from_dict(response.json()) + + return response_202 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | UploadAgentInputApiResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | UploadAgentInputApiResponse]: + """Upload file input + + Upload a file to use as input for a `dynamic_input` agent run. + + Supports the same file types as content source uploads: text, PDF, DOCX, audio, video, images, etc. + Text and document files are processed synchronously; audio/video are submitted for asynchronous + transcription. + + **Size limit:** 200 MB per file. + + **Supported extensions:** txt, html, md, csv, xml, json, pdf, msg, docx, doc, pptx, ppt, xlsx, xls, + zip, epub, png, jpg, gif, bmp, tiff, webp, mp3, wav, m4a, flac, ogg, mp4, mov, avi. + + After uploading, poll `GET /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready`, + then pass `input_upload_id` to `POST /agents/{agent_id}/runs`. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | UploadAgentInputApiResponse] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | UploadAgentInputApiResponse | None: + """Upload file input + + Upload a file to use as input for a `dynamic_input` agent run. + + Supports the same file types as content source uploads: text, PDF, DOCX, audio, video, images, etc. + Text and document files are processed synchronously; audio/video are submitted for asynchronous + transcription. + + **Size limit:** 200 MB per file. + + **Supported extensions:** txt, html, md, csv, xml, json, pdf, msg, docx, doc, pptx, ppt, xlsx, xls, + zip, epub, png, jpg, gif, bmp, tiff, webp, mp3, wav, m4a, flac, ogg, mp4, mov, avi. + + After uploading, poll `GET /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready`, + then pass `input_upload_id` to `POST /agents/{agent_id}/runs`. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | UploadAgentInputApiResponse + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | UploadAgentInputApiResponse]: + """Upload file input + + Upload a file to use as input for a `dynamic_input` agent run. + + Supports the same file types as content source uploads: text, PDF, DOCX, audio, video, images, etc. + Text and document files are processed synchronously; audio/video are submitted for asynchronous + transcription. + + **Size limit:** 200 MB per file. + + **Supported extensions:** txt, html, md, csv, xml, json, pdf, msg, docx, doc, pptx, ppt, xlsx, xls, + zip, epub, png, jpg, gif, bmp, tiff, webp, mp3, wav, m4a, flac, ogg, mp4, mov, avi. + + After uploading, poll `GET /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready`, + then pass `input_upload_id` to `POST /agents/{agent_id}/runs`. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | UploadAgentInputApiResponse] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | UploadAgentInputApiResponse | None: + """Upload file input + + Upload a file to use as input for a `dynamic_input` agent run. + + Supports the same file types as content source uploads: text, PDF, DOCX, audio, video, images, etc. + Text and document files are processed synchronously; audio/video are submitted for asynchronous + transcription. + + **Size limit:** 200 MB per file. + + **Supported extensions:** txt, html, md, csv, xml, json, pdf, msg, docx, doc, pptx, ppt, xlsx, xls, + zip, epub, png, jpg, gif, bmp, tiff, webp, mp3, wav, m4a, flac, ogg, mp4, mov, avi. + + After uploading, poll `GET /agents/{agent_id}/input-uploads/{upload_id}` until `status` is `ready`, + then pass `input_upload_id` to `POST /agents/{agent_id}/runs`. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | UploadAgentInputApiResponse + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/create_agent_api_agents_post.py b/seclai/_generated/api/agents/create_agent_api_agents_post.py new file mode 100644 index 0000000..e9f3b75 --- /dev/null +++ b/seclai/_generated/api/agents/create_agent_api_agents_post.py @@ -0,0 +1,241 @@ +from http import HTTPStatus +from typing import Any, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.agent_summary_response import AgentSummaryResponse +from ...models.create_agent_request import CreateAgentRequest +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: CreateAgentRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/agents", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AgentSummaryResponse | Any | HTTPValidationError | None: + if response.status_code == 201: + response_201 = AgentSummaryResponse.from_dict(response.json()) + + return response_201 + + if response.status_code == 402: + response_402 = cast(Any, None) + return response_402 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AgentSummaryResponse | Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateAgentRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AgentSummaryResponse | Any | HTTPValidationError]: + """Create an agent + + Create a new agent. + + Trigger types: + - `dynamic_input`: triggered via API with user-provided input + - `template_input`: triggered via API with a predefined template + - `schedule`: triggered on a schedule + - `new_content`: triggered when new content arrives + + Templates: `blank`, `retrieval_example`, `simple_qa`, `summarizer`, `json_extractor`, + `content_change_notifier`, `scheduled_report`, `webhook_pipeline` + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Agent is created in the caller's account. + + Args: + x_account_id (str | Unset): + body (CreateAgentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentSummaryResponse | Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: CreateAgentRequest, + x_account_id: str | Unset = UNSET, +) -> AgentSummaryResponse | Any | HTTPValidationError | None: + """Create an agent + + Create a new agent. + + Trigger types: + - `dynamic_input`: triggered via API with user-provided input + - `template_input`: triggered via API with a predefined template + - `schedule`: triggered on a schedule + - `new_content`: triggered when new content arrives + + Templates: `blank`, `retrieval_example`, `simple_qa`, `summarizer`, `json_extractor`, + `content_change_notifier`, `scheduled_report`, `webhook_pipeline` + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Agent is created in the caller's account. + + Args: + x_account_id (str | Unset): + body (CreateAgentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentSummaryResponse | Any | HTTPValidationError + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateAgentRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AgentSummaryResponse | Any | HTTPValidationError]: + """Create an agent + + Create a new agent. + + Trigger types: + - `dynamic_input`: triggered via API with user-provided input + - `template_input`: triggered via API with a predefined template + - `schedule`: triggered on a schedule + - `new_content`: triggered when new content arrives + + Templates: `blank`, `retrieval_example`, `simple_qa`, `summarizer`, `json_extractor`, + `content_change_notifier`, `scheduled_report`, `webhook_pipeline` + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Agent is created in the caller's account. + + Args: + x_account_id (str | Unset): + body (CreateAgentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentSummaryResponse | Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: CreateAgentRequest, + x_account_id: str | Unset = UNSET, +) -> AgentSummaryResponse | Any | HTTPValidationError | None: + """Create an agent + + Create a new agent. + + Trigger types: + - `dynamic_input`: triggered via API with user-provided input + - `template_input`: triggered via API with a predefined template + - `schedule`: triggered on a schedule + - `new_content`: triggered when new content arrives + + Templates: `blank`, `retrieval_example`, `simple_qa`, `summarizer`, `json_extractor`, + `content_change_notifier`, `scheduled_report`, `webhook_pipeline` + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Agent is created in the caller's account. + + Args: + x_account_id (str | Unset): + body (CreateAgentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentSummaryResponse | Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/delete_agent_api_agents_agent_id_delete.py b/seclai/_generated/api/agents/delete_agent_api_agents_agent_id_delete.py new file mode 100644 index 0000000..80f597d --- /dev/null +++ b/seclai/_generated/api/agents/delete_agent_api_agents_agent_id_delete.py @@ -0,0 +1,201 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/agents/{agent_id}".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete an agent + + Soft-delete an agent. The agent will no longer appear in listings or be accessible via the API. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only delete agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete an agent + + Soft-delete an agent. The agent will no longer appear in listings or be accessible via the API. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only delete agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete an agent + + Soft-delete an agent. The agent will no longer appear in listings or be accessible via the API. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only delete agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete an agent + + Soft-delete an agent. The agent will no longer appear in listings or be accessible via the API. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only delete agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/delete_agent_run_api_agents_runs_run_id_delete.py b/seclai/_generated/api/agents/delete_agent_run_api_agents_runs_run_id_delete.py index 41681ad..8533bf2 100644 --- a/seclai/_generated/api/agents/delete_agent_run_api_agents_runs_run_id_delete.py +++ b/seclai/_generated/api/agents/delete_agent_run_api_agents_runs_run_id_delete.py @@ -8,12 +8,18 @@ from ...client import AuthenticatedClient, Client from ...models.agent_run_response import AgentRunResponse from ...models.http_validation_error import HTTPValidationError -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( run_id: str, + *, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + _kwargs: dict[str, Any] = { "method": "delete", "url": "/agents/runs/{run_id}".format( @@ -21,6 +27,7 @@ def _get_kwargs( ), } + _kwargs["headers"] = headers return _kwargs @@ -58,6 +65,7 @@ def sync_detailed( run_id: str, *, client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, ) -> Response[AgentRunResponse | HTTPValidationError]: """Cancel an agent run @@ -66,10 +74,12 @@ def sync_detailed( If the run is already in a terminal state (`completed` or `failed`), cancellation will be rejected. Auth & scoping: - - Requires `X-API-Key`. You can only cancel runs belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only cancel runs belonging to your + account. Args: run_id (str): + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -81,6 +91,7 @@ def sync_detailed( kwargs = _get_kwargs( run_id=run_id, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -94,6 +105,7 @@ def sync( run_id: str, *, client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, ) -> AgentRunResponse | HTTPValidationError | None: """Cancel an agent run @@ -102,10 +114,12 @@ def sync( If the run is already in a terminal state (`completed` or `failed`), cancellation will be rejected. Auth & scoping: - - Requires `X-API-Key`. You can only cancel runs belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only cancel runs belonging to your + account. Args: run_id (str): + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -118,6 +132,7 @@ def sync( return sync_detailed( run_id=run_id, client=client, + x_account_id=x_account_id, ).parsed @@ -125,6 +140,7 @@ async def asyncio_detailed( run_id: str, *, client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, ) -> Response[AgentRunResponse | HTTPValidationError]: """Cancel an agent run @@ -133,10 +149,12 @@ async def asyncio_detailed( If the run is already in a terminal state (`completed` or `failed`), cancellation will be rejected. Auth & scoping: - - Requires `X-API-Key`. You can only cancel runs belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only cancel runs belonging to your + account. Args: run_id (str): + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -148,6 +166,7 @@ async def asyncio_detailed( kwargs = _get_kwargs( run_id=run_id, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -159,6 +178,7 @@ async def asyncio( run_id: str, *, client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, ) -> AgentRunResponse | HTTPValidationError | None: """Cancel an agent run @@ -167,10 +187,12 @@ async def asyncio( If the run is already in a terminal state (`completed` or `failed`), cancellation will be rejected. Auth & scoping: - - Requires `X-API-Key`. You can only cancel runs belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only cancel runs belonging to your + account. Args: run_id (str): + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -184,5 +206,6 @@ async def asyncio( await asyncio_detailed( run_id=run_id, client=client, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/agents/export_agent_api_agents_agent_id_export_get.py b/seclai/_generated/api/agents/export_agent_api_agents_agent_id_export_get.py new file mode 100644 index 0000000..a68ab98 --- /dev/null +++ b/seclai/_generated/api/agents/export_agent_api_agents_agent_id_export_get.py @@ -0,0 +1,303 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.agent_export_response import AgentExportResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + download: bool | Unset = True, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["download"] = download + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/{agent_id}/export".format( + agent_id=quote(str(agent_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AgentExportResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AgentExportResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AgentExportResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + download: bool | Unset = True, + x_account_id: str | Unset = UNSET, +) -> Response[AgentExportResponse | HTTPValidationError]: + r"""Export agent definition + + Export an agent definition as a portable JSON snapshot. + + The response contains the full definition, trigger configuration with schedules, alert configs, + evaluation criteria, agent-scoped governance policies, and a resolved dependency manifest that maps + every referenced external entity UUID to its human-readable name. + + Response shape: + - `export_version`: schema version (currently `\"2\"`) + - `exported_at`: ISO-8601 timestamp + - `agent`: name, description, schema_version, definition, timestamps + - `trigger`: trigger type, input template, schedules + - `alert_configs`: alert type, thresholds, recipients + - `evaluation_criteria`: evaluation settings per step + - `governance_policies`: agent-scoped governance policies + - `dependencies`: knowledge_bases, memory_banks, source_connections, agents, users + + Query params: + - `download` (default true): when true, sets `Content-Disposition: attachment` so clients treat the + response as a file download. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - When using OAuth, you may target a different organization account with `X-Account-Id`; for API + keys, the key's account is always used. + - You can only export agents belonging to the resolved account. + + Args: + agent_id (str): + download (bool | Unset): Return as file download Default: True. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentExportResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + download=download, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + download: bool | Unset = True, + x_account_id: str | Unset = UNSET, +) -> AgentExportResponse | HTTPValidationError | None: + r"""Export agent definition + + Export an agent definition as a portable JSON snapshot. + + The response contains the full definition, trigger configuration with schedules, alert configs, + evaluation criteria, agent-scoped governance policies, and a resolved dependency manifest that maps + every referenced external entity UUID to its human-readable name. + + Response shape: + - `export_version`: schema version (currently `\"2\"`) + - `exported_at`: ISO-8601 timestamp + - `agent`: name, description, schema_version, definition, timestamps + - `trigger`: trigger type, input template, schedules + - `alert_configs`: alert type, thresholds, recipients + - `evaluation_criteria`: evaluation settings per step + - `governance_policies`: agent-scoped governance policies + - `dependencies`: knowledge_bases, memory_banks, source_connections, agents, users + + Query params: + - `download` (default true): when true, sets `Content-Disposition: attachment` so clients treat the + response as a file download. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - When using OAuth, you may target a different organization account with `X-Account-Id`; for API + keys, the key's account is always used. + - You can only export agents belonging to the resolved account. + + Args: + agent_id (str): + download (bool | Unset): Return as file download Default: True. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentExportResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + download=download, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + download: bool | Unset = True, + x_account_id: str | Unset = UNSET, +) -> Response[AgentExportResponse | HTTPValidationError]: + r"""Export agent definition + + Export an agent definition as a portable JSON snapshot. + + The response contains the full definition, trigger configuration with schedules, alert configs, + evaluation criteria, agent-scoped governance policies, and a resolved dependency manifest that maps + every referenced external entity UUID to its human-readable name. + + Response shape: + - `export_version`: schema version (currently `\"2\"`) + - `exported_at`: ISO-8601 timestamp + - `agent`: name, description, schema_version, definition, timestamps + - `trigger`: trigger type, input template, schedules + - `alert_configs`: alert type, thresholds, recipients + - `evaluation_criteria`: evaluation settings per step + - `governance_policies`: agent-scoped governance policies + - `dependencies`: knowledge_bases, memory_banks, source_connections, agents, users + + Query params: + - `download` (default true): when true, sets `Content-Disposition: attachment` so clients treat the + response as a file download. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - When using OAuth, you may target a different organization account with `X-Account-Id`; for API + keys, the key's account is always used. + - You can only export agents belonging to the resolved account. + + Args: + agent_id (str): + download (bool | Unset): Return as file download Default: True. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentExportResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + download=download, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + download: bool | Unset = True, + x_account_id: str | Unset = UNSET, +) -> AgentExportResponse | HTTPValidationError | None: + r"""Export agent definition + + Export an agent definition as a portable JSON snapshot. + + The response contains the full definition, trigger configuration with schedules, alert configs, + evaluation criteria, agent-scoped governance policies, and a resolved dependency manifest that maps + every referenced external entity UUID to its human-readable name. + + Response shape: + - `export_version`: schema version (currently `\"2\"`) + - `exported_at`: ISO-8601 timestamp + - `agent`: name, description, schema_version, definition, timestamps + - `trigger`: trigger type, input template, schedules + - `alert_configs`: alert type, thresholds, recipients + - `evaluation_criteria`: evaluation settings per step + - `governance_policies`: agent-scoped governance policies + - `dependencies`: knowledge_bases, memory_banks, source_connections, agents, users + + Query params: + - `download` (default true): when true, sets `Content-Disposition: attachment` so clients treat the + response as a file download. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - When using OAuth, you may target a different organization account with `X-Account-Id`; for API + keys, the key's account is always used. + - You can only export agents belonging to the resolved account. + + Args: + agent_id (str): + download (bool | Unset): Return as file download Default: True. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentExportResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + download=download, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/generate_agent_steps_api_agents_agent_id_ai_assistant_generate_steps_post.py b/seclai/_generated/api/agents/generate_agent_steps_api_agents_agent_id_ai_assistant_generate_steps_post.py new file mode 100644 index 0000000..9d3c5ac --- /dev/null +++ b/seclai/_generated/api/agents/generate_agent_steps_api_agents_agent_id_ai_assistant_generate_steps_post.py @@ -0,0 +1,237 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.generate_agent_steps_request import GenerateAgentStepsRequest +from ...models.generate_agent_steps_response import GenerateAgentStepsResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + body: GenerateAgentStepsRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/agents/{agent_id}/ai-assistant/generate-steps".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> GenerateAgentStepsResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = GenerateAgentStepsResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[GenerateAgentStepsResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: GenerateAgentStepsRequest, + x_account_id: str | Unset = UNSET, +) -> Response[GenerateAgentStepsResponse | HTTPValidationError]: + """Generate agent workflow + + Use the AI assistant to generate a full agent step workflow from a natural language description. + + Provide a description of what the agent should do, along with optional context (current steps, + trigger type). The AI produces a complete set of agent steps. + Use mode 'generate_full' for new workflows or 'modify_workflow' to refine existing ones. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + used. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (GenerateAgentStepsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GenerateAgentStepsResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: GenerateAgentStepsRequest, + x_account_id: str | Unset = UNSET, +) -> GenerateAgentStepsResponse | HTTPValidationError | None: + """Generate agent workflow + + Use the AI assistant to generate a full agent step workflow from a natural language description. + + Provide a description of what the agent should do, along with optional context (current steps, + trigger type). The AI produces a complete set of agent steps. + Use mode 'generate_full' for new workflows or 'modify_workflow' to refine existing ones. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + used. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (GenerateAgentStepsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GenerateAgentStepsResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: GenerateAgentStepsRequest, + x_account_id: str | Unset = UNSET, +) -> Response[GenerateAgentStepsResponse | HTTPValidationError]: + """Generate agent workflow + + Use the AI assistant to generate a full agent step workflow from a natural language description. + + Provide a description of what the agent should do, along with optional context (current steps, + trigger type). The AI produces a complete set of agent steps. + Use mode 'generate_full' for new workflows or 'modify_workflow' to refine existing ones. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + used. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (GenerateAgentStepsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GenerateAgentStepsResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: GenerateAgentStepsRequest, + x_account_id: str | Unset = UNSET, +) -> GenerateAgentStepsResponse | HTTPValidationError | None: + """Generate agent workflow + + Use the AI assistant to generate a full agent step workflow from a natural language description. + + Provide a description of what the agent should do, along with optional context (current steps, + trigger type). The AI produces a complete set of agent steps. + Use mode 'generate_full' for new workflows or 'modify_workflow' to refine existing ones. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + used. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (GenerateAgentStepsRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GenerateAgentStepsResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/generate_step_config_api_agents_agent_id_ai_assistant_step_config_post.py b/seclai/_generated/api/agents/generate_step_config_api_agents_agent_id_ai_assistant_step_config_post.py new file mode 100644 index 0000000..f63e34f --- /dev/null +++ b/seclai/_generated/api/agents/generate_step_config_api_agents_agent_id_ai_assistant_step_config_post.py @@ -0,0 +1,237 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.generate_step_config_request import GenerateStepConfigRequest +from ...models.generate_step_config_response import GenerateStepConfigResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + body: GenerateStepConfigRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/agents/{agent_id}/ai-assistant/step-config".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> GenerateStepConfigResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = GenerateStepConfigResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[GenerateStepConfigResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: GenerateStepConfigRequest, + x_account_id: str | Unset = UNSET, +) -> Response[GenerateStepConfigResponse | HTTPValidationError]: + """Generate step configuration + + Use the AI assistant to generate or refine a single step's configuration. + + Provide the step type, a natural language instruction, and optionally the current configuration. The + AI will produce a proposed configuration along with an explanation. The suggestion is stored as a + conversation turn that can be accepted or declined separately via the mark endpoint. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + used. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (GenerateStepConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GenerateStepConfigResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: GenerateStepConfigRequest, + x_account_id: str | Unset = UNSET, +) -> GenerateStepConfigResponse | HTTPValidationError | None: + """Generate step configuration + + Use the AI assistant to generate or refine a single step's configuration. + + Provide the step type, a natural language instruction, and optionally the current configuration. The + AI will produce a proposed configuration along with an explanation. The suggestion is stored as a + conversation turn that can be accepted or declined separately via the mark endpoint. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + used. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (GenerateStepConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GenerateStepConfigResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: GenerateStepConfigRequest, + x_account_id: str | Unset = UNSET, +) -> Response[GenerateStepConfigResponse | HTTPValidationError]: + """Generate step configuration + + Use the AI assistant to generate or refine a single step's configuration. + + Provide the step type, a natural language instruction, and optionally the current configuration. The + AI will produce a proposed configuration along with an explanation. The suggestion is stored as a + conversation turn that can be accepted or declined separately via the mark endpoint. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + used. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (GenerateStepConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GenerateStepConfigResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: GenerateStepConfigRequest, + x_account_id: str | Unset = UNSET, +) -> GenerateStepConfigResponse | HTTPValidationError | None: + """Generate step configuration + + Use the AI assistant to generate or refine a single step's configuration. + + Provide the step type, a natural language instruction, and optionally the current configuration. The + AI will produce a proposed configuration along with an explanation. The suggestion is stored as a + conversation turn that can be accepted or declined separately via the mark endpoint. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + used. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (GenerateStepConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GenerateStepConfigResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/get_agent_definition_api_agents_agent_id_definition_get.py b/seclai/_generated/api/agents/get_agent_definition_api_agents_agent_id_definition_get.py new file mode 100644 index 0000000..b3dc7cf --- /dev/null +++ b/seclai/_generated/api/agents/get_agent_definition_api_agents_agent_id_definition_get.py @@ -0,0 +1,339 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.agent_definition_response import AgentDefinitionResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/{agent_id}/definition".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AgentDefinitionResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AgentDefinitionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AgentDefinitionResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[AgentDefinitionResponse | HTTPValidationError]: + """Get agent definition + + Fetch the current agent definition from the main branch. + + The response includes `change_id` which must be provided when updating the definition (optimistic + locking). + + The definition contains the agent's step workflow. Available step types: + - `prompt_call`: Call an LLM with a prompt template + - `retrieval`: Search a knowledge base + - `transform`: Reshape data with a Liquid template + - `gate`: Evaluate conditions, stop or continue child execution + - `retry`: Re-execute from a target ancestor step (for quality-control loops; pair with a `gate` + step for conditional retrying. Fields: `target_step_id` (ancestor step ID), `max_retries` (1–10)) + - `evaluate_step`: Score a selected previous step output and emit JSON with `score`, `passed`, and + `pass_threshold` (fields: `target_step_id`, `evaluation_prompt`, `pass_threshold`, optional + `evaluation_tier`, optional `expectation_config`) + - `insight`: Progressively read and analyze large input + - `extract_json` / `extract_html` / `extract_xml`: Extract structured data + - `send_email`: Send email with step output + - `webhook_call`: POST data to an external URL + - `write_aws_s3_object`: Write output to S3 + - `call_agent`: Invoke another agent + - `write_metadata`: Write a value to content metadata (for filtering/gates; content-triggered agents + only. Fields: `metadata_key`, `content`) + - `write_content_attachment`: Write a file-backed attachment to content (optionally indexed for + retrieval; content-triggered agents only. Fields: `attachment_key`, `content`, `content_type`, + `indexed`) + - `load_content_attachment`: Load a previously written attachment (content-triggered agents only. + Fields: `attachment_key`) + - `load_content`: Load the full text body of a source document (typically used with content- + triggered agents; can also load by explicit `content_version_id`. Fields: `content_version_id` + optional) + - `display_result`: Show output to the user + - `join`: Merge parallel branches + - `combinator`: Combine multiple inputs + - `text`: Static text literal + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentDefinitionResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> AgentDefinitionResponse | HTTPValidationError | None: + """Get agent definition + + Fetch the current agent definition from the main branch. + + The response includes `change_id` which must be provided when updating the definition (optimistic + locking). + + The definition contains the agent's step workflow. Available step types: + - `prompt_call`: Call an LLM with a prompt template + - `retrieval`: Search a knowledge base + - `transform`: Reshape data with a Liquid template + - `gate`: Evaluate conditions, stop or continue child execution + - `retry`: Re-execute from a target ancestor step (for quality-control loops; pair with a `gate` + step for conditional retrying. Fields: `target_step_id` (ancestor step ID), `max_retries` (1–10)) + - `evaluate_step`: Score a selected previous step output and emit JSON with `score`, `passed`, and + `pass_threshold` (fields: `target_step_id`, `evaluation_prompt`, `pass_threshold`, optional + `evaluation_tier`, optional `expectation_config`) + - `insight`: Progressively read and analyze large input + - `extract_json` / `extract_html` / `extract_xml`: Extract structured data + - `send_email`: Send email with step output + - `webhook_call`: POST data to an external URL + - `write_aws_s3_object`: Write output to S3 + - `call_agent`: Invoke another agent + - `write_metadata`: Write a value to content metadata (for filtering/gates; content-triggered agents + only. Fields: `metadata_key`, `content`) + - `write_content_attachment`: Write a file-backed attachment to content (optionally indexed for + retrieval; content-triggered agents only. Fields: `attachment_key`, `content`, `content_type`, + `indexed`) + - `load_content_attachment`: Load a previously written attachment (content-triggered agents only. + Fields: `attachment_key`) + - `load_content`: Load the full text body of a source document (typically used with content- + triggered agents; can also load by explicit `content_version_id`. Fields: `content_version_id` + optional) + - `display_result`: Show output to the user + - `join`: Merge parallel branches + - `combinator`: Combine multiple inputs + - `text`: Static text literal + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentDefinitionResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[AgentDefinitionResponse | HTTPValidationError]: + """Get agent definition + + Fetch the current agent definition from the main branch. + + The response includes `change_id` which must be provided when updating the definition (optimistic + locking). + + The definition contains the agent's step workflow. Available step types: + - `prompt_call`: Call an LLM with a prompt template + - `retrieval`: Search a knowledge base + - `transform`: Reshape data with a Liquid template + - `gate`: Evaluate conditions, stop or continue child execution + - `retry`: Re-execute from a target ancestor step (for quality-control loops; pair with a `gate` + step for conditional retrying. Fields: `target_step_id` (ancestor step ID), `max_retries` (1–10)) + - `evaluate_step`: Score a selected previous step output and emit JSON with `score`, `passed`, and + `pass_threshold` (fields: `target_step_id`, `evaluation_prompt`, `pass_threshold`, optional + `evaluation_tier`, optional `expectation_config`) + - `insight`: Progressively read and analyze large input + - `extract_json` / `extract_html` / `extract_xml`: Extract structured data + - `send_email`: Send email with step output + - `webhook_call`: POST data to an external URL + - `write_aws_s3_object`: Write output to S3 + - `call_agent`: Invoke another agent + - `write_metadata`: Write a value to content metadata (for filtering/gates; content-triggered agents + only. Fields: `metadata_key`, `content`) + - `write_content_attachment`: Write a file-backed attachment to content (optionally indexed for + retrieval; content-triggered agents only. Fields: `attachment_key`, `content`, `content_type`, + `indexed`) + - `load_content_attachment`: Load a previously written attachment (content-triggered agents only. + Fields: `attachment_key`) + - `load_content`: Load the full text body of a source document (typically used with content- + triggered agents; can also load by explicit `content_version_id`. Fields: `content_version_id` + optional) + - `display_result`: Show output to the user + - `join`: Merge parallel branches + - `combinator`: Combine multiple inputs + - `text`: Static text literal + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentDefinitionResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> AgentDefinitionResponse | HTTPValidationError | None: + """Get agent definition + + Fetch the current agent definition from the main branch. + + The response includes `change_id` which must be provided when updating the definition (optimistic + locking). + + The definition contains the agent's step workflow. Available step types: + - `prompt_call`: Call an LLM with a prompt template + - `retrieval`: Search a knowledge base + - `transform`: Reshape data with a Liquid template + - `gate`: Evaluate conditions, stop or continue child execution + - `retry`: Re-execute from a target ancestor step (for quality-control loops; pair with a `gate` + step for conditional retrying. Fields: `target_step_id` (ancestor step ID), `max_retries` (1–10)) + - `evaluate_step`: Score a selected previous step output and emit JSON with `score`, `passed`, and + `pass_threshold` (fields: `target_step_id`, `evaluation_prompt`, `pass_threshold`, optional + `evaluation_tier`, optional `expectation_config`) + - `insight`: Progressively read and analyze large input + - `extract_json` / `extract_html` / `extract_xml`: Extract structured data + - `send_email`: Send email with step output + - `webhook_call`: POST data to an external URL + - `write_aws_s3_object`: Write output to S3 + - `call_agent`: Invoke another agent + - `write_metadata`: Write a value to content metadata (for filtering/gates; content-triggered agents + only. Fields: `metadata_key`, `content`) + - `write_content_attachment`: Write a file-backed attachment to content (optionally indexed for + retrieval; content-triggered agents only. Fields: `attachment_key`, `content`, `content_type`, + `indexed`) + - `load_content_attachment`: Load a previously written attachment (content-triggered agents only. + Fields: `attachment_key`) + - `load_content`: Load the full text body of a source document (typically used with content- + triggered agents; can also load by explicit `content_version_id`. Fields: `content_version_id` + optional) + - `display_result`: Show output to the user + - `join`: Merge parallel branches + - `combinator`: Combine multiple inputs + - `text`: Static text literal + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentDefinitionResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/get_agent_metadata_api_agents_agent_id_get.py b/seclai/_generated/api/agents/get_agent_metadata_api_agents_agent_id_get.py new file mode 100644 index 0000000..058402c --- /dev/null +++ b/seclai/_generated/api/agents/get_agent_metadata_api_agents_agent_id_get.py @@ -0,0 +1,203 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.agent_summary_response import AgentSummaryResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/{agent_id}".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AgentSummaryResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AgentSummaryResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AgentSummaryResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[AgentSummaryResponse | HTTPValidationError]: + """Get an agent + + Fetch an agent's metadata (name, description, trigger type, timestamps). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentSummaryResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> AgentSummaryResponse | HTTPValidationError | None: + """Get an agent + + Fetch an agent's metadata (name, description, trigger type, timestamps). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentSummaryResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[AgentSummaryResponse | HTTPValidationError]: + """Get an agent + + Fetch an agent's metadata (name, description, trigger type, timestamps). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentSummaryResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> AgentSummaryResponse | HTTPValidationError | None: + """Get an agent + + Fetch an agent's metadata (name, description, trigger type, timestamps). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentSummaryResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/get_agent_run_api_agents_runs_run_id_get.py b/seclai/_generated/api/agents/get_agent_run_api_agents_runs_run_id_get.py index 3c96a43..7c05fd8 100644 --- a/seclai/_generated/api/agents/get_agent_run_api_agents_runs_run_id_get.py +++ b/seclai/_generated/api/agents/get_agent_run_api_agents_runs_run_id_get.py @@ -15,7 +15,12 @@ def _get_kwargs( run_id: str, *, include_step_outputs: bool | Unset = False, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + params: dict[str, Any] = {} params["include_step_outputs"] = include_step_outputs @@ -30,6 +35,7 @@ def _get_kwargs( "params": params, } + _kwargs["headers"] = headers return _kwargs @@ -68,6 +74,7 @@ def sync_detailed( *, client: AuthenticatedClient | Client, include_step_outputs: bool | Unset = False, + x_account_id: str | Unset = UNSET, ) -> Response[AgentRunResponse | HTTPValidationError]: """Get an agent run @@ -78,12 +85,14 @@ def sync_detailed( `include_step_outputs=true` to include per-step outputs, timing, durations, and credits. Auth & scoping: - - Requires `X-API-Key`. You can only access runs belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access runs belonging to your + account. Args: run_id (str): include_step_outputs (bool | Unset): If true, include per-step outputs with timing, durations, and credits. Default: False. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -96,6 +105,7 @@ def sync_detailed( kwargs = _get_kwargs( run_id=run_id, include_step_outputs=include_step_outputs, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -110,6 +120,7 @@ def sync( *, client: AuthenticatedClient | Client, include_step_outputs: bool | Unset = False, + x_account_id: str | Unset = UNSET, ) -> AgentRunResponse | HTTPValidationError | None: """Get an agent run @@ -120,12 +131,14 @@ def sync( `include_step_outputs=true` to include per-step outputs, timing, durations, and credits. Auth & scoping: - - Requires `X-API-Key`. You can only access runs belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access runs belonging to your + account. Args: run_id (str): include_step_outputs (bool | Unset): If true, include per-step outputs with timing, durations, and credits. Default: False. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -139,6 +152,7 @@ def sync( run_id=run_id, client=client, include_step_outputs=include_step_outputs, + x_account_id=x_account_id, ).parsed @@ -147,6 +161,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient | Client, include_step_outputs: bool | Unset = False, + x_account_id: str | Unset = UNSET, ) -> Response[AgentRunResponse | HTTPValidationError]: """Get an agent run @@ -157,12 +172,14 @@ async def asyncio_detailed( `include_step_outputs=true` to include per-step outputs, timing, durations, and credits. Auth & scoping: - - Requires `X-API-Key`. You can only access runs belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access runs belonging to your + account. Args: run_id (str): include_step_outputs (bool | Unset): If true, include per-step outputs with timing, durations, and credits. Default: False. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -175,6 +192,7 @@ async def asyncio_detailed( kwargs = _get_kwargs( run_id=run_id, include_step_outputs=include_step_outputs, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -187,6 +205,7 @@ async def asyncio( *, client: AuthenticatedClient | Client, include_step_outputs: bool | Unset = False, + x_account_id: str | Unset = UNSET, ) -> AgentRunResponse | HTTPValidationError | None: """Get an agent run @@ -197,12 +216,14 @@ async def asyncio( `include_step_outputs=true` to include per-step outputs, timing, durations, and credits. Auth & scoping: - - Requires `X-API-Key`. You can only access runs belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access runs belonging to your + account. Args: run_id (str): include_step_outputs (bool | Unset): If true, include per-step outputs with timing, durations, and credits. Default: False. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -217,5 +238,6 @@ async def asyncio( run_id=run_id, client=client, include_step_outputs=include_step_outputs, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/agents/get_ai_conversation_history_api_agents_agent_id_ai_assistant_conversations_get.py b/seclai/_generated/api/agents/get_ai_conversation_history_api_agents_agent_id_ai_assistant_conversations_get.py new file mode 100644 index 0000000..0a2538e --- /dev/null +++ b/seclai/_generated/api/agents/get_ai_conversation_history_api_agents_agent_id_ai_assistant_conversations_get.py @@ -0,0 +1,289 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ai_conversation_history_response import AiConversationHistoryResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + step_type: str, + step_id: None | str | Unset = UNSET, + limit: int | Unset = 10, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["step_type"] = step_type + + json_step_id: None | str | Unset + if isinstance(step_id, Unset): + json_step_id = UNSET + else: + json_step_id = step_id + params["step_id"] = json_step_id + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents/{agent_id}/ai-assistant/conversations".format( + agent_id=quote(str(agent_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AiConversationHistoryResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AiConversationHistoryResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AiConversationHistoryResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + step_type: str, + step_id: None | str | Unset = UNSET, + limit: int | Unset = 10, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> Response[AiConversationHistoryResponse | HTTPValidationError]: + """Get AI conversation history + + Fetch the AI assistant conversation history for a specific step of an agent. + + Returns past conversation turns (user inputs, AI responses, accept/decline status) ordered oldest + first. Use `step_type` to filter by step type, and optionally `step_id` to narrow to a specific step + instance. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + queried. + + Args: + agent_id (str): + step_type (str): Step type to look up. + step_id (None | str | Unset): Step ID to filter by. + limit (int | Unset): Max turns to return. Default: 10. + offset (int | Unset): Number of recent turns to skip. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiConversationHistoryResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + step_type=step_type, + step_id=step_id, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + step_type: str, + step_id: None | str | Unset = UNSET, + limit: int | Unset = 10, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> AiConversationHistoryResponse | HTTPValidationError | None: + """Get AI conversation history + + Fetch the AI assistant conversation history for a specific step of an agent. + + Returns past conversation turns (user inputs, AI responses, accept/decline status) ordered oldest + first. Use `step_type` to filter by step type, and optionally `step_id` to narrow to a specific step + instance. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + queried. + + Args: + agent_id (str): + step_type (str): Step type to look up. + step_id (None | str | Unset): Step ID to filter by. + limit (int | Unset): Max turns to return. Default: 10. + offset (int | Unset): Number of recent turns to skip. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiConversationHistoryResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + step_type=step_type, + step_id=step_id, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + step_type: str, + step_id: None | str | Unset = UNSET, + limit: int | Unset = 10, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> Response[AiConversationHistoryResponse | HTTPValidationError]: + """Get AI conversation history + + Fetch the AI assistant conversation history for a specific step of an agent. + + Returns past conversation turns (user inputs, AI responses, accept/decline status) ordered oldest + first. Use `step_type` to filter by step type, and optionally `step_id` to narrow to a specific step + instance. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + queried. + + Args: + agent_id (str): + step_type (str): Step type to look up. + step_id (None | str | Unset): Step ID to filter by. + limit (int | Unset): Max turns to return. Default: 10. + offset (int | Unset): Number of recent turns to skip. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiConversationHistoryResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + step_type=step_type, + step_id=step_id, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + step_type: str, + step_id: None | str | Unset = UNSET, + limit: int | Unset = 10, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> AiConversationHistoryResponse | HTTPValidationError | None: + """Get AI conversation history + + Fetch the AI assistant conversation history for a specific step of an agent. + + Returns past conversation turns (user inputs, AI responses, accept/decline status) ordered oldest + first. Use `step_type` to filter by step type, and optionally `step_id` to narrow to a specific step + instance. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Only agents belonging to your account can be + queried. + + Args: + agent_id (str): + step_type (str): Step type to look up. + step_id (None | str | Unset): Step ID to filter by. + limit (int | Unset): Max turns to return. Default: 10. + offset (int | Unset): Number of recent turns to skip. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiConversationHistoryResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + step_type=step_type, + step_id=step_id, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/list_agent_runs_api_agents_agent_id_runs_get.py b/seclai/_generated/api/agents/list_agent_runs_api_agents_agent_id_runs_get.py index 0e05841..830d623 100644 --- a/seclai/_generated/api/agents/list_agent_runs_api_agents_agent_id_runs_get.py +++ b/seclai/_generated/api/agents/list_agent_runs_api_agents_agent_id_runs_get.py @@ -8,6 +8,9 @@ from ...client import AuthenticatedClient, Client from ...models.agent_run_list_response import AgentRunListResponse from ...models.http_validation_error import HTTPValidationError +from ...models.pending_processing_completed_failed_status import ( + PendingProcessingCompletedFailedStatus, +) from ...types import UNSET, Response, Unset @@ -16,13 +19,28 @@ def _get_kwargs( *, page: int | Unset = 1, limit: int | Unset = 50, + status: None | PendingProcessingCompletedFailedStatus | Unset = UNSET, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + params: dict[str, Any] = {} params["page"] = page params["limit"] = limit + json_status: None | str | Unset + if isinstance(status, Unset): + json_status = UNSET + elif isinstance(status, PendingProcessingCompletedFailedStatus): + json_status = status.value + else: + json_status = status + params["status"] = json_status + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} _kwargs: dict[str, Any] = { @@ -33,6 +51,7 @@ def _get_kwargs( "params": params, } + _kwargs["headers"] = headers return _kwargs @@ -72,25 +91,30 @@ def sync_detailed( client: AuthenticatedClient | Client, page: int | Unset = 1, limit: int | Unset = 50, + status: None | PendingProcessingCompletedFailedStatus | Unset = UNSET, + x_account_id: str | Unset = UNSET, ) -> Response[AgentRunListResponse | HTTPValidationError]: """List agent runs List runs for a specific agent (most recent first), with pagination. Typical use cases: - - Build a run history UI for an agent. + - Build a traces UI for an agent. - Debug recent executions and inspect terminal statuses. Notes: - This endpoint returns a summary list. Fetch full details with `GET /agents/runs/{run_id}`. Auth & scoping: - - Requires `X-API-Key`. You can only list runs for agents in your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only list runs for agents in your + account. Args: agent_id (str): page (int | Unset): Page number Default: 1. limit (int | Unset): Items per page Default: 50. + status (None | PendingProcessingCompletedFailedStatus | Unset): Filter runs by status + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -104,6 +128,8 @@ def sync_detailed( agent_id=agent_id, page=page, limit=limit, + status=status, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -119,25 +145,30 @@ def sync( client: AuthenticatedClient | Client, page: int | Unset = 1, limit: int | Unset = 50, + status: None | PendingProcessingCompletedFailedStatus | Unset = UNSET, + x_account_id: str | Unset = UNSET, ) -> AgentRunListResponse | HTTPValidationError | None: """List agent runs List runs for a specific agent (most recent first), with pagination. Typical use cases: - - Build a run history UI for an agent. + - Build a traces UI for an agent. - Debug recent executions and inspect terminal statuses. Notes: - This endpoint returns a summary list. Fetch full details with `GET /agents/runs/{run_id}`. Auth & scoping: - - Requires `X-API-Key`. You can only list runs for agents in your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only list runs for agents in your + account. Args: agent_id (str): page (int | Unset): Page number Default: 1. limit (int | Unset): Items per page Default: 50. + status (None | PendingProcessingCompletedFailedStatus | Unset): Filter runs by status + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -152,6 +183,8 @@ def sync( client=client, page=page, limit=limit, + status=status, + x_account_id=x_account_id, ).parsed @@ -161,25 +194,30 @@ async def asyncio_detailed( client: AuthenticatedClient | Client, page: int | Unset = 1, limit: int | Unset = 50, + status: None | PendingProcessingCompletedFailedStatus | Unset = UNSET, + x_account_id: str | Unset = UNSET, ) -> Response[AgentRunListResponse | HTTPValidationError]: """List agent runs List runs for a specific agent (most recent first), with pagination. Typical use cases: - - Build a run history UI for an agent. + - Build a traces UI for an agent. - Debug recent executions and inspect terminal statuses. Notes: - This endpoint returns a summary list. Fetch full details with `GET /agents/runs/{run_id}`. Auth & scoping: - - Requires `X-API-Key`. You can only list runs for agents in your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only list runs for agents in your + account. Args: agent_id (str): page (int | Unset): Page number Default: 1. limit (int | Unset): Items per page Default: 50. + status (None | PendingProcessingCompletedFailedStatus | Unset): Filter runs by status + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -193,6 +231,8 @@ async def asyncio_detailed( agent_id=agent_id, page=page, limit=limit, + status=status, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -206,25 +246,30 @@ async def asyncio( client: AuthenticatedClient | Client, page: int | Unset = 1, limit: int | Unset = 50, + status: None | PendingProcessingCompletedFailedStatus | Unset = UNSET, + x_account_id: str | Unset = UNSET, ) -> AgentRunListResponse | HTTPValidationError | None: """List agent runs List runs for a specific agent (most recent first), with pagination. Typical use cases: - - Build a run history UI for an agent. + - Build a traces UI for an agent. - Debug recent executions and inspect terminal statuses. Notes: - This endpoint returns a summary list. Fetch full details with `GET /agents/runs/{run_id}`. Auth & scoping: - - Requires `X-API-Key`. You can only list runs for agents in your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only list runs for agents in your + account. Args: agent_id (str): page (int | Unset): Page number Default: 1. limit (int | Unset): Items per page Default: 50. + status (None | PendingProcessingCompletedFailedStatus | Unset): Filter runs by status + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -240,5 +285,7 @@ async def asyncio( client=client, page=page, limit=limit, + status=status, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/agents/list_agents_api_agents_get.py b/seclai/_generated/api/agents/list_agents_api_agents_get.py new file mode 100644 index 0000000..ee37bc0 --- /dev/null +++ b/seclai/_generated/api/agents/list_agents_api_agents_get.py @@ -0,0 +1,222 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.agent_list_response import AgentListResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["page"] = page + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agents", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AgentListResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AgentListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AgentListResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[AgentListResponse | HTTPValidationError]: + """List agents + + List agents for the account with pagination. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + page=page, + limit=limit, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> AgentListResponse | HTTPValidationError | None: + """List agents + + List agents for the account with pagination. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentListResponse | HTTPValidationError + """ + + return sync_detailed( + client=client, + page=page, + limit=limit, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[AgentListResponse | HTTPValidationError]: + """List agents + + List agents for the account with pagination. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + page=page, + limit=limit, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> AgentListResponse | HTTPValidationError | None: + """List agents + + List agents for the account with pagination. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentListResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + client=client, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch.py b/seclai/_generated/api/agents/mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch.py new file mode 100644 index 0000000..ccd61a4 --- /dev/null +++ b/seclai/_generated/api/agents/mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch.py @@ -0,0 +1,272 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch_response_mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch import ( + MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch, +) +from ...models.mark_ai_suggestion_request import MarkAiSuggestionRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + conversation_id: str, + *, + body: MarkAiSuggestionRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/agents/{agent_id}/ai-assistant/{conversation_id}".format( + agent_id=quote(str(agent_id), safe=""), + conversation_id=quote(str(conversation_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + HTTPValidationError + | MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch + | None +): + if response.status_code == 200: + response_200 = MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + HTTPValidationError + | MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + conversation_id: str, + *, + client: AuthenticatedClient | Client, + body: MarkAiSuggestionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch +]: + """Accept or decline suggestion + + Accept or decline a proposed AI assistant configuration for a conversation turn. + + This only updates the tracking status on the conversation record. To actually apply the proposed + configuration, use the agent definition update endpoint separately. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. The conversation must belong to one of your + agents. + + Args: + agent_id (str): + conversation_id (str): + x_account_id (str | Unset): + body (MarkAiSuggestionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + conversation_id: str, + *, + client: AuthenticatedClient | Client, + body: MarkAiSuggestionRequest, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch + | None +): + """Accept or decline suggestion + + Accept or decline a proposed AI assistant configuration for a conversation turn. + + This only updates the tracking status on the conversation record. To actually apply the proposed + configuration, use the agent definition update endpoint separately. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. The conversation must belong to one of your + agents. + + Args: + agent_id (str): + conversation_id (str): + x_account_id (str | Unset): + body (MarkAiSuggestionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch + """ + + return sync_detailed( + agent_id=agent_id, + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + conversation_id: str, + *, + client: AuthenticatedClient | Client, + body: MarkAiSuggestionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch +]: + """Accept or decline suggestion + + Accept or decline a proposed AI assistant configuration for a conversation turn. + + This only updates the tracking status on the conversation record. To actually apply the proposed + configuration, use the agent definition update endpoint separately. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. The conversation must belong to one of your + agents. + + Args: + agent_id (str): + conversation_id (str): + x_account_id (str | Unset): + body (MarkAiSuggestionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + conversation_id: str, + *, + client: AuthenticatedClient | Client, + body: MarkAiSuggestionRequest, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch + | None +): + """Accept or decline suggestion + + Accept or decline a proposed AI assistant configuration for a conversation turn. + + This only updates the tracking status on the conversation record. To actually apply the proposed + configuration, use the agent definition update endpoint separately. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. The conversation must belong to one of your + agents. + + Args: + agent_id (str): + conversation_id (str): + x_account_id (str | Unset): + body (MarkAiSuggestionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/run_agent_api_agents_agent_id_runs_post.py b/seclai/_generated/api/agents/run_agent_api_agents_agent_id_runs_post.py index 2008936..bc87ede 100644 --- a/seclai/_generated/api/agents/run_agent_api_agents_agent_id_runs_post.py +++ b/seclai/_generated/api/agents/run_agent_api_agents_agent_id_runs_post.py @@ -9,15 +9,18 @@ from ...models.agent_run_request import AgentRunRequest from ...models.agent_run_response import AgentRunResponse from ...models.http_validation_error import HTTPValidationError -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( agent_id: str, *, body: AgentRunRequest, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id _kwargs: dict[str, Any] = { "method": "post", @@ -69,6 +72,7 @@ def sync_detailed( *, client: AuthenticatedClient | Client, body: AgentRunRequest, + x_account_id: str | Unset = UNSET, ) -> Response[AgentRunResponse | HTTPValidationError]: """Run an agent @@ -83,6 +87,9 @@ def sync_detailed( - Use `POST /agents/{agent_id}/runs/stream` if you need real-time progress via SSE. Key fields: + - `input`: text input for agents with a `dynamic_input` trigger. + - `input_upload_id`: alternatively, reference a file previously uploaded via `POST + /agents/{agent_id}/upload-input` (mutually exclusive with `input`). - `priority`: set true for latency-sensitive, user-facing work. - `metadata`: a JSON object that becomes available to agent steps for string substitution. @@ -91,10 +98,12 @@ def sync_detailed( - Use `include_step_outputs=true` to include per-step outputs, timing, and credits. Auth & scoping: - - Requires `X-API-Key`. All resources are scoped to the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. Args: agent_id (str): + x_account_id (str | Unset): body (AgentRunRequest): Raises: @@ -108,6 +117,7 @@ def sync_detailed( kwargs = _get_kwargs( agent_id=agent_id, body=body, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -122,6 +132,7 @@ def sync( *, client: AuthenticatedClient | Client, body: AgentRunRequest, + x_account_id: str | Unset = UNSET, ) -> AgentRunResponse | HTTPValidationError | None: """Run an agent @@ -136,6 +147,9 @@ def sync( - Use `POST /agents/{agent_id}/runs/stream` if you need real-time progress via SSE. Key fields: + - `input`: text input for agents with a `dynamic_input` trigger. + - `input_upload_id`: alternatively, reference a file previously uploaded via `POST + /agents/{agent_id}/upload-input` (mutually exclusive with `input`). - `priority`: set true for latency-sensitive, user-facing work. - `metadata`: a JSON object that becomes available to agent steps for string substitution. @@ -144,10 +158,12 @@ def sync( - Use `include_step_outputs=true` to include per-step outputs, timing, and credits. Auth & scoping: - - Requires `X-API-Key`. All resources are scoped to the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. Args: agent_id (str): + x_account_id (str | Unset): body (AgentRunRequest): Raises: @@ -162,6 +178,7 @@ def sync( agent_id=agent_id, client=client, body=body, + x_account_id=x_account_id, ).parsed @@ -170,6 +187,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient | Client, body: AgentRunRequest, + x_account_id: str | Unset = UNSET, ) -> Response[AgentRunResponse | HTTPValidationError]: """Run an agent @@ -184,6 +202,9 @@ async def asyncio_detailed( - Use `POST /agents/{agent_id}/runs/stream` if you need real-time progress via SSE. Key fields: + - `input`: text input for agents with a `dynamic_input` trigger. + - `input_upload_id`: alternatively, reference a file previously uploaded via `POST + /agents/{agent_id}/upload-input` (mutually exclusive with `input`). - `priority`: set true for latency-sensitive, user-facing work. - `metadata`: a JSON object that becomes available to agent steps for string substitution. @@ -192,10 +213,12 @@ async def asyncio_detailed( - Use `include_step_outputs=true` to include per-step outputs, timing, and credits. Auth & scoping: - - Requires `X-API-Key`. All resources are scoped to the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. Args: agent_id (str): + x_account_id (str | Unset): body (AgentRunRequest): Raises: @@ -209,6 +232,7 @@ async def asyncio_detailed( kwargs = _get_kwargs( agent_id=agent_id, body=body, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -221,6 +245,7 @@ async def asyncio( *, client: AuthenticatedClient | Client, body: AgentRunRequest, + x_account_id: str | Unset = UNSET, ) -> AgentRunResponse | HTTPValidationError | None: """Run an agent @@ -235,6 +260,9 @@ async def asyncio( - Use `POST /agents/{agent_id}/runs/stream` if you need real-time progress via SSE. Key fields: + - `input`: text input for agents with a `dynamic_input` trigger. + - `input_upload_id`: alternatively, reference a file previously uploaded via `POST + /agents/{agent_id}/upload-input` (mutually exclusive with `input`). - `priority`: set true for latency-sensitive, user-facing work. - `metadata`: a JSON object that becomes available to agent steps for string substitution. @@ -243,10 +271,12 @@ async def asyncio( - Use `include_step_outputs=true` to include per-step outputs, timing, and credits. Auth & scoping: - - Requires `X-API-Key`. All resources are scoped to the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. Args: agent_id (str): + x_account_id (str | Unset): body (AgentRunRequest): Raises: @@ -262,5 +292,6 @@ async def asyncio( agent_id=agent_id, client=client, body=body, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/agents/run_streaming_agent_api_agents_agent_id_runs_stream_post.py b/seclai/_generated/api/agents/run_streaming_agent_api_agents_agent_id_runs_stream_post.py index d18ebda..2fd0b7a 100644 --- a/seclai/_generated/api/agents/run_streaming_agent_api_agents_agent_id_runs_stream_post.py +++ b/seclai/_generated/api/agents/run_streaming_agent_api_agents_agent_id_runs_stream_post.py @@ -8,15 +8,18 @@ from ...client import AuthenticatedClient, Client from ...models.agent_run_stream_request import AgentRunStreamRequest from ...models.http_validation_error import HTTPValidationError -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( agent_id: str, *, body: AgentRunStreamRequest, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id _kwargs: dict[str, Any] = { "method": "post", @@ -67,6 +70,7 @@ def sync_detailed( *, client: AuthenticatedClient | Client, body: AgentRunStreamRequest, + x_account_id: str | Unset = UNSET, ) -> Response[Any | HTTPValidationError]: """Run an agent (stream events) @@ -80,16 +84,23 @@ def sync_detailed( - The final `done` event contains the terminal snapshot (including `output` and `credits` when available). + Input options (for `dynamic_input` triggers): + - `input`: text input passed directly. + - `input_upload_id`: reference a file uploaded via `POST /agents/{agent_id}/upload-input` (mutually + exclusive with `input`). + Client guidance: - Keep the connection open and handle keepalive comments. - On `timeout` or `error`, the payload includes `run_id` so clients can resume by polling `GET /agents/runs/{run_id}`. Auth & scoping: - - Requires `X-API-Key`. All resources are scoped to the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. Args: agent_id (str): + x_account_id (str | Unset): body (AgentRunStreamRequest): Raises: @@ -103,6 +114,7 @@ def sync_detailed( kwargs = _get_kwargs( agent_id=agent_id, body=body, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -117,6 +129,7 @@ def sync( *, client: AuthenticatedClient | Client, body: AgentRunStreamRequest, + x_account_id: str | Unset = UNSET, ) -> Any | HTTPValidationError | None: """Run an agent (stream events) @@ -130,16 +143,23 @@ def sync( - The final `done` event contains the terminal snapshot (including `output` and `credits` when available). + Input options (for `dynamic_input` triggers): + - `input`: text input passed directly. + - `input_upload_id`: reference a file uploaded via `POST /agents/{agent_id}/upload-input` (mutually + exclusive with `input`). + Client guidance: - Keep the connection open and handle keepalive comments. - On `timeout` or `error`, the payload includes `run_id` so clients can resume by polling `GET /agents/runs/{run_id}`. Auth & scoping: - - Requires `X-API-Key`. All resources are scoped to the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. Args: agent_id (str): + x_account_id (str | Unset): body (AgentRunStreamRequest): Raises: @@ -154,6 +174,7 @@ def sync( agent_id=agent_id, client=client, body=body, + x_account_id=x_account_id, ).parsed @@ -162,6 +183,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient | Client, body: AgentRunStreamRequest, + x_account_id: str | Unset = UNSET, ) -> Response[Any | HTTPValidationError]: """Run an agent (stream events) @@ -175,16 +197,23 @@ async def asyncio_detailed( - The final `done` event contains the terminal snapshot (including `output` and `credits` when available). + Input options (for `dynamic_input` triggers): + - `input`: text input passed directly. + - `input_upload_id`: reference a file uploaded via `POST /agents/{agent_id}/upload-input` (mutually + exclusive with `input`). + Client guidance: - Keep the connection open and handle keepalive comments. - On `timeout` or `error`, the payload includes `run_id` so clients can resume by polling `GET /agents/runs/{run_id}`. Auth & scoping: - - Requires `X-API-Key`. All resources are scoped to the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. Args: agent_id (str): + x_account_id (str | Unset): body (AgentRunStreamRequest): Raises: @@ -198,6 +227,7 @@ async def asyncio_detailed( kwargs = _get_kwargs( agent_id=agent_id, body=body, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -210,6 +240,7 @@ async def asyncio( *, client: AuthenticatedClient | Client, body: AgentRunStreamRequest, + x_account_id: str | Unset = UNSET, ) -> Any | HTTPValidationError | None: """Run an agent (stream events) @@ -223,16 +254,23 @@ async def asyncio( - The final `done` event contains the terminal snapshot (including `output` and `credits` when available). + Input options (for `dynamic_input` triggers): + - `input`: text input passed directly. + - `input_upload_id`: reference a file uploaded via `POST /agents/{agent_id}/upload-input` (mutually + exclusive with `input`). + Client guidance: - Keep the connection open and handle keepalive comments. - On `timeout` or `error`, the payload includes `run_id` so clients can resume by polling `GET /agents/runs/{run_id}`. Auth & scoping: - - Requires `X-API-Key`. All resources are scoped to the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. Args: agent_id (str): + x_account_id (str | Unset): body (AgentRunStreamRequest): Raises: @@ -248,5 +286,6 @@ async def asyncio( agent_id=agent_id, client=client, body=body, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/agents/search_agent_runs_api_agents_runs_search_post.py b/seclai/_generated/api/agents/search_agent_runs_api_agents_runs_search_post.py new file mode 100644 index 0000000..153199f --- /dev/null +++ b/seclai/_generated/api/agents/search_agent_runs_api_agents_runs_search_post.py @@ -0,0 +1,225 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.agent_trace_search_request import AgentTraceSearchRequest +from ...models.agent_trace_search_response import AgentTraceSearchResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: AgentTraceSearchRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/agents/runs/search", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AgentTraceSearchResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AgentTraceSearchResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AgentTraceSearchResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: AgentTraceSearchRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AgentTraceSearchResponse | HTTPValidationError]: + """Search agent traces + + Search agent traces using semantic similarity. + + Finds step-run outputs that are most semantically similar to the query. + Results include the matching text, agent/step metadata, and a similarity score. + + Agent traces are automatically indexed when runs complete. The first 7 days of storage are free; + extended retention is billed. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Searches only within your account's traces. + + Args: + x_account_id (str | Unset): + body (AgentTraceSearchRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentTraceSearchResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: AgentTraceSearchRequest, + x_account_id: str | Unset = UNSET, +) -> AgentTraceSearchResponse | HTTPValidationError | None: + """Search agent traces + + Search agent traces using semantic similarity. + + Finds step-run outputs that are most semantically similar to the query. + Results include the matching text, agent/step metadata, and a similarity score. + + Agent traces are automatically indexed when runs complete. The first 7 days of storage are free; + extended retention is billed. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Searches only within your account's traces. + + Args: + x_account_id (str | Unset): + body (AgentTraceSearchRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentTraceSearchResponse | HTTPValidationError + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: AgentTraceSearchRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AgentTraceSearchResponse | HTTPValidationError]: + """Search agent traces + + Search agent traces using semantic similarity. + + Finds step-run outputs that are most semantically similar to the query. + Results include the matching text, agent/step metadata, and a similarity score. + + Agent traces are automatically indexed when runs complete. The first 7 days of storage are free; + extended retention is billed. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Searches only within your account's traces. + + Args: + x_account_id (str | Unset): + body (AgentTraceSearchRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentTraceSearchResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: AgentTraceSearchRequest, + x_account_id: str | Unset = UNSET, +) -> AgentTraceSearchResponse | HTTPValidationError | None: + """Search agent traces + + Search agent traces using semantic similarity. + + Finds step-run outputs that are most semantically similar to the query. + Results include the matching text, agent/step metadata, and a similarity score. + + Agent traces are automatically indexed when runs complete. The first 7 days of storage are free; + extended retention is billed. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Searches only within your account's traces. + + Args: + x_account_id (str | Unset): + body (AgentTraceSearchRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentTraceSearchResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/update_agent_api_agents_agent_id_put.py b/seclai/_generated/api/agents/update_agent_api_agents_agent_id_put.py new file mode 100644 index 0000000..e743aa0 --- /dev/null +++ b/seclai/_generated/api/agents/update_agent_api_agents_agent_id_put.py @@ -0,0 +1,265 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.agent_summary_response import AgentSummaryResponse +from ...models.http_validation_error import HTTPValidationError +from ...models.update_agent_request import UpdateAgentRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + body: UpdateAgentRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "put", + "url": "/agents/{agent_id}".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AgentSummaryResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AgentSummaryResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AgentSummaryResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAgentRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AgentSummaryResponse | HTTPValidationError]: + """Update agent metadata + + Update an agent's name, description, evaluation settings, and model lifecycle settings. + + Evaluation settings: `evaluation_mode` ('output_expectation', 'eval_and_retry', 'sample_and_flag'), + `default_evaluation_tier` ('fast', 'balanced', 'thorough'), `max_retries`, `retry_on_failure`, + `sampling_config`. + + Model lifecycle settings: `prompt_model_auto_upgrade_strategy` ('none', 'early_adopter', + 'middle_of_road', 'cautious_adopter'), `prompt_model_auto_rollback_enabled`, + `prompt_model_auto_rollback_triggers` (list of 'agent_eval_fail', 'governance_flag', + 'governance_block', 'agent_run_failed'). + + At least one field must be provided. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (UpdateAgentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentSummaryResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAgentRequest, + x_account_id: str | Unset = UNSET, +) -> AgentSummaryResponse | HTTPValidationError | None: + """Update agent metadata + + Update an agent's name, description, evaluation settings, and model lifecycle settings. + + Evaluation settings: `evaluation_mode` ('output_expectation', 'eval_and_retry', 'sample_and_flag'), + `default_evaluation_tier` ('fast', 'balanced', 'thorough'), `max_retries`, `retry_on_failure`, + `sampling_config`. + + Model lifecycle settings: `prompt_model_auto_upgrade_strategy` ('none', 'early_adopter', + 'middle_of_road', 'cautious_adopter'), `prompt_model_auto_rollback_enabled`, + `prompt_model_auto_rollback_triggers` (list of 'agent_eval_fail', 'governance_flag', + 'governance_block', 'agent_run_failed'). + + At least one field must be provided. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (UpdateAgentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentSummaryResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAgentRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AgentSummaryResponse | HTTPValidationError]: + """Update agent metadata + + Update an agent's name, description, evaluation settings, and model lifecycle settings. + + Evaluation settings: `evaluation_mode` ('output_expectation', 'eval_and_retry', 'sample_and_flag'), + `default_evaluation_tier` ('fast', 'balanced', 'thorough'), `max_retries`, `retry_on_failure`, + `sampling_config`. + + Model lifecycle settings: `prompt_model_auto_upgrade_strategy` ('none', 'early_adopter', + 'middle_of_road', 'cautious_adopter'), `prompt_model_auto_rollback_enabled`, + `prompt_model_auto_rollback_triggers` (list of 'agent_eval_fail', 'governance_flag', + 'governance_block', 'agent_run_failed'). + + At least one field must be provided. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (UpdateAgentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentSummaryResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAgentRequest, + x_account_id: str | Unset = UNSET, +) -> AgentSummaryResponse | HTTPValidationError | None: + """Update agent metadata + + Update an agent's name, description, evaluation settings, and model lifecycle settings. + + Evaluation settings: `evaluation_mode` ('output_expectation', 'eval_and_retry', 'sample_and_flag'), + `default_evaluation_tier` ('fast', 'balanced', 'thorough'), `max_retries`, `retry_on_failure`, + `sampling_config`. + + Model lifecycle settings: `prompt_model_auto_upgrade_strategy` ('none', 'early_adopter', + 'middle_of_road', 'cautious_adopter'), `prompt_model_auto_rollback_enabled`, + `prompt_model_auto_rollback_triggers` (list of 'agent_eval_fail', 'governance_flag', + 'governance_block', 'agent_run_failed'). + + At least one field must be provided. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (UpdateAgentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentSummaryResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/agents/update_agent_definition_api_agents_agent_id_definition_put.py b/seclai/_generated/api/agents/update_agent_definition_api_agents_agent_id_definition_put.py new file mode 100644 index 0000000..7efeb94 --- /dev/null +++ b/seclai/_generated/api/agents/update_agent_definition_api_agents_agent_id_definition_put.py @@ -0,0 +1,281 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.agent_definition_response import AgentDefinitionResponse +from ...models.http_validation_error import HTTPValidationError +from ...models.update_agent_definition_request import UpdateAgentDefinitionRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + agent_id: str, + *, + body: UpdateAgentDefinitionRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "put", + "url": "/agents/{agent_id}/definition".format( + agent_id=quote(str(agent_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AgentDefinitionResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AgentDefinitionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AgentDefinitionResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAgentDefinitionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AgentDefinitionResponse | HTTPValidationError]: + """Update agent definition + + Update the agent's definition on the main branch. + + Uses **optimistic locking**: provide `expected_change_id` from the last `GET + /api/agents/{agent_id}/definition`. Returns `409 Conflict` if the definition was modified since your + last read. + + The definition contains the agent's step workflow. Step types include `prompt_call`, `retrieval`, + `transform`, `gate`, `retry`, `evaluate_step`, `insight`, `extract_json`, `extract_html`, + `extract_xml`, `send_email`, `webhook_call`, `write_aws_s3_object`, `call_agent`, `write_metadata`, + `write_content_attachment`, `load_content_attachment`, `load_content`, `display_result`, `join`, + `combinator`, and `text`. Non-composite step types (`display_result`, `join`, `retry`, + `evaluate_step`) cannot contain child steps. + + **Retry steps** re-execute from a target ancestor step for quality-control loops. Configure with + `target_step_id` (ancestor step ID) and `max_retries` (1–10). Best practice: place a `gate` step + before the retry to make retries conditional. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (UpdateAgentDefinitionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentDefinitionResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAgentDefinitionRequest, + x_account_id: str | Unset = UNSET, +) -> AgentDefinitionResponse | HTTPValidationError | None: + """Update agent definition + + Update the agent's definition on the main branch. + + Uses **optimistic locking**: provide `expected_change_id` from the last `GET + /api/agents/{agent_id}/definition`. Returns `409 Conflict` if the definition was modified since your + last read. + + The definition contains the agent's step workflow. Step types include `prompt_call`, `retrieval`, + `transform`, `gate`, `retry`, `evaluate_step`, `insight`, `extract_json`, `extract_html`, + `extract_xml`, `send_email`, `webhook_call`, `write_aws_s3_object`, `call_agent`, `write_metadata`, + `write_content_attachment`, `load_content_attachment`, `load_content`, `display_result`, `join`, + `combinator`, and `text`. Non-composite step types (`display_result`, `join`, `retry`, + `evaluate_step`) cannot contain child steps. + + **Retry steps** re-execute from a target ancestor step for quality-control loops. Configure with + `target_step_id` (ancestor step ID) and `max_retries` (1–10). Best practice: place a `gate` step + before the retry to make retries conditional. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (UpdateAgentDefinitionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentDefinitionResponse | HTTPValidationError + """ + + return sync_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAgentDefinitionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AgentDefinitionResponse | HTTPValidationError]: + """Update agent definition + + Update the agent's definition on the main branch. + + Uses **optimistic locking**: provide `expected_change_id` from the last `GET + /api/agents/{agent_id}/definition`. Returns `409 Conflict` if the definition was modified since your + last read. + + The definition contains the agent's step workflow. Step types include `prompt_call`, `retrieval`, + `transform`, `gate`, `retry`, `evaluate_step`, `insight`, `extract_json`, `extract_html`, + `extract_xml`, `send_email`, `webhook_call`, `write_aws_s3_object`, `call_agent`, `write_metadata`, + `write_content_attachment`, `load_content_attachment`, `load_content`, `display_result`, `join`, + `combinator`, and `text`. Non-composite step types (`display_result`, `join`, `retry`, + `evaluate_step`) cannot contain child steps. + + **Retry steps** re-execute from a target ancestor step for quality-control loops. Configure with + `target_step_id` (ancestor step ID) and `max_retries` (1–10). Best practice: place a `gate` step + before the retry to make retries conditional. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (UpdateAgentDefinitionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentDefinitionResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + agent_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAgentDefinitionRequest, + x_account_id: str | Unset = UNSET, +) -> AgentDefinitionResponse | HTTPValidationError | None: + """Update agent definition + + Update the agent's definition on the main branch. + + Uses **optimistic locking**: provide `expected_change_id` from the last `GET + /api/agents/{agent_id}/definition`. Returns `409 Conflict` if the definition was modified since your + last read. + + The definition contains the agent's step workflow. Step types include `prompt_call`, `retrieval`, + `transform`, `gate`, `retry`, `evaluate_step`, `insight`, `extract_json`, `extract_html`, + `extract_xml`, `send_email`, `webhook_call`, `write_aws_s3_object`, `call_agent`, `write_metadata`, + `write_content_attachment`, `load_content_attachment`, `load_content`, `display_result`, `join`, + `combinator`, and `text`. Non-composite step types (`display_result`, `join`, `retry`, + `evaluate_step`) cannot contain child steps. + + **Retry steps** re-execute from a target ancestor step for quality-control loops. Configure with + `target_step_id` (ancestor step ID) and `max_retries` (1–10). Best practice: place a `gate` step + before the retry to make retries conditional. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update agents belonging to your + account. + + Args: + agent_id (str): + x_account_id (str | Unset): + body (UpdateAgentDefinitionRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentDefinitionResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + agent_id=agent_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/ai_assistant/__init__.py b/seclai/_generated/api/ai_assistant/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/ai_assistant/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/ai_assistant/api_ai_accept_api_ai_assistant_conversation_id_accept_post.py b/seclai/_generated/api/ai_assistant/api_ai_accept_api_ai_assistant_conversation_id_accept_post.py new file mode 100644 index 0000000..346f61a --- /dev/null +++ b/seclai/_generated/api/ai_assistant/api_ai_accept_api_ai_assistant_conversation_id_accept_post.py @@ -0,0 +1,218 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ai_assistant_accept_request import AiAssistantAcceptRequest +from ...models.ai_assistant_accept_response import AiAssistantAcceptResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + conversation_id: UUID, + *, + body: AiAssistantAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/ai-assistant/{conversation_id}/accept".format( + conversation_id=quote(str(conversation_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AiAssistantAcceptResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AiAssistantAcceptResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AiAssistantAcceptResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantAcceptResponse | HTTPValidationError]: + """Accept and execute a standalone plan + + Accept and execute a previously proposed standalone plan. If the plan contains destructive actions + (deletions), ``confirm_deletions`` must be set to true. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (AiAssistantAcceptRequest): Request body for accepting a proposed plan. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantAcceptResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantAcceptResponse | HTTPValidationError | None: + """Accept and execute a standalone plan + + Accept and execute a previously proposed standalone plan. If the plan contains destructive actions + (deletions), ``confirm_deletions`` must be set to true. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (AiAssistantAcceptRequest): Request body for accepting a proposed plan. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantAcceptResponse | HTTPValidationError + """ + + return sync_detailed( + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantAcceptResponse | HTTPValidationError]: + """Accept and execute a standalone plan + + Accept and execute a previously proposed standalone plan. If the plan contains destructive actions + (deletions), ``confirm_deletions`` must be set to true. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (AiAssistantAcceptRequest): Request body for accepting a proposed plan. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantAcceptResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantAcceptResponse | HTTPValidationError | None: + """Accept and execute a standalone plan + + Accept and execute a previously proposed standalone plan. If the plan contains destructive actions + (deletions), ``confirm_deletions`` must be set to true. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (AiAssistantAcceptRequest): Request body for accepting a proposed plan. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantAcceptResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/ai_assistant/api_ai_decline_api_ai_assistant_conversation_id_decline_post.py b/seclai/_generated/api/ai_assistant/api_ai_decline_api_ai_assistant_conversation_id_decline_post.py new file mode 100644 index 0000000..5ac92c4 --- /dev/null +++ b/seclai/_generated/api/ai_assistant/api_ai_decline_api_ai_assistant_conversation_id_decline_post.py @@ -0,0 +1,198 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + conversation_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/ai-assistant/{conversation_id}/decline".format( + conversation_id=quote(str(conversation_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Decline a standalone plan + + Decline a previously proposed standalone plan. No resources are modified. The conversation is marked + as declined. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Decline a standalone plan + + Decline a previously proposed standalone plan. No resources are modified. The conversation is marked + as declined. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + conversation_id=conversation_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Decline a standalone plan + + Decline a previously proposed standalone plan. No resources are modified. The conversation is marked + as declined. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Decline a standalone plan + + Decline a previously proposed standalone plan. No resources are modified. The conversation is marked + as declined. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + conversation_id=conversation_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/ai_assistant/api_ai_feedback_api_ai_assistant_feedback_post.py b/seclai/_generated/api/ai_assistant/api_ai_feedback_api_ai_assistant_feedback_post.py new file mode 100644 index 0000000..45f222e --- /dev/null +++ b/seclai/_generated/api/ai_assistant/api_ai_feedback_api_ai_assistant_feedback_post.py @@ -0,0 +1,201 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ai_assistant_feedback_request import AiAssistantFeedbackRequest +from ...models.ai_assistant_feedback_response import AiAssistantFeedbackResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: AiAssistantFeedbackRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/ai-assistant/feedback", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AiAssistantFeedbackResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AiAssistantFeedbackResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AiAssistantFeedbackResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: AiAssistantFeedbackRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantFeedbackResponse | HTTPValidationError]: + """Submit AI assistant feedback + + Submit thumbs-up/down feedback on any AI assistant interaction. Negative feedback with a comment is + analyzed for concerning issues. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantFeedbackRequest): Request body for submitting AI assistant feedback. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantFeedbackResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: AiAssistantFeedbackRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantFeedbackResponse | HTTPValidationError | None: + """Submit AI assistant feedback + + Submit thumbs-up/down feedback on any AI assistant interaction. Negative feedback with a comment is + analyzed for concerning issues. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantFeedbackRequest): Request body for submitting AI assistant feedback. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantFeedbackResponse | HTTPValidationError + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: AiAssistantFeedbackRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantFeedbackResponse | HTTPValidationError]: + """Submit AI assistant feedback + + Submit thumbs-up/down feedback on any AI assistant interaction. Negative feedback with a comment is + analyzed for concerning issues. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantFeedbackRequest): Request body for submitting AI assistant feedback. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantFeedbackResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: AiAssistantFeedbackRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantFeedbackResponse | HTTPValidationError | None: + """Submit AI assistant feedback + + Submit thumbs-up/down feedback on any AI assistant interaction. Negative feedback with a comment is + analyzed for concerning issues. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantFeedbackRequest): Request body for submitting AI assistant feedback. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantFeedbackResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/ai_assistant/api_ai_knowledge_base_api_ai_assistant_knowledge_base_post.py b/seclai/_generated/api/ai_assistant/api_ai_knowledge_base_api_ai_assistant_knowledge_base_post.py new file mode 100644 index 0000000..3d25770 --- /dev/null +++ b/seclai/_generated/api/ai_assistant/api_ai_knowledge_base_api_ai_assistant_knowledge_base_post.py @@ -0,0 +1,201 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ai_assistant_generate_request import AiAssistantGenerateRequest +from ...models.ai_assistant_generate_response import AiAssistantGenerateResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/ai-assistant/knowledge-base", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AiAssistantGenerateResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate a knowledge base plan (standalone) + + Generate a knowledge base creation/modification plan without requiring an existing solution. May + also propose prerequisite source creation actions. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate a knowledge base plan (standalone) + + Generate a knowledge base creation/modification plan without requiring an existing solution. May + also propose prerequisite source creation actions. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate a knowledge base plan (standalone) + + Generate a knowledge base creation/modification plan without requiring an existing solution. May + also propose prerequisite source creation actions. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate a knowledge base plan (standalone) + + Generate a knowledge base creation/modification plan without requiring an existing solution. May + also propose prerequisite source creation actions. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/ai_assistant/api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch.py b/seclai/_generated/api/ai_assistant/api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch.py new file mode 100644 index 0000000..feebb72 --- /dev/null +++ b/seclai/_generated/api/ai_assistant/api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch.py @@ -0,0 +1,247 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch_response_api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch import ( + ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch, +) +from ...models.http_validation_error import HTTPValidationError +from ...models.memory_bank_accept_request import MemoryBankAcceptRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + conversation_id: UUID, + *, + body: MemoryBankAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/ai-assistant/memory-bank/{conversation_id}".format( + conversation_id=quote(str(conversation_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch + | HTTPValidationError + | None +): + if response.status_code == 200: + response_200 = ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch + | HTTPValidationError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MemoryBankAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch + | HTTPValidationError +]: + """Accept or decline a memory bank AI suggestion + + Update the acceptance status of a memory bank AI assistant conversation turn. Set ``accepted`` to + true to accept the proposed configuration, or false to decline it. The accepted status is recorded + for audit purposes. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (MemoryBankAcceptRequest): Accept or decline a memory bank AI suggestion. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch | HTTPValidationError] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MemoryBankAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> ( + ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch + | HTTPValidationError + | None +): + """Accept or decline a memory bank AI suggestion + + Update the acceptance status of a memory bank AI assistant conversation turn. Set ``accepted`` to + true to accept the proposed configuration, or false to decline it. The accepted status is recorded + for audit purposes. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (MemoryBankAcceptRequest): Accept or decline a memory bank AI suggestion. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch | HTTPValidationError + """ + + return sync_detailed( + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MemoryBankAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch + | HTTPValidationError +]: + """Accept or decline a memory bank AI suggestion + + Update the acceptance status of a memory bank AI assistant conversation turn. Set ``accepted`` to + true to accept the proposed configuration, or false to decline it. The accepted status is recorded + for audit purposes. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (MemoryBankAcceptRequest): Accept or decline a memory bank AI suggestion. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch | HTTPValidationError] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MemoryBankAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> ( + ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch + | HTTPValidationError + | None +): + """Accept or decline a memory bank AI suggestion + + Update the acceptance status of a memory bank AI assistant conversation turn. Set ``accepted`` to + true to accept the proposed configuration, or false to decline it. The accepted status is recorded + for audit purposes. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (MemoryBankAcceptRequest): Accept or decline a memory bank AI suggestion. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch | HTTPValidationError + """ + + return ( + await asyncio_detailed( + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/ai_assistant/api_ai_memory_bank_api_ai_assistant_memory_bank_post.py b/seclai/_generated/api/ai_assistant/api_ai_memory_bank_api_ai_assistant_memory_bank_post.py new file mode 100644 index 0000000..d986a31 --- /dev/null +++ b/seclai/_generated/api/ai_assistant/api_ai_memory_bank_api_ai_assistant_memory_bank_post.py @@ -0,0 +1,201 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.memory_bank_ai_assistant_request import MemoryBankAiAssistantRequest +from ...models.memory_bank_ai_assistant_response import MemoryBankAiAssistantResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: MemoryBankAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/ai-assistant/memory-bank", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | MemoryBankAiAssistantResponse | None: + if response.status_code == 200: + response_200 = MemoryBankAiAssistantResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | MemoryBankAiAssistantResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: MemoryBankAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBankAiAssistantResponse]: + """Generate a memory bank configuration (standalone) + + Generate a memory bank configuration suggestion via the AI assistant. The AI proposes name, type, + mode, compaction prompt, and retention settings. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (MemoryBankAiAssistantRequest): Request body for the memory bank AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBankAiAssistantResponse] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: MemoryBankAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBankAiAssistantResponse | None: + """Generate a memory bank configuration (standalone) + + Generate a memory bank configuration suggestion via the AI assistant. The AI proposes name, type, + mode, compaction prompt, and retention settings. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (MemoryBankAiAssistantRequest): Request body for the memory bank AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBankAiAssistantResponse + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: MemoryBankAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBankAiAssistantResponse]: + """Generate a memory bank configuration (standalone) + + Generate a memory bank configuration suggestion via the AI assistant. The AI proposes name, type, + mode, compaction prompt, and retention settings. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (MemoryBankAiAssistantRequest): Request body for the memory bank AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBankAiAssistantResponse] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: MemoryBankAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBankAiAssistantResponse | None: + """Generate a memory bank configuration (standalone) + + Generate a memory bank configuration suggestion via the AI assistant. The AI proposes name, type, + mode, compaction prompt, and retention settings. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (MemoryBankAiAssistantRequest): Request body for the memory bank AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBankAiAssistantResponse + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/ai_assistant/api_ai_memory_bank_history_api_ai_assistant_memory_bank_last_conversation_get.py b/seclai/_generated/api/ai_assistant/api_ai_memory_bank_history_api_ai_assistant_memory_bank_last_conversation_get.py new file mode 100644 index 0000000..9974d84 --- /dev/null +++ b/seclai/_generated/api/ai_assistant/api_ai_memory_bank_history_api_ai_assistant_memory_bank_last_conversation_get.py @@ -0,0 +1,224 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.memory_bank_last_conversation_response import ( + MemoryBankLastConversationResponse, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: int | Unset = 5, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/ai-assistant/memory-bank/last-conversation", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | MemoryBankLastConversationResponse | None: + if response.status_code == 200: + response_200 = MemoryBankLastConversationResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | MemoryBankLastConversationResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 5, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBankLastConversationResponse]: + """Fetch memory bank AI conversation history + + Fetch the most recent memory bank AI assistant conversation turns for the authenticated user. + Returns turns in oldest-first order with a total count for pagination via limit/offset query + parameters. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + limit (int | Unset): Max turns. Default: 5. + offset (int | Unset): Skip count. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBankLastConversationResponse] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 5, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBankLastConversationResponse | None: + """Fetch memory bank AI conversation history + + Fetch the most recent memory bank AI assistant conversation turns for the authenticated user. + Returns turns in oldest-first order with a total count for pagination via limit/offset query + parameters. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + limit (int | Unset): Max turns. Default: 5. + offset (int | Unset): Skip count. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBankLastConversationResponse + """ + + return sync_detailed( + client=client, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 5, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBankLastConversationResponse]: + """Fetch memory bank AI conversation history + + Fetch the most recent memory bank AI assistant conversation turns for the authenticated user. + Returns turns in oldest-first order with a total count for pagination via limit/offset query + parameters. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + limit (int | Unset): Max turns. Default: 5. + offset (int | Unset): Skip count. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBankLastConversationResponse] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 5, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBankLastConversationResponse | None: + """Fetch memory bank AI conversation history + + Fetch the most recent memory bank AI assistant conversation turns for the authenticated user. + Returns turns in oldest-first order with a total count for pagination via limit/offset query + parameters. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + limit (int | Unset): Max turns. Default: 5. + offset (int | Unset): Skip count. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBankLastConversationResponse + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/ai_assistant/api_ai_solution_api_ai_assistant_solution_post.py b/seclai/_generated/api/ai_assistant/api_ai_solution_api_ai_assistant_solution_post.py new file mode 100644 index 0000000..00e2da9 --- /dev/null +++ b/seclai/_generated/api/ai_assistant/api_ai_solution_api_ai_assistant_solution_post.py @@ -0,0 +1,201 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ai_assistant_generate_request import AiAssistantGenerateRequest +from ...models.ai_assistant_generate_response import AiAssistantGenerateResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/ai-assistant/solution", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AiAssistantGenerateResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate a solution plan (standalone) + + Generate a complete solution plan covering sources, knowledge bases, and agents without requiring an + existing solution. Supports SSE streaming when ``Accept: text/event-stream`` is set. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate a solution plan (standalone) + + Generate a complete solution plan covering sources, knowledge bases, and agents without requiring an + existing solution. Supports SSE streaming when ``Accept: text/event-stream`` is set. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate a solution plan (standalone) + + Generate a complete solution plan covering sources, knowledge bases, and agents without requiring an + existing solution. Supports SSE streaming when ``Accept: text/event-stream`` is set. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate a solution plan (standalone) + + Generate a complete solution plan covering sources, knowledge bases, and agents without requiring an + existing solution. Supports SSE streaming when ``Accept: text/event-stream`` is set. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/ai_assistant/api_ai_source_api_ai_assistant_source_post.py b/seclai/_generated/api/ai_assistant/api_ai_source_api_ai_assistant_source_post.py new file mode 100644 index 0000000..7700f96 --- /dev/null +++ b/seclai/_generated/api/ai_assistant/api_ai_source_api_ai_assistant_source_post.py @@ -0,0 +1,201 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ai_assistant_generate_request import AiAssistantGenerateRequest +from ...models.ai_assistant_generate_response import AiAssistantGenerateResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/ai-assistant/source", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AiAssistantGenerateResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate a source plan (standalone) + + Generate a content source creation/modification plan without requiring an existing solution. The AI + proposes actions for the user to review before any changes are made. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate a source plan (standalone) + + Generate a content source creation/modification plan without requiring an existing solution. The AI + proposes actions for the user to review before any changes are made. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate a source plan (standalone) + + Generate a content source creation/modification plan without requiring an existing solution. The AI + proposes actions for the user to review before any changes are made. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate a source plan (standalone) + + Generate a content source creation/modification plan without requiring an existing solution. The AI + proposes actions for the user to review before any changes are made. + + Auth: requires ``X-API-Key`` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/__init__.py b/seclai/_generated/api/alerts/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/alerts/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/alerts/add_alert_comment_api_alerts_alert_id_comments_post.py b/seclai/_generated/api/alerts/add_alert_comment_api_alerts_alert_id_comments_post.py new file mode 100644 index 0000000..943d7c4 --- /dev/null +++ b/seclai/_generated/api/alerts/add_alert_comment_api_alerts_alert_id_comments_post.py @@ -0,0 +1,246 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.add_alert_comment_api_alerts_alert_id_comments_post_response_add_alert_comment_api_alerts_alert_id_comments_post import ( + AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost, +) +from ...models.add_comment_request import AddCommentRequest +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + alert_id: str, + *, + body: AddCommentRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/alerts/{alert_id}/comments".format( + alert_id=quote(str(alert_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost + | HTTPValidationError + | None +): + if response.status_code == 200: + response_200 = AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost + | HTTPValidationError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + alert_id: str, + *, + client: AuthenticatedClient | Client, + body: AddCommentRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost + | HTTPValidationError +]: + """Add alert comment + + Add a comment to an alert. Comments are visible to all subscribers and are included in the alert + detail response. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + body (AddCommentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost | HTTPValidationError] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + alert_id: str, + *, + client: AuthenticatedClient | Client, + body: AddCommentRequest, + x_account_id: str | Unset = UNSET, +) -> ( + AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost + | HTTPValidationError + | None +): + """Add alert comment + + Add a comment to an alert. Comments are visible to all subscribers and are included in the alert + detail response. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + body (AddCommentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost | HTTPValidationError + """ + + return sync_detailed( + alert_id=alert_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + alert_id: str, + *, + client: AuthenticatedClient | Client, + body: AddCommentRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost + | HTTPValidationError +]: + """Add alert comment + + Add a comment to an alert. Comments are visible to all subscribers and are included in the alert + detail response. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + body (AddCommentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost | HTTPValidationError] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + alert_id: str, + *, + client: AuthenticatedClient | Client, + body: AddCommentRequest, + x_account_id: str | Unset = UNSET, +) -> ( + AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost + | HTTPValidationError + | None +): + """Add alert comment + + Add a comment to an alert. Comments are visible to all subscribers and are included in the alert + detail response. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + body (AddCommentRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost | HTTPValidationError + """ + + return ( + await asyncio_detailed( + alert_id=alert_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/change_alert_status_api_alerts_alert_id_status_post.py b/seclai/_generated/api/alerts/change_alert_status_api_alerts_alert_id_status_post.py new file mode 100644 index 0000000..d327a1d --- /dev/null +++ b/seclai/_generated/api/alerts/change_alert_status_api_alerts_alert_id_status_post.py @@ -0,0 +1,242 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.change_alert_status_api_alerts_alert_id_status_post_response_change_alert_status_api_alerts_alert_id_status_post import ( + ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost, +) +from ...models.change_status_request import ChangeStatusRequest +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + alert_id: str, + *, + body: ChangeStatusRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/alerts/{alert_id}/status".format( + alert_id=quote(str(alert_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost + | HTTPValidationError + | None +): + if response.status_code == 200: + response_200 = ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost + | HTTPValidationError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + alert_id: str, + *, + client: AuthenticatedClient | Client, + body: ChangeStatusRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost + | HTTPValidationError +]: + """Change alert status + + Change the status of an alert. Valid statuses: triggered, acknowledged, resolved, dismissed. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + body (ChangeStatusRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost | HTTPValidationError] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + alert_id: str, + *, + client: AuthenticatedClient | Client, + body: ChangeStatusRequest, + x_account_id: str | Unset = UNSET, +) -> ( + ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost + | HTTPValidationError + | None +): + """Change alert status + + Change the status of an alert. Valid statuses: triggered, acknowledged, resolved, dismissed. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + body (ChangeStatusRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost | HTTPValidationError + """ + + return sync_detailed( + alert_id=alert_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + alert_id: str, + *, + client: AuthenticatedClient | Client, + body: ChangeStatusRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost + | HTTPValidationError +]: + """Change alert status + + Change the status of an alert. Valid statuses: triggered, acknowledged, resolved, dismissed. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + body (ChangeStatusRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost | HTTPValidationError] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + alert_id: str, + *, + client: AuthenticatedClient | Client, + body: ChangeStatusRequest, + x_account_id: str | Unset = UNSET, +) -> ( + ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost + | HTTPValidationError + | None +): + """Change alert status + + Change the status of an alert. Valid statuses: triggered, acknowledged, resolved, dismissed. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + body (ChangeStatusRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost | HTTPValidationError + """ + + return ( + await asyncio_detailed( + alert_id=alert_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/create_alert_config_api_alerts_configs_post.py b/seclai/_generated/api/alerts/create_alert_config_api_alerts_configs_post.py new file mode 100644 index 0000000..fbf4b5e --- /dev/null +++ b/seclai/_generated/api/alerts/create_alert_config_api_alerts_configs_post.py @@ -0,0 +1,262 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_alert_config_api_alerts_configs_post_response_create_alert_config_api_alerts_configs_post import ( + CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost, +) +from ...models.create_alert_config_request import CreateAlertConfigRequest +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: CreateAlertConfigRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/alerts/configs", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost + | HTTPValidationError + | None +): + if response.status_code == 201: + response_201 = CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost.from_dict( + response.json() + ) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost + | HTTPValidationError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateAlertConfigRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost + | HTTPValidationError +]: + """Create alert config + + Create a new alert configuration. + + Agent alert types: run_failed, consecutive_failures, error_rate_spike, run_burst, slow_run, + credits_low_threshold, credits_runout_prediction, credits_usage_spike, non_manual_eval_failed, + non_manual_eval_flagged, governance_flagged, governance_blocked, model_newer_available, + model_deprecated, model_sunset. + Source alert types: pull_failed, consecutive_pull_failures, pull_error_rate_spike. + + Distribution types: owner, owner_admins, selected_members. Organization accounts are normalized to + owner_admins. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (CreateAlertConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: CreateAlertConfigRequest, + x_account_id: str | Unset = UNSET, +) -> ( + CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost + | HTTPValidationError + | None +): + """Create alert config + + Create a new alert configuration. + + Agent alert types: run_failed, consecutive_failures, error_rate_spike, run_burst, slow_run, + credits_low_threshold, credits_runout_prediction, credits_usage_spike, non_manual_eval_failed, + non_manual_eval_flagged, governance_flagged, governance_blocked, model_newer_available, + model_deprecated, model_sunset. + Source alert types: pull_failed, consecutive_pull_failures, pull_error_rate_spike. + + Distribution types: owner, owner_admins, selected_members. Organization accounts are normalized to + owner_admins. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (CreateAlertConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost | HTTPValidationError + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateAlertConfigRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost + | HTTPValidationError +]: + """Create alert config + + Create a new alert configuration. + + Agent alert types: run_failed, consecutive_failures, error_rate_spike, run_burst, slow_run, + credits_low_threshold, credits_runout_prediction, credits_usage_spike, non_manual_eval_failed, + non_manual_eval_flagged, governance_flagged, governance_blocked, model_newer_available, + model_deprecated, model_sunset. + Source alert types: pull_failed, consecutive_pull_failures, pull_error_rate_spike. + + Distribution types: owner, owner_admins, selected_members. Organization accounts are normalized to + owner_admins. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (CreateAlertConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: CreateAlertConfigRequest, + x_account_id: str | Unset = UNSET, +) -> ( + CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost + | HTTPValidationError + | None +): + """Create alert config + + Create a new alert configuration. + + Agent alert types: run_failed, consecutive_failures, error_rate_spike, run_burst, slow_run, + credits_low_threshold, credits_runout_prediction, credits_usage_spike, non_manual_eval_failed, + non_manual_eval_flagged, governance_flagged, governance_blocked, model_newer_available, + model_deprecated, model_sunset. + Source alert types: pull_failed, consecutive_pull_failures, pull_error_rate_spike. + + Distribution types: owner, owner_admins, selected_members. Organization accounts are normalized to + owner_admins. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (CreateAlertConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost | HTTPValidationError + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/delete_alert_config_api_alerts_configs_config_id_delete.py b/seclai/_generated/api/alerts/delete_alert_config_api_alerts_configs_config_id_delete.py new file mode 100644 index 0000000..5a1af0e --- /dev/null +++ b/seclai/_generated/api/alerts/delete_alert_config_api_alerts_configs_config_id_delete.py @@ -0,0 +1,201 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + config_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/alerts/configs/{config_id}".format( + config_id=quote(str(config_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + config_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete alert config + + Delete an alert configuration. This permanently removes the config and stops any future alerts of + this type from being triggered. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + config_id=config_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + config_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete alert config + + Delete an alert configuration. This permanently removes the config and stops any future alerts of + this type from being triggered. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + config_id=config_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + config_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete alert config + + Delete an alert configuration. This permanently removes the config and stops any future alerts of + this type from being triggered. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + config_id=config_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + config_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete alert config + + Delete an alert configuration. This permanently removes the config and stops any future alerts of + this type from being triggered. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + config_id=config_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/get_alert_config_api_alerts_configs_config_id_get.py b/seclai/_generated/api/alerts/get_alert_config_api_alerts_configs_config_id_get.py new file mode 100644 index 0000000..58c371f --- /dev/null +++ b/seclai/_generated/api/alerts/get_alert_config_api_alerts_configs_config_id_get.py @@ -0,0 +1,236 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.get_alert_config_api_alerts_configs_config_id_get_response_get_alert_config_api_alerts_configs_config_id_get import ( + GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet, +) +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + config_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/alerts/configs/{config_id}".format( + config_id=quote(str(config_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet + | HTTPValidationError + | None +): + if response.status_code == 200: + response_200 = GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet + | HTTPValidationError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + config_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet + | HTTPValidationError +]: + """Get alert config + + Get a specific alert configuration by ID. + + Returns all fields including type, enabled state, threshold, cooldown, distribution type, and + recipient list. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet | HTTPValidationError] + """ + + kwargs = _get_kwargs( + config_id=config_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + config_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet + | HTTPValidationError + | None +): + """Get alert config + + Get a specific alert configuration by ID. + + Returns all fields including type, enabled state, threshold, cooldown, distribution type, and + recipient list. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet | HTTPValidationError + """ + + return sync_detailed( + config_id=config_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + config_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet + | HTTPValidationError +]: + """Get alert config + + Get a specific alert configuration by ID. + + Returns all fields including type, enabled state, threshold, cooldown, distribution type, and + recipient list. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet | HTTPValidationError] + """ + + kwargs = _get_kwargs( + config_id=config_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + config_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet + | HTTPValidationError + | None +): + """Get alert config + + Get a specific alert configuration by ID. + + Returns all fields including type, enabled state, threshold, cooldown, distribution type, and + recipient list. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet | HTTPValidationError + """ + + return ( + await asyncio_detailed( + config_id=config_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/get_alert_detail_api_alerts_alert_id_get.py b/seclai/_generated/api/alerts/get_alert_detail_api_alerts_alert_id_get.py new file mode 100644 index 0000000..6c07a35 --- /dev/null +++ b/seclai/_generated/api/alerts/get_alert_detail_api_alerts_alert_id_get.py @@ -0,0 +1,224 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.get_alert_detail_api_alerts_alert_id_get_response_get_alert_detail_api_alerts_alert_id_get import ( + GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet, +) +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + alert_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/alerts/{alert_id}".format( + alert_id=quote(str(alert_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet + | HTTPValidationError + | None +): + if response.status_code == 200: + response_200 = GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet + | HTTPValidationError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet + | HTTPValidationError +]: + """Get alert detail + + Get full alert detail including history, comments, and subscribers. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet | HTTPValidationError] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet + | HTTPValidationError + | None +): + """Get alert detail + + Get full alert detail including history, comments, and subscribers. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet | HTTPValidationError + """ + + return sync_detailed( + alert_id=alert_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet + | HTTPValidationError +]: + """Get alert detail + + Get full alert detail including history, comments, and subscribers. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet | HTTPValidationError] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet + | HTTPValidationError + | None +): + """Get alert detail + + Get full alert detail including history, comments, and subscribers. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet | HTTPValidationError + """ + + return ( + await asyncio_detailed( + alert_id=alert_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/list_alert_configs_api_alerts_configs_get.py b/seclai/_generated/api/alerts/list_alert_configs_api_alerts_configs_get.py new file mode 100644 index 0000000..7405dbc --- /dev/null +++ b/seclai/_generated/api/alerts/list_alert_configs_api_alerts_configs_get.py @@ -0,0 +1,313 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.list_alert_configs_api_alerts_configs_get_response_list_alert_configs_api_alerts_configs_get import ( + ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + agent_id: None | str | Unset = UNSET, + source_connection_id: None | str | Unset = UNSET, + scope: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + json_agent_id: None | str | Unset + if isinstance(agent_id, Unset): + json_agent_id = UNSET + else: + json_agent_id = agent_id + params["agent_id"] = json_agent_id + + json_source_connection_id: None | str | Unset + if isinstance(source_connection_id, Unset): + json_source_connection_id = UNSET + else: + json_source_connection_id = source_connection_id + params["source_connection_id"] = json_source_connection_id + + json_scope: None | str | Unset + if isinstance(scope, Unset): + json_scope = UNSET + else: + json_scope = scope + params["scope"] = json_scope + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/alerts/configs", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + HTTPValidationError + | ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet + | None +): + if response.status_code == 200: + response_200 = ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + HTTPValidationError + | ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + agent_id: None | str | Unset = UNSET, + source_connection_id: None | str | Unset = UNSET, + scope: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet +]: + """List alert configs + + List alert configurations. + + Filters: + - `agent_id`: list configs for a specific agent + - `source_connection_id`: list configs for a specific source + - Neither: list account-level agent alert configs + - `scope=source`: list account-level source alert configs + + Credits alerts (`credits_low_threshold`, `credits_runout_prediction`, `credits_usage_spike`) are + account-level alert configs. They are evaluated by the credits alert sweep and default-enabled + configs may be auto-created for active accounts at runtime. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + agent_id (None | str | Unset): Filter by agent ID + source_connection_id (None | str | Unset): Filter by source connection ID + scope (None | str | Unset): Set to 'source' to list account-level source alert configs + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + source_connection_id=source_connection_id, + scope=scope, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + agent_id: None | str | Unset = UNSET, + source_connection_id: None | str | Unset = UNSET, + scope: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet + | None +): + """List alert configs + + List alert configurations. + + Filters: + - `agent_id`: list configs for a specific agent + - `source_connection_id`: list configs for a specific source + - Neither: list account-level agent alert configs + - `scope=source`: list account-level source alert configs + + Credits alerts (`credits_low_threshold`, `credits_runout_prediction`, `credits_usage_spike`) are + account-level alert configs. They are evaluated by the credits alert sweep and default-enabled + configs may be auto-created for active accounts at runtime. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + agent_id (None | str | Unset): Filter by agent ID + source_connection_id (None | str | Unset): Filter by source connection ID + scope (None | str | Unset): Set to 'source' to list account-level source alert configs + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet + """ + + return sync_detailed( + client=client, + agent_id=agent_id, + source_connection_id=source_connection_id, + scope=scope, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + agent_id: None | str | Unset = UNSET, + source_connection_id: None | str | Unset = UNSET, + scope: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet +]: + """List alert configs + + List alert configurations. + + Filters: + - `agent_id`: list configs for a specific agent + - `source_connection_id`: list configs for a specific source + - Neither: list account-level agent alert configs + - `scope=source`: list account-level source alert configs + + Credits alerts (`credits_low_threshold`, `credits_runout_prediction`, `credits_usage_spike`) are + account-level alert configs. They are evaluated by the credits alert sweep and default-enabled + configs may be auto-created for active accounts at runtime. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + agent_id (None | str | Unset): Filter by agent ID + source_connection_id (None | str | Unset): Filter by source connection ID + scope (None | str | Unset): Set to 'source' to list account-level source alert configs + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + source_connection_id=source_connection_id, + scope=scope, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + agent_id: None | str | Unset = UNSET, + source_connection_id: None | str | Unset = UNSET, + scope: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet + | None +): + """List alert configs + + List alert configurations. + + Filters: + - `agent_id`: list configs for a specific agent + - `source_connection_id`: list configs for a specific source + - Neither: list account-level agent alert configs + - `scope=source`: list account-level source alert configs + + Credits alerts (`credits_low_threshold`, `credits_runout_prediction`, `credits_usage_spike`) are + account-level alert configs. They are evaluated by the credits alert sweep and default-enabled + configs may be auto-created for active accounts at runtime. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + agent_id (None | str | Unset): Filter by agent ID + source_connection_id (None | str | Unset): Filter by source connection ID + scope (None | str | Unset): Set to 'source' to list account-level source alert configs + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet + """ + + return ( + await asyncio_detailed( + client=client, + agent_id=agent_id, + source_connection_id=source_connection_id, + scope=scope, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/list_alerts_api_alerts_get.py b/seclai/_generated/api/alerts/list_alerts_api_alerts_get.py new file mode 100644 index 0000000..b32e11b --- /dev/null +++ b/seclai/_generated/api/alerts/list_alerts_api_alerts_get.py @@ -0,0 +1,357 @@ +import datetime +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.list_alerts_api_alerts_get_response_list_alerts_api_alerts_get import ( + ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + page: int | Unset = 1, + limit: int | Unset = 20, + status: None | str | Unset = UNSET, + agent_id: None | str | Unset = UNSET, + source_connection_id: None | str | Unset = UNSET, + time_from: datetime.datetime | None | Unset = UNSET, + time_to: datetime.datetime | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["page"] = page + + params["limit"] = limit + + json_status: None | str | Unset + if isinstance(status, Unset): + json_status = UNSET + else: + json_status = status + params["status"] = json_status + + json_agent_id: None | str | Unset + if isinstance(agent_id, Unset): + json_agent_id = UNSET + else: + json_agent_id = agent_id + params["agent_id"] = json_agent_id + + json_source_connection_id: None | str | Unset + if isinstance(source_connection_id, Unset): + json_source_connection_id = UNSET + else: + json_source_connection_id = source_connection_id + params["source_connection_id"] = json_source_connection_id + + json_time_from: None | str | Unset + if isinstance(time_from, Unset): + json_time_from = UNSET + elif isinstance(time_from, datetime.datetime): + json_time_from = time_from.isoformat() + else: + json_time_from = time_from + params["time_from"] = json_time_from + + json_time_to: None | str | Unset + if isinstance(time_to, Unset): + json_time_to = UNSET + elif isinstance(time_to, datetime.datetime): + json_time_to = time_to.isoformat() + else: + json_time_to = time_to + params["time_to"] = json_time_to + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/alerts", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet | None: + if response.status_code == 200: + response_200 = ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + HTTPValidationError | ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + status: None | str | Unset = UNSET, + agent_id: None | str | Unset = UNSET, + source_connection_id: None | str | Unset = UNSET, + time_from: datetime.datetime | None | Unset = UNSET, + time_to: datetime.datetime | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError | ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet +]: + """List alerts + + List alerts for the account with optional filters. + + Filters: + - `status`: triggered, acknowledged, resolved, dismissed + - `agent_id`: filter by agent + - `source_connection_id`: filter by source + - `time_from` / `time_to`: ISO 8601 date range + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + status (None | str | Unset): Filter by alert status + agent_id (None | str | Unset): Filter by agent ID + source_connection_id (None | str | Unset): Filter by source connection ID + time_from (datetime.datetime | None | Unset): From (ISO 8601) + time_to (datetime.datetime | None | Unset): To (ISO 8601) + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet] + """ + + kwargs = _get_kwargs( + page=page, + limit=limit, + status=status, + agent_id=agent_id, + source_connection_id=source_connection_id, + time_from=time_from, + time_to=time_to, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + status: None | str | Unset = UNSET, + agent_id: None | str | Unset = UNSET, + source_connection_id: None | str | Unset = UNSET, + time_from: datetime.datetime | None | Unset = UNSET, + time_to: datetime.datetime | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet | None: + """List alerts + + List alerts for the account with optional filters. + + Filters: + - `status`: triggered, acknowledged, resolved, dismissed + - `agent_id`: filter by agent + - `source_connection_id`: filter by source + - `time_from` / `time_to`: ISO 8601 date range + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + status (None | str | Unset): Filter by alert status + agent_id (None | str | Unset): Filter by agent ID + source_connection_id (None | str | Unset): Filter by source connection ID + time_from (datetime.datetime | None | Unset): From (ISO 8601) + time_to (datetime.datetime | None | Unset): To (ISO 8601) + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet + """ + + return sync_detailed( + client=client, + page=page, + limit=limit, + status=status, + agent_id=agent_id, + source_connection_id=source_connection_id, + time_from=time_from, + time_to=time_to, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + status: None | str | Unset = UNSET, + agent_id: None | str | Unset = UNSET, + source_connection_id: None | str | Unset = UNSET, + time_from: datetime.datetime | None | Unset = UNSET, + time_to: datetime.datetime | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError | ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet +]: + """List alerts + + List alerts for the account with optional filters. + + Filters: + - `status`: triggered, acknowledged, resolved, dismissed + - `agent_id`: filter by agent + - `source_connection_id`: filter by source + - `time_from` / `time_to`: ISO 8601 date range + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + status (None | str | Unset): Filter by alert status + agent_id (None | str | Unset): Filter by agent ID + source_connection_id (None | str | Unset): Filter by source connection ID + time_from (datetime.datetime | None | Unset): From (ISO 8601) + time_to (datetime.datetime | None | Unset): To (ISO 8601) + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet] + """ + + kwargs = _get_kwargs( + page=page, + limit=limit, + status=status, + agent_id=agent_id, + source_connection_id=source_connection_id, + time_from=time_from, + time_to=time_to, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + status: None | str | Unset = UNSET, + agent_id: None | str | Unset = UNSET, + source_connection_id: None | str | Unset = UNSET, + time_from: datetime.datetime | None | Unset = UNSET, + time_to: datetime.datetime | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet | None: + """List alerts + + List alerts for the account with optional filters. + + Filters: + - `status`: triggered, acknowledged, resolved, dismissed + - `agent_id`: filter by agent + - `source_connection_id`: filter by source + - `time_from` / `time_to`: ISO 8601 date range + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + status (None | str | Unset): Filter by alert status + agent_id (None | str | Unset): Filter by agent ID + source_connection_id (None | str | Unset): Filter by source connection ID + time_from (datetime.datetime | None | Unset): From (ISO 8601) + time_to (datetime.datetime | None | Unset): To (ISO 8601) + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet + """ + + return ( + await asyncio_detailed( + client=client, + page=page, + limit=limit, + status=status, + agent_id=agent_id, + source_connection_id=source_connection_id, + time_from=time_from, + time_to=time_to, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/list_organization_preferences_api_alerts_organization_preferences_list_get.py b/seclai/_generated/api/alerts/list_organization_preferences_api_alerts_organization_preferences_list_get.py new file mode 100644 index 0000000..58a43da --- /dev/null +++ b/seclai/_generated/api/alerts/list_organization_preferences_api_alerts_organization_preferences_list_get.py @@ -0,0 +1,250 @@ +from http import HTTPStatus +from typing import Any +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.organization_alert_preference_list_response import ( + OrganizationAlertPreferenceListResponse, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + organization_id: None | Unset | UUID = UNSET, + include_defaults: bool | Unset = False, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + json_organization_id: None | str | Unset + if isinstance(organization_id, Unset): + json_organization_id = UNSET + elif isinstance(organization_id, UUID): + json_organization_id = str(organization_id) + else: + json_organization_id = organization_id + params["organization_id"] = json_organization_id + + params["include_defaults"] = include_defaults + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/alerts/organization-preferences/list", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | OrganizationAlertPreferenceListResponse | None: + if response.status_code == 200: + response_200 = OrganizationAlertPreferenceListResponse.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | OrganizationAlertPreferenceListResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + organization_id: None | Unset | UUID = UNSET, + include_defaults: bool | Unset = False, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | OrganizationAlertPreferenceListResponse]: + """List organization alert delivery preferences + + List per-organization alert delivery preferences for the authenticated user. + + By default, only explicit override rows are returned. Set `include_defaults=true` to return the + effective subscribed state for every alert type in every organization the user can manage. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - Only organizations where the user is an owner or administrator are included. + + Args: + organization_id (None | Unset | UUID): Optional organization filter + include_defaults (bool | Unset): Include default subscribed entries for all alert types + Default: False. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | OrganizationAlertPreferenceListResponse] + """ + + kwargs = _get_kwargs( + organization_id=organization_id, + include_defaults=include_defaults, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + organization_id: None | Unset | UUID = UNSET, + include_defaults: bool | Unset = False, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | OrganizationAlertPreferenceListResponse | None: + """List organization alert delivery preferences + + List per-organization alert delivery preferences for the authenticated user. + + By default, only explicit override rows are returned. Set `include_defaults=true` to return the + effective subscribed state for every alert type in every organization the user can manage. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - Only organizations where the user is an owner or administrator are included. + + Args: + organization_id (None | Unset | UUID): Optional organization filter + include_defaults (bool | Unset): Include default subscribed entries for all alert types + Default: False. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | OrganizationAlertPreferenceListResponse + """ + + return sync_detailed( + client=client, + organization_id=organization_id, + include_defaults=include_defaults, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + organization_id: None | Unset | UUID = UNSET, + include_defaults: bool | Unset = False, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | OrganizationAlertPreferenceListResponse]: + """List organization alert delivery preferences + + List per-organization alert delivery preferences for the authenticated user. + + By default, only explicit override rows are returned. Set `include_defaults=true` to return the + effective subscribed state for every alert type in every organization the user can manage. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - Only organizations where the user is an owner or administrator are included. + + Args: + organization_id (None | Unset | UUID): Optional organization filter + include_defaults (bool | Unset): Include default subscribed entries for all alert types + Default: False. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | OrganizationAlertPreferenceListResponse] + """ + + kwargs = _get_kwargs( + organization_id=organization_id, + include_defaults=include_defaults, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + organization_id: None | Unset | UUID = UNSET, + include_defaults: bool | Unset = False, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | OrganizationAlertPreferenceListResponse | None: + """List organization alert delivery preferences + + List per-organization alert delivery preferences for the authenticated user. + + By default, only explicit override rows are returned. Set `include_defaults=true` to return the + effective subscribed state for every alert type in every organization the user can manage. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - Only organizations where the user is an owner or administrator are included. + + Args: + organization_id (None | Unset | UUID): Optional organization filter + include_defaults (bool | Unset): Include default subscribed entries for all alert types + Default: False. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | OrganizationAlertPreferenceListResponse + """ + + return ( + await asyncio_detailed( + client=client, + organization_id=organization_id, + include_defaults=include_defaults, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/subscribe_to_alert_api_alerts_alert_id_subscribe_post.py b/seclai/_generated/api/alerts/subscribe_to_alert_api_alerts_alert_id_subscribe_post.py new file mode 100644 index 0000000..e16fcc0 --- /dev/null +++ b/seclai/_generated/api/alerts/subscribe_to_alert_api_alerts_alert_id_subscribe_post.py @@ -0,0 +1,228 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.subscribe_to_alert_api_alerts_alert_id_subscribe_post_response_subscribe_to_alert_api_alerts_alert_id_subscribe_post import ( + SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + alert_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/alerts/{alert_id}/subscribe".format( + alert_id=quote(str(alert_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + HTTPValidationError + | SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost + | None +): + if response.status_code == 200: + response_200 = SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + HTTPValidationError + | SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost +]: + """Subscribe to alert + + Subscribe the current user to an alert. Subscribed users receive email notifications when the alert + status changes or new comments are added. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost + | None +): + """Subscribe to alert + + Subscribe the current user to an alert. Subscribed users receive email notifications when the alert + status changes or new comments are added. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost + """ + + return sync_detailed( + alert_id=alert_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost +]: + """Subscribe to alert + + Subscribe the current user to an alert. Subscribed users receive email notifications when the alert + status changes or new comments are added. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost + | None +): + """Subscribe to alert + + Subscribe the current user to an alert. Subscribed users receive email notifications when the alert + status changes or new comments are added. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost + """ + + return ( + await asyncio_detailed( + alert_id=alert_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post.py b/seclai/_generated/api/alerts/unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post.py new file mode 100644 index 0000000..5688f64 --- /dev/null +++ b/seclai/_generated/api/alerts/unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post.py @@ -0,0 +1,228 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post_response_unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post import ( + UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + alert_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/alerts/{alert_id}/unsubscribe".format( + alert_id=quote(str(alert_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + HTTPValidationError + | UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost + | None +): + if response.status_code == 200: + response_200 = UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + HTTPValidationError + | UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost +]: + """Unsubscribe from alert + + Unsubscribe the current user from an alert. The user will no longer receive email notifications for + status changes or new comments on this alert. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost + | None +): + """Unsubscribe from alert + + Unsubscribe the current user from an alert. The user will no longer receive email notifications for + status changes or new comments on this alert. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost + """ + + return sync_detailed( + alert_id=alert_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost +]: + """Unsubscribe from alert + + Unsubscribe the current user from an alert. The user will no longer receive email notifications for + status changes or new comments on this alert. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + alert_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost + | None +): + """Unsubscribe from alert + + Unsubscribe the current user from an alert. The user will no longer receive email notifications for + status changes or new comments on this alert. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + alert_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost + """ + + return ( + await asyncio_detailed( + alert_id=alert_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/update_alert_config_api_alerts_configs_config_id_patch.py b/seclai/_generated/api/alerts/update_alert_config_api_alerts_configs_config_id_patch.py new file mode 100644 index 0000000..b43c36a --- /dev/null +++ b/seclai/_generated/api/alerts/update_alert_config_api_alerts_configs_config_id_patch.py @@ -0,0 +1,242 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.update_alert_config_api_alerts_configs_config_id_patch_response_update_alert_config_api_alerts_configs_config_id_patch import ( + UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch, +) +from ...models.update_alert_config_request import UpdateAlertConfigRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + config_id: str, + *, + body: UpdateAlertConfigRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/alerts/configs/{config_id}".format( + config_id=quote(str(config_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + HTTPValidationError + | UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch + | None +): + if response.status_code == 200: + response_200 = UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + HTTPValidationError + | UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + config_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAlertConfigRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch +]: + """Update alert config + + Update an alert configuration. Only provided fields are updated. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + body (UpdateAlertConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch] + """ + + kwargs = _get_kwargs( + config_id=config_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + config_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAlertConfigRequest, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch + | None +): + """Update alert config + + Update an alert configuration. Only provided fields are updated. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + body (UpdateAlertConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch + """ + + return sync_detailed( + config_id=config_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + config_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAlertConfigRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch +]: + """Update alert config + + Update an alert configuration. Only provided fields are updated. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + body (UpdateAlertConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch] + """ + + kwargs = _get_kwargs( + config_id=config_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + config_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateAlertConfigRequest, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch + | None +): + """Update alert config + + Update an alert configuration. Only provided fields are updated. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + config_id (str): + x_account_id (str | Unset): + body (UpdateAlertConfigRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch + """ + + return ( + await asyncio_detailed( + config_id=config_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/alerts/update_organization_preference_api_alerts_organization_preferences_organization_id_alert_type_patch.py b/seclai/_generated/api/alerts/update_organization_preference_api_alerts_organization_preferences_organization_id_alert_type_patch.py new file mode 100644 index 0000000..d5fd227 --- /dev/null +++ b/seclai/_generated/api/alerts/update_organization_preference_api_alerts_organization_preferences_organization_id_alert_type_patch.py @@ -0,0 +1,252 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.organization_alert_preference_response import ( + OrganizationAlertPreferenceResponse, +) +from ...models.update_organization_alert_preference_request import ( + UpdateOrganizationAlertPreferenceRequest, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + organization_id: UUID, + alert_type: str, + *, + body: UpdateOrganizationAlertPreferenceRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/alerts/organization-preferences/{organization_id}/{alert_type}".format( + organization_id=quote(str(organization_id), safe=""), + alert_type=quote(str(alert_type), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | OrganizationAlertPreferenceResponse | None: + if response.status_code == 200: + response_200 = OrganizationAlertPreferenceResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | OrganizationAlertPreferenceResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + organization_id: UUID, + alert_type: str, + *, + client: AuthenticatedClient | Client, + body: UpdateOrganizationAlertPreferenceRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | OrganizationAlertPreferenceResponse]: + """Update organization alert delivery preference + + Update the authenticated user's personal delivery preference for one alert type in one organization. + + Setting `subscribed=false` stores an explicit opt-out override. Setting `subscribed=true` removes + the override and restores the default subscribed behavior. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - Only owners and administrators can update preferences for an organization. + + Args: + organization_id (UUID): + alert_type (str): + x_account_id (str | Unset): + body (UpdateOrganizationAlertPreferenceRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | OrganizationAlertPreferenceResponse] + """ + + kwargs = _get_kwargs( + organization_id=organization_id, + alert_type=alert_type, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + organization_id: UUID, + alert_type: str, + *, + client: AuthenticatedClient | Client, + body: UpdateOrganizationAlertPreferenceRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | OrganizationAlertPreferenceResponse | None: + """Update organization alert delivery preference + + Update the authenticated user's personal delivery preference for one alert type in one organization. + + Setting `subscribed=false` stores an explicit opt-out override. Setting `subscribed=true` removes + the override and restores the default subscribed behavior. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - Only owners and administrators can update preferences for an organization. + + Args: + organization_id (UUID): + alert_type (str): + x_account_id (str | Unset): + body (UpdateOrganizationAlertPreferenceRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | OrganizationAlertPreferenceResponse + """ + + return sync_detailed( + organization_id=organization_id, + alert_type=alert_type, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + organization_id: UUID, + alert_type: str, + *, + client: AuthenticatedClient | Client, + body: UpdateOrganizationAlertPreferenceRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | OrganizationAlertPreferenceResponse]: + """Update organization alert delivery preference + + Update the authenticated user's personal delivery preference for one alert type in one organization. + + Setting `subscribed=false` stores an explicit opt-out override. Setting `subscribed=true` removes + the override and restores the default subscribed behavior. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - Only owners and administrators can update preferences for an organization. + + Args: + organization_id (UUID): + alert_type (str): + x_account_id (str | Unset): + body (UpdateOrganizationAlertPreferenceRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | OrganizationAlertPreferenceResponse] + """ + + kwargs = _get_kwargs( + organization_id=organization_id, + alert_type=alert_type, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + organization_id: UUID, + alert_type: str, + *, + client: AuthenticatedClient | Client, + body: UpdateOrganizationAlertPreferenceRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | OrganizationAlertPreferenceResponse | None: + """Update organization alert delivery preference + + Update the authenticated user's personal delivery preference for one alert type in one organization. + + Setting `subscribed=false` stores an explicit opt-out override. Setting `subscribed=true` removes + the override and restores the default subscribed behavior. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + - Only owners and administrators can update preferences for an organization. + + Args: + organization_id (UUID): + alert_type (str): + x_account_id (str | Unset): + body (UpdateOrganizationAlertPreferenceRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | OrganizationAlertPreferenceResponse + """ + + return ( + await asyncio_detailed( + organization_id=organization_id, + alert_type=alert_type, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/contents/delete_content_api_contents_source_connection_content_version_delete.py b/seclai/_generated/api/contents/delete_content_api_contents_source_connection_content_version_delete.py index 20c5f01..4e8f21e 100644 --- a/seclai/_generated/api/contents/delete_content_api_contents_source_connection_content_version_delete.py +++ b/seclai/_generated/api/contents/delete_content_api_contents_source_connection_content_version_delete.py @@ -7,12 +7,18 @@ from ... import errors from ...client import AuthenticatedClient, Client from ...models.http_validation_error import HTTPValidationError -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( source_connection_content_version: str, + *, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + _kwargs: dict[str, Any] = { "method": "delete", "url": "/contents/{source_connection_content_version}".format( @@ -22,6 +28,7 @@ def _get_kwargs( ), } + _kwargs["headers"] = headers return _kwargs @@ -58,6 +65,7 @@ def sync_detailed( source_connection_content_version: str, *, client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, ) -> Response[Any | HTTPValidationError]: """Delete content @@ -67,10 +75,12 @@ def sync_detailed( and knowledge base workflows that reference this item. Auth & scoping: - - Requires `X-API-Key`. You can only delete content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only delete content belonging to your + account. Args: source_connection_content_version (str): + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -82,6 +92,7 @@ def sync_detailed( kwargs = _get_kwargs( source_connection_content_version=source_connection_content_version, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -95,6 +106,7 @@ def sync( source_connection_content_version: str, *, client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, ) -> Any | HTTPValidationError | None: """Delete content @@ -104,10 +116,12 @@ def sync( and knowledge base workflows that reference this item. Auth & scoping: - - Requires `X-API-Key`. You can only delete content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only delete content belonging to your + account. Args: source_connection_content_version (str): + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -120,6 +134,7 @@ def sync( return sync_detailed( source_connection_content_version=source_connection_content_version, client=client, + x_account_id=x_account_id, ).parsed @@ -127,6 +142,7 @@ async def asyncio_detailed( source_connection_content_version: str, *, client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, ) -> Response[Any | HTTPValidationError]: """Delete content @@ -136,10 +152,12 @@ async def asyncio_detailed( and knowledge base workflows that reference this item. Auth & scoping: - - Requires `X-API-Key`. You can only delete content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only delete content belonging to your + account. Args: source_connection_content_version (str): + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -151,6 +169,7 @@ async def asyncio_detailed( kwargs = _get_kwargs( source_connection_content_version=source_connection_content_version, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -162,6 +181,7 @@ async def asyncio( source_connection_content_version: str, *, client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, ) -> Any | HTTPValidationError | None: """Delete content @@ -171,10 +191,12 @@ async def asyncio( and knowledge base workflows that reference this item. Auth & scoping: - - Requires `X-API-Key`. You can only delete content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only delete content belonging to your + account. Args: source_connection_content_version (str): + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -188,5 +210,6 @@ async def asyncio( await asyncio_detailed( source_connection_content_version=source_connection_content_version, client=client, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/contents/get_content_detail_api_contents_source_connection_content_version_get.py b/seclai/_generated/api/contents/get_content_detail_api_contents_source_connection_content_version_get.py index f7c9acc..7db6e0d 100644 --- a/seclai/_generated/api/contents/get_content_detail_api_contents_source_connection_content_version_get.py +++ b/seclai/_generated/api/contents/get_content_detail_api_contents_source_connection_content_version_get.py @@ -16,7 +16,12 @@ def _get_kwargs( *, start: int | Unset = 0, end: int | Unset = 5000, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + params: dict[str, Any] = {} params["start"] = start @@ -35,6 +40,7 @@ def _get_kwargs( "params": params, } + _kwargs["headers"] = headers return _kwargs @@ -74,6 +80,7 @@ def sync_detailed( client: AuthenticatedClient | Client, start: int | Unset = 0, end: int | Unset = 5000, + x_account_id: str | Unset = UNSET, ) -> Response[ContentDetailResponse | HTTPValidationError]: """Get content details @@ -88,12 +95,14 @@ def sync_detailed( through large documents. Auth & scoping: - - Requires `X-API-Key`. You can only access content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your + account. Args: source_connection_content_version (str): start (int | Unset): Default: 0. end (int | Unset): Default: 5000. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -107,6 +116,7 @@ def sync_detailed( source_connection_content_version=source_connection_content_version, start=start, end=end, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -122,6 +132,7 @@ def sync( client: AuthenticatedClient | Client, start: int | Unset = 0, end: int | Unset = 5000, + x_account_id: str | Unset = UNSET, ) -> ContentDetailResponse | HTTPValidationError | None: """Get content details @@ -136,12 +147,14 @@ def sync( through large documents. Auth & scoping: - - Requires `X-API-Key`. You can only access content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your + account. Args: source_connection_content_version (str): start (int | Unset): Default: 0. end (int | Unset): Default: 5000. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -156,6 +169,7 @@ def sync( client=client, start=start, end=end, + x_account_id=x_account_id, ).parsed @@ -165,6 +179,7 @@ async def asyncio_detailed( client: AuthenticatedClient | Client, start: int | Unset = 0, end: int | Unset = 5000, + x_account_id: str | Unset = UNSET, ) -> Response[ContentDetailResponse | HTTPValidationError]: """Get content details @@ -179,12 +194,14 @@ async def asyncio_detailed( through large documents. Auth & scoping: - - Requires `X-API-Key`. You can only access content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your + account. Args: source_connection_content_version (str): start (int | Unset): Default: 0. end (int | Unset): Default: 5000. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -198,6 +215,7 @@ async def asyncio_detailed( source_connection_content_version=source_connection_content_version, start=start, end=end, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -211,6 +229,7 @@ async def asyncio( client: AuthenticatedClient | Client, start: int | Unset = 0, end: int | Unset = 5000, + x_account_id: str | Unset = UNSET, ) -> ContentDetailResponse | HTTPValidationError | None: """Get content details @@ -225,12 +244,14 @@ async def asyncio( through large documents. Auth & scoping: - - Requires `X-API-Key`. You can only access content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access content belonging to your + account. Args: source_connection_content_version (str): start (int | Unset): Default: 0. end (int | Unset): Default: 5000. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -246,5 +267,6 @@ async def asyncio( client=client, start=start, end=end, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/contents/list_content_embeddings_api_contents_source_connection_content_version_embeddings_get.py b/seclai/_generated/api/contents/list_content_embeddings_api_contents_source_connection_content_version_embeddings_get.py index d6356f1..0628395 100644 --- a/seclai/_generated/api/contents/list_content_embeddings_api_contents_source_connection_content_version_embeddings_get.py +++ b/seclai/_generated/api/contents/list_content_embeddings_api_contents_source_connection_content_version_embeddings_get.py @@ -16,7 +16,12 @@ def _get_kwargs( *, page: int | Unset = 1, limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + params: dict[str, Any] = {} params["page"] = page @@ -35,6 +40,7 @@ def _get_kwargs( "params": params, } + _kwargs["headers"] = headers return _kwargs @@ -74,6 +80,7 @@ def sync_detailed( client: AuthenticatedClient | Client, page: int | Unset = 1, limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, ) -> Response[ContentEmbeddingsListResponse | HTTPValidationError]: """List content embeddings @@ -83,12 +90,14 @@ def sync_detailed( primarily useful for debugging chunking, indexing, and vector contents. Auth & scoping: - - Requires `X-API-Key`. You can only access embeddings for content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access embeddings for content + belonging to your account. Args: source_connection_content_version (str): page (int | Unset): Default: 1. limit (int | Unset): Default: 20. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -102,6 +111,7 @@ def sync_detailed( source_connection_content_version=source_connection_content_version, page=page, limit=limit, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -117,6 +127,7 @@ def sync( client: AuthenticatedClient | Client, page: int | Unset = 1, limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, ) -> ContentEmbeddingsListResponse | HTTPValidationError | None: """List content embeddings @@ -126,12 +137,14 @@ def sync( primarily useful for debugging chunking, indexing, and vector contents. Auth & scoping: - - Requires `X-API-Key`. You can only access embeddings for content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access embeddings for content + belonging to your account. Args: source_connection_content_version (str): page (int | Unset): Default: 1. limit (int | Unset): Default: 20. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -146,6 +159,7 @@ def sync( client=client, page=page, limit=limit, + x_account_id=x_account_id, ).parsed @@ -155,6 +169,7 @@ async def asyncio_detailed( client: AuthenticatedClient | Client, page: int | Unset = 1, limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, ) -> Response[ContentEmbeddingsListResponse | HTTPValidationError]: """List content embeddings @@ -164,12 +179,14 @@ async def asyncio_detailed( primarily useful for debugging chunking, indexing, and vector contents. Auth & scoping: - - Requires `X-API-Key`. You can only access embeddings for content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access embeddings for content + belonging to your account. Args: source_connection_content_version (str): page (int | Unset): Default: 1. limit (int | Unset): Default: 20. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -183,6 +200,7 @@ async def asyncio_detailed( source_connection_content_version=source_connection_content_version, page=page, limit=limit, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -196,6 +214,7 @@ async def asyncio( client: AuthenticatedClient | Client, page: int | Unset = 1, limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, ) -> ContentEmbeddingsListResponse | HTTPValidationError | None: """List content embeddings @@ -205,12 +224,14 @@ async def asyncio( primarily useful for debugging chunking, indexing, and vector contents. Auth & scoping: - - Requires `X-API-Key`. You can only access embeddings for content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only access embeddings for content + belonging to your account. Args: source_connection_content_version (str): page (int | Unset): Default: 1. limit (int | Unset): Default: 20. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -226,5 +247,6 @@ async def asyncio( client=client, page=page, limit=limit, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/contents/replace_content_with_inline_text_api_contents_source_connection_content_version_put.py b/seclai/_generated/api/contents/replace_content_with_inline_text_api_contents_source_connection_content_version_put.py new file mode 100644 index 0000000..214d65c --- /dev/null +++ b/seclai/_generated/api/contents/replace_content_with_inline_text_api_contents_source_connection_content_version_put.py @@ -0,0 +1,271 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.file_upload_response import FileUploadResponse +from ...models.http_validation_error import HTTPValidationError +from ...models.inline_text_replace_request import InlineTextReplaceRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_content_version: str, + *, + body: InlineTextReplaceRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "put", + "url": "/contents/{source_connection_content_version}".format( + source_connection_content_version=quote( + str(source_connection_content_version), safe="" + ), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> FileUploadResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = FileUploadResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[FileUploadResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_content_version: str, + *, + client: AuthenticatedClient | Client, + body: InlineTextReplaceRequest, + x_account_id: str | Unset = UNSET, +) -> Response[FileUploadResponse | HTTPValidationError]: + """Replace a content version with inline text + + Replace a content version using a small inline text payload. + + **Maximum payload size:** 8192 bytes (UTF-8). + + **Supported content types:** + - `application/json` + - `application/xml` + - `text/csv` + - `text/html` + - `text/markdown` + - `text/plain` + - `text/x-markdown` + - `text/xml` + + Notes: + - Use this endpoint for small text payloads; larger files should use `/upload`. + - `title` is merged into `metadata.title` when not already present. + + Args: + source_connection_content_version (str): + x_account_id (str | Unset): + body (InlineTextReplaceRequest): Request model for inline text content replacement. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[FileUploadResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_content_version=source_connection_content_version, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_content_version: str, + *, + client: AuthenticatedClient | Client, + body: InlineTextReplaceRequest, + x_account_id: str | Unset = UNSET, +) -> FileUploadResponse | HTTPValidationError | None: + """Replace a content version with inline text + + Replace a content version using a small inline text payload. + + **Maximum payload size:** 8192 bytes (UTF-8). + + **Supported content types:** + - `application/json` + - `application/xml` + - `text/csv` + - `text/html` + - `text/markdown` + - `text/plain` + - `text/x-markdown` + - `text/xml` + + Notes: + - Use this endpoint for small text payloads; larger files should use `/upload`. + - `title` is merged into `metadata.title` when not already present. + + Args: + source_connection_content_version (str): + x_account_id (str | Unset): + body (InlineTextReplaceRequest): Request model for inline text content replacement. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + FileUploadResponse | HTTPValidationError + """ + + return sync_detailed( + source_connection_content_version=source_connection_content_version, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_content_version: str, + *, + client: AuthenticatedClient | Client, + body: InlineTextReplaceRequest, + x_account_id: str | Unset = UNSET, +) -> Response[FileUploadResponse | HTTPValidationError]: + """Replace a content version with inline text + + Replace a content version using a small inline text payload. + + **Maximum payload size:** 8192 bytes (UTF-8). + + **Supported content types:** + - `application/json` + - `application/xml` + - `text/csv` + - `text/html` + - `text/markdown` + - `text/plain` + - `text/x-markdown` + - `text/xml` + + Notes: + - Use this endpoint for small text payloads; larger files should use `/upload`. + - `title` is merged into `metadata.title` when not already present. + + Args: + source_connection_content_version (str): + x_account_id (str | Unset): + body (InlineTextReplaceRequest): Request model for inline text content replacement. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[FileUploadResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_content_version=source_connection_content_version, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_content_version: str, + *, + client: AuthenticatedClient | Client, + body: InlineTextReplaceRequest, + x_account_id: str | Unset = UNSET, +) -> FileUploadResponse | HTTPValidationError | None: + """Replace a content version with inline text + + Replace a content version using a small inline text payload. + + **Maximum payload size:** 8192 bytes (UTF-8). + + **Supported content types:** + - `application/json` + - `application/xml` + - `text/csv` + - `text/html` + - `text/markdown` + - `text/plain` + - `text/x-markdown` + - `text/xml` + + Notes: + - Use this endpoint for small text payloads; larger files should use `/upload`. + - `title` is merged into `metadata.title` when not already present. + + Args: + source_connection_content_version (str): + x_account_id (str | Unset): + body (InlineTextReplaceRequest): Request model for inline text content replacement. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + FileUploadResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + source_connection_content_version=source_connection_content_version, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/contents/upload_file_to_content_api_contents_source_connection_content_version_upload_post.py b/seclai/_generated/api/contents/upload_file_to_content_api_contents_source_connection_content_version_upload_post.py index fd72121..c9d18d8 100644 --- a/seclai/_generated/api/contents/upload_file_to_content_api_contents_source_connection_content_version_upload_post.py +++ b/seclai/_generated/api/contents/upload_file_to_content_api_contents_source_connection_content_version_upload_post.py @@ -11,15 +11,18 @@ ) from ...models.file_upload_response import FileUploadResponse from ...models.http_validation_error import HTTPValidationError -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( source_connection_content_version: str, *, body: BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id _kwargs: dict[str, Any] = { "method": "post", @@ -71,6 +74,7 @@ def sync_detailed( *, client: AuthenticatedClient | Client, body: BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost, + x_account_id: str | Unset = UNSET, ) -> Response[FileUploadResponse | HTTPValidationError]: r"""Replace a content version with a new upload @@ -126,10 +130,12 @@ def sync_detailed( `metadata_author=...`). These override keys from `metadata`. Auth & scoping: - - Requires `X-API-Key`. You can only replace content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only replace content belonging to your + account. Args: source_connection_content_version (str): + x_account_id (str | Unset): body (BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost): Raises: @@ -143,6 +149,7 @@ def sync_detailed( kwargs = _get_kwargs( source_connection_content_version=source_connection_content_version, body=body, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -157,6 +164,7 @@ def sync( *, client: AuthenticatedClient | Client, body: BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost, + x_account_id: str | Unset = UNSET, ) -> FileUploadResponse | HTTPValidationError | None: r"""Replace a content version with a new upload @@ -212,10 +220,12 @@ def sync( `metadata_author=...`). These override keys from `metadata`. Auth & scoping: - - Requires `X-API-Key`. You can only replace content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only replace content belonging to your + account. Args: source_connection_content_version (str): + x_account_id (str | Unset): body (BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost): Raises: @@ -230,6 +240,7 @@ def sync( source_connection_content_version=source_connection_content_version, client=client, body=body, + x_account_id=x_account_id, ).parsed @@ -238,6 +249,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient | Client, body: BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost, + x_account_id: str | Unset = UNSET, ) -> Response[FileUploadResponse | HTTPValidationError]: r"""Replace a content version with a new upload @@ -293,10 +305,12 @@ async def asyncio_detailed( `metadata_author=...`). These override keys from `metadata`. Auth & scoping: - - Requires `X-API-Key`. You can only replace content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only replace content belonging to your + account. Args: source_connection_content_version (str): + x_account_id (str | Unset): body (BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost): Raises: @@ -310,6 +324,7 @@ async def asyncio_detailed( kwargs = _get_kwargs( source_connection_content_version=source_connection_content_version, body=body, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -322,6 +337,7 @@ async def asyncio( *, client: AuthenticatedClient | Client, body: BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost, + x_account_id: str | Unset = UNSET, ) -> FileUploadResponse | HTTPValidationError | None: r"""Replace a content version with a new upload @@ -377,10 +393,12 @@ async def asyncio( `metadata_author=...`). These override keys from `metadata`. Auth & scoping: - - Requires `X-API-Key`. You can only replace content belonging to your account. + - Requires `X-API-Key` header or OAuth Bearer token. You can only replace content belonging to your + account. Args: source_connection_content_version (str): + x_account_id (str | Unset): body (BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost): Raises: @@ -396,5 +414,6 @@ async def asyncio( source_connection_content_version=source_connection_content_version, client=client, body=body, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/governance/__init__.py b/seclai/_generated/api/governance/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/governance/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/governance/governance_ai_accept_api_governance_ai_assistant_conversation_id_accept_post.py b/seclai/_generated/api/governance/governance_ai_accept_api_governance_ai_assistant_conversation_id_accept_post.py new file mode 100644 index 0000000..59948d8 --- /dev/null +++ b/seclai/_generated/api/governance/governance_ai_accept_api_governance_ai_assistant_conversation_id_accept_post.py @@ -0,0 +1,208 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.governance_ai_accept_response import GovernanceAiAcceptResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + conversation_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/governance/ai-assistant/{conversation_id}/accept".format( + conversation_id=quote(str(conversation_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | GovernanceAiAcceptResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = GovernanceAiAcceptResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = cast(Any, None) + return response_400 + + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | GovernanceAiAcceptResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | GovernanceAiAcceptResponse | HTTPValidationError]: + """Accept a governance plan + + Execute the proposed policy changes from a governance AI assistant conversation. Each action is + applied in order and results are returned. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | GovernanceAiAcceptResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | GovernanceAiAcceptResponse | HTTPValidationError | None: + """Accept a governance plan + + Execute the proposed policy changes from a governance AI assistant conversation. Each action is + applied in order and results are returned. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | GovernanceAiAcceptResponse | HTTPValidationError + """ + + return sync_detailed( + conversation_id=conversation_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | GovernanceAiAcceptResponse | HTTPValidationError]: + """Accept a governance plan + + Execute the proposed policy changes from a governance AI assistant conversation. Each action is + applied in order and results are returned. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | GovernanceAiAcceptResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | GovernanceAiAcceptResponse | HTTPValidationError | None: + """Accept a governance plan + + Execute the proposed policy changes from a governance AI assistant conversation. Each action is + applied in order and results are returned. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | GovernanceAiAcceptResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + conversation_id=conversation_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/governance/governance_ai_decline_api_governance_ai_assistant_conversation_id_decline_post.py b/seclai/_generated/api/governance/governance_ai_decline_api_governance_ai_assistant_conversation_id_decline_post.py new file mode 100644 index 0000000..cd43b86 --- /dev/null +++ b/seclai/_generated/api/governance/governance_ai_decline_api_governance_ai_assistant_conversation_id_decline_post.py @@ -0,0 +1,206 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + conversation_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/governance/ai-assistant/{conversation_id}/decline".format( + conversation_id=quote(str(conversation_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 400: + response_400 = cast(Any, None) + return response_400 + + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Decline a governance plan + + Reject a previously proposed governance AI assistant plan without applying any changes. The + conversation is marked as declined and no policy modifications are made. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Decline a governance plan + + Reject a previously proposed governance AI assistant plan without applying any changes. The + conversation is marked as declined and no policy modifications are made. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + conversation_id=conversation_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Decline a governance plan + + Reject a previously proposed governance AI assistant plan without applying any changes. The + conversation is marked as declined and no policy modifications are made. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Decline a governance plan + + Reject a previously proposed governance AI assistant plan without applying any changes. The + conversation is marked as declined and no policy modifications are made. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + conversation_id=conversation_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/governance/governance_ai_generate_api_governance_ai_assistant_post.py b/seclai/_generated/api/governance/governance_ai_generate_api_governance_ai_assistant_post.py new file mode 100644 index 0000000..114ab3f --- /dev/null +++ b/seclai/_generated/api/governance/governance_ai_generate_api_governance_ai_assistant_post.py @@ -0,0 +1,209 @@ +from http import HTTPStatus +from typing import Any, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.governance_ai_assistant_request import GovernanceAiAssistantRequest +from ...models.governance_ai_assistant_response import GovernanceAiAssistantResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: GovernanceAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/governance/ai-assistant", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | GovernanceAiAssistantResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = GovernanceAiAssistantResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = cast(Any, None) + return response_400 + + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | GovernanceAiAssistantResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: GovernanceAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> Response[Any | GovernanceAiAssistantResponse | HTTPValidationError]: + """Generate a governance plan + + Send a natural-language request to the governance AI assistant to generate a plan of policy changes. + Returns a conversation with proposed actions that can be accepted or declined. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + x_account_id (str | Unset): + body (GovernanceAiAssistantRequest): Request body for the governance AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | GovernanceAiAssistantResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: GovernanceAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> Any | GovernanceAiAssistantResponse | HTTPValidationError | None: + """Generate a governance plan + + Send a natural-language request to the governance AI assistant to generate a plan of policy changes. + Returns a conversation with proposed actions that can be accepted or declined. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + x_account_id (str | Unset): + body (GovernanceAiAssistantRequest): Request body for the governance AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | GovernanceAiAssistantResponse | HTTPValidationError + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: GovernanceAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> Response[Any | GovernanceAiAssistantResponse | HTTPValidationError]: + """Generate a governance plan + + Send a natural-language request to the governance AI assistant to generate a plan of policy changes. + Returns a conversation with proposed actions that can be accepted or declined. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + x_account_id (str | Unset): + body (GovernanceAiAssistantRequest): Request body for the governance AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | GovernanceAiAssistantResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: GovernanceAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> Any | GovernanceAiAssistantResponse | HTTPValidationError | None: + """Generate a governance plan + + Send a natural-language request to the governance AI assistant to generate a plan of policy changes. + Returns a conversation with proposed actions that can be accepted or declined. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + x_account_id (str | Unset): + body (GovernanceAiAssistantRequest): Request body for the governance AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | GovernanceAiAssistantResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/governance/list_governance_ai_conversations_api_governance_ai_assistant_conversations_get.py b/seclai/_generated/api/governance/list_governance_ai_conversations_api_governance_ai_assistant_conversations_get.py new file mode 100644 index 0000000..1b46f70 --- /dev/null +++ b/seclai/_generated/api/governance/list_governance_ai_conversations_api_governance_ai_assistant_conversations_get.py @@ -0,0 +1,210 @@ +from http import HTTPStatus +from typing import Any, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.governance_conversation_response import GovernanceConversationResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/governance/ai-assistant/conversations", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | list[GovernanceConversationResponse] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = GovernanceConversationResponse.from_dict( + response_200_item_data + ) + + response_200.append(response_200_item) + + return response_200 + + if response.status_code == 403: + response_403 = cast(Any, None) + return response_403 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError | list[GovernanceConversationResponse]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError | list[GovernanceConversationResponse]]: + """List AI assistant conversations + + Return recent governance AI assistant conversations for the account, ordered by most recent first. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + limit (int | Unset): Number of conversations. Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError | list[GovernanceConversationResponse]] + """ + + kwargs = _get_kwargs( + limit=limit, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | list[GovernanceConversationResponse] | None: + """List AI assistant conversations + + Return recent governance AI assistant conversations for the account, ordered by most recent first. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + limit (int | Unset): Number of conversations. Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError | list[GovernanceConversationResponse] + """ + + return sync_detailed( + client=client, + limit=limit, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError | list[GovernanceConversationResponse]]: + """List AI assistant conversations + + Return recent governance AI assistant conversations for the account, ordered by most recent first. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + limit (int | Unset): Number of conversations. Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError | list[GovernanceConversationResponse]] + """ + + kwargs = _get_kwargs( + limit=limit, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | list[GovernanceConversationResponse] | None: + """List AI assistant conversations + + Return recent governance AI assistant conversations for the account, ordered by most recent first. + + Auth: requires `X-API-Key` header or OAuth Bearer token with governance access. + + Args: + limit (int | Unset): Number of conversations. Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError | list[GovernanceConversationResponse] + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/identity/__init__.py b/seclai/_generated/api/identity/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/identity/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/identity/get_me_api_me_get.py b/seclai/_generated/api/identity/get_me_api_me_get.py new file mode 100644 index 0000000..da0549a --- /dev/null +++ b/seclai/_generated/api/identity/get_me_api_me_get.py @@ -0,0 +1,173 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.me_response import MeResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/me", + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> MeResponse | None: + if response.status_code == 200: + response_200 = MeResponse.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[MeResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[MeResponse]: + """Get current user identity + + Returns the authenticated user's personal account ID and a list of organizations they belong to. + Each organization entry includes the organization's id, name, and account_id. Useful for CLI tooling + that needs to let the user pick an organization context. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[MeResponse] + """ + + kwargs = _get_kwargs( + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> MeResponse | None: + """Get current user identity + + Returns the authenticated user's personal account ID and a list of organizations they belong to. + Each organization entry includes the organization's id, name, and account_id. Useful for CLI tooling + that needs to let the user pick an organization context. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + MeResponse + """ + + return sync_detailed( + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[MeResponse]: + """Get current user identity + + Returns the authenticated user's personal account ID and a list of organizations they belong to. + Each organization entry includes the organization's id, name, and account_id. Useful for CLI tooling + that needs to let the user pick an organization context. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[MeResponse] + """ + + kwargs = _get_kwargs( + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> MeResponse | None: + """Get current user identity + + Returns the authenticated user's personal account ID and a list of organizations they belong to. + Each organization entry includes the organization's id, name, and account_id. Useful for CLI tooling + that needs to let the user pick an organization context. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + MeResponse + """ + + return ( + await asyncio_detailed( + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/knowledge_bases/__init__.py b/seclai/_generated/api/knowledge_bases/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/knowledge_bases/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/knowledge_bases/create_knowledge_base_api_knowledge_bases_post.py b/seclai/_generated/api/knowledge_bases/create_knowledge_base_api_knowledge_bases_post.py new file mode 100644 index 0000000..6393085 --- /dev/null +++ b/seclai/_generated/api/knowledge_bases/create_knowledge_base_api_knowledge_bases_post.py @@ -0,0 +1,201 @@ +from http import HTTPStatus +from typing import Any, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_knowledge_base_body import CreateKnowledgeBaseBody +from ...models.http_validation_error import HTTPValidationError +from ...models.knowledge_base import KnowledgeBase +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: CreateKnowledgeBaseBody, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/knowledge_bases", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | KnowledgeBase | None: + if response.status_code == 201: + response_201 = KnowledgeBase.from_dict(response.json()) + + return response_201 + + if response.status_code == 402: + response_402 = cast(Any, None) + return response_402 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError | KnowledgeBase]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateKnowledgeBaseBody, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError | KnowledgeBase]: + """Create Knowledge Base + + Create a new knowledge base. + + At least one `source_id` is required. The source connections must belong to the same account. + + Args: + x_account_id (str | Unset): + body (CreateKnowledgeBaseBody): Request body for creating a knowledge base. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError | KnowledgeBase] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: CreateKnowledgeBaseBody, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | KnowledgeBase | None: + """Create Knowledge Base + + Create a new knowledge base. + + At least one `source_id` is required. The source connections must belong to the same account. + + Args: + x_account_id (str | Unset): + body (CreateKnowledgeBaseBody): Request body for creating a knowledge base. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError | KnowledgeBase + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateKnowledgeBaseBody, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError | KnowledgeBase]: + """Create Knowledge Base + + Create a new knowledge base. + + At least one `source_id` is required. The source connections must belong to the same account. + + Args: + x_account_id (str | Unset): + body (CreateKnowledgeBaseBody): Request body for creating a knowledge base. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError | KnowledgeBase] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: CreateKnowledgeBaseBody, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | KnowledgeBase | None: + """Create Knowledge Base + + Create a new knowledge base. + + At least one `source_id` is required. The source connections must belong to the same account. + + Args: + x_account_id (str | Unset): + body (CreateKnowledgeBaseBody): Request body for creating a knowledge base. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError | KnowledgeBase + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/knowledge_bases/delete_knowledge_base_api_knowledge_bases_knowledge_base_id_delete.py b/seclai/_generated/api/knowledge_bases/delete_knowledge_base_api_knowledge_bases_knowledge_base_id_delete.py new file mode 100644 index 0000000..67b24f2 --- /dev/null +++ b/seclai/_generated/api/knowledge_bases/delete_knowledge_base_api_knowledge_bases_knowledge_base_id_delete.py @@ -0,0 +1,197 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + knowledge_base_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/knowledge_bases/{knowledge_base_id}".format( + knowledge_base_id=quote(str(knowledge_base_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete Knowledge Base + + Soft-delete a knowledge base. This action cannot be undone. + + Fails if the knowledge base is referenced by any agent definitions. Remove the knowledge base from + agents first. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + knowledge_base_id=knowledge_base_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete Knowledge Base + + Soft-delete a knowledge base. This action cannot be undone. + + Fails if the knowledge base is referenced by any agent definitions. Remove the knowledge base from + agents first. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + knowledge_base_id=knowledge_base_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete Knowledge Base + + Soft-delete a knowledge base. This action cannot be undone. + + Fails if the knowledge base is referenced by any agent definitions. Remove the knowledge base from + agents first. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + knowledge_base_id=knowledge_base_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete Knowledge Base + + Soft-delete a knowledge base. This action cannot be undone. + + Fails if the knowledge base is referenced by any agent definitions. Remove the knowledge base from + agents first. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + knowledge_base_id=knowledge_base_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/knowledge_bases/get_knowledge_base_api_knowledge_bases_knowledge_base_id_get.py b/seclai/_generated/api/knowledge_bases/get_knowledge_base_api_knowledge_bases_knowledge_base_id_get.py new file mode 100644 index 0000000..ccb7aa1 --- /dev/null +++ b/seclai/_generated/api/knowledge_bases/get_knowledge_base_api_knowledge_bases_knowledge_base_id_get.py @@ -0,0 +1,203 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.knowledge_base import KnowledgeBase +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + knowledge_base_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/knowledge_bases/{knowledge_base_id}".format( + knowledge_base_id=quote(str(knowledge_base_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | KnowledgeBase | None: + if response.status_code == 200: + response_200 = KnowledgeBase.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | KnowledgeBase]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | KnowledgeBase]: + """Get Knowledge Base + + Fetch a knowledge base by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access knowledge bases belonging + to your account. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | KnowledgeBase] + """ + + kwargs = _get_kwargs( + knowledge_base_id=knowledge_base_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | KnowledgeBase | None: + """Get Knowledge Base + + Fetch a knowledge base by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access knowledge bases belonging + to your account. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | KnowledgeBase + """ + + return sync_detailed( + knowledge_base_id=knowledge_base_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | KnowledgeBase]: + """Get Knowledge Base + + Fetch a knowledge base by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access knowledge bases belonging + to your account. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | KnowledgeBase] + """ + + kwargs = _get_kwargs( + knowledge_base_id=knowledge_base_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | KnowledgeBase | None: + """Get Knowledge Base + + Fetch a knowledge base by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access knowledge bases belonging + to your account. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | KnowledgeBase + """ + + return ( + await asyncio_detailed( + knowledge_base_id=knowledge_base_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/knowledge_bases/list_knowledge_bases_api_knowledge_bases_get.py b/seclai/_generated/api/knowledge_bases/list_knowledge_bases_api_knowledge_bases_get.py new file mode 100644 index 0000000..01c3aab --- /dev/null +++ b/seclai/_generated/api/knowledge_bases/list_knowledge_bases_api_knowledge_bases_get.py @@ -0,0 +1,256 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.knowledge_base_list_response_model import KnowledgeBaseListResponseModel +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["page"] = page + + params["limit"] = limit + + params["sort"] = sort + + params["order"] = order + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/knowledge_bases", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | KnowledgeBaseListResponseModel | None: + if response.status_code == 200: + response_200 = KnowledgeBaseListResponseModel.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | KnowledgeBaseListResponseModel]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | KnowledgeBaseListResponseModel]: + """List Knowledge Bases + + List knowledge bases for the account. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number (1-based). Default: 1. + limit (int | Unset): Items per page. Default: 20. + sort (str | Unset): Sort field. One of: created_at, updated_at, name. Default: + 'created_at'. + order (str | Unset): Sort direction: asc or desc. Default: 'desc'. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | KnowledgeBaseListResponseModel] + """ + + kwargs = _get_kwargs( + page=page, + limit=limit, + sort=sort, + order=order, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | KnowledgeBaseListResponseModel | None: + """List Knowledge Bases + + List knowledge bases for the account. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number (1-based). Default: 1. + limit (int | Unset): Items per page. Default: 20. + sort (str | Unset): Sort field. One of: created_at, updated_at, name. Default: + 'created_at'. + order (str | Unset): Sort direction: asc or desc. Default: 'desc'. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | KnowledgeBaseListResponseModel + """ + + return sync_detailed( + client=client, + page=page, + limit=limit, + sort=sort, + order=order, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | KnowledgeBaseListResponseModel]: + """List Knowledge Bases + + List knowledge bases for the account. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number (1-based). Default: 1. + limit (int | Unset): Items per page. Default: 20. + sort (str | Unset): Sort field. One of: created_at, updated_at, name. Default: + 'created_at'. + order (str | Unset): Sort direction: asc or desc. Default: 'desc'. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | KnowledgeBaseListResponseModel] + """ + + kwargs = _get_kwargs( + page=page, + limit=limit, + sort=sort, + order=order, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | KnowledgeBaseListResponseModel | None: + """List Knowledge Bases + + List knowledge bases for the account. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number (1-based). Default: 1. + limit (int | Unset): Items per page. Default: 20. + sort (str | Unset): Sort field. One of: created_at, updated_at, name. Default: + 'created_at'. + order (str | Unset): Sort direction: asc or desc. Default: 'desc'. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | KnowledgeBaseListResponseModel + """ + + return ( + await asyncio_detailed( + client=client, + page=page, + limit=limit, + sort=sort, + order=order, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/knowledge_bases/update_knowledge_base_api_knowledge_bases_knowledge_base_id_put.py b/seclai/_generated/api/knowledge_bases/update_knowledge_base_api_knowledge_bases_knowledge_base_id_put.py new file mode 100644 index 0000000..8776170 --- /dev/null +++ b/seclai/_generated/api/knowledge_bases/update_knowledge_base_api_knowledge_bases_knowledge_base_id_put.py @@ -0,0 +1,225 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.knowledge_base import KnowledgeBase +from ...models.update_knowledge_base_body import UpdateKnowledgeBaseBody +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + knowledge_base_id: str, + *, + body: UpdateKnowledgeBaseBody, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "put", + "url": "/knowledge_bases/{knowledge_base_id}".format( + knowledge_base_id=quote(str(knowledge_base_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | KnowledgeBase | None: + if response.status_code == 200: + response_200 = KnowledgeBase.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | KnowledgeBase]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateKnowledgeBaseBody, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | KnowledgeBase]: + """Update Knowledge Base + + Update a knowledge base's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update knowledge bases belonging + to your account. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + body (UpdateKnowledgeBaseBody): Request body for updating a knowledge base. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | KnowledgeBase] + """ + + kwargs = _get_kwargs( + knowledge_base_id=knowledge_base_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateKnowledgeBaseBody, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | KnowledgeBase | None: + """Update Knowledge Base + + Update a knowledge base's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update knowledge bases belonging + to your account. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + body (UpdateKnowledgeBaseBody): Request body for updating a knowledge base. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | KnowledgeBase + """ + + return sync_detailed( + knowledge_base_id=knowledge_base_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateKnowledgeBaseBody, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | KnowledgeBase]: + """Update Knowledge Base + + Update a knowledge base's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update knowledge bases belonging + to your account. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + body (UpdateKnowledgeBaseBody): Request body for updating a knowledge base. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | KnowledgeBase] + """ + + kwargs = _get_kwargs( + knowledge_base_id=knowledge_base_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + knowledge_base_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateKnowledgeBaseBody, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | KnowledgeBase | None: + """Update Knowledge Base + + Update a knowledge base's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only update knowledge bases belonging + to your account. + + Args: + knowledge_base_id (str): + x_account_id (str | Unset): + body (UpdateKnowledgeBaseBody): Request body for updating a knowledge base. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | KnowledgeBase + """ + + return ( + await asyncio_detailed( + knowledge_base_id=knowledge_base_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/__init__.py b/seclai/_generated/api/memory_banks/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/memory_banks/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/memory_banks/compact_memory_bank_api_memory_banks_memory_bank_id_compact_post.py b/seclai/_generated/api/memory_banks/compact_memory_bank_api_memory_banks_memory_bank_id_compact_post.py new file mode 100644 index 0000000..a708a63 --- /dev/null +++ b/seclai/_generated/api/memory_banks/compact_memory_bank_api_memory_banks_memory_bank_id_compact_post.py @@ -0,0 +1,224 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.compact_memory_bank_api_memory_banks_memory_bank_id_compact_post_response_compact_memory_bank_api_memory_banks_memory_bank_id_compact_post import ( + CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost, +) +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + memory_bank_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/memory_banks/{memory_bank_id}/compact".format( + memory_bank_id=quote(str(memory_bank_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost + | HTTPValidationError + | None +): + if response.status_code == 202: + response_202 = CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost.from_dict( + response.json() + ) + + return response_202 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost + | HTTPValidationError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost + | HTTPValidationError +]: + """Compact Memory Bank + + Trigger an on-demand compaction run for a memory bank. + + The bank must have at least one compaction threshold configured (max_age_days, max_turns, or + max_size_tokens). Compaction runs asynchronously — the response confirms scheduling, not completion. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost | HTTPValidationError] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost + | HTTPValidationError + | None +): + """Compact Memory Bank + + Trigger an on-demand compaction run for a memory bank. + + The bank must have at least one compaction threshold configured (max_age_days, max_turns, or + max_size_tokens). Compaction runs asynchronously — the response confirms scheduling, not completion. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost | HTTPValidationError + """ + + return sync_detailed( + memory_bank_id=memory_bank_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost + | HTTPValidationError +]: + """Compact Memory Bank + + Trigger an on-demand compaction run for a memory bank. + + The bank must have at least one compaction threshold configured (max_age_days, max_turns, or + max_size_tokens). Compaction runs asynchronously — the response confirms scheduling, not completion. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost | HTTPValidationError] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost + | HTTPValidationError + | None +): + """Compact Memory Bank + + Trigger an on-demand compaction run for a memory bank. + + The bank must have at least one compaction threshold configured (max_age_days, max_turns, or + max_size_tokens). Compaction runs asynchronously — the response confirms scheduling, not completion. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost | HTTPValidationError + """ + + return ( + await asyncio_detailed( + memory_bank_id=memory_bank_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/create_memory_bank_api_memory_banks_post.py b/seclai/_generated/api/memory_banks/create_memory_bank_api_memory_banks_post.py new file mode 100644 index 0000000..a9e077b --- /dev/null +++ b/seclai/_generated/api/memory_banks/create_memory_bank_api_memory_banks_post.py @@ -0,0 +1,201 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_memory_bank_body import CreateMemoryBankBody +from ...models.http_validation_error import HTTPValidationError +from ...models.memory_bank import MemoryBank +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: CreateMemoryBankBody, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/memory_banks", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | MemoryBank | None: + if response.status_code == 201: + response_201 = MemoryBank.from_dict(response.json()) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | MemoryBank]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateMemoryBankBody, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBank]: + """Create Memory Bank + + Create a new memory bank. + + Modes: `fast_and_cheap` (256-dim), `balanced` (512-dim), `slow_and_thorough` (1024-dim), or `custom` + (supply your own embedding params). + + Args: + x_account_id (str | Unset): + body (CreateMemoryBankBody): Request body for creating a memory bank. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBank] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: CreateMemoryBankBody, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBank | None: + """Create Memory Bank + + Create a new memory bank. + + Modes: `fast_and_cheap` (256-dim), `balanced` (512-dim), `slow_and_thorough` (1024-dim), or `custom` + (supply your own embedding params). + + Args: + x_account_id (str | Unset): + body (CreateMemoryBankBody): Request body for creating a memory bank. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBank + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateMemoryBankBody, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBank]: + """Create Memory Bank + + Create a new memory bank. + + Modes: `fast_and_cheap` (256-dim), `balanced` (512-dim), `slow_and_thorough` (1024-dim), or `custom` + (supply your own embedding params). + + Args: + x_account_id (str | Unset): + body (CreateMemoryBankBody): Request body for creating a memory bank. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBank] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: CreateMemoryBankBody, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBank | None: + """Create Memory Bank + + Create a new memory bank. + + Modes: `fast_and_cheap` (256-dim), `balanced` (512-dim), `slow_and_thorough` (1024-dim), or `custom` + (supply your own embedding params). + + Args: + x_account_id (str | Unset): + body (CreateMemoryBankBody): Request body for creating a memory bank. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBank + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/delete_memory_bank_api_memory_banks_memory_bank_id_delete.py b/seclai/_generated/api/memory_banks/delete_memory_bank_api_memory_banks_memory_bank_id_delete.py new file mode 100644 index 0000000..70f4e04 --- /dev/null +++ b/seclai/_generated/api/memory_banks/delete_memory_bank_api_memory_banks_memory_bank_id_delete.py @@ -0,0 +1,193 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + memory_bank_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/memory_banks/{memory_bank_id}".format( + memory_bank_id=quote(str(memory_bank_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete Memory Bank + + Soft-delete a memory bank. This action is permanent and cannot be undone. + + The linked content source and all stored conversation memory entries will also be removed. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete Memory Bank + + Soft-delete a memory bank. This action is permanent and cannot be undone. + + The linked content source and all stored conversation memory entries will also be removed. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + memory_bank_id=memory_bank_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete Memory Bank + + Soft-delete a memory bank. This action is permanent and cannot be undone. + + The linked content source and all stored conversation memory entries will also be removed. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete Memory Bank + + Soft-delete a memory bank. This action is permanent and cannot be undone. + + The linked content source and all stored conversation memory entries will also be removed. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + memory_bank_id=memory_bank_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/delete_memory_bank_source_api_memory_banks_memory_bank_id_source_delete.py b/seclai/_generated/api/memory_banks/delete_memory_bank_source_api_memory_banks_memory_bank_id_source_delete.py new file mode 100644 index 0000000..0d110e2 --- /dev/null +++ b/seclai/_generated/api/memory_banks/delete_memory_bank_source_api_memory_banks_memory_bank_id_source_delete.py @@ -0,0 +1,197 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + memory_bank_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/memory_banks/{memory_bank_id}/source".format( + memory_bank_id=quote(str(memory_bank_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete Memory Bank Source + + Delete the content source linked to a memory bank, removing all stored memory entries. + + A new content source is automatically created on the next write. Use this to reset a bank's data + without deleting the bank itself. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete Memory Bank Source + + Delete the content source linked to a memory bank, removing all stored memory entries. + + A new content source is automatically created on the next write. Use this to reset a bank's data + without deleting the bank itself. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + memory_bank_id=memory_bank_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete Memory Bank Source + + Delete the content source linked to a memory bank, removing all stored memory entries. + + A new content source is automatically created on the next write. Use this to reset a bank's data + without deleting the bank itself. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete Memory Bank Source + + Delete the content source linked to a memory bank, removing all stored memory entries. + + A new content source is automatically created on the next write. Use this to reset a bank's data + without deleting the bank itself. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + memory_bank_id=memory_bank_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get.py b/seclai/_generated/api/memory_banks/get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get.py new file mode 100644 index 0000000..b078a89 --- /dev/null +++ b/seclai/_generated/api/memory_banks/get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get.py @@ -0,0 +1,225 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get_response_200_item import ( + GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item, +) +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + memory_bank_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/memory_banks/{memory_bank_id}/agents".format( + memory_bank_id=quote(str(memory_bank_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + HTTPValidationError + | list[GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item] + | None +): + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item.from_dict( + response_200_item_data + ) + + response_200.append(response_200_item) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + HTTPValidationError + | list[GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item] +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | list[GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item] +]: + """Get Agents Using Bank + + List agents whose current definition references this memory bank. + + Returns an array of `{agent_id, agent_name}` objects. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | list[GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item]] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | list[GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item] + | None +): + """Get Agents Using Bank + + List agents whose current definition references this memory bank. + + Returns an array of `{agent_id, agent_name}` objects. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | list[GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item] + """ + + return sync_detailed( + memory_bank_id=memory_bank_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | list[GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item] +]: + """Get Agents Using Bank + + List agents whose current definition references this memory bank. + + Returns an array of `{agent_id, agent_name}` objects. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | list[GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item]] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | list[GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item] + | None +): + """Get Agents Using Bank + + List agents whose current definition references this memory bank. + + Returns an array of `{agent_id, agent_name}` objects. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | list[GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item] + """ + + return ( + await asyncio_detailed( + memory_bank_id=memory_bank_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/get_memory_bank_api_memory_banks_memory_bank_id_get.py b/seclai/_generated/api/memory_banks/get_memory_bank_api_memory_banks_memory_bank_id_get.py new file mode 100644 index 0000000..16d1b6c --- /dev/null +++ b/seclai/_generated/api/memory_banks/get_memory_bank_api_memory_banks_memory_bank_id_get.py @@ -0,0 +1,203 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.memory_bank import MemoryBank +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + memory_bank_id: str, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/memory_banks/{memory_bank_id}".format( + memory_bank_id=quote(str(memory_bank_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | MemoryBank | None: + if response.status_code == 200: + response_200 = MemoryBank.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | MemoryBank]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBank]: + """Get Memory Bank + + Fetch a memory bank by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access memory banks belonging to + your account. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBank] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBank | None: + """Get Memory Bank + + Fetch a memory bank by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access memory banks belonging to + your account. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBank + """ + + return sync_detailed( + memory_bank_id=memory_bank_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBank]: + """Get Memory Bank + + Fetch a memory bank by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access memory banks belonging to + your account. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBank] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBank | None: + """Get Memory Bank + + Fetch a memory bank by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access memory banks belonging to + your account. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBank + """ + + return ( + await asyncio_detailed( + memory_bank_id=memory_bank_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get.py b/seclai/_generated/api/memory_banks/get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get.py new file mode 100644 index 0000000..756396e --- /dev/null +++ b/seclai/_generated/api/memory_banks/get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get.py @@ -0,0 +1,285 @@ +import datetime +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get_response_get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get import ( + GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet, +) +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + memory_bank_id: str, + *, + days: int | Unset = 30, + start_date: datetime.date | None | Unset = UNSET, + end_date: datetime.date | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["days"] = days + + json_start_date: None | str | Unset + if isinstance(start_date, Unset): + json_start_date = UNSET + elif isinstance(start_date, datetime.date): + json_start_date = start_date.isoformat() + else: + json_start_date = start_date + params["start_date"] = json_start_date + + json_end_date: None | str | Unset + if isinstance(end_date, Unset): + json_end_date = UNSET + elif isinstance(end_date, datetime.date): + json_end_date = end_date.isoformat() + else: + json_end_date = end_date + params["end_date"] = json_end_date + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/memory_banks/{memory_bank_id}/stats".format( + memory_bank_id=quote(str(memory_bank_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet + | HTTPValidationError + | None +): + if response.status_code == 200: + response_200 = GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet + | HTTPValidationError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + days: int | Unset = 30, + start_date: datetime.date | None | Unset = UNSET, + end_date: datetime.date | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[ + GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet + | HTTPValidationError +]: + """Get Memory Bank Entry Stats + + Return aggregated entry statistics for a memory bank, including total counts, token/age/entries-per- + key distributions (avg, p95, min, max), and top conversation keys, group keys, speakers, and tags. + Supports time-range filtering via `days`, `start_date`, and `end_date` query parameters. + + Args: + memory_bank_id (str): + days (int | Unset): Default: 30. + start_date (datetime.date | None | Unset): + end_date (datetime.date | None | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet | HTTPValidationError] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + days=days, + start_date=start_date, + end_date=end_date, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + days: int | Unset = 30, + start_date: datetime.date | None | Unset = UNSET, + end_date: datetime.date | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> ( + GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet + | HTTPValidationError + | None +): + """Get Memory Bank Entry Stats + + Return aggregated entry statistics for a memory bank, including total counts, token/age/entries-per- + key distributions (avg, p95, min, max), and top conversation keys, group keys, speakers, and tags. + Supports time-range filtering via `days`, `start_date`, and `end_date` query parameters. + + Args: + memory_bank_id (str): + days (int | Unset): Default: 30. + start_date (datetime.date | None | Unset): + end_date (datetime.date | None | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet | HTTPValidationError + """ + + return sync_detailed( + memory_bank_id=memory_bank_id, + client=client, + days=days, + start_date=start_date, + end_date=end_date, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + days: int | Unset = 30, + start_date: datetime.date | None | Unset = UNSET, + end_date: datetime.date | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[ + GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet + | HTTPValidationError +]: + """Get Memory Bank Entry Stats + + Return aggregated entry statistics for a memory bank, including total counts, token/age/entries-per- + key distributions (avg, p95, min, max), and top conversation keys, group keys, speakers, and tags. + Supports time-range filtering via `days`, `start_date`, and `end_date` query parameters. + + Args: + memory_bank_id (str): + days (int | Unset): Default: 30. + start_date (datetime.date | None | Unset): + end_date (datetime.date | None | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet | HTTPValidationError] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + days=days, + start_date=start_date, + end_date=end_date, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + days: int | Unset = 30, + start_date: datetime.date | None | Unset = UNSET, + end_date: datetime.date | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> ( + GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet + | HTTPValidationError + | None +): + """Get Memory Bank Entry Stats + + Return aggregated entry statistics for a memory bank, including total counts, token/age/entries-per- + key distributions (avg, p95, min, max), and top conversation keys, group keys, speakers, and tags. + Supports time-range filtering via `days`, `start_date`, and `end_date` query parameters. + + Args: + memory_bank_id (str): + days (int | Unset): Default: 30. + start_date (datetime.date | None | Unset): + end_date (datetime.date | None | Unset): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet | HTTPValidationError + """ + + return ( + await asyncio_detailed( + memory_bank_id=memory_bank_id, + client=client, + days=days, + start_date=start_date, + end_date=end_date, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/list_memory_banks_api_memory_banks_get.py b/seclai/_generated/api/memory_banks/list_memory_banks_api_memory_banks_get.py new file mode 100644 index 0000000..f544c58 --- /dev/null +++ b/seclai/_generated/api/memory_banks/list_memory_banks_api_memory_banks_get.py @@ -0,0 +1,276 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.memory_bank_list_response_model import MemoryBankListResponseModel +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + type_: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["page"] = page + + params["limit"] = limit + + params["sort"] = sort + + params["order"] = order + + json_type_: None | str | Unset + if isinstance(type_, Unset): + json_type_ = UNSET + else: + json_type_ = type_ + params["type"] = json_type_ + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/memory_banks", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | MemoryBankListResponseModel | None: + if response.status_code == 200: + response_200 = MemoryBankListResponseModel.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | MemoryBankListResponseModel]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + type_: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBankListResponseModel]: + """List Memory Banks + + List memory banks for the account. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number (1-based). Default: 1. + limit (int | Unset): Items per page. Default: 20. + sort (str | Unset): Sort field. One of: created_at, updated_at, name. Default: + 'created_at'. + order (str | Unset): Sort direction: asc or desc. Default: 'desc'. + type_ (None | str | Unset): Filter by bank type: conversation or general. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBankListResponseModel] + """ + + kwargs = _get_kwargs( + page=page, + limit=limit, + sort=sort, + order=order, + type_=type_, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + type_: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBankListResponseModel | None: + """List Memory Banks + + List memory banks for the account. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number (1-based). Default: 1. + limit (int | Unset): Items per page. Default: 20. + sort (str | Unset): Sort field. One of: created_at, updated_at, name. Default: + 'created_at'. + order (str | Unset): Sort direction: asc or desc. Default: 'desc'. + type_ (None | str | Unset): Filter by bank type: conversation or general. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBankListResponseModel + """ + + return sync_detailed( + client=client, + page=page, + limit=limit, + sort=sort, + order=order, + type_=type_, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + type_: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBankListResponseModel]: + """List Memory Banks + + List memory banks for the account. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number (1-based). Default: 1. + limit (int | Unset): Items per page. Default: 20. + sort (str | Unset): Sort field. One of: created_at, updated_at, name. Default: + 'created_at'. + order (str | Unset): Sort direction: asc or desc. Default: 'desc'. + type_ (None | str | Unset): Filter by bank type: conversation or general. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBankListResponseModel] + """ + + kwargs = _get_kwargs( + page=page, + limit=limit, + sort=sort, + order=order, + type_=type_, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + type_: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBankListResponseModel | None: + """List Memory Banks + + List memory banks for the account. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. All resources are scoped to the caller's + account. + + Args: + page (int | Unset): Page number (1-based). Default: 1. + limit (int | Unset): Items per page. Default: 20. + sort (str | Unset): Sort field. One of: created_at, updated_at, name. Default: + 'created_at'. + order (str | Unset): Sort direction: asc or desc. Default: 'desc'. + type_ (None | str | Unset): Filter by bank type: conversation or general. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBankListResponseModel + """ + + return ( + await asyncio_detailed( + client=client, + page=page, + limit=limit, + sort=sort, + order=order, + type_=type_, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/list_templates_api_memory_banks_templates_get.py b/seclai/_generated/api/memory_banks/list_templates_api_memory_banks_templates_get.py new file mode 100644 index 0000000..a8fcfd2 --- /dev/null +++ b/seclai/_generated/api/memory_banks/list_templates_api_memory_banks_templates_get.py @@ -0,0 +1,188 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.list_templates_api_memory_banks_templates_get_response_200_item import ( + ListTemplatesApiMemoryBanksTemplatesGetResponse200Item, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/memory_banks/templates", + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> list[ListTemplatesApiMemoryBanksTemplatesGetResponse200Item] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = ( + ListTemplatesApiMemoryBanksTemplatesGetResponse200Item.from_dict( + response_200_item_data + ) + ) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[list[ListTemplatesApiMemoryBanksTemplatesGetResponse200Item]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[list[ListTemplatesApiMemoryBanksTemplatesGetResponse200Item]]: + """List Templates + + Return pre-built template configurations for common memory bank use cases. + + Each template includes a name, description, suggested use case, and full default settings that can + be used directly with the create endpoint. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list[ListTemplatesApiMemoryBanksTemplatesGetResponse200Item]] + """ + + kwargs = _get_kwargs( + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> list[ListTemplatesApiMemoryBanksTemplatesGetResponse200Item] | None: + """List Templates + + Return pre-built template configurations for common memory bank use cases. + + Each template includes a name, description, suggested use case, and full default settings that can + be used directly with the create endpoint. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list[ListTemplatesApiMemoryBanksTemplatesGetResponse200Item] + """ + + return sync_detailed( + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[list[ListTemplatesApiMemoryBanksTemplatesGetResponse200Item]]: + """List Templates + + Return pre-built template configurations for common memory bank use cases. + + Each template includes a name, description, suggested use case, and full default settings that can + be used directly with the create endpoint. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list[ListTemplatesApiMemoryBanksTemplatesGetResponse200Item]] + """ + + kwargs = _get_kwargs( + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> list[ListTemplatesApiMemoryBanksTemplatesGetResponse200Item] | None: + """List Templates + + Return pre-built template configurations for common memory bank use cases. + + Each template includes a name, description, suggested use case, and full default settings that can + be used directly with the create endpoint. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list[ListTemplatesApiMemoryBanksTemplatesGetResponse200Item] + """ + + return ( + await asyncio_detailed( + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch.py b/seclai/_generated/api/memory_banks/memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch.py new file mode 100644 index 0000000..8c4ca8e --- /dev/null +++ b/seclai/_generated/api/memory_banks/memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch.py @@ -0,0 +1,247 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.memory_bank_accept_request import MemoryBankAcceptRequest +from ...models.memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch_response_memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch import ( + MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + conversation_id: UUID, + *, + body: MemoryBankAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/memory_banks/ai-assistant/{conversation_id}".format( + conversation_id=quote(str(conversation_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + HTTPValidationError + | MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch + | None +): + if response.status_code == 200: + response_200 = MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + HTTPValidationError + | MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MemoryBankAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch +]: + """Accept or decline a memory bank AI suggestion + + Update the acceptance status of a memory bank AI assistant conversation turn. Set ``accepted`` to + true to accept the proposed configuration, or false to decline it. The accepted status is recorded + for audit purposes. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (MemoryBankAcceptRequest): Accept or decline a memory bank AI suggestion. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MemoryBankAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch + | None +): + """Accept or decline a memory bank AI suggestion + + Update the acceptance status of a memory bank AI assistant conversation turn. Set ``accepted`` to + true to accept the proposed configuration, or false to decline it. The accepted status is recorded + for audit purposes. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (MemoryBankAcceptRequest): Accept or decline a memory bank AI suggestion. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch + """ + + return sync_detailed( + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MemoryBankAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch +]: + """Accept or decline a memory bank AI suggestion + + Update the acceptance status of a memory bank AI assistant conversation turn. Set ``accepted`` to + true to accept the proposed configuration, or false to decline it. The accepted status is recorded + for audit purposes. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (MemoryBankAcceptRequest): Accept or decline a memory bank AI suggestion. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch] + """ + + kwargs = _get_kwargs( + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MemoryBankAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch + | None +): + """Accept or decline a memory bank AI suggestion + + Update the acceptance status of a memory bank AI assistant conversation turn. Set ``accepted`` to + true to accept the proposed configuration, or false to decline it. The accepted status is recorded + for audit purposes. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + conversation_id (UUID): + x_account_id (str | Unset): + body (MemoryBankAcceptRequest): Accept or decline a memory bank AI suggestion. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch + """ + + return ( + await asyncio_detailed( + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/memory_bank_ai_generate_api_memory_banks_ai_assistant_post.py b/seclai/_generated/api/memory_banks/memory_bank_ai_generate_api_memory_banks_ai_assistant_post.py new file mode 100644 index 0000000..9e3947b --- /dev/null +++ b/seclai/_generated/api/memory_banks/memory_bank_ai_generate_api_memory_banks_ai_assistant_post.py @@ -0,0 +1,205 @@ +from http import HTTPStatus +from typing import Any, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.memory_bank_ai_assistant_request import MemoryBankAiAssistantRequest +from ...models.memory_bank_ai_assistant_response import MemoryBankAiAssistantResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: MemoryBankAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/memory_banks/ai-assistant", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | MemoryBankAiAssistantResponse | None: + if response.status_code == 200: + response_200 = MemoryBankAiAssistantResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = cast(Any, None) + return response_400 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError | MemoryBankAiAssistantResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: MemoryBankAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError | MemoryBankAiAssistantResponse]: + """Generate a memory bank configuration + + Generate a memory bank configuration suggestion via the AI assistant. The AI proposes name, type, + mode, compaction prompt, and retention settings based on the user's description. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (MemoryBankAiAssistantRequest): Request body for the memory bank AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError | MemoryBankAiAssistantResponse] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: MemoryBankAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | MemoryBankAiAssistantResponse | None: + """Generate a memory bank configuration + + Generate a memory bank configuration suggestion via the AI assistant. The AI proposes name, type, + mode, compaction prompt, and retention settings based on the user's description. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (MemoryBankAiAssistantRequest): Request body for the memory bank AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError | MemoryBankAiAssistantResponse + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: MemoryBankAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError | MemoryBankAiAssistantResponse]: + """Generate a memory bank configuration + + Generate a memory bank configuration suggestion via the AI assistant. The AI proposes name, type, + mode, compaction prompt, and retention settings based on the user's description. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (MemoryBankAiAssistantRequest): Request body for the memory bank AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError | MemoryBankAiAssistantResponse] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: MemoryBankAiAssistantRequest, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | MemoryBankAiAssistantResponse | None: + """Generate a memory bank configuration + + Generate a memory bank configuration suggestion via the AI assistant. The AI proposes name, type, + mode, compaction prompt, and retention settings based on the user's description. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + x_account_id (str | Unset): + body (MemoryBankAiAssistantRequest): Request body for the memory bank AI assistant. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError | MemoryBankAiAssistantResponse + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/memory_bank_ai_last_conversation_api_memory_banks_ai_assistant_last_conversation_get.py b/seclai/_generated/api/memory_banks/memory_bank_ai_last_conversation_api_memory_banks_ai_assistant_last_conversation_get.py new file mode 100644 index 0000000..03feedb --- /dev/null +++ b/seclai/_generated/api/memory_banks/memory_bank_ai_last_conversation_api_memory_banks_ai_assistant_last_conversation_get.py @@ -0,0 +1,220 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.memory_bank_last_conversation_response import ( + MemoryBankLastConversationResponse, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: int | Unset = 5, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/memory_banks/ai-assistant/last-conversation", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | MemoryBankLastConversationResponse | None: + if response.status_code == 200: + response_200 = MemoryBankLastConversationResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | MemoryBankLastConversationResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 5, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBankLastConversationResponse]: + """Fetch memory bank AI conversation history + + Fetch the most recent memory bank AI assistant conversation turns for the current user. Supports + pagination via limit/offset. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + limit (int | Unset): Max turns to return. Default: 5. + offset (int | Unset): Number of most-recent turns to skip. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBankLastConversationResponse] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 5, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBankLastConversationResponse | None: + """Fetch memory bank AI conversation history + + Fetch the most recent memory bank AI assistant conversation turns for the current user. Supports + pagination via limit/offset. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + limit (int | Unset): Max turns to return. Default: 5. + offset (int | Unset): Number of most-recent turns to skip. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBankLastConversationResponse + """ + + return sync_detailed( + client=client, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 5, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBankLastConversationResponse]: + """Fetch memory bank AI conversation history + + Fetch the most recent memory bank AI assistant conversation turns for the current user. Supports + pagination via limit/offset. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + limit (int | Unset): Max turns to return. Default: 5. + offset (int | Unset): Number of most-recent turns to skip. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBankLastConversationResponse] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + limit: int | Unset = 5, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBankLastConversationResponse | None: + """Fetch memory bank AI conversation history + + Fetch the most recent memory bank AI assistant conversation turns for the current user. Supports + pagination via limit/offset. + + Auth: requires `X-API-Key` header or OAuth Bearer token. + + Args: + limit (int | Unset): Max turns to return. Default: 5. + offset (int | Unset): Number of most-recent turns to skip. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBankLastConversationResponse + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/test_compaction_prompt_api_memory_banks_memory_bank_id_test_compaction_post.py b/seclai/_generated/api/memory_banks/test_compaction_prompt_api_memory_banks_memory_bank_id_test_compaction_post.py new file mode 100644 index 0000000..e560fed --- /dev/null +++ b/seclai/_generated/api/memory_banks/test_compaction_prompt_api_memory_banks_memory_bank_id_test_compaction_post.py @@ -0,0 +1,261 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.compaction_test_response_model import CompactionTestResponseModel +from ...models.http_validation_error import HTTPValidationError +from ...models.test_compaction_request import TestCompactionRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + memory_bank_id: str, + *, + body: TestCompactionRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/memory_banks/{memory_bank_id}/test-compaction".format( + memory_bank_id=quote(str(memory_bank_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> CompactionTestResponseModel | HTTPValidationError | None: + if response.status_code == 200: + response_200 = CompactionTestResponseModel.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[CompactionTestResponseModel | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + body: TestCompactionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[CompactionTestResponseModel | HTTPValidationError]: + """Test Compaction Prompt + + Test a compaction prompt by running the summarizer and evaluating the result with an LLM-as-judge. + Returns original entries, compaction summary, surviving entries, and a structured quality evaluation + with verdict, score, and reasoning. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + body (TestCompactionRequest): Request body for testing a compaction prompt against an + existing bank. + + The user may supply a ``compaction_prompt`` to override (or provide when + the bank has none). Content can come from three sources: + + 1. Existing entries in the bank (default when neither field is set). + 2. ``sample_entries`` – caller-provided list of strings. + 3. ``generate_direction`` – an instruction to the LLM to generate sample + memory entries. Useful for trying a prompt before any real data + exists. + + At most one of ``sample_entries`` / ``generate_direction`` may be given. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CompactionTestResponseModel | HTTPValidationError] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + body: TestCompactionRequest, + x_account_id: str | Unset = UNSET, +) -> CompactionTestResponseModel | HTTPValidationError | None: + """Test Compaction Prompt + + Test a compaction prompt by running the summarizer and evaluating the result with an LLM-as-judge. + Returns original entries, compaction summary, surviving entries, and a structured quality evaluation + with verdict, score, and reasoning. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + body (TestCompactionRequest): Request body for testing a compaction prompt against an + existing bank. + + The user may supply a ``compaction_prompt`` to override (or provide when + the bank has none). Content can come from three sources: + + 1. Existing entries in the bank (default when neither field is set). + 2. ``sample_entries`` – caller-provided list of strings. + 3. ``generate_direction`` – an instruction to the LLM to generate sample + memory entries. Useful for trying a prompt before any real data + exists. + + At most one of ``sample_entries`` / ``generate_direction`` may be given. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CompactionTestResponseModel | HTTPValidationError + """ + + return sync_detailed( + memory_bank_id=memory_bank_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + body: TestCompactionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[CompactionTestResponseModel | HTTPValidationError]: + """Test Compaction Prompt + + Test a compaction prompt by running the summarizer and evaluating the result with an LLM-as-judge. + Returns original entries, compaction summary, surviving entries, and a structured quality evaluation + with verdict, score, and reasoning. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + body (TestCompactionRequest): Request body for testing a compaction prompt against an + existing bank. + + The user may supply a ``compaction_prompt`` to override (or provide when + the bank has none). Content can come from three sources: + + 1. Existing entries in the bank (default when neither field is set). + 2. ``sample_entries`` – caller-provided list of strings. + 3. ``generate_direction`` – an instruction to the LLM to generate sample + memory entries. Useful for trying a prompt before any real data + exists. + + At most one of ``sample_entries`` / ``generate_direction`` may be given. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CompactionTestResponseModel | HTTPValidationError] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + body: TestCompactionRequest, + x_account_id: str | Unset = UNSET, +) -> CompactionTestResponseModel | HTTPValidationError | None: + """Test Compaction Prompt + + Test a compaction prompt by running the summarizer and evaluating the result with an LLM-as-judge. + Returns original entries, compaction summary, surviving entries, and a structured quality evaluation + with verdict, score, and reasoning. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + body (TestCompactionRequest): Request body for testing a compaction prompt against an + existing bank. + + The user may supply a ``compaction_prompt`` to override (or provide when + the bank has none). Content can come from three sources: + + 1. Existing entries in the bank (default when neither field is set). + 2. ``sample_entries`` – caller-provided list of strings. + 3. ``generate_direction`` – an instruction to the LLM to generate sample + memory entries. Useful for trying a prompt before any real data + exists. + + At most one of ``sample_entries`` / ``generate_direction`` may be given. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CompactionTestResponseModel | HTTPValidationError + """ + + return ( + await asyncio_detailed( + memory_bank_id=memory_bank_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/test_compaction_prompt_standalone_api_memory_banks_test_compaction_post.py b/seclai/_generated/api/memory_banks/test_compaction_prompt_standalone_api_memory_banks_test_compaction_post.py new file mode 100644 index 0000000..32c5a1f --- /dev/null +++ b/seclai/_generated/api/memory_banks/test_compaction_prompt_standalone_api_memory_banks_test_compaction_post.py @@ -0,0 +1,221 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.compaction_test_response_model import CompactionTestResponseModel +from ...models.http_validation_error import HTTPValidationError +from ...models.standalone_test_compaction_request import StandaloneTestCompactionRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: StandaloneTestCompactionRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/memory_banks/test-compaction", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> CompactionTestResponseModel | HTTPValidationError | None: + if response.status_code == 200: + response_200 = CompactionTestResponseModel.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[CompactionTestResponseModel | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: StandaloneTestCompactionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[CompactionTestResponseModel | HTTPValidationError]: + """Test Compaction Prompt Standalone + + Test a compaction prompt by running the summarizer and evaluating the result with an LLM-as-judge. + Returns original entries, compaction summary, surviving entries, and a structured quality evaluation + with verdict, score, and reasoning. + + Args: + x_account_id (str | Unset): + body (StandaloneTestCompactionRequest): Request body for testing a compaction prompt + *without* an existing bank. + + Used on the create-memory-bank page where no bank ID exists yet. + ``compaction_prompt`` is required (no bank to fall back to). + Content must come from ``sample_entries`` or ``generate_direction`` + (no existing entries to fetch). + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CompactionTestResponseModel | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: StandaloneTestCompactionRequest, + x_account_id: str | Unset = UNSET, +) -> CompactionTestResponseModel | HTTPValidationError | None: + """Test Compaction Prompt Standalone + + Test a compaction prompt by running the summarizer and evaluating the result with an LLM-as-judge. + Returns original entries, compaction summary, surviving entries, and a structured quality evaluation + with verdict, score, and reasoning. + + Args: + x_account_id (str | Unset): + body (StandaloneTestCompactionRequest): Request body for testing a compaction prompt + *without* an existing bank. + + Used on the create-memory-bank page where no bank ID exists yet. + ``compaction_prompt`` is required (no bank to fall back to). + Content must come from ``sample_entries`` or ``generate_direction`` + (no existing entries to fetch). + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CompactionTestResponseModel | HTTPValidationError + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: StandaloneTestCompactionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[CompactionTestResponseModel | HTTPValidationError]: + """Test Compaction Prompt Standalone + + Test a compaction prompt by running the summarizer and evaluating the result with an LLM-as-judge. + Returns original entries, compaction summary, surviving entries, and a structured quality evaluation + with verdict, score, and reasoning. + + Args: + x_account_id (str | Unset): + body (StandaloneTestCompactionRequest): Request body for testing a compaction prompt + *without* an existing bank. + + Used on the create-memory-bank page where no bank ID exists yet. + ``compaction_prompt`` is required (no bank to fall back to). + Content must come from ``sample_entries`` or ``generate_direction`` + (no existing entries to fetch). + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CompactionTestResponseModel | HTTPValidationError] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: StandaloneTestCompactionRequest, + x_account_id: str | Unset = UNSET, +) -> CompactionTestResponseModel | HTTPValidationError | None: + """Test Compaction Prompt Standalone + + Test a compaction prompt by running the summarizer and evaluating the result with an LLM-as-judge. + Returns original entries, compaction summary, surviving entries, and a structured quality evaluation + with verdict, score, and reasoning. + + Args: + x_account_id (str | Unset): + body (StandaloneTestCompactionRequest): Request body for testing a compaction prompt + *without* an existing bank. + + Used on the create-memory-bank page where no bank ID exists yet. + ``compaction_prompt`` is required (no bank to fall back to). + Content must come from ``sample_entries`` or ``generate_direction`` + (no existing entries to fetch). + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CompactionTestResponseModel | HTTPValidationError + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/memory_banks/update_memory_bank_api_memory_banks_memory_bank_id_put.py b/seclai/_generated/api/memory_banks/update_memory_bank_api_memory_banks_memory_bank_id_put.py new file mode 100644 index 0000000..7d7e79c --- /dev/null +++ b/seclai/_generated/api/memory_banks/update_memory_bank_api_memory_banks_memory_bank_id_put.py @@ -0,0 +1,233 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.memory_bank import MemoryBank +from ...models.update_memory_bank_body import UpdateMemoryBankBody +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + memory_bank_id: str, + *, + body: UpdateMemoryBankBody, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "put", + "url": "/memory_banks/{memory_bank_id}".format( + memory_bank_id=quote(str(memory_bank_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | MemoryBank | None: + if response.status_code == 200: + response_200 = MemoryBank.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | MemoryBank]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateMemoryBankBody, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBank]: + """Update Memory Bank + + Update a memory bank's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + Note: the embedding `mode` cannot be changed after creation because it determines the vector + dimensions used to store entries. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + body (UpdateMemoryBankBody): Request body for updating a memory bank. + + Omitted fields are left unchanged. To **clear** a field back to null, + send a zero-value sentinel: ``0`` for integers, ``""`` for strings. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBank] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateMemoryBankBody, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBank | None: + """Update Memory Bank + + Update a memory bank's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + Note: the embedding `mode` cannot be changed after creation because it determines the vector + dimensions used to store entries. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + body (UpdateMemoryBankBody): Request body for updating a memory bank. + + Omitted fields are left unchanged. To **clear** a field back to null, + send a zero-value sentinel: ``0`` for integers, ``""`` for strings. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBank + """ + + return sync_detailed( + memory_bank_id=memory_bank_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateMemoryBankBody, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | MemoryBank]: + """Update Memory Bank + + Update a memory bank's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + Note: the embedding `mode` cannot be changed after creation because it determines the vector + dimensions used to store entries. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + body (UpdateMemoryBankBody): Request body for updating a memory bank. + + Omitted fields are left unchanged. To **clear** a field back to null, + send a zero-value sentinel: ``0`` for integers, ``""`` for strings. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | MemoryBank] + """ + + kwargs = _get_kwargs( + memory_bank_id=memory_bank_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + memory_bank_id: str, + *, + client: AuthenticatedClient | Client, + body: UpdateMemoryBankBody, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | MemoryBank | None: + """Update Memory Bank + + Update a memory bank's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + Note: the embedding `mode` cannot be changed after creation because it determines the vector + dimensions used to store entries. + + Args: + memory_bank_id (str): + x_account_id (str | Unset): + body (UpdateMemoryBankBody): Request body for updating a memory bank. + + Omitted fields are left unchanged. To **clear** a field back to null, + send a zero-value sentinel: ``0`` for integers, ``""`` for strings. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | MemoryBank + """ + + return ( + await asyncio_detailed( + memory_bank_id=memory_bank_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/models/__init__.py b/seclai/_generated/api/models/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/models/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/models/get_alert_unread_count_api_models_alerts_unread_count_get.py b/seclai/_generated/api/models/get_alert_unread_count_api_models_alerts_unread_count_get.py new file mode 100644 index 0000000..f171cfc --- /dev/null +++ b/seclai/_generated/api/models/get_alert_unread_count_api_models_alerts_unread_count_get.py @@ -0,0 +1,204 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.get_alert_unread_count_api_models_alerts_unread_count_get_response_get_alert_unread_count_api_models_alerts_unread_count_get import ( + GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/models/alerts/unread-count", + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet + | None +): + if response.status_code == 200: + response_200 = GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet.from_dict( + response.json() + ) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet +]: + """Get Alert Unread Count + + Get the count of unread model lifecycle alerts. + + Useful for badge indicators in UIs and dashboards. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Count is scoped to the caller's account. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet] + """ + + kwargs = _get_kwargs( + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet + | None +): + """Get Alert Unread Count + + Get the count of unread model lifecycle alerts. + + Useful for badge indicators in UIs and dashboards. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Count is scoped to the caller's account. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet + """ + + return sync_detailed( + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ + GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet +]: + """Get Alert Unread Count + + Get the count of unread model lifecycle alerts. + + Useful for badge indicators in UIs and dashboards. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Count is scoped to the caller's account. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet] + """ + + kwargs = _get_kwargs( + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ( + GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet + | None +): + """Get Alert Unread Count + + Get the count of unread model lifecycle alerts. + + Useful for badge indicators in UIs and dashboards. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Count is scoped to the caller's account. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet + """ + + return ( + await asyncio_detailed( + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/models/get_recommendations_api_models_model_id_recommendations_get.py b/seclai/_generated/api/models/get_recommendations_api_models_model_id_recommendations_get.py new file mode 100644 index 0000000..8060daf --- /dev/null +++ b/seclai/_generated/api/models/get_recommendations_api_models_model_id_recommendations_get.py @@ -0,0 +1,349 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.get_recommendations_api_models_model_id_recommendations_get_response_get_recommendations_api_models_model_id_recommendations_get import ( + GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet, +) +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + model_id: str, + *, + require_tool_use: bool | None | Unset = UNSET, + require_structured_output: bool | None | Unset = UNSET, + require_thinking: bool | None | Unset = UNSET, + min_context_tokens: int | None | Unset = UNSET, + min_output_tokens: int | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + json_require_tool_use: bool | None | Unset + if isinstance(require_tool_use, Unset): + json_require_tool_use = UNSET + else: + json_require_tool_use = require_tool_use + params["require_tool_use"] = json_require_tool_use + + json_require_structured_output: bool | None | Unset + if isinstance(require_structured_output, Unset): + json_require_structured_output = UNSET + else: + json_require_structured_output = require_structured_output + params["require_structured_output"] = json_require_structured_output + + json_require_thinking: bool | None | Unset + if isinstance(require_thinking, Unset): + json_require_thinking = UNSET + else: + json_require_thinking = require_thinking + params["require_thinking"] = json_require_thinking + + json_min_context_tokens: int | None | Unset + if isinstance(min_context_tokens, Unset): + json_min_context_tokens = UNSET + else: + json_min_context_tokens = min_context_tokens + params["min_context_tokens"] = json_min_context_tokens + + json_min_output_tokens: int | None | Unset + if isinstance(min_output_tokens, Unset): + json_min_output_tokens = UNSET + else: + json_min_output_tokens = min_output_tokens + params["min_output_tokens"] = json_min_output_tokens + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/models/{model_id}/recommendations".format( + model_id=quote(str(model_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet + | HTTPValidationError + | None +): + if response.status_code == 200: + response_200 = GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet + | HTTPValidationError +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + model_id: str, + *, + client: AuthenticatedClient | Client, + require_tool_use: bool | None | Unset = UNSET, + require_structured_output: bool | None | Unset = UNSET, + require_thinking: bool | None | Unset = UNSET, + min_context_tokens: int | None | Unset = UNSET, + min_output_tokens: int | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[ + GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet + | HTTPValidationError +]: + """Get Recommendations + + Get replacement/upgrade recommendations for a model. + + Returns a designated successor (if any), same-family upgrades, and cross-provider/cross-family + alternatives. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + model_id (str): + require_tool_use (bool | None | Unset): Only recommend models that support tool use. + require_structured_output (bool | None | Unset): Only recommend models that support + structured output. + require_thinking (bool | None | Unset): Only recommend models that support + thinking/reasoning. + min_context_tokens (int | None | Unset): Minimum context window size in tokens. + min_output_tokens (int | None | Unset): Minimum output token limit. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet | HTTPValidationError] + """ + + kwargs = _get_kwargs( + model_id=model_id, + require_tool_use=require_tool_use, + require_structured_output=require_structured_output, + require_thinking=require_thinking, + min_context_tokens=min_context_tokens, + min_output_tokens=min_output_tokens, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + model_id: str, + *, + client: AuthenticatedClient | Client, + require_tool_use: bool | None | Unset = UNSET, + require_structured_output: bool | None | Unset = UNSET, + require_thinking: bool | None | Unset = UNSET, + min_context_tokens: int | None | Unset = UNSET, + min_output_tokens: int | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> ( + GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet + | HTTPValidationError + | None +): + """Get Recommendations + + Get replacement/upgrade recommendations for a model. + + Returns a designated successor (if any), same-family upgrades, and cross-provider/cross-family + alternatives. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + model_id (str): + require_tool_use (bool | None | Unset): Only recommend models that support tool use. + require_structured_output (bool | None | Unset): Only recommend models that support + structured output. + require_thinking (bool | None | Unset): Only recommend models that support + thinking/reasoning. + min_context_tokens (int | None | Unset): Minimum context window size in tokens. + min_output_tokens (int | None | Unset): Minimum output token limit. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet | HTTPValidationError + """ + + return sync_detailed( + model_id=model_id, + client=client, + require_tool_use=require_tool_use, + require_structured_output=require_structured_output, + require_thinking=require_thinking, + min_context_tokens=min_context_tokens, + min_output_tokens=min_output_tokens, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + model_id: str, + *, + client: AuthenticatedClient | Client, + require_tool_use: bool | None | Unset = UNSET, + require_structured_output: bool | None | Unset = UNSET, + require_thinking: bool | None | Unset = UNSET, + min_context_tokens: int | None | Unset = UNSET, + min_output_tokens: int | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[ + GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet + | HTTPValidationError +]: + """Get Recommendations + + Get replacement/upgrade recommendations for a model. + + Returns a designated successor (if any), same-family upgrades, and cross-provider/cross-family + alternatives. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + model_id (str): + require_tool_use (bool | None | Unset): Only recommend models that support tool use. + require_structured_output (bool | None | Unset): Only recommend models that support + structured output. + require_thinking (bool | None | Unset): Only recommend models that support + thinking/reasoning. + min_context_tokens (int | None | Unset): Minimum context window size in tokens. + min_output_tokens (int | None | Unset): Minimum output token limit. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet | HTTPValidationError] + """ + + kwargs = _get_kwargs( + model_id=model_id, + require_tool_use=require_tool_use, + require_structured_output=require_structured_output, + require_thinking=require_thinking, + min_context_tokens=min_context_tokens, + min_output_tokens=min_output_tokens, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + model_id: str, + *, + client: AuthenticatedClient | Client, + require_tool_use: bool | None | Unset = UNSET, + require_structured_output: bool | None | Unset = UNSET, + require_thinking: bool | None | Unset = UNSET, + min_context_tokens: int | None | Unset = UNSET, + min_output_tokens: int | None | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> ( + GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet + | HTTPValidationError + | None +): + """Get Recommendations + + Get replacement/upgrade recommendations for a model. + + Returns a designated successor (if any), same-family upgrades, and cross-provider/cross-family + alternatives. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. + + Args: + model_id (str): + require_tool_use (bool | None | Unset): Only recommend models that support tool use. + require_structured_output (bool | None | Unset): Only recommend models that support + structured output. + require_thinking (bool | None | Unset): Only recommend models that support + thinking/reasoning. + min_context_tokens (int | None | Unset): Minimum context window size in tokens. + min_output_tokens (int | None | Unset): Minimum output token limit. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet | HTTPValidationError + """ + + return ( + await asyncio_detailed( + model_id=model_id, + client=client, + require_tool_use=require_tool_use, + require_structured_output=require_structured_output, + require_thinking=require_thinking, + min_context_tokens=min_context_tokens, + min_output_tokens=min_output_tokens, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/models/list_alerts_api_models_alerts_get.py b/seclai/_generated/api/models/list_alerts_api_models_alerts_get.py new file mode 100644 index 0000000..aba278b --- /dev/null +++ b/seclai/_generated/api/models/list_alerts_api_models_alerts_get.py @@ -0,0 +1,292 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.list_alerts_api_models_alerts_get_response_list_alerts_api_models_alerts_get import ( + ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + agent_id: None | str | Unset = UNSET, + unread_only: bool | Unset = False, + limit: int | Unset = 50, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + json_agent_id: None | str | Unset + if isinstance(agent_id, Unset): + json_agent_id = UNSET + else: + json_agent_id = agent_id + params["agent_id"] = json_agent_id + + params["unread_only"] = unread_only + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/models/alerts", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ( + HTTPValidationError + | ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet + | None +): + if response.status_code == 200: + response_200 = ( + ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet.from_dict( + response.json() + ) + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ + HTTPValidationError + | ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + agent_id: None | str | Unset = UNSET, + unread_only: bool | Unset = False, + limit: int | Unset = 50, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet +]: + """List Alerts + + List model lifecycle alerts for the account. + + Returns in-app notifications about model deprecations, sunsets, and newer model availability. + Supports filtering by agent, unread-only, and pagination. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Alerts are scoped to the caller's account. + + Args: + agent_id (None | str | Unset): Filter alerts to a specific agent UUID. + unread_only (bool | Unset): When true, only return unread alerts. Default: False. + limit (int | Unset): Maximum number of alerts to return (1-100). Default: 50. + offset (int | Unset): Pagination offset. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + unread_only=unread_only, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + agent_id: None | str | Unset = UNSET, + unread_only: bool | Unset = False, + limit: int | Unset = 50, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet + | None +): + """List Alerts + + List model lifecycle alerts for the account. + + Returns in-app notifications about model deprecations, sunsets, and newer model availability. + Supports filtering by agent, unread-only, and pagination. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Alerts are scoped to the caller's account. + + Args: + agent_id (None | str | Unset): Filter alerts to a specific agent UUID. + unread_only (bool | Unset): When true, only return unread alerts. Default: False. + limit (int | Unset): Maximum number of alerts to return (1-100). Default: 50. + offset (int | Unset): Pagination offset. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet + """ + + return sync_detailed( + client=client, + agent_id=agent_id, + unread_only=unread_only, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + agent_id: None | str | Unset = UNSET, + unread_only: bool | Unset = False, + limit: int | Unset = 50, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> Response[ + HTTPValidationError + | ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet +]: + """List Alerts + + List model lifecycle alerts for the account. + + Returns in-app notifications about model deprecations, sunsets, and newer model availability. + Supports filtering by agent, unread-only, and pagination. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Alerts are scoped to the caller's account. + + Args: + agent_id (None | str | Unset): Filter alerts to a specific agent UUID. + unread_only (bool | Unset): When true, only return unread alerts. Default: False. + limit (int | Unset): Maximum number of alerts to return (1-100). Default: 50. + offset (int | Unset): Pagination offset. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet] + """ + + kwargs = _get_kwargs( + agent_id=agent_id, + unread_only=unread_only, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + agent_id: None | str | Unset = UNSET, + unread_only: bool | Unset = False, + limit: int | Unset = 50, + offset: int | Unset = 0, + x_account_id: str | Unset = UNSET, +) -> ( + HTTPValidationError + | ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet + | None +): + """List Alerts + + List model lifecycle alerts for the account. + + Returns in-app notifications about model deprecations, sunsets, and newer model availability. + Supports filtering by agent, unread-only, and pagination. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Alerts are scoped to the caller's account. + + Args: + agent_id (None | str | Unset): Filter alerts to a specific agent UUID. + unread_only (bool | Unset): When true, only return unread alerts. Default: False. + limit (int | Unset): Maximum number of alerts to return (1-100). Default: 50. + offset (int | Unset): Pagination offset. Default: 0. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet + """ + + return ( + await asyncio_detailed( + client=client, + agent_id=agent_id, + unread_only=unread_only, + limit=limit, + offset=offset, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/models/mark_all_read_api_models_alerts_mark_all_read_post.py b/seclai/_generated/api/models/mark_all_read_api_models_alerts_mark_all_read_post.py new file mode 100644 index 0000000..fe546b3 --- /dev/null +++ b/seclai/_generated/api/models/mark_all_read_api_models_alerts_mark_all_read_post.py @@ -0,0 +1,114 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/models/alerts/mark-all-read", + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | None: + if response.status_code == 204: + return None + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any]: + """Mark All Read + + Mark all model lifecycle alerts as read for the account. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Scoped to the caller's account. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any]: + """Mark All Read + + Mark all model lifecycle alerts as read for the account. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Scoped to the caller's account. + + Args: + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) diff --git a/seclai/_generated/api/models/mark_read_api_models_alerts_alert_id_read_patch.py b/seclai/_generated/api/models/mark_read_api_models_alerts_alert_id_read_patch.py new file mode 100644 index 0000000..8914566 --- /dev/null +++ b/seclai/_generated/api/models/mark_read_api_models_alerts_alert_id_read_patch.py @@ -0,0 +1,198 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + alert_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/models/alerts/{alert_id}/read".format( + alert_id=quote(str(alert_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + alert_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Mark Read + + Mark a single model lifecycle alert as read (dismissed). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. The alert must belong to the caller's account. + + Args: + alert_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + alert_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Mark Read + + Mark a single model lifecycle alert as read (dismissed). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. The alert must belong to the caller's account. + + Args: + alert_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + alert_id=alert_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + alert_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Mark Read + + Mark a single model lifecycle alert as read (dismissed). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. The alert must belong to the caller's account. + + Args: + alert_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + alert_id=alert_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + alert_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Mark Read + + Mark a single model lifecycle alert as read (dismissed). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. The alert must belong to the caller's account. + + Args: + alert_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + alert_id=alert_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/search/__init__.py b/seclai/_generated/api/search/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/search/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/search/search_api_search_get.py b/seclai/_generated/api/search/search_api_search_get.py new file mode 100644 index 0000000..462bd65 --- /dev/null +++ b/seclai/_generated/api/search/search_api_search_get.py @@ -0,0 +1,250 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.search_api_search_get_response_search_api_search_get import ( + SearchApiSearchGetResponseSearchApiSearchGet, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + q: str, + limit: int | Unset = 10, + entity_type: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["q"] = q + + params["limit"] = limit + + json_entity_type: None | str | Unset + if isinstance(entity_type, Unset): + json_entity_type = UNSET + else: + json_entity_type = entity_type + params["entity_type"] = json_entity_type + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/search", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SearchApiSearchGetResponseSearchApiSearchGet | None: + if response.status_code == 200: + response_200 = SearchApiSearchGetResponseSearchApiSearchGet.from_dict( + response.json() + ) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SearchApiSearchGetResponseSearchApiSearchGet]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + q: str, + limit: int | Unset = 10, + entity_type: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SearchApiSearchGetResponseSearchApiSearchGet]: + """Search resources + + Search across all resource types in your account. Accepts a free-text keyword query or a UUID. + UUIDs are matched exactly; keywords are matched by name and description (case-insensitive + substring). Results are ranked: name-prefix > name-substring > description-substring. Searchable + types: agent, knowledge_base, source_connection, solution, memory_bank, alert, api_key, + governance_policy. + + Args: + q (str): Search query + limit (int | Unset): Maximum results Default: 10. + entity_type (None | str | Unset): Optional entity type filter (e.g. 'agent', + 'knowledge_base') + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SearchApiSearchGetResponseSearchApiSearchGet] + """ + + kwargs = _get_kwargs( + q=q, + limit=limit, + entity_type=entity_type, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + q: str, + limit: int | Unset = 10, + entity_type: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SearchApiSearchGetResponseSearchApiSearchGet | None: + """Search resources + + Search across all resource types in your account. Accepts a free-text keyword query or a UUID. + UUIDs are matched exactly; keywords are matched by name and description (case-insensitive + substring). Results are ranked: name-prefix > name-substring > description-substring. Searchable + types: agent, knowledge_base, source_connection, solution, memory_bank, alert, api_key, + governance_policy. + + Args: + q (str): Search query + limit (int | Unset): Maximum results Default: 10. + entity_type (None | str | Unset): Optional entity type filter (e.g. 'agent', + 'knowledge_base') + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SearchApiSearchGetResponseSearchApiSearchGet + """ + + return sync_detailed( + client=client, + q=q, + limit=limit, + entity_type=entity_type, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + q: str, + limit: int | Unset = 10, + entity_type: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SearchApiSearchGetResponseSearchApiSearchGet]: + """Search resources + + Search across all resource types in your account. Accepts a free-text keyword query or a UUID. + UUIDs are matched exactly; keywords are matched by name and description (case-insensitive + substring). Results are ranked: name-prefix > name-substring > description-substring. Searchable + types: agent, knowledge_base, source_connection, solution, memory_bank, alert, api_key, + governance_policy. + + Args: + q (str): Search query + limit (int | Unset): Maximum results Default: 10. + entity_type (None | str | Unset): Optional entity type filter (e.g. 'agent', + 'knowledge_base') + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SearchApiSearchGetResponseSearchApiSearchGet] + """ + + kwargs = _get_kwargs( + q=q, + limit=limit, + entity_type=entity_type, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + q: str, + limit: int | Unset = 10, + entity_type: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SearchApiSearchGetResponseSearchApiSearchGet | None: + """Search resources + + Search across all resource types in your account. Accepts a free-text keyword query or a UUID. + UUIDs are matched exactly; keywords are matched by name and description (case-insensitive + substring). Results are ranked: name-prefix > name-substring > description-substring. Searchable + types: agent, knowledge_base, source_connection, solution, memory_bank, alert, api_key, + governance_policy. + + Args: + q (str): Search query + limit (int | Unset): Maximum results Default: 10. + entity_type (None | str | Unset): Optional entity type filter (e.g. 'agent', + 'knowledge_base') + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SearchApiSearchGetResponseSearchApiSearchGet + """ + + return ( + await asyncio_detailed( + client=client, + q=q, + limit=limit, + entity_type=entity_type, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/__init__.py b/seclai/_generated/api/solutions/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/solutions/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/solutions/add_conversation_turn_api_solutions_solution_id_conversations_post.py b/seclai/_generated/api/solutions/add_conversation_turn_api_solutions_solution_id_conversations_post.py new file mode 100644 index 0000000..c08c183 --- /dev/null +++ b/seclai/_generated/api/solutions/add_conversation_turn_api_solutions_solution_id_conversations_post.py @@ -0,0 +1,218 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.add_conversation_turn_request import AddConversationTurnRequest +from ...models.http_validation_error import HTTPValidationError +from ...models.solution_conversation_response import SolutionConversationResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: AddConversationTurnRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/solutions/{solution_id}/conversations".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionConversationResponse | None: + if response.status_code == 201: + response_201 = SolutionConversationResponse.from_dict(response.json()) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionConversationResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AddConversationTurnRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionConversationResponse]: + """Add conversation turn + + Add a conversation turn to a solution's AI assistant history. + + Records a user input and optional AI response and actions taken. This is typically called internally + by AI assistant endpoints, but can also be used to manually log interactions. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AddConversationTurnRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionConversationResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AddConversationTurnRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionConversationResponse | None: + """Add conversation turn + + Add a conversation turn to a solution's AI assistant history. + + Records a user input and optional AI response and actions taken. This is typically called internally + by AI assistant endpoints, but can also be used to manually log interactions. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AddConversationTurnRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionConversationResponse + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AddConversationTurnRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionConversationResponse]: + """Add conversation turn + + Add a conversation turn to a solution's AI assistant history. + + Records a user input and optional AI response and actions taken. This is typically called internally + by AI assistant endpoints, but can also be used to manually log interactions. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AddConversationTurnRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionConversationResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AddConversationTurnRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionConversationResponse | None: + """Add conversation turn + + Add a conversation turn to a solution's AI assistant history. + + Records a user input and optional AI response and actions taken. This is typically called internally + by AI assistant endpoints, but can also be used to manually log interactions. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AddConversationTurnRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionConversationResponse + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/ai_assistant_accept_api_solutions_solution_id_ai_assistant_conversation_id_accept_post.py b/seclai/_generated/api/solutions/ai_assistant_accept_api_solutions_solution_id_ai_assistant_conversation_id_accept_post.py new file mode 100644 index 0000000..45f1753 --- /dev/null +++ b/seclai/_generated/api/solutions/ai_assistant_accept_api_solutions_solution_id_ai_assistant_conversation_id_accept_post.py @@ -0,0 +1,236 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ai_assistant_accept_request import AiAssistantAcceptRequest +from ...models.ai_assistant_accept_response import AiAssistantAcceptResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + conversation_id: UUID, + *, + body: AiAssistantAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/solutions/{solution_id}/ai-assistant/{conversation_id}/accept".format( + solution_id=quote(str(solution_id), safe=""), + conversation_id=quote(str(conversation_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AiAssistantAcceptResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AiAssistantAcceptResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AiAssistantAcceptResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantAcceptResponse | HTTPValidationError]: + """Accept plan + + Accept and execute a proposed plan generated by one of the AI assistant endpoints. + + Executes all proposed actions in the plan and returns the results of each action. If the plan + contains destructive actions (e.g. deletions), you must set `confirm_deletions` to `true` in the + request body. Returns a summary of executed actions with success/failure status. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + body (AiAssistantAcceptRequest): Request body for accepting a proposed plan. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantAcceptResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantAcceptResponse | HTTPValidationError | None: + """Accept plan + + Accept and execute a proposed plan generated by one of the AI assistant endpoints. + + Executes all proposed actions in the plan and returns the results of each action. If the plan + contains destructive actions (e.g. deletions), you must set `confirm_deletions` to `true` in the + request body. Returns a summary of executed actions with success/failure status. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + body (AiAssistantAcceptRequest): Request body for accepting a proposed plan. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantAcceptResponse | HTTPValidationError + """ + + return sync_detailed( + solution_id=solution_id, + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantAcceptResponse | HTTPValidationError]: + """Accept plan + + Accept and execute a proposed plan generated by one of the AI assistant endpoints. + + Executes all proposed actions in the plan and returns the results of each action. If the plan + contains destructive actions (e.g. deletions), you must set `confirm_deletions` to `true` in the + request body. Returns a summary of executed actions with success/failure status. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + body (AiAssistantAcceptRequest): Request body for accepting a proposed plan. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantAcceptResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantAcceptRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantAcceptResponse | HTTPValidationError | None: + """Accept plan + + Accept and execute a proposed plan generated by one of the AI assistant endpoints. + + Executes all proposed actions in the plan and returns the results of each action. If the plan + contains destructive actions (e.g. deletions), you must set `confirm_deletions` to `true` in the + request body. Returns a summary of executed actions with success/failure status. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + body (AiAssistantAcceptRequest): Request body for accepting a proposed plan. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantAcceptResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/ai_assistant_decline_api_solutions_solution_id_ai_assistant_conversation_id_decline_post.py b/seclai/_generated/api/solutions/ai_assistant_decline_api_solutions_solution_id_ai_assistant_conversation_id_decline_post.py new file mode 100644 index 0000000..96ce7c5 --- /dev/null +++ b/seclai/_generated/api/solutions/ai_assistant_decline_api_solutions_solution_id_ai_assistant_conversation_id_decline_post.py @@ -0,0 +1,212 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + conversation_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/solutions/{solution_id}/ai-assistant/{conversation_id}/decline".format( + solution_id=quote(str(solution_id), safe=""), + conversation_id=quote(str(conversation_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Decline plan + + Decline a proposed plan generated by one of the AI assistant endpoints. + + Marks the conversation as declined without executing any actions. The conversation history is + preserved for reference. You can generate a new plan afterwards if needed. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + conversation_id=conversation_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Decline plan + + Decline a proposed plan generated by one of the AI assistant endpoints. + + Marks the conversation as declined without executing any actions. The conversation history is + preserved for reference. You can generate a new plan afterwards if needed. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + solution_id=solution_id, + conversation_id=conversation_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Decline plan + + Decline a proposed plan generated by one of the AI assistant endpoints. + + Marks the conversation as declined without executing any actions. The conversation history is + preserved for reference. You can generate a new plan afterwards if needed. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + conversation_id=conversation_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Decline plan + + Decline a proposed plan generated by one of the AI assistant endpoints. + + Marks the conversation as declined without executing any actions. The conversation history is + preserved for reference. You can generate a new plan afterwards if needed. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + conversation_id=conversation_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/ai_assistant_generate_api_solutions_solution_id_ai_assistant_generate_post.py b/seclai/_generated/api/solutions/ai_assistant_generate_api_solutions_solution_id_ai_assistant_generate_post.py new file mode 100644 index 0000000..82a8c2a --- /dev/null +++ b/seclai/_generated/api/solutions/ai_assistant_generate_api_solutions_solution_id_ai_assistant_generate_post.py @@ -0,0 +1,230 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ai_assistant_generate_request import AiAssistantGenerateRequest +from ...models.ai_assistant_generate_response import AiAssistantGenerateResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/solutions/{solution_id}/ai-assistant/generate".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AiAssistantGenerateResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate solution plan + + Generate a comprehensive solution management plan via the solution AI assistant. + + This is the most powerful assistant — it can propose changes across sources, knowledge bases, and + agents. Describe your goal in natural language and the assistant will create a multi-step plan. + Review the proposed actions and use the accept or decline endpoint. + + Supports SSE streaming when `Accept: text/event-stream` is set. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate solution plan + + Generate a comprehensive solution management plan via the solution AI assistant. + + This is the most powerful assistant — it can propose changes across sources, knowledge bases, and + agents. Describe your goal in natural language and the assistant will create a multi-step plan. + Review the proposed actions and use the accept or decline endpoint. + + Supports SSE streaming when `Accept: text/event-stream` is set. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate solution plan + + Generate a comprehensive solution management plan via the solution AI assistant. + + This is the most powerful assistant — it can propose changes across sources, knowledge bases, and + agents. Describe your goal in natural language and the assistant will create a multi-step plan. + Review the proposed actions and use the accept or decline endpoint. + + Supports SSE streaming when `Accept: text/event-stream` is set. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate solution plan + + Generate a comprehensive solution management plan via the solution AI assistant. + + This is the most powerful assistant — it can propose changes across sources, knowledge bases, and + agents. Describe your goal in natural language and the assistant will create a multi-step plan. + Review the proposed actions and use the accept or decline endpoint. + + Supports SSE streaming when `Accept: text/event-stream` is set. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/ai_assistant_knowledge_base_api_solutions_solution_id_ai_assistant_knowledge_base_post.py b/seclai/_generated/api/solutions/ai_assistant_knowledge_base_api_solutions_solution_id_ai_assistant_knowledge_base_post.py new file mode 100644 index 0000000..9940f65 --- /dev/null +++ b/seclai/_generated/api/solutions/ai_assistant_knowledge_base_api_solutions_solution_id_ai_assistant_knowledge_base_post.py @@ -0,0 +1,222 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ai_assistant_generate_request import AiAssistantGenerateRequest +from ...models.ai_assistant_generate_response import AiAssistantGenerateResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/solutions/{solution_id}/ai-assistant/knowledge-base".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AiAssistantGenerateResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate knowledge base plan + + Generate a knowledge base plan via the KB AI assistant. + + Describe what knowledge bases you need in natural language and the assistant will propose a plan + with create, update, or delete actions. The assistant may also propose creating new sources if + needed. Review the proposed actions and use the accept or decline endpoint. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate knowledge base plan + + Generate a knowledge base plan via the KB AI assistant. + + Describe what knowledge bases you need in natural language and the assistant will propose a plan + with create, update, or delete actions. The assistant may also propose creating new sources if + needed. Review the proposed actions and use the accept or decline endpoint. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate knowledge base plan + + Generate a knowledge base plan via the KB AI assistant. + + Describe what knowledge bases you need in natural language and the assistant will propose a plan + with create, update, or delete actions. The assistant may also propose creating new sources if + needed. Review the proposed actions and use the accept or decline endpoint. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate knowledge base plan + + Generate a knowledge base plan via the KB AI assistant. + + Describe what knowledge bases you need in natural language and the assistant will propose a plan + with create, update, or delete actions. The assistant may also propose creating new sources if + needed. Review the proposed actions and use the accept or decline endpoint. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/ai_assistant_source_api_solutions_solution_id_ai_assistant_source_post.py b/seclai/_generated/api/solutions/ai_assistant_source_api_solutions_solution_id_ai_assistant_source_post.py new file mode 100644 index 0000000..72021a8 --- /dev/null +++ b/seclai/_generated/api/solutions/ai_assistant_source_api_solutions_solution_id_ai_assistant_source_post.py @@ -0,0 +1,222 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ai_assistant_generate_request import AiAssistantGenerateRequest +from ...models.ai_assistant_generate_response import AiAssistantGenerateResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/solutions/{solution_id}/ai-assistant/source".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = AiAssistantGenerateResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate source plan + + Generate a content source plan via the source AI assistant. + + Describe what sources you need in natural language and the assistant will propose a plan with + create, update, or delete actions. Review the proposed actions and use the accept or decline + endpoint to execute or discard the plan. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate source plan + + Generate a content source plan via the source AI assistant. + + Describe what sources you need in natural language and the assistant will propose a plan with + create, update, or delete actions. Review the proposed actions and use the accept or decline + endpoint to execute or discard the plan. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> Response[AiAssistantGenerateResponse | HTTPValidationError]: + """Generate source plan + + Generate a content source plan via the source AI assistant. + + Describe what sources you need in natural language and the assistant will propose a plan with + create, update, or delete actions. Review the proposed actions and use the accept or decline + endpoint to execute or discard the plan. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AiAssistantGenerateResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: AiAssistantGenerateRequest, + x_account_id: str | Unset = UNSET, +) -> AiAssistantGenerateResponse | HTTPValidationError | None: + """Generate source plan + + Generate a content source plan via the source AI assistant. + + Describe what sources you need in natural language and the assistant will propose a plan with + create, update, or delete actions. Review the proposed actions and use the accept or decline + endpoint to execute or discard the plan. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (AiAssistantGenerateRequest): Request body for AI assistant generate endpoints. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AiAssistantGenerateResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/create_solution_api_solutions_post.py b/seclai/_generated/api/solutions/create_solution_api_solutions_post.py new file mode 100644 index 0000000..d8a64a5 --- /dev/null +++ b/seclai/_generated/api/solutions/create_solution_api_solutions_post.py @@ -0,0 +1,201 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_solution_request import CreateSolutionRequest +from ...models.http_validation_error import HTTPValidationError +from ...models.solution_response import SolutionResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: CreateSolutionRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/solutions", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionResponse | None: + if response.status_code == 201: + response_201 = SolutionResponse.from_dict(response.json()) + + return response_201 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateSolutionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Create a solution + + Create a new solution for the caller's account. + + A *solution* groups agents, knowledge bases, and content sources into a cohesive unit. Provide a + `name` and optional `description` in the request body. + + Args: + x_account_id (str | Unset): + body (CreateSolutionRequest): Request model for creating a new solution + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: CreateSolutionRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Create a solution + + Create a new solution for the caller's account. + + A *solution* groups agents, knowledge bases, and content sources into a cohesive unit. Provide a + `name` and optional `description` in the request body. + + Args: + x_account_id (str | Unset): + body (CreateSolutionRequest): Request model for creating a new solution + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateSolutionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Create a solution + + Create a new solution for the caller's account. + + A *solution* groups agents, knowledge bases, and content sources into a cohesive unit. Provide a + `name` and optional `description` in the request body. + + Args: + x_account_id (str | Unset): + body (CreateSolutionRequest): Request model for creating a new solution + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: CreateSolutionRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Create a solution + + Create a new solution for the caller's account. + + A *solution* groups agents, knowledge bases, and content sources into a cohesive unit. Provide a + `name` and optional `description` in the request body. + + Args: + x_account_id (str | Unset): + body (CreateSolutionRequest): Request model for creating a new solution + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/delete_solution_api_solutions_solution_id_delete.py b/seclai/_generated/api/solutions/delete_solution_api_solutions_solution_id_delete.py new file mode 100644 index 0000000..b04be6e --- /dev/null +++ b/seclai/_generated/api/solutions/delete_solution_api_solutions_solution_id_delete.py @@ -0,0 +1,198 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/solutions/{solution_id}".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete a solution + + Delete a solution by its ID. + + This permanently removes the solution and all its resource associations (agent links, knowledge base + links, source connection links). The underlying resources themselves are not deleted. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete a solution + + Delete a solution by its ID. + + This permanently removes the solution and all its resource associations (agent links, knowledge base + links, source connection links). The underlying resources themselves are not deleted. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete a solution + + Delete a solution by its ID. + + This permanently removes the solution and all its resource associations (agent links, knowledge base + links, source connection links). The underlying resources themselves are not deleted. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete a solution + + Delete a solution by its ID. + + This permanently removes the solution and all its resource associations (agent links, knowledge base + links, source connection links). The underlying resources themselves are not deleted. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/get_solution_api_solutions_solution_id_get.py b/seclai/_generated/api/solutions/get_solution_api_solutions_solution_id_get.py new file mode 100644 index 0000000..a4ead97 --- /dev/null +++ b/seclai/_generated/api/solutions/get_solution_api_solutions_solution_id_get.py @@ -0,0 +1,196 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.solution_response import SolutionResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/solutions/{solution_id}".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionResponse | None: + if response.status_code == 200: + response_200 = SolutionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Get a solution + + Retrieve a solution by its ID, including all linked agents, knowledge bases, and source connections. + + Returns the full solution detail with nested resource information. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Get a solution + + Retrieve a solution by its ID, including all linked agents, knowledge bases, and source connections. + + Returns the full solution detail with nested resource information. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Get a solution + + Retrieve a solution by its ID, including all linked agents, knowledge bases, and source connections. + + Returns the full solution detail with nested resource information. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Get a solution + + Retrieve a solution by its ID, including all linked agents, knowledge bases, and source connections. + + Returns the full solution detail with nested resource information. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/link_agents_api_solutions_solution_id_agents_post.py b/seclai/_generated/api/solutions/link_agents_api_solutions_solution_id_agents_post.py new file mode 100644 index 0000000..8f3f728 --- /dev/null +++ b/seclai/_generated/api/solutions/link_agents_api_solutions_solution_id_agents_post.py @@ -0,0 +1,218 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.link_resources_request import LinkResourcesRequest +from ...models.solution_response import SolutionResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/solutions/{solution_id}/agents".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionResponse | None: + if response.status_code == 200: + response_200 = SolutionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Link agents + + Link one or more agents to a solution by their IDs. + + Pass a JSON body with an `ids` array of agent UUIDs. Already-linked agents are silently ignored. + Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Link agents + + Link one or more agents to a solution by their IDs. + + Pass a JSON body with an `ids` array of agent UUIDs. Already-linked agents are silently ignored. + Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Link agents + + Link one or more agents to a solution by their IDs. + + Pass a JSON body with an `ids` array of agent UUIDs. Already-linked agents are silently ignored. + Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Link agents + + Link one or more agents to a solution by their IDs. + + Pass a JSON body with an `ids` array of agent UUIDs. Already-linked agents are silently ignored. + Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/link_knowledge_bases_api_solutions_solution_id_knowledge_bases_post.py b/seclai/_generated/api/solutions/link_knowledge_bases_api_solutions_solution_id_knowledge_bases_post.py new file mode 100644 index 0000000..c4a1e8d --- /dev/null +++ b/seclai/_generated/api/solutions/link_knowledge_bases_api_solutions_solution_id_knowledge_bases_post.py @@ -0,0 +1,218 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.link_resources_request import LinkResourcesRequest +from ...models.solution_response import SolutionResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/solutions/{solution_id}/knowledge-bases".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionResponse | None: + if response.status_code == 200: + response_200 = SolutionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Link knowledge bases + + Link one or more knowledge bases to a solution by their IDs. + + Pass a JSON body with an `ids` array of knowledge base UUIDs. Already-linked knowledge bases are + silently ignored. Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Link knowledge bases + + Link one or more knowledge bases to a solution by their IDs. + + Pass a JSON body with an `ids` array of knowledge base UUIDs. Already-linked knowledge bases are + silently ignored. Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Link knowledge bases + + Link one or more knowledge bases to a solution by their IDs. + + Pass a JSON body with an `ids` array of knowledge base UUIDs. Already-linked knowledge bases are + silently ignored. Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Link knowledge bases + + Link one or more knowledge bases to a solution by their IDs. + + Pass a JSON body with an `ids` array of knowledge base UUIDs. Already-linked knowledge bases are + silently ignored. Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/link_source_connections_api_solutions_solution_id_source_connections_post.py b/seclai/_generated/api/solutions/link_source_connections_api_solutions_solution_id_source_connections_post.py new file mode 100644 index 0000000..2d16047 --- /dev/null +++ b/seclai/_generated/api/solutions/link_source_connections_api_solutions_solution_id_source_connections_post.py @@ -0,0 +1,218 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.link_resources_request import LinkResourcesRequest +from ...models.solution_response import SolutionResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/solutions/{solution_id}/source-connections".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionResponse | None: + if response.status_code == 200: + response_200 = SolutionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Link source connections + + Link one or more source connections to a solution by their IDs. + + Pass a JSON body with an `ids` array of source connection UUIDs. Already-linked sources are silently + ignored. Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Link source connections + + Link one or more source connections to a solution by their IDs. + + Pass a JSON body with an `ids` array of source connection UUIDs. Already-linked sources are silently + ignored. Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Link source connections + + Link one or more source connections to a solution by their IDs. + + Pass a JSON body with an `ids` array of source connection UUIDs. Already-linked sources are silently + ignored. Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: LinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Link source connections + + Link one or more source connections to a solution by their IDs. + + Pass a JSON body with an `ids` array of source connection UUIDs. Already-linked sources are silently + ignored. Returns the updated solution with all linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (LinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/list_conversations_api_solutions_solution_id_conversations_get.py b/seclai/_generated/api/solutions/list_conversations_api_solutions_solution_id_conversations_get.py new file mode 100644 index 0000000..a9741cd --- /dev/null +++ b/seclai/_generated/api/solutions/list_conversations_api_solutions_solution_id_conversations_get.py @@ -0,0 +1,207 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.solution_conversation_response import SolutionConversationResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/solutions/{solution_id}/conversations".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | list[SolutionConversationResponse] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = SolutionConversationResponse.from_dict( + response_200_item_data + ) + + response_200.append(response_200_item) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | list[SolutionConversationResponse]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | list[SolutionConversationResponse]]: + """List conversations + + List AI assistant conversation history for a solution. + + Returns all conversation turns for the given solution, including user inputs, AI responses, proposed + actions, and acceptance status. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | list[SolutionConversationResponse]] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | list[SolutionConversationResponse] | None: + """List conversations + + List AI assistant conversation history for a solution. + + Returns all conversation turns for the given solution, including user inputs, AI responses, proposed + actions, and acceptance status. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | list[SolutionConversationResponse] + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | list[SolutionConversationResponse]]: + """List conversations + + List AI assistant conversation history for a solution. + + Returns all conversation turns for the given solution, including user inputs, AI responses, proposed + actions, and acceptance status. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | list[SolutionConversationResponse]] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | list[SolutionConversationResponse] | None: + """List conversations + + List AI assistant conversation history for a solution. + + Returns all conversation turns for the given solution, including user inputs, AI responses, proposed + actions, and acceptance status. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | list[SolutionConversationResponse] + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/list_solutions_api_solutions_get.py b/seclai/_generated/api/solutions/list_solutions_api_solutions_get.py new file mode 100644 index 0000000..92885b6 --- /dev/null +++ b/seclai/_generated/api/solutions/list_solutions_api_solutions_get.py @@ -0,0 +1,300 @@ +from http import HTTPStatus +from typing import Any + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.solution_list_response import SolutionListResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + search: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["page"] = page + + params["limit"] = limit + + params["sort"] = sort + + params["order"] = order + + json_search: None | str | Unset + if isinstance(search, Unset): + json_search = UNSET + else: + json_search = search + params["search"] = json_search + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/solutions", + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionListResponse | None: + if response.status_code == 200: + response_200 = SolutionListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionListResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + search: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionListResponse]: + """List solutions + + List solutions for your account. + + A *solution* groups agents, knowledge bases, and content sources into a cohesive unit. Use solutions + to organise related resources and leverage AI assistants for automated setup. + + Parameters: + - Pagination: `page` and `limit`. + - Sorting: `sort` (created_at/updated_at/name) and `order` (asc/desc). + - Filtering: `search` to filter by solution name (case-insensitive partial match). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + sort (str | Unset): Sort field Default: 'created_at'. + order (str | Unset): Sort order Default: 'desc'. + search (None | str | Unset): Filter by solution name (case-insensitive partial match) + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionListResponse] + """ + + kwargs = _get_kwargs( + page=page, + limit=limit, + sort=sort, + order=order, + search=search, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + search: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionListResponse | None: + """List solutions + + List solutions for your account. + + A *solution* groups agents, knowledge bases, and content sources into a cohesive unit. Use solutions + to organise related resources and leverage AI assistants for automated setup. + + Parameters: + - Pagination: `page` and `limit`. + - Sorting: `sort` (created_at/updated_at/name) and `order` (asc/desc). + - Filtering: `search` to filter by solution name (case-insensitive partial match). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + sort (str | Unset): Sort field Default: 'created_at'. + order (str | Unset): Sort order Default: 'desc'. + search (None | str | Unset): Filter by solution name (case-insensitive partial match) + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionListResponse + """ + + return sync_detailed( + client=client, + page=page, + limit=limit, + sort=sort, + order=order, + search=search, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + search: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionListResponse]: + """List solutions + + List solutions for your account. + + A *solution* groups agents, knowledge bases, and content sources into a cohesive unit. Use solutions + to organise related resources and leverage AI assistants for automated setup. + + Parameters: + - Pagination: `page` and `limit`. + - Sorting: `sort` (created_at/updated_at/name) and `order` (asc/desc). + - Filtering: `search` to filter by solution name (case-insensitive partial match). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + sort (str | Unset): Sort field Default: 'created_at'. + order (str | Unset): Sort order Default: 'desc'. + search (None | str | Unset): Filter by solution name (case-insensitive partial match) + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionListResponse] + """ + + kwargs = _get_kwargs( + page=page, + limit=limit, + sort=sort, + order=order, + search=search, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + sort: str | Unset = "created_at", + order: str | Unset = "desc", + search: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionListResponse | None: + """List solutions + + List solutions for your account. + + A *solution* groups agents, knowledge bases, and content sources into a cohesive unit. Use solutions + to organise related resources and leverage AI assistants for automated setup. + + Parameters: + - Pagination: `page` and `limit`. + - Sorting: `sort` (created_at/updated_at/name) and `order` (asc/desc). + - Filtering: `search` to filter by solution name (case-insensitive partial match). + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + + Args: + page (int | Unset): Page number Default: 1. + limit (int | Unset): Items per page Default: 20. + sort (str | Unset): Sort field Default: 'created_at'. + order (str | Unset): Sort order Default: 'desc'. + search (None | str | Unset): Filter by solution name (case-insensitive partial match) + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionListResponse + """ + + return ( + await asyncio_detailed( + client=client, + page=page, + limit=limit, + sort=sort, + order=order, + search=search, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/mark_conversation_turn_api_solutions_solution_id_conversations_conversation_id_patch.py b/seclai/_generated/api/solutions/mark_conversation_turn_api_solutions_solution_id_conversations_conversation_id_patch.py new file mode 100644 index 0000000..f419c30 --- /dev/null +++ b/seclai/_generated/api/solutions/mark_conversation_turn_api_solutions_solution_id_conversations_conversation_id_patch.py @@ -0,0 +1,230 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.mark_conversation_turn_request import MarkConversationTurnRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + conversation_id: UUID, + *, + body: MarkConversationTurnRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/solutions/{solution_id}/conversations/{conversation_id}".format( + solution_id=quote(str(solution_id), safe=""), + conversation_id=quote(str(conversation_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MarkConversationTurnRequest, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Mark conversation turn + + Mark a conversation turn as accepted or declined. + + Updates the `accepted` field on an existing conversation turn. Use this after reviewing a proposed + plan to record whether it was accepted or declined by the user. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + body (MarkConversationTurnRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MarkConversationTurnRequest, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Mark conversation turn + + Mark a conversation turn as accepted or declined. + + Updates the `accepted` field on an existing conversation turn. Use this after reviewing a proposed + plan to record whether it was accepted or declined by the user. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + body (MarkConversationTurnRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + solution_id=solution_id, + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MarkConversationTurnRequest, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Mark conversation turn + + Mark a conversation turn as accepted or declined. + + Updates the `accepted` field on an existing conversation turn. Use this after reviewing a proposed + plan to record whether it was accepted or declined by the user. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + body (MarkConversationTurnRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + conversation_id=conversation_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + conversation_id: UUID, + *, + client: AuthenticatedClient | Client, + body: MarkConversationTurnRequest, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Mark conversation turn + + Mark a conversation turn as accepted or declined. + + Updates the `accepted` field on an existing conversation turn. Use this after reviewing a proposed + plan to record whether it was accepted or declined by the user. + + Args: + solution_id (UUID): + conversation_id (UUID): + x_account_id (str | Unset): + body (MarkConversationTurnRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + conversation_id=conversation_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/unlink_agents_api_solutions_solution_id_agents_delete.py b/seclai/_generated/api/solutions/unlink_agents_api_solutions_solution_id_agents_delete.py new file mode 100644 index 0000000..c9f26bf --- /dev/null +++ b/seclai/_generated/api/solutions/unlink_agents_api_solutions_solution_id_agents_delete.py @@ -0,0 +1,218 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.solution_response import SolutionResponse +from ...models.unlink_resources_request import UnlinkResourcesRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/solutions/{solution_id}/agents".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionResponse | None: + if response.status_code == 200: + response_200 = SolutionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Unlink agents + + Unlink one or more agents from a solution by their IDs. + + Pass a JSON body with an `ids` array of agent UUIDs to remove. Agents not currently linked are + silently ignored. Returns the updated solution with remaining linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Unlink agents + + Unlink one or more agents from a solution by their IDs. + + Pass a JSON body with an `ids` array of agent UUIDs to remove. Agents not currently linked are + silently ignored. Returns the updated solution with remaining linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Unlink agents + + Unlink one or more agents from a solution by their IDs. + + Pass a JSON body with an `ids` array of agent UUIDs to remove. Agents not currently linked are + silently ignored. Returns the updated solution with remaining linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Unlink agents + + Unlink one or more agents from a solution by their IDs. + + Pass a JSON body with an `ids` array of agent UUIDs to remove. Agents not currently linked are + silently ignored. Returns the updated solution with remaining linked resources. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/unlink_knowledge_bases_api_solutions_solution_id_knowledge_bases_delete.py b/seclai/_generated/api/solutions/unlink_knowledge_bases_api_solutions_solution_id_knowledge_bases_delete.py new file mode 100644 index 0000000..2a9e74c --- /dev/null +++ b/seclai/_generated/api/solutions/unlink_knowledge_bases_api_solutions_solution_id_knowledge_bases_delete.py @@ -0,0 +1,218 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.solution_response import SolutionResponse +from ...models.unlink_resources_request import UnlinkResourcesRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/solutions/{solution_id}/knowledge-bases".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionResponse | None: + if response.status_code == 200: + response_200 = SolutionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Unlink knowledge bases + + Unlink one or more knowledge bases from a solution by their IDs. + + Pass a JSON body with an `ids` array of knowledge base UUIDs to remove. Knowledge bases not + currently linked are silently ignored. Returns the updated solution. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Unlink knowledge bases + + Unlink one or more knowledge bases from a solution by their IDs. + + Pass a JSON body with an `ids` array of knowledge base UUIDs to remove. Knowledge bases not + currently linked are silently ignored. Returns the updated solution. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Unlink knowledge bases + + Unlink one or more knowledge bases from a solution by their IDs. + + Pass a JSON body with an `ids` array of knowledge base UUIDs to remove. Knowledge bases not + currently linked are silently ignored. Returns the updated solution. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Unlink knowledge bases + + Unlink one or more knowledge bases from a solution by their IDs. + + Pass a JSON body with an `ids` array of knowledge base UUIDs to remove. Knowledge bases not + currently linked are silently ignored. Returns the updated solution. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/unlink_source_connections_api_solutions_solution_id_source_connections_delete.py b/seclai/_generated/api/solutions/unlink_source_connections_api_solutions_solution_id_source_connections_delete.py new file mode 100644 index 0000000..c92040b --- /dev/null +++ b/seclai/_generated/api/solutions/unlink_source_connections_api_solutions_solution_id_source_connections_delete.py @@ -0,0 +1,218 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.solution_response import SolutionResponse +from ...models.unlink_resources_request import UnlinkResourcesRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/solutions/{solution_id}/source-connections".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionResponse | None: + if response.status_code == 200: + response_200 = SolutionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Unlink source connections + + Unlink one or more source connections from a solution by their IDs. + + Pass a JSON body with an `ids` array of source connection UUIDs to remove. Sources not currently + linked are silently ignored. Returns the updated solution. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Unlink source connections + + Unlink one or more source connections from a solution by their IDs. + + Pass a JSON body with an `ids` array of source connection UUIDs to remove. Sources not currently + linked are silently ignored. Returns the updated solution. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Unlink source connections + + Unlink one or more source connections from a solution by their IDs. + + Pass a JSON body with an `ids` array of source connection UUIDs to remove. Sources not currently + linked are silently ignored. Returns the updated solution. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UnlinkResourcesRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Unlink source connections + + Unlink one or more source connections from a solution by their IDs. + + Pass a JSON body with an `ids` array of source connection UUIDs to remove. Sources not currently + linked are silently ignored. Returns the updated solution. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UnlinkResourcesRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/solutions/update_solution_api_solutions_solution_id_patch.py b/seclai/_generated/api/solutions/update_solution_api_solutions_solution_id_patch.py new file mode 100644 index 0000000..366728e --- /dev/null +++ b/seclai/_generated/api/solutions/update_solution_api_solutions_solution_id_patch.py @@ -0,0 +1,214 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.solution_response import SolutionResponse +from ...models.update_solution_request import UpdateSolutionRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + solution_id: UUID, + *, + body: UpdateSolutionRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": "/solutions/{solution_id}".format( + solution_id=quote(str(solution_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SolutionResponse | None: + if response.status_code == 200: + response_200 = SolutionResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SolutionResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UpdateSolutionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Update a solution + + Update an existing solution's name or description. + + Pass the fields you wish to change in the request body. Fields not included remain unchanged. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UpdateSolutionRequest): Request model for updating a solution + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UpdateSolutionRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Update a solution + + Update an existing solution's name or description. + + Pass the fields you wish to change in the request body. Fields not included remain unchanged. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UpdateSolutionRequest): Request model for updating a solution + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return sync_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UpdateSolutionRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SolutionResponse]: + """Update a solution + + Update an existing solution's name or description. + + Pass the fields you wish to change in the request body. Fields not included remain unchanged. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UpdateSolutionRequest): Request model for updating a solution + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SolutionResponse] + """ + + kwargs = _get_kwargs( + solution_id=solution_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + solution_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UpdateSolutionRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SolutionResponse | None: + """Update a solution + + Update an existing solution's name or description. + + Pass the fields you wish to change in the request body. Fields not included remain unchanged. + + Args: + solution_id (UUID): + x_account_id (str | Unset): + body (UpdateSolutionRequest): Request model for updating a solution + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SolutionResponse + """ + + return ( + await asyncio_detailed( + solution_id=solution_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/source_exports/__init__.py b/seclai/_generated/api/source_exports/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/seclai/_generated/api/source_exports/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/seclai/_generated/api/source_exports/cancel_source_export_api_sources_source_connection_id_exports_export_id_cancel_post.py b/seclai/_generated/api/source_exports/cancel_source_export_api_sources_source_connection_id_exports_export_id_cancel_post.py new file mode 100644 index 0000000..6effaab --- /dev/null +++ b/seclai/_generated/api/source_exports/cancel_source_export_api_sources_source_connection_id_exports_export_id_cancel_post.py @@ -0,0 +1,206 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.export_response import ExportResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + export_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/sources/{source_connection_id}/exports/{export_id}/cancel".format( + source_connection_id=quote(str(source_connection_id), safe=""), + export_id=quote(str(export_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ExportResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = ExportResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ExportResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ExportResponse | HTTPValidationError]: + """Cancel export + + Cancel a pending or running export. The background task will stop at the next chunk boundary. + Completed, failed, expired, or already-cancelled exports cannot be cancelled. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ExportResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + export_id=export_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ExportResponse | HTTPValidationError | None: + """Cancel export + + Cancel a pending or running export. The background task will stop at the next chunk boundary. + Completed, failed, expired, or already-cancelled exports cannot be cancelled. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ExportResponse | HTTPValidationError + """ + + return sync_detailed( + source_connection_id=source_connection_id, + export_id=export_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ExportResponse | HTTPValidationError]: + """Cancel export + + Cancel a pending or running export. The background task will stop at the next chunk boundary. + Completed, failed, expired, or already-cancelled exports cannot be cancelled. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ExportResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + export_id=export_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ExportResponse | HTTPValidationError | None: + """Cancel export + + Cancel a pending or running export. The background task will stop at the next chunk boundary. + Completed, failed, expired, or already-cancelled exports cannot be cancelled. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ExportResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + export_id=export_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/source_exports/create_source_export_api_sources_source_connection_id_exports_post.py b/seclai/_generated/api/source_exports/create_source_export_api_sources_source_connection_id_exports_post.py new file mode 100644 index 0000000..22ce26f --- /dev/null +++ b/seclai/_generated/api/source_exports/create_source_export_api_sources_source_connection_id_exports_post.py @@ -0,0 +1,210 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_export_request import CreateExportRequest +from ...models.export_response import ExportResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + body: CreateExportRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/sources/{source_connection_id}/exports".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ExportResponse | HTTPValidationError | None: + if response.status_code == 202: + response_202 = ExportResponse.from_dict(response.json()) + + return response_202 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ExportResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: CreateExportRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ExportResponse | HTTPValidationError]: + """Create export + + Start an asynchronous export job. Poll GET .../exports/{export_id} until status becomes completed, + then use /download to retrieve the file. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (CreateExportRequest): Parameters for creating a new export job. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ExportResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: CreateExportRequest, + x_account_id: str | Unset = UNSET, +) -> ExportResponse | HTTPValidationError | None: + """Create export + + Start an asynchronous export job. Poll GET .../exports/{export_id} until status becomes completed, + then use /download to retrieve the file. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (CreateExportRequest): Parameters for creating a new export job. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ExportResponse | HTTPValidationError + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: CreateExportRequest, + x_account_id: str | Unset = UNSET, +) -> Response[ExportResponse | HTTPValidationError]: + """Create export + + Start an asynchronous export job. Poll GET .../exports/{export_id} until status becomes completed, + then use /download to retrieve the file. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (CreateExportRequest): Parameters for creating a new export job. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ExportResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: CreateExportRequest, + x_account_id: str | Unset = UNSET, +) -> ExportResponse | HTTPValidationError | None: + """Create export + + Start an asynchronous export job. Poll GET .../exports/{export_id} until status becomes completed, + then use /download to retrieve the file. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (CreateExportRequest): Parameters for creating a new export job. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ExportResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/source_exports/delete_source_export_api_sources_source_connection_id_exports_export_id_delete.py b/seclai/_generated/api/source_exports/delete_source_export_api_sources_source_connection_id_exports_export_id_delete.py new file mode 100644 index 0000000..c588362 --- /dev/null +++ b/seclai/_generated/api/source_exports/delete_source_export_api_sources_source_connection_id_exports_export_id_delete.py @@ -0,0 +1,204 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + export_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/sources/{source_connection_id}/exports/{export_id}".format( + source_connection_id=quote(str(source_connection_id), safe=""), + export_id=quote(str(export_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete export + + Delete an export job and remove the associated file from S3. This is a soft-delete: the database + record is retained for audit purposes but the backing file is permanently removed. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + export_id=export_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete export + + Delete an export job and remove the associated file from S3. This is a soft-delete: the database + record is retained for audit purposes but the backing file is permanently removed. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + source_connection_id=source_connection_id, + export_id=export_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete export + + Delete an export job and remove the associated file from S3. This is a soft-delete: the database + record is retained for audit purposes but the backing file is permanently removed. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + export_id=export_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete export + + Delete an export job and remove the associated file from S3. This is a soft-delete: the database + record is retained for audit purposes but the backing file is permanently removed. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + export_id=export_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/source_exports/download_source_export_api_sources_source_connection_id_exports_export_id_download_get.py b/seclai/_generated/api/source_exports/download_source_export_api_sources_source_connection_id_exports_export_id_download_get.py new file mode 100644 index 0000000..c532c62 --- /dev/null +++ b/seclai/_generated/api/source_exports/download_source_export_api_sources_source_connection_id_exports_export_id_download_get.py @@ -0,0 +1,208 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + export_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/sources/{source_connection_id}/exports/{export_id}/download".format( + source_connection_id=quote(str(source_connection_id), safe=""), + export_id=quote(str(export_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 200: + response_200 = response.json() + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Download export + + Stream the completed export file. Returns the file content with appropriate Content-Type and + Content-Disposition headers. Returns 409 if the export is not yet completed and 410 if it has + expired. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + export_id=export_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Download export + + Stream the completed export file. Returns the file content with appropriate Content-Type and + Content-Disposition headers. Returns 409 if the export is not yet completed and 410 if it has + expired. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + source_connection_id=source_connection_id, + export_id=export_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Download export + + Stream the completed export file. Returns the file content with appropriate Content-Type and + Content-Disposition headers. Returns 409 if the export is not yet completed and 410 if it has + expired. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + export_id=export_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Download export + + Stream the completed export file. Returns the file content with appropriate Content-Type and + Content-Disposition headers. Returns 409 if the export is not yet completed and 410 if it has + expired. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + export_id=export_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/source_exports/estimate_source_export_api_sources_source_connection_id_exports_estimate_post.py b/seclai/_generated/api/source_exports/estimate_source_export_api_sources_source_connection_id_exports_estimate_post.py new file mode 100644 index 0000000..f841827 --- /dev/null +++ b/seclai/_generated/api/source_exports/estimate_source_export_api_sources_source_connection_id_exports_estimate_post.py @@ -0,0 +1,210 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.estimate_export_request import EstimateExportRequest +from ...models.estimate_export_response import EstimateExportResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + body: EstimateExportRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/sources/{source_connection_id}/exports/estimate".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> EstimateExportResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = EstimateExportResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[EstimateExportResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: EstimateExportRequest, + x_account_id: str | Unset = UNSET, +) -> Response[EstimateExportResponse | HTTPValidationError]: + """Estimate export size + + Return an order-of-magnitude size estimate (in bytes) for an export without creating a job. Use + this to show users how large the download will be before they commit to running the export. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (EstimateExportRequest): Parameters for estimating export size. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EstimateExportResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: EstimateExportRequest, + x_account_id: str | Unset = UNSET, +) -> EstimateExportResponse | HTTPValidationError | None: + """Estimate export size + + Return an order-of-magnitude size estimate (in bytes) for an export without creating a job. Use + this to show users how large the download will be before they commit to running the export. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (EstimateExportRequest): Parameters for estimating export size. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EstimateExportResponse | HTTPValidationError + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: EstimateExportRequest, + x_account_id: str | Unset = UNSET, +) -> Response[EstimateExportResponse | HTTPValidationError]: + """Estimate export size + + Return an order-of-magnitude size estimate (in bytes) for an export without creating a job. Use + this to show users how large the download will be before they commit to running the export. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (EstimateExportRequest): Parameters for estimating export size. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[EstimateExportResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: EstimateExportRequest, + x_account_id: str | Unset = UNSET, +) -> EstimateExportResponse | HTTPValidationError | None: + """Estimate export size + + Return an order-of-magnitude size estimate (in bytes) for an export without creating a job. Use + this to show users how large the download will be before they commit to running the export. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (EstimateExportRequest): Parameters for estimating export size. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + EstimateExportResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/source_exports/get_source_export_api_sources_source_connection_id_exports_export_id_get.py b/seclai/_generated/api/source_exports/get_source_export_api_sources_source_connection_id_exports_export_id_get.py new file mode 100644 index 0000000..5abfcfc --- /dev/null +++ b/seclai/_generated/api/source_exports/get_source_export_api_sources_source_connection_id_exports_export_id_get.py @@ -0,0 +1,206 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.export_response import ExportResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + export_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/sources/{source_connection_id}/exports/{export_id}".format( + source_connection_id=quote(str(source_connection_id), safe=""), + export_id=quote(str(export_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ExportResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = ExportResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ExportResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ExportResponse | HTTPValidationError]: + """Get export status + + Retrieve the current status and progress of an export job. Returns all metadata including progress + counters, file size, item count, and expiration time once completed. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ExportResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + export_id=export_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ExportResponse | HTTPValidationError | None: + """Get export status + + Retrieve the current status and progress of an export job. Returns all metadata including progress + counters, file size, item count, and expiration time once completed. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ExportResponse | HTTPValidationError + """ + + return sync_detailed( + source_connection_id=source_connection_id, + export_id=export_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[ExportResponse | HTTPValidationError]: + """Get export status + + Retrieve the current status and progress of an export job. Returns all metadata including progress + counters, file size, item count, and expiration time once completed. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ExportResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + export_id=export_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + export_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> ExportResponse | HTTPValidationError | None: + """Get export status + + Retrieve the current status and progress of an export job. Returns all metadata including progress + counters, file size, item count, and expiration time once completed. + + Args: + source_connection_id (UUID): + export_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ExportResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + export_id=export_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/source_exports/list_source_exports_api_sources_source_connection_id_exports_get.py b/seclai/_generated/api/source_exports/list_source_exports_api_sources_source_connection_id_exports_get.py new file mode 100644 index 0000000..48f916a --- /dev/null +++ b/seclai/_generated/api/source_exports/list_source_exports_api_sources_source_connection_id_exports_get.py @@ -0,0 +1,231 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.export_list_response import ExportListResponse +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + params: dict[str, Any] = {} + + params["page"] = page + + params["limit"] = limit + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/sources/{source_connection_id}/exports".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + "params": params, + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> ExportListResponse | HTTPValidationError | None: + if response.status_code == 200: + response_200 = ExportListResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[ExportListResponse | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[ExportListResponse | HTTPValidationError]: + """List exports + + List all export jobs for a source connection, ordered newest first. Supports pagination via + ``page`` and ``limit`` query parameters. Returns status, progress, and file metadata for each + export. + + Args: + source_connection_id (UUID): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ExportListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> ExportListResponse | HTTPValidationError | None: + """List exports + + List all export jobs for a source connection, ordered newest first. Supports pagination via + ``page`` and ``limit`` query parameters. Returns status, progress, and file metadata for each + export. + + Args: + source_connection_id (UUID): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ExportListResponse | HTTPValidationError + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + page=page, + limit=limit, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> Response[ExportListResponse | HTTPValidationError]: + """List exports + + List all export jobs for a source connection, ordered newest first. Supports pagination via + ``page`` and ``limit`` query parameters. Returns status, progress, and file metadata for each + export. + + Args: + source_connection_id (UUID): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ExportListResponse | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + page: int | Unset = 1, + limit: int | Unset = 20, + x_account_id: str | Unset = UNSET, +) -> ExportListResponse | HTTPValidationError | None: + """List exports + + List all export jobs for a source connection, ordered newest first. Supports pagination via + ``page`` and ``limit`` query parameters. Returns status, progress, and file metadata for each + export. + + Args: + source_connection_id (UUID): + page (int | Unset): Default: 1. + limit (int | Unset): Default: 20. + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ExportListResponse | HTTPValidationError + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + page=page, + limit=limit, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/sources/cancel_source_embedding_migration_api_sources_source_connection_id_embedding_migration_cancel_post.py b/seclai/_generated/api/sources/cancel_source_embedding_migration_api_sources_source_connection_id_embedding_migration_cancel_post.py new file mode 100644 index 0000000..920fbe3 --- /dev/null +++ b/seclai/_generated/api/sources/cancel_source_embedding_migration_api_sources_source_connection_id_embedding_migration_cancel_post.py @@ -0,0 +1,198 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.source_embedding_migration_response import ( + SourceEmbeddingMigrationResponse, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/sources/{source_connection_id}/embedding-migration/cancel".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SourceEmbeddingMigrationResponse | None: + if response.status_code == 200: + response_200 = SourceEmbeddingMigrationResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SourceEmbeddingMigrationResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SourceEmbeddingMigrationResponse]: + """Cancel Source Embedding Migration + + Cancel an active embedding migration for a custom-index source. + + Only pending, running, or switching migrations can be cancelled. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SourceEmbeddingMigrationResponse] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SourceEmbeddingMigrationResponse | None: + """Cancel Source Embedding Migration + + Cancel an active embedding migration for a custom-index source. + + Only pending, running, or switching migrations can be cancelled. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SourceEmbeddingMigrationResponse + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SourceEmbeddingMigrationResponse]: + """Cancel Source Embedding Migration + + Cancel an active embedding migration for a custom-index source. + + Only pending, running, or switching migrations can be cancelled. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SourceEmbeddingMigrationResponse] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SourceEmbeddingMigrationResponse | None: + """Cancel Source Embedding Migration + + Cancel an active embedding migration for a custom-index source. + + Only pending, running, or switching migrations can be cancelled. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SourceEmbeddingMigrationResponse + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/sources/create_source_api_sources_post.py b/seclai/_generated/api/sources/create_source_api_sources_post.py new file mode 100644 index 0000000..2fa7cd9 --- /dev/null +++ b/seclai/_generated/api/sources/create_source_api_sources_post.py @@ -0,0 +1,213 @@ +from http import HTTPStatus +from typing import Any, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.create_source_body import CreateSourceBody +from ...models.http_validation_error import HTTPValidationError +from ...models.source_response import SourceResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + body: CreateSourceBody, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/sources", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | SourceResponse | None: + if response.status_code == 201: + response_201 = SourceResponse.from_dict(response.json()) + + return response_201 + + if response.status_code == 402: + response_402 = cast(Any, None) + return response_402 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError | SourceResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateSourceBody, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError | SourceResponse]: + """Create Source + + Create a new content source. + + Source types: `rss`, `website`, `file_uploads`, `custom_index`. + + For RSS and website sources, provide the URL. For file upload and custom index sources, the URL is + created automatically. + + Args: + x_account_id (str | Unset): + body (CreateSourceBody): Request body for creating a content source. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError | SourceResponse] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient | Client, + body: CreateSourceBody, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | SourceResponse | None: + """Create Source + + Create a new content source. + + Source types: `rss`, `website`, `file_uploads`, `custom_index`. + + For RSS and website sources, provide the URL. For file upload and custom index sources, the URL is + created automatically. + + Args: + x_account_id (str | Unset): + body (CreateSourceBody): Request body for creating a content source. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError | SourceResponse + """ + + return sync_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient | Client, + body: CreateSourceBody, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError | SourceResponse]: + """Create Source + + Create a new content source. + + Source types: `rss`, `website`, `file_uploads`, `custom_index`. + + For RSS and website sources, provide the URL. For file upload and custom index sources, the URL is + created automatically. + + Args: + x_account_id (str | Unset): + body (CreateSourceBody): Request body for creating a content source. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError | SourceResponse] + """ + + kwargs = _get_kwargs( + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient | Client, + body: CreateSourceBody, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | SourceResponse | None: + """Create Source + + Create a new content source. + + Source types: `rss`, `website`, `file_uploads`, `custom_index`. + + For RSS and website sources, provide the URL. For file upload and custom index sources, the URL is + created automatically. + + Args: + x_account_id (str | Unset): + body (CreateSourceBody): Request body for creating a content source. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError | SourceResponse + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/sources/delete_source_api_sources_source_connection_id_delete.py b/seclai/_generated/api/sources/delete_source_api_sources_source_connection_id_delete.py new file mode 100644 index 0000000..3e19f2c --- /dev/null +++ b/seclai/_generated/api/sources/delete_source_api_sources_source_connection_id_delete.py @@ -0,0 +1,198 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "delete", + "url": "/sources/{source_connection_id}".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | None: + if response.status_code == 204: + response_204 = cast(Any, None) + return response_204 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete Source + + Soft-delete a content source. This action cannot be undone. + + System-managed sources (such as agent history or conversation memory) cannot be deleted through this + endpoint. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete Source + + Soft-delete a content source. This action cannot be undone. + + System-managed sources (such as agent history or conversation memory) cannot be deleted through this + endpoint. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError]: + """Delete Source + + Soft-delete a content source. This action cannot be undone. + + System-managed sources (such as agent history or conversation memory) cannot be deleted through this + endpoint. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | None: + """Delete Source + + Soft-delete a content source. This action cannot be undone. + + System-managed sources (such as agent history or conversation memory) cannot be deleted through this + endpoint. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/sources/get_source_api_sources_source_connection_id_get.py b/seclai/_generated/api/sources/get_source_api_sources_source_connection_id_get.py new file mode 100644 index 0000000..03b3ef7 --- /dev/null +++ b/seclai/_generated/api/sources/get_source_api_sources_source_connection_id_get.py @@ -0,0 +1,204 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.source_response import SourceResponse +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/sources/{source_connection_id}".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SourceResponse | None: + if response.status_code == 200: + response_200 = SourceResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SourceResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SourceResponse]: + """Get Source + + Fetch a content source by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access sources belonging to your + account. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SourceResponse] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SourceResponse | None: + """Get Source + + Fetch a content source by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access sources belonging to your + account. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SourceResponse + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SourceResponse]: + """Get Source + + Fetch a content source by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access sources belonging to your + account. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SourceResponse] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SourceResponse | None: + """Get Source + + Fetch a content source by ID. + + Auth & scoping: + - Requires `X-API-Key` header or OAuth Bearer token. You can only access sources belonging to your + account. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SourceResponse + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/sources/get_source_embedding_migration_api_sources_source_connection_id_embedding_migration_get.py b/seclai/_generated/api/sources/get_source_embedding_migration_api_sources_source_connection_id_embedding_migration_get.py new file mode 100644 index 0000000..0e3207d --- /dev/null +++ b/seclai/_generated/api/sources/get_source_embedding_migration_api_sources_source_connection_id_embedding_migration_get.py @@ -0,0 +1,214 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.source_embedding_migration_response import ( + SourceEmbeddingMigrationResponse, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/sources/{source_connection_id}/embedding-migration".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | None | SourceEmbeddingMigrationResponse | None: + if response.status_code == 200: + + def _parse_response_200( + data: object, + ) -> None | SourceEmbeddingMigrationResponse: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + response_200_type_0 = SourceEmbeddingMigrationResponse.from_dict(data) + + return response_200_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | SourceEmbeddingMigrationResponse, data) + + response_200 = _parse_response_200(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | None | SourceEmbeddingMigrationResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | None | SourceEmbeddingMigrationResponse]: + """Get Source Embedding Migration + + Get the latest embedding migration status for a custom-index source. + + Returns `null` when no migration has ever been started for this source. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | None | SourceEmbeddingMigrationResponse] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | None | SourceEmbeddingMigrationResponse | None: + """Get Source Embedding Migration + + Get the latest embedding migration status for a custom-index source. + + Returns `null` when no migration has ever been started for this source. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | None | SourceEmbeddingMigrationResponse + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | None | SourceEmbeddingMigrationResponse]: + """Get Source Embedding Migration + + Get the latest embedding migration status for a custom-index source. + + Returns `null` when no migration has ever been started for this source. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | None | SourceEmbeddingMigrationResponse] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | None | SourceEmbeddingMigrationResponse | None: + """Get Source Embedding Migration + + Get the latest embedding migration status for a custom-index source. + + Returns `null` when no migration has ever been started for this source. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | None | SourceEmbeddingMigrationResponse + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/sources/list_sources_api_sources_get.py b/seclai/_generated/api/sources/list_sources_api_sources_get.py index 082dac0..0b62cad 100644 --- a/seclai/_generated/api/sources/list_sources_api_sources_get.py +++ b/seclai/_generated/api/sources/list_sources_api_sources_get.py @@ -17,7 +17,12 @@ def _get_kwargs( sort: str | Unset = "created_at", order: str | Unset = "desc", account_id: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + params: dict[str, Any] = {} params["page"] = page @@ -43,6 +48,7 @@ def _get_kwargs( "params": params, } + _kwargs["headers"] = headers return _kwargs @@ -84,6 +90,7 @@ def sync_detailed( sort: str | Unset = "created_at", order: str | Unset = "desc", account_id: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, ) -> Response[HTTPValidationError | SourceListResponse]: """List sources @@ -98,16 +105,17 @@ def sync_detailed( - Sorting: `sort` (created_at/updated_at/name) and `order` (asc/desc). Auth & scoping: - - Requires `X-API-Key`. Results are scoped to the API key's account. - - The optional `account_id` query param is only allowed when it matches the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + - The optional `account_id` query param is only allowed when it matches the caller's account. Args: page (int | Unset): Page number Default: 1. limit (int | Unset): Items per page Default: 20. sort (str | Unset): Sort field Default: 'created_at'. order (str | Unset): Sort order Default: 'desc'. - account_id (None | str | Unset): List sources for the given account. Defaults to the api - key's account. + account_id (None | str | Unset): List sources for the given account. Defaults to the + caller's account. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -123,6 +131,7 @@ def sync_detailed( sort=sort, order=order, account_id=account_id, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -140,6 +149,7 @@ def sync( sort: str | Unset = "created_at", order: str | Unset = "desc", account_id: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, ) -> HTTPValidationError | SourceListResponse | None: """List sources @@ -154,16 +164,17 @@ def sync( - Sorting: `sort` (created_at/updated_at/name) and `order` (asc/desc). Auth & scoping: - - Requires `X-API-Key`. Results are scoped to the API key's account. - - The optional `account_id` query param is only allowed when it matches the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + - The optional `account_id` query param is only allowed when it matches the caller's account. Args: page (int | Unset): Page number Default: 1. limit (int | Unset): Items per page Default: 20. sort (str | Unset): Sort field Default: 'created_at'. order (str | Unset): Sort order Default: 'desc'. - account_id (None | str | Unset): List sources for the given account. Defaults to the api - key's account. + account_id (None | str | Unset): List sources for the given account. Defaults to the + caller's account. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -180,6 +191,7 @@ def sync( sort=sort, order=order, account_id=account_id, + x_account_id=x_account_id, ).parsed @@ -191,6 +203,7 @@ async def asyncio_detailed( sort: str | Unset = "created_at", order: str | Unset = "desc", account_id: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, ) -> Response[HTTPValidationError | SourceListResponse]: """List sources @@ -205,16 +218,17 @@ async def asyncio_detailed( - Sorting: `sort` (created_at/updated_at/name) and `order` (asc/desc). Auth & scoping: - - Requires `X-API-Key`. Results are scoped to the API key's account. - - The optional `account_id` query param is only allowed when it matches the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + - The optional `account_id` query param is only allowed when it matches the caller's account. Args: page (int | Unset): Page number Default: 1. limit (int | Unset): Items per page Default: 20. sort (str | Unset): Sort field Default: 'created_at'. order (str | Unset): Sort order Default: 'desc'. - account_id (None | str | Unset): List sources for the given account. Defaults to the api - key's account. + account_id (None | str | Unset): List sources for the given account. Defaults to the + caller's account. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -230,6 +244,7 @@ async def asyncio_detailed( sort=sort, order=order, account_id=account_id, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -245,6 +260,7 @@ async def asyncio( sort: str | Unset = "created_at", order: str | Unset = "desc", account_id: None | str | Unset = UNSET, + x_account_id: str | Unset = UNSET, ) -> HTTPValidationError | SourceListResponse | None: """List sources @@ -259,16 +275,17 @@ async def asyncio( - Sorting: `sort` (created_at/updated_at/name) and `order` (asc/desc). Auth & scoping: - - Requires `X-API-Key`. Results are scoped to the API key's account. - - The optional `account_id` query param is only allowed when it matches the API key's account. + - Requires `X-API-Key` header or OAuth Bearer token. Results are scoped to the caller's account. + - The optional `account_id` query param is only allowed when it matches the caller's account. Args: page (int | Unset): Page number Default: 1. limit (int | Unset): Items per page Default: 20. sort (str | Unset): Sort field Default: 'created_at'. order (str | Unset): Sort order Default: 'desc'. - account_id (None | str | Unset): List sources for the given account. Defaults to the api - key's account. + account_id (None | str | Unset): List sources for the given account. Defaults to the + caller's account. + x_account_id (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -286,5 +303,6 @@ async def asyncio( sort=sort, order=order, account_id=account_id, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/sources/start_source_embedding_migration_api_sources_source_connection_id_embedding_migration_post.py b/seclai/_generated/api/sources/start_source_embedding_migration_api_sources_source_connection_id_embedding_migration_post.py new file mode 100644 index 0000000..924bd74 --- /dev/null +++ b/seclai/_generated/api/sources/start_source_embedding_migration_api_sources_source_connection_id_embedding_migration_post.py @@ -0,0 +1,266 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.source_embedding_migration_response import ( + SourceEmbeddingMigrationResponse, +) +from ...models.start_source_embedding_migration_request import ( + StartSourceEmbeddingMigrationRequest, +) +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + body: StartSourceEmbeddingMigrationRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/sources/{source_connection_id}/embedding-migration".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | HTTPValidationError | SourceEmbeddingMigrationResponse | None: + if response.status_code == 200: + response_200 = SourceEmbeddingMigrationResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 409: + response_409 = cast(Any, None) + return response_409 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | HTTPValidationError | SourceEmbeddingMigrationResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: StartSourceEmbeddingMigrationRequest, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError | SourceEmbeddingMigrationResponse]: + """Start Source Embedding Migration + + Start an embedding model migration for a custom-index source. + + The migration runs asynchronously in the background. Poll `GET /api/sources/{id}/embedding- + migration` to track progress. + + Optionally override chunking configuration (`chunk_size`, `chunk_overlap`, `chunk_language`, + `chunk_separators`, `chunk_regex_separators`). When a chunking field is omitted (null), the current + source's value is preserved. + + Constraints: + - Only `custom_index` source types support migration. + - A migration cannot be started while another is already active. + - The target model + dimensions must differ from the source's current settings. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (StartSourceEmbeddingMigrationRequest): Request payload to start a source embedding + migration. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError | SourceEmbeddingMigrationResponse] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: StartSourceEmbeddingMigrationRequest, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | SourceEmbeddingMigrationResponse | None: + """Start Source Embedding Migration + + Start an embedding model migration for a custom-index source. + + The migration runs asynchronously in the background. Poll `GET /api/sources/{id}/embedding- + migration` to track progress. + + Optionally override chunking configuration (`chunk_size`, `chunk_overlap`, `chunk_language`, + `chunk_separators`, `chunk_regex_separators`). When a chunking field is omitted (null), the current + source's value is preserved. + + Constraints: + - Only `custom_index` source types support migration. + - A migration cannot be started while another is already active. + - The target model + dimensions must differ from the source's current settings. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (StartSourceEmbeddingMigrationRequest): Request payload to start a source embedding + migration. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError | SourceEmbeddingMigrationResponse + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: StartSourceEmbeddingMigrationRequest, + x_account_id: str | Unset = UNSET, +) -> Response[Any | HTTPValidationError | SourceEmbeddingMigrationResponse]: + """Start Source Embedding Migration + + Start an embedding model migration for a custom-index source. + + The migration runs asynchronously in the background. Poll `GET /api/sources/{id}/embedding- + migration` to track progress. + + Optionally override chunking configuration (`chunk_size`, `chunk_overlap`, `chunk_language`, + `chunk_separators`, `chunk_regex_separators`). When a chunking field is omitted (null), the current + source's value is preserved. + + Constraints: + - Only `custom_index` source types support migration. + - A migration cannot be started while another is already active. + - The target model + dimensions must differ from the source's current settings. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (StartSourceEmbeddingMigrationRequest): Request payload to start a source embedding + migration. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any | HTTPValidationError | SourceEmbeddingMigrationResponse] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: StartSourceEmbeddingMigrationRequest, + x_account_id: str | Unset = UNSET, +) -> Any | HTTPValidationError | SourceEmbeddingMigrationResponse | None: + """Start Source Embedding Migration + + Start an embedding model migration for a custom-index source. + + The migration runs asynchronously in the background. Poll `GET /api/sources/{id}/embedding- + migration` to track progress. + + Optionally override chunking configuration (`chunk_size`, `chunk_overlap`, `chunk_language`, + `chunk_separators`, `chunk_regex_separators`). When a chunking field is omitted (null), the current + source's value is preserved. + + Constraints: + - Only `custom_index` source types support migration. + - A migration cannot be started while another is already active. + - The target model + dimensions must differ from the source's current settings. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (StartSourceEmbeddingMigrationRequest): Request payload to start a source embedding + migration. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Any | HTTPValidationError | SourceEmbeddingMigrationResponse + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/sources/update_source_api_sources_source_connection_id_put.py b/seclai/_generated/api/sources/update_source_api_sources_source_connection_id_put.py new file mode 100644 index 0000000..d8931d5 --- /dev/null +++ b/seclai/_generated/api/sources/update_source_api_sources_source_connection_id_put.py @@ -0,0 +1,218 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.source_response import SourceResponse +from ...models.update_source_body import UpdateSourceBody +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + body: UpdateSourceBody, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "put", + "url": "/sources/{source_connection_id}".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | SourceResponse | None: + if response.status_code == 200: + response_200 = SourceResponse.from_dict(response.json()) + + return response_200 + + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError | SourceResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UpdateSourceBody, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SourceResponse]: + """Update Source + + Update a content source's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + System-managed sources only allow `retention_days` updates. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (UpdateSourceBody): Request body for updating a content source. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SourceResponse] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UpdateSourceBody, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SourceResponse | None: + """Update Source + + Update a content source's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + System-managed sources only allow `retention_days` updates. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (UpdateSourceBody): Request body for updating a content source. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SourceResponse + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UpdateSourceBody, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError | SourceResponse]: + """Update Source + + Update a content source's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + System-managed sources only allow `retention_days` updates. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (UpdateSourceBody): Request body for updating a content source. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError | SourceResponse] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: UpdateSourceBody, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | SourceResponse | None: + """Update Source + + Update a content source's configuration. Only provided fields are changed; omitted fields are left + unchanged. + + System-managed sources only allow `retention_days` updates. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (UpdateSourceBody): Request body for updating a content source. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError | SourceResponse + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/api/sources/upload_file_to_source_api_sources_source_connection_id_upload_post.py b/seclai/_generated/api/sources/upload_file_to_source_api_sources_source_connection_id_upload_post.py index 4e881f9..b1f4e32 100644 --- a/seclai/_generated/api/sources/upload_file_to_source_api_sources_source_connection_id_upload_post.py +++ b/seclai/_generated/api/sources/upload_file_to_source_api_sources_source_connection_id_upload_post.py @@ -10,15 +10,18 @@ BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost, ) from ...models.http_validation_error import HTTPValidationError -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( source_connection_id: str, *, body: BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost, + x_account_id: str | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id _kwargs: dict[str, Any] = { "method": "post", @@ -63,6 +66,7 @@ def sync_detailed( *, client: AuthenticatedClient | Client, body: BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost, + x_account_id: str | Unset = UNSET, ) -> Response[HTTPValidationError]: r"""Upload a file to a content source @@ -120,6 +124,7 @@ def sync_detailed( Args: source_connection_id (str): + x_account_id (str | Unset): body (BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost): Raises: @@ -133,6 +138,7 @@ def sync_detailed( kwargs = _get_kwargs( source_connection_id=source_connection_id, body=body, + x_account_id=x_account_id, ) response = client.get_httpx_client().request( @@ -147,6 +153,7 @@ def sync( *, client: AuthenticatedClient | Client, body: BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost, + x_account_id: str | Unset = UNSET, ) -> HTTPValidationError | None: r"""Upload a file to a content source @@ -204,6 +211,7 @@ def sync( Args: source_connection_id (str): + x_account_id (str | Unset): body (BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost): Raises: @@ -218,6 +226,7 @@ def sync( source_connection_id=source_connection_id, client=client, body=body, + x_account_id=x_account_id, ).parsed @@ -226,6 +235,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient | Client, body: BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost, + x_account_id: str | Unset = UNSET, ) -> Response[HTTPValidationError]: r"""Upload a file to a content source @@ -283,6 +293,7 @@ async def asyncio_detailed( Args: source_connection_id (str): + x_account_id (str | Unset): body (BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost): Raises: @@ -296,6 +307,7 @@ async def asyncio_detailed( kwargs = _get_kwargs( source_connection_id=source_connection_id, body=body, + x_account_id=x_account_id, ) response = await client.get_async_httpx_client().request(**kwargs) @@ -308,6 +320,7 @@ async def asyncio( *, client: AuthenticatedClient | Client, body: BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost, + x_account_id: str | Unset = UNSET, ) -> HTTPValidationError | None: r"""Upload a file to a content source @@ -365,6 +378,7 @@ async def asyncio( Args: source_connection_id (str): + x_account_id (str | Unset): body (BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost): Raises: @@ -380,5 +394,6 @@ async def asyncio( source_connection_id=source_connection_id, client=client, body=body, + x_account_id=x_account_id, ) ).parsed diff --git a/seclai/_generated/api/sources/upload_inline_text_to_source_api_sources_source_connection_id_post.py b/seclai/_generated/api/sources/upload_inline_text_to_source_api_sources_source_connection_id_post.py new file mode 100644 index 0000000..825f51a --- /dev/null +++ b/seclai/_generated/api/sources/upload_inline_text_to_source_api_sources_source_connection_id_post.py @@ -0,0 +1,264 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.http_validation_error import HTTPValidationError +from ...models.inline_text_upload_request import InlineTextUploadRequest +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + source_connection_id: UUID, + *, + body: InlineTextUploadRequest, + x_account_id: str | Unset = UNSET, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(x_account_id, Unset): + headers["X-Account-Id"] = x_account_id + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/sources/{source_connection_id}".format( + source_connection_id=quote(str(source_connection_id), safe=""), + ), + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> HTTPValidationError | None: + if response.status_code == 422: + response_422 = HTTPValidationError.from_dict(response.json()) + + return response_422 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[HTTPValidationError]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: InlineTextUploadRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError]: + """Upload inline text to a content source + + Upload a small text payload to a content source (no multipart/form-data required). + + **Maximum payload size:** 8192 bytes (UTF-8). + + **Supported content types:** + - `application/json` + - `application/xml` + - `text/csv` + - `text/html` + - `text/markdown` + - `text/plain` + - `text/x-markdown` + - `text/xml` + + Notes: + - Use this endpoint for small text payloads; larger files should use `/upload`. + - `title` is merged into `metadata.title` when not already present. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (InlineTextUploadRequest): Request model for inline text uploads. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + body=body, + x_account_id=x_account_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: InlineTextUploadRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | None: + """Upload inline text to a content source + + Upload a small text payload to a content source (no multipart/form-data required). + + **Maximum payload size:** 8192 bytes (UTF-8). + + **Supported content types:** + - `application/json` + - `application/xml` + - `text/csv` + - `text/html` + - `text/markdown` + - `text/plain` + - `text/x-markdown` + - `text/xml` + + Notes: + - Use this endpoint for small text payloads; larger files should use `/upload`. + - `title` is merged into `metadata.title` when not already present. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (InlineTextUploadRequest): Request model for inline text uploads. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError + """ + + return sync_detailed( + source_connection_id=source_connection_id, + client=client, + body=body, + x_account_id=x_account_id, + ).parsed + + +async def asyncio_detailed( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: InlineTextUploadRequest, + x_account_id: str | Unset = UNSET, +) -> Response[HTTPValidationError]: + """Upload inline text to a content source + + Upload a small text payload to a content source (no multipart/form-data required). + + **Maximum payload size:** 8192 bytes (UTF-8). + + **Supported content types:** + - `application/json` + - `application/xml` + - `text/csv` + - `text/html` + - `text/markdown` + - `text/plain` + - `text/x-markdown` + - `text/xml` + + Notes: + - Use this endpoint for small text payloads; larger files should use `/upload`. + - `title` is merged into `metadata.title` when not already present. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (InlineTextUploadRequest): Request model for inline text uploads. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[HTTPValidationError] + """ + + kwargs = _get_kwargs( + source_connection_id=source_connection_id, + body=body, + x_account_id=x_account_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + source_connection_id: UUID, + *, + client: AuthenticatedClient | Client, + body: InlineTextUploadRequest, + x_account_id: str | Unset = UNSET, +) -> HTTPValidationError | None: + """Upload inline text to a content source + + Upload a small text payload to a content source (no multipart/form-data required). + + **Maximum payload size:** 8192 bytes (UTF-8). + + **Supported content types:** + - `application/json` + - `application/xml` + - `text/csv` + - `text/html` + - `text/markdown` + - `text/plain` + - `text/x-markdown` + - `text/xml` + + Notes: + - Use this endpoint for small text payloads; larger files should use `/upload`. + - `title` is merged into `metadata.title` when not already present. + + Args: + source_connection_id (UUID): + x_account_id (str | Unset): + body (InlineTextUploadRequest): Request model for inline text uploads. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + HTTPValidationError + """ + + return ( + await asyncio_detailed( + source_connection_id=source_connection_id, + client=client, + body=body, + x_account_id=x_account_id, + ) + ).parsed diff --git a/seclai/_generated/models/__init__.py b/seclai/_generated/models/__init__.py index a688bd2..79fb21f 100644 --- a/seclai/_generated/models/__init__.py +++ b/seclai/_generated/models/__init__.py @@ -1,5 +1,35 @@ """Contains all the data models used in inputs/outputs""" +from .add_alert_comment_api_alerts_alert_id_comments_post_response_add_alert_comment_api_alerts_alert_id_comments_post import ( + AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost, +) +from .add_comment_request import AddCommentRequest +from .add_conversation_turn_request import AddConversationTurnRequest +from .add_conversation_turn_request_actions_taken_type_0 import ( + AddConversationTurnRequestActionsTakenType0, +) +from .agent_definition_response import AgentDefinitionResponse +from .agent_definition_response_definition import AgentDefinitionResponseDefinition +from .agent_definition_response_warnings_type_0_item import ( + AgentDefinitionResponseWarningsType0Item, +) +from .agent_evaluation_tier import AgentEvaluationTier +from .agent_export_response import AgentExportResponse +from .agent_export_response_agent import AgentExportResponseAgent +from .agent_export_response_alert_configs_type_0_item import ( + AgentExportResponseAlertConfigsType0Item, +) +from .agent_export_response_dependencies_type_0 import ( + AgentExportResponseDependenciesType0, +) +from .agent_export_response_evaluation_criteria_type_0_item import ( + AgentExportResponseEvaluationCriteriaType0Item, +) +from .agent_export_response_governance_policies_type_0_item import ( + AgentExportResponseGovernancePoliciesType0Item, +) +from .agent_export_response_trigger_type_0 import AgentExportResponseTriggerType0 +from .agent_list_response import AgentListResponse from .agent_run_attempt_response import AgentRunAttemptResponse from .agent_run_list_response import AgentRunListResponse from .agent_run_request import AgentRunRequest @@ -8,29 +38,307 @@ from .agent_run_step_response import AgentRunStepResponse from .agent_run_stream_request import AgentRunStreamRequest from .agent_run_stream_request_metadata_type_0 import AgentRunStreamRequestMetadataType0 +from .agent_summary_response import AgentSummaryResponse +from .agent_summary_response_sampling_config_type_0 import ( + AgentSummaryResponseSamplingConfigType0, +) +from .agent_trace_match_response import AgentTraceMatchResponse +from .agent_trace_search_request import AgentTraceSearchRequest +from .agent_trace_search_response import AgentTraceSearchResponse +from .ai_assistant_accept_request import AiAssistantAcceptRequest +from .ai_assistant_accept_response import AiAssistantAcceptResponse +from .ai_assistant_feedback_request import AiAssistantFeedbackRequest +from .ai_assistant_feedback_request_context_type_0 import ( + AiAssistantFeedbackRequestContextType0, +) +from .ai_assistant_feedback_response import AiAssistantFeedbackResponse +from .ai_assistant_generate_request import AiAssistantGenerateRequest +from .ai_assistant_generate_response import AiAssistantGenerateResponse +from .ai_conversation_history_response import AiConversationHistoryResponse +from .ai_conversation_turn_response import AiConversationTurnResponse +from .ai_conversation_turn_response_resulting_config_type_0 import ( + AiConversationTurnResponseResultingConfigType0, +) +from .api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch_response_api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch import ( + ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch, +) +from .applied_action_response import AppliedActionResponse from .body_upload_file_to_content_api_contents_source_connection_content_version_upload_post import ( BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost, ) from .body_upload_file_to_source_api_sources_source_connection_id_upload_post import ( BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost, ) +from .change_alert_status_api_alerts_alert_id_status_post_response_change_alert_status_api_alerts_alert_id_status_post import ( + ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost, +) +from .change_status_request import ChangeStatusRequest +from .compact_memory_bank_api_memory_banks_memory_bank_id_compact_post_response_compact_memory_bank_api_memory_banks_memory_bank_id_compact_post import ( + CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost, +) +from .compaction_evaluation_model import CompactionEvaluationModel +from .compaction_test_response_model import CompactionTestResponseModel +from .compatible_run_list_response import CompatibleRunListResponse +from .compatible_run_response import CompatibleRunResponse from .content_detail_response import ContentDetailResponse from .content_detail_response_metadata_type_0_item import ( ContentDetailResponseMetadataType0Item, ) from .content_embedding_response import ContentEmbeddingResponse from .content_embeddings_list_response import ContentEmbeddingsListResponse +from .create_agent_request import CreateAgentRequest +from .create_alert_config_api_alerts_configs_post_response_create_alert_config_api_alerts_configs_post import ( + CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost, +) +from .create_alert_config_request import CreateAlertConfigRequest +from .create_alert_config_request_threshold_type_0 import ( + CreateAlertConfigRequestThresholdType0, +) +from .create_evaluation_criteria_request import CreateEvaluationCriteriaRequest +from .create_evaluation_criteria_request_expectation_config_type_0 import ( + CreateEvaluationCriteriaRequestExpectationConfigType0, +) +from .create_evaluation_result_request import CreateEvaluationResultRequest +from .create_evaluation_result_request_details_type_0 import ( + CreateEvaluationResultRequestDetailsType0, +) +from .create_export_request import CreateExportRequest +from .create_export_request_metadata_filter_type_0 import ( + CreateExportRequestMetadataFilterType0, +) +from .create_knowledge_base_body import CreateKnowledgeBaseBody +from .create_memory_bank_body import CreateMemoryBankBody +from .create_solution_request import CreateSolutionRequest +from .create_source_body import CreateSourceBody +from .estimate_export_request import EstimateExportRequest +from .estimate_export_request_metadata_filter_type_0 import ( + EstimateExportRequestMetadataFilterType0, +) +from .estimate_export_response import EstimateExportResponse +from .evaluation_criteria_response import EvaluationCriteriaResponse +from .evaluation_criteria_response_expectation_config_type_0 import ( + EvaluationCriteriaResponseExpectationConfigType0, +) +from .evaluation_criteria_response_result_summary import ( + EvaluationCriteriaResponseResultSummary, +) +from .evaluation_result_list_response import EvaluationResultListResponse +from .evaluation_result_response import EvaluationResultResponse +from .evaluation_result_response_details_type_0 import ( + EvaluationResultResponseDetailsType0, +) +from .evaluation_result_summary_response import EvaluationResultSummaryResponse +from .evaluation_result_with_criteria_list_response import ( + EvaluationResultWithCriteriaListResponse, +) +from .evaluation_result_with_criteria_response import ( + EvaluationResultWithCriteriaResponse, +) +from .evaluation_result_with_criteria_response_details_type_0 import ( + EvaluationResultWithCriteriaResponseDetailsType0, +) +from .evaluation_run_summary_list_response import EvaluationRunSummaryListResponse +from .evaluation_run_summary_response import EvaluationRunSummaryResponse +from .evaluation_status import EvaluationStatus +from .example_prompt import ExamplePrompt +from .executed_action_response import ExecutedActionResponse +from .export_format import ExportFormat +from .export_list_response import ExportListResponse +from .export_response import ExportResponse +from .export_response_metadata_filter_type_0 import ExportResponseMetadataFilterType0 from .file_upload_response import FileUploadResponse +from .generate_agent_steps_request import GenerateAgentStepsRequest +from .generate_agent_steps_request_agent_steps_type_0_item import ( + GenerateAgentStepsRequestAgentStepsType0Item, +) +from .generate_agent_steps_response import GenerateAgentStepsResponse +from .generate_agent_steps_response_agent_config_type_0 import ( + GenerateAgentStepsResponseAgentConfigType0, +) +from .generate_agent_steps_response_steps_item import ( + GenerateAgentStepsResponseStepsItem, +) +from .generate_step_config_request import GenerateStepConfigRequest +from .generate_step_config_request_agent_steps_type_0_item import ( + GenerateStepConfigRequestAgentStepsType0Item, +) +from .generate_step_config_request_current_config_type_0 import ( + GenerateStepConfigRequestCurrentConfigType0, +) +from .generate_step_config_response import GenerateStepConfigResponse +from .generate_step_config_response_resulting_config_type_0 import ( + GenerateStepConfigResponseResultingConfigType0, +) +from .get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get_response_200_item import ( + GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item, +) +from .get_alert_config_api_alerts_configs_config_id_get_response_get_alert_config_api_alerts_configs_config_id_get import ( + GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet, +) +from .get_alert_detail_api_alerts_alert_id_get_response_get_alert_detail_api_alerts_alert_id_get import ( + GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet, +) +from .get_alert_unread_count_api_models_alerts_unread_count_get_response_get_alert_unread_count_api_models_alerts_unread_count_get import ( + GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet, +) +from .get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get_response_get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get import ( + GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet, +) +from .get_recommendations_api_models_model_id_recommendations_get_response_get_recommendations_api_models_model_id_recommendations_get import ( + GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet, +) +from .governance_ai_accept_response import GovernanceAiAcceptResponse +from .governance_ai_assistant_request import GovernanceAiAssistantRequest +from .governance_ai_assistant_response import GovernanceAiAssistantResponse +from .governance_conversation_response import GovernanceConversationResponse +from .governance_conversation_response_proposed_actions_type_0 import ( + GovernanceConversationResponseProposedActionsType0, +) from .http_validation_error import HTTPValidationError +from .inline_text_replace_request import InlineTextReplaceRequest +from .inline_text_replace_request_metadata_type_0 import ( + InlineTextReplaceRequestMetadataType0, +) +from .inline_text_upload_request import InlineTextUploadRequest +from .inline_text_upload_request_metadata_type_0 import ( + InlineTextUploadRequestMetadataType0, +) +from .knowledge_base import KnowledgeBase +from .knowledge_base_list_response_model import KnowledgeBaseListResponseModel +from .link_resources_request import LinkResourcesRequest +from .list_alert_configs_api_alerts_configs_get_response_list_alert_configs_api_alerts_configs_get import ( + ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet, +) +from .list_alerts_api_alerts_get_response_list_alerts_api_alerts_get import ( + ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet, +) +from .list_alerts_api_models_alerts_get_response_list_alerts_api_models_alerts_get import ( + ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet, +) +from .list_templates_api_memory_banks_templates_get_response_200_item import ( + ListTemplatesApiMemoryBanksTemplatesGetResponse200Item, +) +from .mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch_response_mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch import ( + MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch, +) +from .mark_ai_suggestion_request import MarkAiSuggestionRequest +from .mark_conversation_turn_request import MarkConversationTurnRequest +from .me_response import MeResponse +from .memory_bank import MemoryBank +from .memory_bank_accept_request import MemoryBankAcceptRequest +from .memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch_response_memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch import ( + MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch, +) +from .memory_bank_ai_assistant_request import MemoryBankAiAssistantRequest +from .memory_bank_ai_assistant_request_current_config_type_0 import ( + MemoryBankAiAssistantRequestCurrentConfigType0, +) +from .memory_bank_ai_assistant_response import MemoryBankAiAssistantResponse +from .memory_bank_config_response import MemoryBankConfigResponse +from .memory_bank_conversation_turn_response import MemoryBankConversationTurnResponse +from .memory_bank_conversation_turn_response_resulting_config_type_0 import ( + MemoryBankConversationTurnResponseResultingConfigType0, +) +from .memory_bank_last_conversation_response import MemoryBankLastConversationResponse +from .memory_bank_list_response_model import MemoryBankListResponseModel +from .non_manual_evaluation_mode_stat_response import ( + NonManualEvaluationModeStatResponse, +) +from .non_manual_evaluation_summary_response import NonManualEvaluationSummaryResponse +from .organization_alert_preference_list_response import ( + OrganizationAlertPreferenceListResponse, +) +from .organization_alert_preference_response import OrganizationAlertPreferenceResponse +from .organization_info_response import OrganizationInfoResponse from .pagination_response import PaginationResponse from .pending_processing_completed_failed_status import ( PendingProcessingCompletedFailedStatus, ) +from .prompt_model_auto_upgrade_strategy import PromptModelAutoUpgradeStrategy +from .proposed_action_response import ProposedActionResponse +from .proposed_action_response_params import ProposedActionResponseParams +from .proposed_policy_action_response import ProposedPolicyActionResponse +from .proposed_policy_action_response_params import ProposedPolicyActionResponseParams +from .search_api_search_get_response_search_api_search_get import ( + SearchApiSearchGetResponseSearchApiSearchGet, +) +from .solution_agent_response import SolutionAgentResponse +from .solution_conversation_response import SolutionConversationResponse +from .solution_conversation_response_actions_taken_type_0 import ( + SolutionConversationResponseActionsTakenType0, +) +from .solution_knowledge_base_response import SolutionKnowledgeBaseResponse +from .solution_list_response import SolutionListResponse +from .solution_response import SolutionResponse +from .solution_source_connection_response import SolutionSourceConnectionResponse +from .solution_summary_response import SolutionSummaryResponse +from .source_connection_response_model import SourceConnectionResponseModel +from .source_embedding_migration_response import SourceEmbeddingMigrationResponse from .source_list_response import SourceListResponse from .source_response import SourceResponse +from .standalone_test_compaction_request import StandaloneTestCompactionRequest +from .start_source_embedding_migration_request import ( + StartSourceEmbeddingMigrationRequest, +) +from .subscribe_to_alert_api_alerts_alert_id_subscribe_post_response_subscribe_to_alert_api_alerts_alert_id_subscribe_post import ( + SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost, +) +from .test_compaction_request import TestCompactionRequest +from .test_draft_evaluation_request import TestDraftEvaluationRequest +from .test_draft_evaluation_request_expectation_config_type_0 import ( + TestDraftEvaluationRequestExpectationConfigType0, +) +from .test_draft_evaluation_response import TestDraftEvaluationResponse +from .unlink_resources_request import UnlinkResourcesRequest +from .unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post_response_unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post import ( + UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost, +) +from .update_agent_definition_request import UpdateAgentDefinitionRequest +from .update_agent_definition_request_definition import ( + UpdateAgentDefinitionRequestDefinition, +) +from .update_agent_request import UpdateAgentRequest +from .update_agent_request_sampling_config_type_0 import ( + UpdateAgentRequestSamplingConfigType0, +) +from .update_alert_config_api_alerts_configs_config_id_patch_response_update_alert_config_api_alerts_configs_config_id_patch import ( + UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch, +) +from .update_alert_config_request import UpdateAlertConfigRequest +from .update_alert_config_request_threshold_type_0 import ( + UpdateAlertConfigRequestThresholdType0, +) +from .update_evaluation_criteria_request import UpdateEvaluationCriteriaRequest +from .update_evaluation_criteria_request_expectation_config_type_0 import ( + UpdateEvaluationCriteriaRequestExpectationConfigType0, +) +from .update_knowledge_base_body import UpdateKnowledgeBaseBody +from .update_memory_bank_body import UpdateMemoryBankBody +from .update_organization_alert_preference_request import ( + UpdateOrganizationAlertPreferenceRequest, +) +from .update_solution_request import UpdateSolutionRequest +from .update_source_body import UpdateSourceBody +from .upload_agent_input_api_response import UploadAgentInputApiResponse from .validation_error import ValidationError __all__ = ( + "AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost", + "AddCommentRequest", + "AddConversationTurnRequest", + "AddConversationTurnRequestActionsTakenType0", + "AgentDefinitionResponse", + "AgentDefinitionResponseDefinition", + "AgentDefinitionResponseWarningsType0Item", + "AgentEvaluationTier", + "AgentExportResponse", + "AgentExportResponseAgent", + "AgentExportResponseAlertConfigsType0Item", + "AgentExportResponseDependenciesType0", + "AgentExportResponseEvaluationCriteriaType0Item", + "AgentExportResponseGovernancePoliciesType0Item", + "AgentExportResponseTriggerType0", + "AgentListResponse", "AgentRunAttemptResponse", "AgentRunListResponse", "AgentRunRequest", @@ -39,17 +347,169 @@ "AgentRunStepResponse", "AgentRunStreamRequest", "AgentRunStreamRequestMetadataType0", + "AgentSummaryResponse", + "AgentSummaryResponseSamplingConfigType0", + "AgentTraceMatchResponse", + "AgentTraceSearchRequest", + "AgentTraceSearchResponse", + "AiAssistantAcceptRequest", + "AiAssistantAcceptResponse", + "AiAssistantFeedbackRequest", + "AiAssistantFeedbackRequestContextType0", + "AiAssistantFeedbackResponse", + "AiAssistantGenerateRequest", + "AiAssistantGenerateResponse", + "AiConversationHistoryResponse", + "AiConversationTurnResponse", + "AiConversationTurnResponseResultingConfigType0", + "ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch", + "AppliedActionResponse", "BodyUploadFileToContentApiContentsSourceConnectionContentVersionUploadPost", "BodyUploadFileToSourceApiSourcesSourceConnectionIdUploadPost", + "ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost", + "ChangeStatusRequest", + "CompactionEvaluationModel", + "CompactionTestResponseModel", + "CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost", + "CompatibleRunListResponse", + "CompatibleRunResponse", "ContentDetailResponse", "ContentDetailResponseMetadataType0Item", "ContentEmbeddingResponse", "ContentEmbeddingsListResponse", + "CreateAgentRequest", + "CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost", + "CreateAlertConfigRequest", + "CreateAlertConfigRequestThresholdType0", + "CreateEvaluationCriteriaRequest", + "CreateEvaluationCriteriaRequestExpectationConfigType0", + "CreateEvaluationResultRequest", + "CreateEvaluationResultRequestDetailsType0", + "CreateExportRequest", + "CreateExportRequestMetadataFilterType0", + "CreateKnowledgeBaseBody", + "CreateMemoryBankBody", + "CreateSolutionRequest", + "CreateSourceBody", + "EstimateExportRequest", + "EstimateExportRequestMetadataFilterType0", + "EstimateExportResponse", + "EvaluationCriteriaResponse", + "EvaluationCriteriaResponseExpectationConfigType0", + "EvaluationCriteriaResponseResultSummary", + "EvaluationResultListResponse", + "EvaluationResultResponse", + "EvaluationResultResponseDetailsType0", + "EvaluationResultSummaryResponse", + "EvaluationResultWithCriteriaListResponse", + "EvaluationResultWithCriteriaResponse", + "EvaluationResultWithCriteriaResponseDetailsType0", + "EvaluationRunSummaryListResponse", + "EvaluationRunSummaryResponse", + "EvaluationStatus", + "ExamplePrompt", + "ExecutedActionResponse", + "ExportFormat", + "ExportListResponse", + "ExportResponse", + "ExportResponseMetadataFilterType0", "FileUploadResponse", + "GenerateAgentStepsRequest", + "GenerateAgentStepsRequestAgentStepsType0Item", + "GenerateAgentStepsResponse", + "GenerateAgentStepsResponseAgentConfigType0", + "GenerateAgentStepsResponseStepsItem", + "GenerateStepConfigRequest", + "GenerateStepConfigRequestAgentStepsType0Item", + "GenerateStepConfigRequestCurrentConfigType0", + "GenerateStepConfigResponse", + "GenerateStepConfigResponseResultingConfigType0", + "GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item", + "GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet", + "GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet", + "GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet", + "GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet", + "GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet", + "GovernanceAiAcceptResponse", + "GovernanceAiAssistantRequest", + "GovernanceAiAssistantResponse", + "GovernanceConversationResponse", + "GovernanceConversationResponseProposedActionsType0", "HTTPValidationError", + "InlineTextReplaceRequest", + "InlineTextReplaceRequestMetadataType0", + "InlineTextUploadRequest", + "InlineTextUploadRequestMetadataType0", + "KnowledgeBase", + "KnowledgeBaseListResponseModel", + "LinkResourcesRequest", + "ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet", + "ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet", + "ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet", + "ListTemplatesApiMemoryBanksTemplatesGetResponse200Item", + "MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch", + "MarkAiSuggestionRequest", + "MarkConversationTurnRequest", + "MemoryBank", + "MemoryBankAcceptRequest", + "MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch", + "MemoryBankAiAssistantRequest", + "MemoryBankAiAssistantRequestCurrentConfigType0", + "MemoryBankAiAssistantResponse", + "MemoryBankConfigResponse", + "MemoryBankConversationTurnResponse", + "MemoryBankConversationTurnResponseResultingConfigType0", + "MemoryBankLastConversationResponse", + "MemoryBankListResponseModel", + "MeResponse", + "NonManualEvaluationModeStatResponse", + "NonManualEvaluationSummaryResponse", + "OrganizationAlertPreferenceListResponse", + "OrganizationAlertPreferenceResponse", + "OrganizationInfoResponse", "PaginationResponse", "PendingProcessingCompletedFailedStatus", + "PromptModelAutoUpgradeStrategy", + "ProposedActionResponse", + "ProposedActionResponseParams", + "ProposedPolicyActionResponse", + "ProposedPolicyActionResponseParams", + "SearchApiSearchGetResponseSearchApiSearchGet", + "SolutionAgentResponse", + "SolutionConversationResponse", + "SolutionConversationResponseActionsTakenType0", + "SolutionKnowledgeBaseResponse", + "SolutionListResponse", + "SolutionResponse", + "SolutionSourceConnectionResponse", + "SolutionSummaryResponse", + "SourceConnectionResponseModel", + "SourceEmbeddingMigrationResponse", "SourceListResponse", "SourceResponse", + "StandaloneTestCompactionRequest", + "StartSourceEmbeddingMigrationRequest", + "SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost", + "TestCompactionRequest", + "TestDraftEvaluationRequest", + "TestDraftEvaluationRequestExpectationConfigType0", + "TestDraftEvaluationResponse", + "UnlinkResourcesRequest", + "UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost", + "UpdateAgentDefinitionRequest", + "UpdateAgentDefinitionRequestDefinition", + "UpdateAgentRequest", + "UpdateAgentRequestSamplingConfigType0", + "UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch", + "UpdateAlertConfigRequest", + "UpdateAlertConfigRequestThresholdType0", + "UpdateEvaluationCriteriaRequest", + "UpdateEvaluationCriteriaRequestExpectationConfigType0", + "UpdateKnowledgeBaseBody", + "UpdateMemoryBankBody", + "UpdateOrganizationAlertPreferenceRequest", + "UpdateSolutionRequest", + "UpdateSourceBody", + "UploadAgentInputApiResponse", "ValidationError", ) diff --git a/seclai/_generated/models/add_alert_comment_api_alerts_alert_id_comments_post_response_add_alert_comment_api_alerts_alert_id_comments_post.py b/seclai/_generated/models/add_alert_comment_api_alerts_alert_id_comments_post_response_add_alert_comment_api_alerts_alert_id_comments_post.py new file mode 100644 index 0000000..d8f2725 --- /dev/null +++ b/seclai/_generated/models/add_alert_comment_api_alerts_alert_id_comments_post_response_add_alert_comment_api_alerts_alert_id_comments_post.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost", +) + + +@_attrs_define +class AddAlertCommentApiAlertsAlertIdCommentsPostResponseAddAlertCommentApiAlertsAlertIdCommentsPost: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + add_alert_comment_api_alerts_alert_id_comments_post_response_add_alert_comment_api_alerts_alert_id_comments_post = ( + cls() + ) + + add_alert_comment_api_alerts_alert_id_comments_post_response_add_alert_comment_api_alerts_alert_id_comments_post.additional_properties = ( + d + ) + return add_alert_comment_api_alerts_alert_id_comments_post_response_add_alert_comment_api_alerts_alert_id_comments_post + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/add_comment_request.py b/seclai/_generated/models/add_comment_request.py new file mode 100644 index 0000000..a10326f --- /dev/null +++ b/seclai/_generated/models/add_comment_request.py @@ -0,0 +1,61 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AddCommentRequest") + + +@_attrs_define +class AddCommentRequest: + """ + Attributes: + body (str): Comment text + """ + + body: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + body = self.body + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "body": body, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + body = d.pop("body") + + add_comment_request = cls( + body=body, + ) + + add_comment_request.additional_properties = d + return add_comment_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/add_conversation_turn_request.py b/seclai/_generated/models/add_conversation_turn_request.py new file mode 100644 index 0000000..f8a3c24 --- /dev/null +++ b/seclai/_generated/models/add_conversation_turn_request.py @@ -0,0 +1,135 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.add_conversation_turn_request_actions_taken_type_0 import ( + AddConversationTurnRequestActionsTakenType0, + ) + + +T = TypeVar("T", bound="AddConversationTurnRequest") + + +@_attrs_define +class AddConversationTurnRequest: + """ + Attributes: + user_input (str): User input text + actions_taken (AddConversationTurnRequestActionsTakenType0 | None | Unset): Actions taken by the AI + ai_response (None | str | Unset): AI response text + """ + + user_input: str + actions_taken: AddConversationTurnRequestActionsTakenType0 | None | Unset = UNSET + ai_response: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.add_conversation_turn_request_actions_taken_type_0 import ( + AddConversationTurnRequestActionsTakenType0, + ) + + user_input = self.user_input + + actions_taken: dict[str, Any] | None | Unset + if isinstance(self.actions_taken, Unset): + actions_taken = UNSET + elif isinstance( + self.actions_taken, AddConversationTurnRequestActionsTakenType0 + ): + actions_taken = self.actions_taken.to_dict() + else: + actions_taken = self.actions_taken + + ai_response: None | str | Unset + if isinstance(self.ai_response, Unset): + ai_response = UNSET + else: + ai_response = self.ai_response + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "user_input": user_input, + } + ) + if actions_taken is not UNSET: + field_dict["actions_taken"] = actions_taken + if ai_response is not UNSET: + field_dict["ai_response"] = ai_response + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.add_conversation_turn_request_actions_taken_type_0 import ( + AddConversationTurnRequestActionsTakenType0, + ) + + d = dict(src_dict) + user_input = d.pop("user_input") + + def _parse_actions_taken( + data: object, + ) -> AddConversationTurnRequestActionsTakenType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + actions_taken_type_0 = ( + AddConversationTurnRequestActionsTakenType0.from_dict(data) + ) + + return actions_taken_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + AddConversationTurnRequestActionsTakenType0 | None | Unset, data + ) + + actions_taken = _parse_actions_taken(d.pop("actions_taken", UNSET)) + + def _parse_ai_response(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + ai_response = _parse_ai_response(d.pop("ai_response", UNSET)) + + add_conversation_turn_request = cls( + user_input=user_input, + actions_taken=actions_taken, + ai_response=ai_response, + ) + + add_conversation_turn_request.additional_properties = d + return add_conversation_turn_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/add_conversation_turn_request_actions_taken_type_0.py b/seclai/_generated/models/add_conversation_turn_request_actions_taken_type_0.py new file mode 100644 index 0000000..6ffd995 --- /dev/null +++ b/seclai/_generated/models/add_conversation_turn_request_actions_taken_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AddConversationTurnRequestActionsTakenType0") + + +@_attrs_define +class AddConversationTurnRequestActionsTakenType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + add_conversation_turn_request_actions_taken_type_0 = cls() + + add_conversation_turn_request_actions_taken_type_0.additional_properties = d + return add_conversation_turn_request_actions_taken_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_definition_response.py b/seclai/_generated/models/agent_definition_response.py new file mode 100644 index 0000000..507c360 --- /dev/null +++ b/seclai/_generated/models/agent_definition_response.py @@ -0,0 +1,145 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.agent_definition_response_definition import ( + AgentDefinitionResponseDefinition, + ) + from ..models.agent_definition_response_warnings_type_0_item import ( + AgentDefinitionResponseWarningsType0Item, + ) + + +T = TypeVar("T", bound="AgentDefinitionResponse") + + +@_attrs_define +class AgentDefinitionResponse: + """ + Attributes: + change_id (str): Current change ID (use as expected_change_id when updating). + definition (AgentDefinitionResponseDefinition): The agent definition containing name, description, tags, and + step workflow tree. Step types include prompt_call, retrieval, transform, gate, retry, evaluate_step, insight, + extract_json, send_email, webhook_call, call_agent, write_metadata, write_content_attachment, + load_content_attachment, load_content, display_result, and others. + schema_version (str): Agent schema version. + warnings (list[AgentDefinitionResponseWarningsType0Item] | None | Unset): Validation warnings, if any. + """ + + change_id: str + definition: AgentDefinitionResponseDefinition + schema_version: str + warnings: list[AgentDefinitionResponseWarningsType0Item] | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + change_id = self.change_id + + definition = self.definition.to_dict() + + schema_version = self.schema_version + + warnings: list[dict[str, Any]] | None | Unset + if isinstance(self.warnings, Unset): + warnings = UNSET + elif isinstance(self.warnings, list): + warnings = [] + for warnings_type_0_item_data in self.warnings: + warnings_type_0_item = warnings_type_0_item_data.to_dict() + warnings.append(warnings_type_0_item) + + else: + warnings = self.warnings + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "change_id": change_id, + "definition": definition, + "schema_version": schema_version, + } + ) + if warnings is not UNSET: + field_dict["warnings"] = warnings + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.agent_definition_response_definition import ( + AgentDefinitionResponseDefinition, + ) + from ..models.agent_definition_response_warnings_type_0_item import ( + AgentDefinitionResponseWarningsType0Item, + ) + + d = dict(src_dict) + change_id = d.pop("change_id") + + definition = AgentDefinitionResponseDefinition.from_dict(d.pop("definition")) + + schema_version = d.pop("schema_version") + + def _parse_warnings( + data: object, + ) -> list[AgentDefinitionResponseWarningsType0Item] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + warnings_type_0 = [] + _warnings_type_0 = data + for warnings_type_0_item_data in _warnings_type_0: + warnings_type_0_item = ( + AgentDefinitionResponseWarningsType0Item.from_dict( + warnings_type_0_item_data + ) + ) + + warnings_type_0.append(warnings_type_0_item) + + return warnings_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + list[AgentDefinitionResponseWarningsType0Item] | None | Unset, data + ) + + warnings = _parse_warnings(d.pop("warnings", UNSET)) + + agent_definition_response = cls( + change_id=change_id, + definition=definition, + schema_version=schema_version, + warnings=warnings, + ) + + agent_definition_response.additional_properties = d + return agent_definition_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_definition_response_definition.py b/seclai/_generated/models/agent_definition_response_definition.py new file mode 100644 index 0000000..ce24474 --- /dev/null +++ b/seclai/_generated/models/agent_definition_response_definition.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AgentDefinitionResponseDefinition") + + +@_attrs_define +class AgentDefinitionResponseDefinition: + """The agent definition containing name, description, tags, and step workflow tree. Step types include prompt_call, + retrieval, transform, gate, retry, evaluate_step, insight, extract_json, send_email, webhook_call, call_agent, + write_metadata, write_content_attachment, load_content_attachment, load_content, display_result, and others. + + """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_definition_response_definition = cls() + + agent_definition_response_definition.additional_properties = d + return agent_definition_response_definition + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_definition_response_warnings_type_0_item.py b/seclai/_generated/models/agent_definition_response_warnings_type_0_item.py new file mode 100644 index 0000000..cfc7887 --- /dev/null +++ b/seclai/_generated/models/agent_definition_response_warnings_type_0_item.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AgentDefinitionResponseWarningsType0Item") + + +@_attrs_define +class AgentDefinitionResponseWarningsType0Item: + """ """ + + additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_definition_response_warnings_type_0_item = cls() + + agent_definition_response_warnings_type_0_item.additional_properties = d + return agent_definition_response_warnings_type_0_item + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> str: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: str) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_evaluation_tier.py b/seclai/_generated/models/agent_evaluation_tier.py new file mode 100644 index 0000000..ea671db --- /dev/null +++ b/seclai/_generated/models/agent_evaluation_tier.py @@ -0,0 +1,10 @@ +from enum import Enum + + +class AgentEvaluationTier(str, Enum): + BALANCED = "balanced" + FAST = "fast" + THOROUGH = "thorough" + + def __str__(self) -> str: + return str(self.value) diff --git a/seclai/_generated/models/agent_export_response.py b/seclai/_generated/models/agent_export_response.py new file mode 100644 index 0000000..f51281a --- /dev/null +++ b/seclai/_generated/models/agent_export_response.py @@ -0,0 +1,358 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.agent_export_response_agent import AgentExportResponseAgent + from ..models.agent_export_response_alert_configs_type_0_item import ( + AgentExportResponseAlertConfigsType0Item, + ) + from ..models.agent_export_response_dependencies_type_0 import ( + AgentExportResponseDependenciesType0, + ) + from ..models.agent_export_response_evaluation_criteria_type_0_item import ( + AgentExportResponseEvaluationCriteriaType0Item, + ) + from ..models.agent_export_response_governance_policies_type_0_item import ( + AgentExportResponseGovernancePoliciesType0Item, + ) + from ..models.agent_export_response_trigger_type_0 import ( + AgentExportResponseTriggerType0, + ) + + +T = TypeVar("T", bound="AgentExportResponse") + + +@_attrs_define +class AgentExportResponse: + """Portable JSON snapshot of an agent definition. + + Attributes: + agent (AgentExportResponseAgent): Agent metadata and full definition. Keys: name, description, schema_version, + definition, default_evaluation_tier, evaluation_mode, sampling_config, max_retries, retry_on_failure, + prompt_model_auto_upgrade_strategy, prompt_model_auto_rollback_enabled, prompt_model_auto_rollback_triggers, + created_at, updated_at. + export_version (str): Schema version of the export format (currently "2"). + exported_at (str): ISO-8601 timestamp of when the export was generated. + software_version (str): Application version that produced this export. + alert_configs (list[AgentExportResponseAlertConfigsType0Item] | None | Unset): Alert configurations. + dependencies (AgentExportResponseDependenciesType0 | None | Unset): Resolved dependency manifest. Keys: + knowledge_bases, memory_banks, source_connections, agents, users — each a list of {id, name, description, …}. + evaluation_criteria (list[AgentExportResponseEvaluationCriteriaType0Item] | None | Unset): Evaluation criteria + for agent steps. + governance_policies (list[AgentExportResponseGovernancePoliciesType0Item] | None | Unset): Agent-scoped + governance policies. + trigger (AgentExportResponseTriggerType0 | None | Unset): Trigger configuration with schedules. + """ + + agent: AgentExportResponseAgent + export_version: str + exported_at: str + software_version: str + alert_configs: list[AgentExportResponseAlertConfigsType0Item] | None | Unset = UNSET + dependencies: AgentExportResponseDependenciesType0 | None | Unset = UNSET + evaluation_criteria: ( + list[AgentExportResponseEvaluationCriteriaType0Item] | None | Unset + ) = UNSET + governance_policies: ( + list[AgentExportResponseGovernancePoliciesType0Item] | None | Unset + ) = UNSET + trigger: AgentExportResponseTriggerType0 | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.agent_export_response_dependencies_type_0 import ( + AgentExportResponseDependenciesType0, + ) + from ..models.agent_export_response_trigger_type_0 import ( + AgentExportResponseTriggerType0, + ) + + agent = self.agent.to_dict() + + export_version = self.export_version + + exported_at = self.exported_at + + software_version = self.software_version + + alert_configs: list[dict[str, Any]] | None | Unset + if isinstance(self.alert_configs, Unset): + alert_configs = UNSET + elif isinstance(self.alert_configs, list): + alert_configs = [] + for alert_configs_type_0_item_data in self.alert_configs: + alert_configs_type_0_item = alert_configs_type_0_item_data.to_dict() + alert_configs.append(alert_configs_type_0_item) + + else: + alert_configs = self.alert_configs + + dependencies: dict[str, Any] | None | Unset + if isinstance(self.dependencies, Unset): + dependencies = UNSET + elif isinstance(self.dependencies, AgentExportResponseDependenciesType0): + dependencies = self.dependencies.to_dict() + else: + dependencies = self.dependencies + + evaluation_criteria: list[dict[str, Any]] | None | Unset + if isinstance(self.evaluation_criteria, Unset): + evaluation_criteria = UNSET + elif isinstance(self.evaluation_criteria, list): + evaluation_criteria = [] + for evaluation_criteria_type_0_item_data in self.evaluation_criteria: + evaluation_criteria_type_0_item = ( + evaluation_criteria_type_0_item_data.to_dict() + ) + evaluation_criteria.append(evaluation_criteria_type_0_item) + + else: + evaluation_criteria = self.evaluation_criteria + + governance_policies: list[dict[str, Any]] | None | Unset + if isinstance(self.governance_policies, Unset): + governance_policies = UNSET + elif isinstance(self.governance_policies, list): + governance_policies = [] + for governance_policies_type_0_item_data in self.governance_policies: + governance_policies_type_0_item = ( + governance_policies_type_0_item_data.to_dict() + ) + governance_policies.append(governance_policies_type_0_item) + + else: + governance_policies = self.governance_policies + + trigger: dict[str, Any] | None | Unset + if isinstance(self.trigger, Unset): + trigger = UNSET + elif isinstance(self.trigger, AgentExportResponseTriggerType0): + trigger = self.trigger.to_dict() + else: + trigger = self.trigger + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "agent": agent, + "export_version": export_version, + "exported_at": exported_at, + "software_version": software_version, + } + ) + if alert_configs is not UNSET: + field_dict["alert_configs"] = alert_configs + if dependencies is not UNSET: + field_dict["dependencies"] = dependencies + if evaluation_criteria is not UNSET: + field_dict["evaluation_criteria"] = evaluation_criteria + if governance_policies is not UNSET: + field_dict["governance_policies"] = governance_policies + if trigger is not UNSET: + field_dict["trigger"] = trigger + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.agent_export_response_agent import AgentExportResponseAgent + from ..models.agent_export_response_alert_configs_type_0_item import ( + AgentExportResponseAlertConfigsType0Item, + ) + from ..models.agent_export_response_dependencies_type_0 import ( + AgentExportResponseDependenciesType0, + ) + from ..models.agent_export_response_evaluation_criteria_type_0_item import ( + AgentExportResponseEvaluationCriteriaType0Item, + ) + from ..models.agent_export_response_governance_policies_type_0_item import ( + AgentExportResponseGovernancePoliciesType0Item, + ) + from ..models.agent_export_response_trigger_type_0 import ( + AgentExportResponseTriggerType0, + ) + + d = dict(src_dict) + agent = AgentExportResponseAgent.from_dict(d.pop("agent")) + + export_version = d.pop("export_version") + + exported_at = d.pop("exported_at") + + software_version = d.pop("software_version") + + def _parse_alert_configs( + data: object, + ) -> list[AgentExportResponseAlertConfigsType0Item] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + alert_configs_type_0 = [] + _alert_configs_type_0 = data + for alert_configs_type_0_item_data in _alert_configs_type_0: + alert_configs_type_0_item = ( + AgentExportResponseAlertConfigsType0Item.from_dict( + alert_configs_type_0_item_data + ) + ) + + alert_configs_type_0.append(alert_configs_type_0_item) + + return alert_configs_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + list[AgentExportResponseAlertConfigsType0Item] | None | Unset, data + ) + + alert_configs = _parse_alert_configs(d.pop("alert_configs", UNSET)) + + def _parse_dependencies( + data: object, + ) -> AgentExportResponseDependenciesType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + dependencies_type_0 = AgentExportResponseDependenciesType0.from_dict( + data + ) + + return dependencies_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(AgentExportResponseDependenciesType0 | None | Unset, data) + + dependencies = _parse_dependencies(d.pop("dependencies", UNSET)) + + def _parse_evaluation_criteria( + data: object, + ) -> list[AgentExportResponseEvaluationCriteriaType0Item] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + evaluation_criteria_type_0 = [] + _evaluation_criteria_type_0 = data + for evaluation_criteria_type_0_item_data in _evaluation_criteria_type_0: + evaluation_criteria_type_0_item = ( + AgentExportResponseEvaluationCriteriaType0Item.from_dict( + evaluation_criteria_type_0_item_data + ) + ) + + evaluation_criteria_type_0.append(evaluation_criteria_type_0_item) + + return evaluation_criteria_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + list[AgentExportResponseEvaluationCriteriaType0Item] | None | Unset, + data, + ) + + evaluation_criteria = _parse_evaluation_criteria( + d.pop("evaluation_criteria", UNSET) + ) + + def _parse_governance_policies( + data: object, + ) -> list[AgentExportResponseGovernancePoliciesType0Item] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + governance_policies_type_0 = [] + _governance_policies_type_0 = data + for governance_policies_type_0_item_data in _governance_policies_type_0: + governance_policies_type_0_item = ( + AgentExportResponseGovernancePoliciesType0Item.from_dict( + governance_policies_type_0_item_data + ) + ) + + governance_policies_type_0.append(governance_policies_type_0_item) + + return governance_policies_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + list[AgentExportResponseGovernancePoliciesType0Item] | None | Unset, + data, + ) + + governance_policies = _parse_governance_policies( + d.pop("governance_policies", UNSET) + ) + + def _parse_trigger( + data: object, + ) -> AgentExportResponseTriggerType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + trigger_type_0 = AgentExportResponseTriggerType0.from_dict(data) + + return trigger_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(AgentExportResponseTriggerType0 | None | Unset, data) + + trigger = _parse_trigger(d.pop("trigger", UNSET)) + + agent_export_response = cls( + agent=agent, + export_version=export_version, + exported_at=exported_at, + software_version=software_version, + alert_configs=alert_configs, + dependencies=dependencies, + evaluation_criteria=evaluation_criteria, + governance_policies=governance_policies, + trigger=trigger, + ) + + agent_export_response.additional_properties = d + return agent_export_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_export_response_agent.py b/seclai/_generated/models/agent_export_response_agent.py new file mode 100644 index 0000000..b01a142 --- /dev/null +++ b/seclai/_generated/models/agent_export_response_agent.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AgentExportResponseAgent") + + +@_attrs_define +class AgentExportResponseAgent: + """Agent metadata and full definition. Keys: name, description, schema_version, definition, default_evaluation_tier, + evaluation_mode, sampling_config, max_retries, retry_on_failure, prompt_model_auto_upgrade_strategy, + prompt_model_auto_rollback_enabled, prompt_model_auto_rollback_triggers, created_at, updated_at. + + """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_export_response_agent = cls() + + agent_export_response_agent.additional_properties = d + return agent_export_response_agent + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_export_response_alert_configs_type_0_item.py b/seclai/_generated/models/agent_export_response_alert_configs_type_0_item.py new file mode 100644 index 0000000..e256120 --- /dev/null +++ b/seclai/_generated/models/agent_export_response_alert_configs_type_0_item.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AgentExportResponseAlertConfigsType0Item") + + +@_attrs_define +class AgentExportResponseAlertConfigsType0Item: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_export_response_alert_configs_type_0_item = cls() + + agent_export_response_alert_configs_type_0_item.additional_properties = d + return agent_export_response_alert_configs_type_0_item + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_export_response_dependencies_type_0.py b/seclai/_generated/models/agent_export_response_dependencies_type_0.py new file mode 100644 index 0000000..787acc2 --- /dev/null +++ b/seclai/_generated/models/agent_export_response_dependencies_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AgentExportResponseDependenciesType0") + + +@_attrs_define +class AgentExportResponseDependenciesType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_export_response_dependencies_type_0 = cls() + + agent_export_response_dependencies_type_0.additional_properties = d + return agent_export_response_dependencies_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_export_response_evaluation_criteria_type_0_item.py b/seclai/_generated/models/agent_export_response_evaluation_criteria_type_0_item.py new file mode 100644 index 0000000..a2501b8 --- /dev/null +++ b/seclai/_generated/models/agent_export_response_evaluation_criteria_type_0_item.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AgentExportResponseEvaluationCriteriaType0Item") + + +@_attrs_define +class AgentExportResponseEvaluationCriteriaType0Item: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_export_response_evaluation_criteria_type_0_item = cls() + + agent_export_response_evaluation_criteria_type_0_item.additional_properties = d + return agent_export_response_evaluation_criteria_type_0_item + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_export_response_governance_policies_type_0_item.py b/seclai/_generated/models/agent_export_response_governance_policies_type_0_item.py new file mode 100644 index 0000000..15b78d3 --- /dev/null +++ b/seclai/_generated/models/agent_export_response_governance_policies_type_0_item.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AgentExportResponseGovernancePoliciesType0Item") + + +@_attrs_define +class AgentExportResponseGovernancePoliciesType0Item: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_export_response_governance_policies_type_0_item = cls() + + agent_export_response_governance_policies_type_0_item.additional_properties = d + return agent_export_response_governance_policies_type_0_item + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_export_response_trigger_type_0.py b/seclai/_generated/models/agent_export_response_trigger_type_0.py new file mode 100644 index 0000000..927472c --- /dev/null +++ b/seclai/_generated/models/agent_export_response_trigger_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AgentExportResponseTriggerType0") + + +@_attrs_define +class AgentExportResponseTriggerType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_export_response_trigger_type_0 = cls() + + agent_export_response_trigger_type_0.additional_properties = d + return agent_export_response_trigger_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_list_response.py b/seclai/_generated/models/agent_list_response.py new file mode 100644 index 0000000..a53173f --- /dev/null +++ b/seclai/_generated/models/agent_list_response.py @@ -0,0 +1,85 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.agent_summary_response import AgentSummaryResponse + from ..models.pagination_response import PaginationResponse + + +T = TypeVar("T", bound="AgentListResponse") + + +@_attrs_define +class AgentListResponse: + """ + Attributes: + data (list[AgentSummaryResponse]): List of agents. + pagination (PaginationResponse): Pagination information. + """ + + data: list[AgentSummaryResponse] + pagination: PaginationResponse + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data = [] + for data_item_data in self.data: + data_item = data_item_data.to_dict() + data.append(data_item) + + pagination = self.pagination.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "data": data, + "pagination": pagination, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.agent_summary_response import AgentSummaryResponse + from ..models.pagination_response import PaginationResponse + + d = dict(src_dict) + data = [] + _data = d.pop("data") + for data_item_data in _data: + data_item = AgentSummaryResponse.from_dict(data_item_data) + + data.append(data_item) + + pagination = PaginationResponse.from_dict(d.pop("pagination")) + + agent_list_response = cls( + data=data, + pagination=pagination, + ) + + agent_list_response.additional_properties = d + return agent_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_run_request.py b/seclai/_generated/models/agent_run_request.py index 8f08c65..429f67c 100644 --- a/seclai/_generated/models/agent_run_request.py +++ b/seclai/_generated/models/agent_run_request.py @@ -2,6 +2,7 @@ from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -19,14 +20,17 @@ class AgentRunRequest: """ Attributes: - input_ (None | str): Input to provide to the agent upon running for agents with dynamic triggers. - metadata (AgentRunRequestMetadataType0 | None): Metadata to make available for string substitution expressions - in agent tasks. + input_ (None | str | Unset): Input to provide to the agent upon running for agents with dynamic triggers. + input_upload_id (None | Unset | UUID): ID of a previously uploaded file (via POST /{agent_id}/upload-input) to + use as the run input for dynamic-input triggers. Mutually exclusive with the 'input' field. + metadata (AgentRunRequestMetadataType0 | None | Unset): Metadata to make available for string substitution + expressions in agent tasks. priority (bool | Unset): If true, the agent run will be treated as priority execution. Default: False. """ - input_: None | str - metadata: AgentRunRequestMetadataType0 | None + input_: None | str | Unset = UNSET + input_upload_id: None | Unset | UUID = UNSET + metadata: AgentRunRequestMetadataType0 | None | Unset = UNSET priority: bool | Unset = False additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) @@ -35,11 +39,24 @@ def to_dict(self) -> dict[str, Any]: AgentRunRequestMetadataType0, ) - input_: None | str - input_ = self.input_ + input_: None | str | Unset + if isinstance(self.input_, Unset): + input_ = UNSET + else: + input_ = self.input_ + + input_upload_id: None | str | Unset + if isinstance(self.input_upload_id, Unset): + input_upload_id = UNSET + elif isinstance(self.input_upload_id, UUID): + input_upload_id = str(self.input_upload_id) + else: + input_upload_id = self.input_upload_id - metadata: dict[str, Any] | None - if isinstance(self.metadata, AgentRunRequestMetadataType0): + metadata: dict[str, Any] | None | Unset + if isinstance(self.metadata, Unset): + metadata = UNSET + elif isinstance(self.metadata, AgentRunRequestMetadataType0): metadata = self.metadata.to_dict() else: metadata = self.metadata @@ -48,12 +65,13 @@ def to_dict(self) -> dict[str, Any]: field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update( - { - "input": input_, - "metadata": metadata, - } - ) + field_dict.update({}) + if input_ is not UNSET: + field_dict["input"] = input_ + if input_upload_id is not UNSET: + field_dict["input_upload_id"] = input_upload_id + if metadata is not UNSET: + field_dict["metadata"] = metadata if priority is not UNSET: field_dict["priority"] = priority @@ -67,16 +85,39 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - def _parse_input_(data: object) -> None | str: + def _parse_input_(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + input_ = _parse_input_(d.pop("input", UNSET)) + + def _parse_input_upload_id(data: object) -> None | Unset | UUID: if data is None: return data - return cast(None | str, data) + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + input_upload_id_type_0 = UUID(data) - input_ = _parse_input_(d.pop("input")) + return input_upload_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) - def _parse_metadata(data: object) -> AgentRunRequestMetadataType0 | None: + input_upload_id = _parse_input_upload_id(d.pop("input_upload_id", UNSET)) + + def _parse_metadata( + data: object, + ) -> AgentRunRequestMetadataType0 | None | Unset: if data is None: return data + if isinstance(data, Unset): + return data try: if not isinstance(data, dict): raise TypeError() @@ -85,14 +126,15 @@ def _parse_metadata(data: object) -> AgentRunRequestMetadataType0 | None: return metadata_type_0 except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(AgentRunRequestMetadataType0 | None, data) + return cast(AgentRunRequestMetadataType0 | None | Unset, data) - metadata = _parse_metadata(d.pop("metadata")) + metadata = _parse_metadata(d.pop("metadata", UNSET)) priority = d.pop("priority", UNSET) agent_run_request = cls( input_=input_, + input_upload_id=input_upload_id, metadata=metadata, priority=priority, ) diff --git a/seclai/_generated/models/agent_run_step_response.py b/seclai/_generated/models/agent_run_step_response.py index 0e803ab..504141d 100644 --- a/seclai/_generated/models/agent_run_step_response.py +++ b/seclai/_generated/models/agent_run_step_response.py @@ -21,6 +21,7 @@ class AgentRunStepResponse: credits_used (float): Credits consumed by the step attempt, if applicable. duration_seconds (float | None): Duration of the step attempt in seconds. ended_at (None | str): Timestamp when the step attempt ended. + input_ (None | str): Input provided to the step, if any. output (None | str): Output produced by the step, if any. output_content_type (None | str): Content type of the step output, if any. started_at (None | str): Timestamp when the step attempt started. @@ -32,6 +33,7 @@ class AgentRunStepResponse: credits_used: float duration_seconds: float | None ended_at: None | str + input_: None | str output: None | str output_content_type: None | str started_at: None | str @@ -50,6 +52,9 @@ def to_dict(self) -> dict[str, Any]: ended_at: None | str ended_at = self.ended_at + input_: None | str + input_ = self.input_ + output: None | str output = self.output @@ -71,6 +76,7 @@ def to_dict(self) -> dict[str, Any]: "credits_used": credits_used, "duration_seconds": duration_seconds, "ended_at": ended_at, + "input": input_, "output": output, "output_content_type": output_content_type, "started_at": started_at, @@ -102,6 +108,13 @@ def _parse_ended_at(data: object) -> None | str: ended_at = _parse_ended_at(d.pop("ended_at")) + def _parse_input_(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + input_ = _parse_input_(d.pop("input")) + def _parse_output(data: object) -> None | str: if data is None: return data @@ -132,6 +145,7 @@ def _parse_started_at(data: object) -> None | str: credits_used=credits_used, duration_seconds=duration_seconds, ended_at=ended_at, + input_=input_, output=output, output_content_type=output_content_type, started_at=started_at, diff --git a/seclai/_generated/models/agent_run_stream_request.py b/seclai/_generated/models/agent_run_stream_request.py index 1b5acaf..b63b16f 100644 --- a/seclai/_generated/models/agent_run_stream_request.py +++ b/seclai/_generated/models/agent_run_stream_request.py @@ -2,10 +2,13 @@ from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID from attrs import define as _attrs_define from attrs import field as _attrs_field +from ..types import UNSET, Unset + if TYPE_CHECKING: from ..models.agent_run_stream_request_metadata_type_0 import ( AgentRunStreamRequestMetadataType0, @@ -19,13 +22,16 @@ class AgentRunStreamRequest: """ Attributes: - input_ (None | str): Input to provide to the agent upon running for agents with dynamic triggers. - metadata (AgentRunStreamRequestMetadataType0 | None): Metadata to make available for string substitution + input_ (None | str | Unset): Input to provide to the agent upon running for agents with dynamic triggers. + input_upload_id (None | Unset | UUID): ID of a previously uploaded file (via POST /{agent_id}/upload-input) to + use as the run input for dynamic-input triggers. Mutually exclusive with the 'input' field. + metadata (AgentRunStreamRequestMetadataType0 | None | Unset): Metadata to make available for string substitution expressions in agent tasks. """ - input_: None | str - metadata: AgentRunStreamRequestMetadataType0 | None + input_: None | str | Unset = UNSET + input_upload_id: None | Unset | UUID = UNSET + metadata: AgentRunStreamRequestMetadataType0 | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -33,23 +39,37 @@ def to_dict(self) -> dict[str, Any]: AgentRunStreamRequestMetadataType0, ) - input_: None | str - input_ = self.input_ + input_: None | str | Unset + if isinstance(self.input_, Unset): + input_ = UNSET + else: + input_ = self.input_ - metadata: dict[str, Any] | None - if isinstance(self.metadata, AgentRunStreamRequestMetadataType0): + input_upload_id: None | str | Unset + if isinstance(self.input_upload_id, Unset): + input_upload_id = UNSET + elif isinstance(self.input_upload_id, UUID): + input_upload_id = str(self.input_upload_id) + else: + input_upload_id = self.input_upload_id + + metadata: dict[str, Any] | None | Unset + if isinstance(self.metadata, Unset): + metadata = UNSET + elif isinstance(self.metadata, AgentRunStreamRequestMetadataType0): metadata = self.metadata.to_dict() else: metadata = self.metadata field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update( - { - "input": input_, - "metadata": metadata, - } - ) + field_dict.update({}) + if input_ is not UNSET: + field_dict["input"] = input_ + if input_upload_id is not UNSET: + field_dict["input_upload_id"] = input_upload_id + if metadata is not UNSET: + field_dict["metadata"] = metadata return field_dict @@ -61,16 +81,39 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - def _parse_input_(data: object) -> None | str: + def _parse_input_(data: object) -> None | str | Unset: if data is None: return data - return cast(None | str, data) + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) - input_ = _parse_input_(d.pop("input")) + input_ = _parse_input_(d.pop("input", UNSET)) - def _parse_metadata(data: object) -> AgentRunStreamRequestMetadataType0 | None: + def _parse_input_upload_id(data: object) -> None | Unset | UUID: if data is None: return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + input_upload_id_type_0 = UUID(data) + + return input_upload_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) + + input_upload_id = _parse_input_upload_id(d.pop("input_upload_id", UNSET)) + + def _parse_metadata( + data: object, + ) -> AgentRunStreamRequestMetadataType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data try: if not isinstance(data, dict): raise TypeError() @@ -79,12 +122,13 @@ def _parse_metadata(data: object) -> AgentRunStreamRequestMetadataType0 | None: return metadata_type_0 except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(AgentRunStreamRequestMetadataType0 | None, data) + return cast(AgentRunStreamRequestMetadataType0 | None | Unset, data) - metadata = _parse_metadata(d.pop("metadata")) + metadata = _parse_metadata(d.pop("metadata", UNSET)) agent_run_stream_request = cls( input_=input_, + input_upload_id=input_upload_id, metadata=metadata, ) diff --git a/seclai/_generated/models/agent_summary_response.py b/seclai/_generated/models/agent_summary_response.py new file mode 100644 index 0000000..6ac329c --- /dev/null +++ b/seclai/_generated/models/agent_summary_response.py @@ -0,0 +1,286 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.agent_summary_response_sampling_config_type_0 import ( + AgentSummaryResponseSamplingConfigType0, + ) + + +T = TypeVar("T", bound="AgentSummaryResponse") + + +@_attrs_define +class AgentSummaryResponse: + """ + Attributes: + created_at (str): ISO 8601 creation timestamp. + description (None | str): Agent description. + id (str): Unique agent identifier. + name (str): Agent name. + trigger_type (None | str): Trigger type for the agent. + updated_at (str): ISO 8601 last-updated timestamp. + default_evaluation_tier (None | str | Unset): Default evaluation tier: fast, balanced, or thorough. + evaluation_mode (str | Unset): Evaluation mode: output_expectation, eval_and_retry, or sample_and_flag. Default: + 'eval_and_retry'. + max_retries (int | Unset): Max retries for eval_and_retry mode. Default: 3. + prompt_model_auto_rollback_enabled (bool | Unset): Whether automatic rollback is enabled for upgraded models. + Default: False. + prompt_model_auto_rollback_triggers (list[str] | None | Unset): Failure signals that trigger rollback. Defaults + to agent_eval_fail, governance_block, agent_run_failed when null. + prompt_model_auto_upgrade_strategy (str | Unset): Auto-upgrade strategy: none, early_adopter, middle_of_road, + cautious_adopter. Default: 'none'. + retry_on_failure (bool | Unset): Whether to retry on evaluation failure. Default: True. + sampling_config (AgentSummaryResponseSamplingConfigType0 | None | Unset): Sampling configuration for + sample_and_flag mode. + """ + + created_at: str + description: None | str + id: str + name: str + trigger_type: None | str + updated_at: str + default_evaluation_tier: None | str | Unset = UNSET + evaluation_mode: str | Unset = "eval_and_retry" + max_retries: int | Unset = 3 + prompt_model_auto_rollback_enabled: bool | Unset = False + prompt_model_auto_rollback_triggers: list[str] | None | Unset = UNSET + prompt_model_auto_upgrade_strategy: str | Unset = "none" + retry_on_failure: bool | Unset = True + sampling_config: AgentSummaryResponseSamplingConfigType0 | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.agent_summary_response_sampling_config_type_0 import ( + AgentSummaryResponseSamplingConfigType0, + ) + + created_at = self.created_at + + description: None | str + description = self.description + + id = self.id + + name = self.name + + trigger_type: None | str + trigger_type = self.trigger_type + + updated_at = self.updated_at + + default_evaluation_tier: None | str | Unset + if isinstance(self.default_evaluation_tier, Unset): + default_evaluation_tier = UNSET + else: + default_evaluation_tier = self.default_evaluation_tier + + evaluation_mode = self.evaluation_mode + + max_retries = self.max_retries + + prompt_model_auto_rollback_enabled = self.prompt_model_auto_rollback_enabled + + prompt_model_auto_rollback_triggers: list[str] | None | Unset + if isinstance(self.prompt_model_auto_rollback_triggers, Unset): + prompt_model_auto_rollback_triggers = UNSET + elif isinstance(self.prompt_model_auto_rollback_triggers, list): + prompt_model_auto_rollback_triggers = ( + self.prompt_model_auto_rollback_triggers + ) + + else: + prompt_model_auto_rollback_triggers = ( + self.prompt_model_auto_rollback_triggers + ) + + prompt_model_auto_upgrade_strategy = self.prompt_model_auto_upgrade_strategy + + retry_on_failure = self.retry_on_failure + + sampling_config: dict[str, Any] | None | Unset + if isinstance(self.sampling_config, Unset): + sampling_config = UNSET + elif isinstance(self.sampling_config, AgentSummaryResponseSamplingConfigType0): + sampling_config = self.sampling_config.to_dict() + else: + sampling_config = self.sampling_config + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "created_at": created_at, + "description": description, + "id": id, + "name": name, + "trigger_type": trigger_type, + "updated_at": updated_at, + } + ) + if default_evaluation_tier is not UNSET: + field_dict["default_evaluation_tier"] = default_evaluation_tier + if evaluation_mode is not UNSET: + field_dict["evaluation_mode"] = evaluation_mode + if max_retries is not UNSET: + field_dict["max_retries"] = max_retries + if prompt_model_auto_rollback_enabled is not UNSET: + field_dict["prompt_model_auto_rollback_enabled"] = ( + prompt_model_auto_rollback_enabled + ) + if prompt_model_auto_rollback_triggers is not UNSET: + field_dict["prompt_model_auto_rollback_triggers"] = ( + prompt_model_auto_rollback_triggers + ) + if prompt_model_auto_upgrade_strategy is not UNSET: + field_dict["prompt_model_auto_upgrade_strategy"] = ( + prompt_model_auto_upgrade_strategy + ) + if retry_on_failure is not UNSET: + field_dict["retry_on_failure"] = retry_on_failure + if sampling_config is not UNSET: + field_dict["sampling_config"] = sampling_config + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.agent_summary_response_sampling_config_type_0 import ( + AgentSummaryResponseSamplingConfigType0, + ) + + d = dict(src_dict) + created_at = d.pop("created_at") + + def _parse_description(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + description = _parse_description(d.pop("description")) + + id = d.pop("id") + + name = d.pop("name") + + def _parse_trigger_type(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + trigger_type = _parse_trigger_type(d.pop("trigger_type")) + + updated_at = d.pop("updated_at") + + def _parse_default_evaluation_tier(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + default_evaluation_tier = _parse_default_evaluation_tier( + d.pop("default_evaluation_tier", UNSET) + ) + + evaluation_mode = d.pop("evaluation_mode", UNSET) + + max_retries = d.pop("max_retries", UNSET) + + prompt_model_auto_rollback_enabled = d.pop( + "prompt_model_auto_rollback_enabled", UNSET + ) + + def _parse_prompt_model_auto_rollback_triggers( + data: object, + ) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + prompt_model_auto_rollback_triggers_type_0 = cast(list[str], data) + + return prompt_model_auto_rollback_triggers_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + prompt_model_auto_rollback_triggers = ( + _parse_prompt_model_auto_rollback_triggers( + d.pop("prompt_model_auto_rollback_triggers", UNSET) + ) + ) + + prompt_model_auto_upgrade_strategy = d.pop( + "prompt_model_auto_upgrade_strategy", UNSET + ) + + retry_on_failure = d.pop("retry_on_failure", UNSET) + + def _parse_sampling_config( + data: object, + ) -> AgentSummaryResponseSamplingConfigType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + sampling_config_type_0 = ( + AgentSummaryResponseSamplingConfigType0.from_dict(data) + ) + + return sampling_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(AgentSummaryResponseSamplingConfigType0 | None | Unset, data) + + sampling_config = _parse_sampling_config(d.pop("sampling_config", UNSET)) + + agent_summary_response = cls( + created_at=created_at, + description=description, + id=id, + name=name, + trigger_type=trigger_type, + updated_at=updated_at, + default_evaluation_tier=default_evaluation_tier, + evaluation_mode=evaluation_mode, + max_retries=max_retries, + prompt_model_auto_rollback_enabled=prompt_model_auto_rollback_enabled, + prompt_model_auto_rollback_triggers=prompt_model_auto_rollback_triggers, + prompt_model_auto_upgrade_strategy=prompt_model_auto_upgrade_strategy, + retry_on_failure=retry_on_failure, + sampling_config=sampling_config, + ) + + agent_summary_response.additional_properties = d + return agent_summary_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_summary_response_sampling_config_type_0.py b/seclai/_generated/models/agent_summary_response_sampling_config_type_0.py new file mode 100644 index 0000000..a9ce7fb --- /dev/null +++ b/seclai/_generated/models/agent_summary_response_sampling_config_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AgentSummaryResponseSamplingConfigType0") + + +@_attrs_define +class AgentSummaryResponseSamplingConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_summary_response_sampling_config_type_0 = cls() + + agent_summary_response_sampling_config_type_0.additional_properties = d + return agent_summary_response_sampling_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_trace_match_response.py b/seclai/_generated/models/agent_trace_match_response.py new file mode 100644 index 0000000..7081edf --- /dev/null +++ b/seclai/_generated/models/agent_trace_match_response.py @@ -0,0 +1,168 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AgentTraceMatchResponse") + + +@_attrs_define +class AgentTraceMatchResponse: + """ + Attributes: + agent_id (None | str): Agent ID. + agent_run_id (None | str): Agent run ID. + agent_run_status (None | str): Status of the agent run. + agent_step_id (None | str): Step identifier. + agent_step_run_id (None | str): Agent step run ID. + agent_step_type (None | str): Type of the step. + score (float): Similarity score (0-1, higher is better). + text (str): Matching text chunk. + title (None | str): Title of the indexed entry. + """ + + agent_id: None | str + agent_run_id: None | str + agent_run_status: None | str + agent_step_id: None | str + agent_step_run_id: None | str + agent_step_type: None | str + score: float + text: str + title: None | str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + agent_id: None | str + agent_id = self.agent_id + + agent_run_id: None | str + agent_run_id = self.agent_run_id + + agent_run_status: None | str + agent_run_status = self.agent_run_status + + agent_step_id: None | str + agent_step_id = self.agent_step_id + + agent_step_run_id: None | str + agent_step_run_id = self.agent_step_run_id + + agent_step_type: None | str + agent_step_type = self.agent_step_type + + score = self.score + + text = self.text + + title: None | str + title = self.title + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "agent_id": agent_id, + "agent_run_id": agent_run_id, + "agent_run_status": agent_run_status, + "agent_step_id": agent_step_id, + "agent_step_run_id": agent_step_run_id, + "agent_step_type": agent_step_type, + "score": score, + "text": text, + "title": title, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_agent_id(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + agent_id = _parse_agent_id(d.pop("agent_id")) + + def _parse_agent_run_id(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + agent_run_id = _parse_agent_run_id(d.pop("agent_run_id")) + + def _parse_agent_run_status(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + agent_run_status = _parse_agent_run_status(d.pop("agent_run_status")) + + def _parse_agent_step_id(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + agent_step_id = _parse_agent_step_id(d.pop("agent_step_id")) + + def _parse_agent_step_run_id(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + agent_step_run_id = _parse_agent_step_run_id(d.pop("agent_step_run_id")) + + def _parse_agent_step_type(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + agent_step_type = _parse_agent_step_type(d.pop("agent_step_type")) + + score = d.pop("score") + + text = d.pop("text") + + def _parse_title(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + title = _parse_title(d.pop("title")) + + agent_trace_match_response = cls( + agent_id=agent_id, + agent_run_id=agent_run_id, + agent_run_status=agent_run_status, + agent_step_id=agent_step_id, + agent_step_run_id=agent_step_run_id, + agent_step_type=agent_step_type, + score=score, + text=text, + title=title, + ) + + agent_trace_match_response.additional_properties = d + return agent_trace_match_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_trace_search_request.py b/seclai/_generated/models/agent_trace_search_request.py new file mode 100644 index 0000000..0bf0d6f --- /dev/null +++ b/seclai/_generated/models/agent_trace_search_request.py @@ -0,0 +1,132 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AgentTraceSearchRequest") + + +@_attrs_define +class AgentTraceSearchRequest: + """ + Attributes: + query (str): Search query text. + agent_id (None | str | Unset): Filter by agent ID. + run_status (None | str | Unset): Filter by run status. + step_type (None | str | Unset): Filter by step type. + top_n (int | Unset): Maximum number of results. Default: 10. + """ + + query: str + agent_id: None | str | Unset = UNSET + run_status: None | str | Unset = UNSET + step_type: None | str | Unset = UNSET + top_n: int | Unset = 10 + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + query = self.query + + agent_id: None | str | Unset + if isinstance(self.agent_id, Unset): + agent_id = UNSET + else: + agent_id = self.agent_id + + run_status: None | str | Unset + if isinstance(self.run_status, Unset): + run_status = UNSET + else: + run_status = self.run_status + + step_type: None | str | Unset + if isinstance(self.step_type, Unset): + step_type = UNSET + else: + step_type = self.step_type + + top_n = self.top_n + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "query": query, + } + ) + if agent_id is not UNSET: + field_dict["agent_id"] = agent_id + if run_status is not UNSET: + field_dict["run_status"] = run_status + if step_type is not UNSET: + field_dict["step_type"] = step_type + if top_n is not UNSET: + field_dict["top_n"] = top_n + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + query = d.pop("query") + + def _parse_agent_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + agent_id = _parse_agent_id(d.pop("agent_id", UNSET)) + + def _parse_run_status(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + run_status = _parse_run_status(d.pop("run_status", UNSET)) + + def _parse_step_type(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + step_type = _parse_step_type(d.pop("step_type", UNSET)) + + top_n = d.pop("top_n", UNSET) + + agent_trace_search_request = cls( + query=query, + agent_id=agent_id, + run_status=run_status, + step_type=step_type, + top_n=top_n, + ) + + agent_trace_search_request.additional_properties = d + return agent_trace_search_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/agent_trace_search_response.py b/seclai/_generated/models/agent_trace_search_response.py new file mode 100644 index 0000000..42fbd60 --- /dev/null +++ b/seclai/_generated/models/agent_trace_search_response.py @@ -0,0 +1,83 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.agent_trace_match_response import AgentTraceMatchResponse + + +T = TypeVar("T", bound="AgentTraceSearchResponse") + + +@_attrs_define +class AgentTraceSearchResponse: + """ + Attributes: + matches (list[AgentTraceMatchResponse]): List of matching entries. + total (int): Number of matches returned. + """ + + matches: list[AgentTraceMatchResponse] + total: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + matches = [] + for matches_item_data in self.matches: + matches_item = matches_item_data.to_dict() + matches.append(matches_item) + + total = self.total + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "matches": matches, + "total": total, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.agent_trace_match_response import AgentTraceMatchResponse + + d = dict(src_dict) + matches = [] + _matches = d.pop("matches") + for matches_item_data in _matches: + matches_item = AgentTraceMatchResponse.from_dict(matches_item_data) + + matches.append(matches_item) + + total = d.pop("total") + + agent_trace_search_response = cls( + matches=matches, + total=total, + ) + + agent_trace_search_response.additional_properties = d + return agent_trace_search_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/ai_assistant_accept_request.py b/seclai/_generated/models/ai_assistant_accept_request.py new file mode 100644 index 0000000..67594d9 --- /dev/null +++ b/seclai/_generated/models/ai_assistant_accept_request.py @@ -0,0 +1,106 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AiAssistantAcceptRequest") + + +@_attrs_define +class AiAssistantAcceptRequest: + """Request body for accepting a proposed plan. + + Attributes: + confirm_deletions (bool | Unset): Must be true when the plan contains destructive actions Default: False. + solution_description (None | str | Unset): When running in standalone mode (no pre-existing solution), provide a + description for the auto-created solution. + solution_name (None | str | Unset): When running in standalone mode (no pre-existing solution), provide a name + to auto-create a solution and link resources. + """ + + confirm_deletions: bool | Unset = False + solution_description: None | str | Unset = UNSET + solution_name: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + confirm_deletions = self.confirm_deletions + + solution_description: None | str | Unset + if isinstance(self.solution_description, Unset): + solution_description = UNSET + else: + solution_description = self.solution_description + + solution_name: None | str | Unset + if isinstance(self.solution_name, Unset): + solution_name = UNSET + else: + solution_name = self.solution_name + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if confirm_deletions is not UNSET: + field_dict["confirm_deletions"] = confirm_deletions + if solution_description is not UNSET: + field_dict["solution_description"] = solution_description + if solution_name is not UNSET: + field_dict["solution_name"] = solution_name + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + confirm_deletions = d.pop("confirm_deletions", UNSET) + + def _parse_solution_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + solution_description = _parse_solution_description( + d.pop("solution_description", UNSET) + ) + + def _parse_solution_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + solution_name = _parse_solution_name(d.pop("solution_name", UNSET)) + + ai_assistant_accept_request = cls( + confirm_deletions=confirm_deletions, + solution_description=solution_description, + solution_name=solution_name, + ) + + ai_assistant_accept_request.additional_properties = d + return ai_assistant_accept_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/ai_assistant_accept_response.py b/seclai/_generated/models/ai_assistant_accept_response.py new file mode 100644 index 0000000..c9253ca --- /dev/null +++ b/seclai/_generated/models/ai_assistant_accept_response.py @@ -0,0 +1,148 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.executed_action_response import ExecutedActionResponse + + +T = TypeVar("T", bound="AiAssistantAcceptResponse") + + +@_attrs_define +class AiAssistantAcceptResponse: + """Response from accepting and executing a plan. + + Attributes: + conversation_id (UUID): Conversation ID. + executed_actions (list[ExecutedActionResponse]): Results of each executed action. + error (None | str | Unset): Error message if failed. + solution_id (None | Unset | UUID): Solution ID when a new solution was auto-created. + success (bool | Unset): Whether execution succeeded. Default: True. + """ + + conversation_id: UUID + executed_actions: list[ExecutedActionResponse] + error: None | str | Unset = UNSET + solution_id: None | Unset | UUID = UNSET + success: bool | Unset = True + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + conversation_id = str(self.conversation_id) + + executed_actions = [] + for executed_actions_item_data in self.executed_actions: + executed_actions_item = executed_actions_item_data.to_dict() + executed_actions.append(executed_actions_item) + + error: None | str | Unset + if isinstance(self.error, Unset): + error = UNSET + else: + error = self.error + + solution_id: None | str | Unset + if isinstance(self.solution_id, Unset): + solution_id = UNSET + elif isinstance(self.solution_id, UUID): + solution_id = str(self.solution_id) + else: + solution_id = self.solution_id + + success = self.success + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "conversation_id": conversation_id, + "executed_actions": executed_actions, + } + ) + if error is not UNSET: + field_dict["error"] = error + if solution_id is not UNSET: + field_dict["solution_id"] = solution_id + if success is not UNSET: + field_dict["success"] = success + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.executed_action_response import ExecutedActionResponse + + d = dict(src_dict) + conversation_id = UUID(d.pop("conversation_id")) + + executed_actions = [] + _executed_actions = d.pop("executed_actions") + for executed_actions_item_data in _executed_actions: + executed_actions_item = ExecutedActionResponse.from_dict( + executed_actions_item_data + ) + + executed_actions.append(executed_actions_item) + + def _parse_error(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + error = _parse_error(d.pop("error", UNSET)) + + def _parse_solution_id(data: object) -> None | Unset | UUID: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + solution_id_type_0 = UUID(data) + + return solution_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) + + solution_id = _parse_solution_id(d.pop("solution_id", UNSET)) + + success = d.pop("success", UNSET) + + ai_assistant_accept_response = cls( + conversation_id=conversation_id, + executed_actions=executed_actions, + error=error, + solution_id=solution_id, + success=success, + ) + + ai_assistant_accept_response.additional_properties = d + return ai_assistant_accept_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/ai_assistant_feedback_request.py b/seclai/_generated/models/ai_assistant_feedback_request.py new file mode 100644 index 0000000..0bf4264 --- /dev/null +++ b/seclai/_generated/models/ai_assistant_feedback_request.py @@ -0,0 +1,231 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.ai_assistant_feedback_request_context_type_0 import ( + AiAssistantFeedbackRequestContextType0, + ) + + +T = TypeVar("T", bound="AiAssistantFeedbackRequest") + + +@_attrs_define +class AiAssistantFeedbackRequest: + """Request body for submitting AI assistant feedback. + + Attributes: + feature (str): Feature name (e.g. 'source', 'solution'). + rating (str): Rating: 'thumbs_up' or 'thumbs_down'. + agent_conversation_id (None | Unset | UUID): Agent conversation ID, if applicable. + comment (None | str | Unset): Optional comment. + context (AiAssistantFeedbackRequestContextType0 | None | Unset): Additional context. + conversation_id (None | Unset | UUID): Conversation ID for the interaction. + prompt_call_id (None | Unset | UUID): Prompt call ID for credit tracking. + """ + + feature: str + rating: str + agent_conversation_id: None | Unset | UUID = UNSET + comment: None | str | Unset = UNSET + context: AiAssistantFeedbackRequestContextType0 | None | Unset = UNSET + conversation_id: None | Unset | UUID = UNSET + prompt_call_id: None | Unset | UUID = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.ai_assistant_feedback_request_context_type_0 import ( + AiAssistantFeedbackRequestContextType0, + ) + + feature = self.feature + + rating = self.rating + + agent_conversation_id: None | str | Unset + if isinstance(self.agent_conversation_id, Unset): + agent_conversation_id = UNSET + elif isinstance(self.agent_conversation_id, UUID): + agent_conversation_id = str(self.agent_conversation_id) + else: + agent_conversation_id = self.agent_conversation_id + + comment: None | str | Unset + if isinstance(self.comment, Unset): + comment = UNSET + else: + comment = self.comment + + context: dict[str, Any] | None | Unset + if isinstance(self.context, Unset): + context = UNSET + elif isinstance(self.context, AiAssistantFeedbackRequestContextType0): + context = self.context.to_dict() + else: + context = self.context + + conversation_id: None | str | Unset + if isinstance(self.conversation_id, Unset): + conversation_id = UNSET + elif isinstance(self.conversation_id, UUID): + conversation_id = str(self.conversation_id) + else: + conversation_id = self.conversation_id + + prompt_call_id: None | str | Unset + if isinstance(self.prompt_call_id, Unset): + prompt_call_id = UNSET + elif isinstance(self.prompt_call_id, UUID): + prompt_call_id = str(self.prompt_call_id) + else: + prompt_call_id = self.prompt_call_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "feature": feature, + "rating": rating, + } + ) + if agent_conversation_id is not UNSET: + field_dict["agent_conversation_id"] = agent_conversation_id + if comment is not UNSET: + field_dict["comment"] = comment + if context is not UNSET: + field_dict["context"] = context + if conversation_id is not UNSET: + field_dict["conversation_id"] = conversation_id + if prompt_call_id is not UNSET: + field_dict["prompt_call_id"] = prompt_call_id + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.ai_assistant_feedback_request_context_type_0 import ( + AiAssistantFeedbackRequestContextType0, + ) + + d = dict(src_dict) + feature = d.pop("feature") + + rating = d.pop("rating") + + def _parse_agent_conversation_id(data: object) -> None | Unset | UUID: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + agent_conversation_id_type_0 = UUID(data) + + return agent_conversation_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) + + agent_conversation_id = _parse_agent_conversation_id( + d.pop("agent_conversation_id", UNSET) + ) + + def _parse_comment(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + comment = _parse_comment(d.pop("comment", UNSET)) + + def _parse_context( + data: object, + ) -> AiAssistantFeedbackRequestContextType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + context_type_0 = AiAssistantFeedbackRequestContextType0.from_dict(data) + + return context_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(AiAssistantFeedbackRequestContextType0 | None | Unset, data) + + context = _parse_context(d.pop("context", UNSET)) + + def _parse_conversation_id(data: object) -> None | Unset | UUID: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + conversation_id_type_0 = UUID(data) + + return conversation_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) + + conversation_id = _parse_conversation_id(d.pop("conversation_id", UNSET)) + + def _parse_prompt_call_id(data: object) -> None | Unset | UUID: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + prompt_call_id_type_0 = UUID(data) + + return prompt_call_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) + + prompt_call_id = _parse_prompt_call_id(d.pop("prompt_call_id", UNSET)) + + ai_assistant_feedback_request = cls( + feature=feature, + rating=rating, + agent_conversation_id=agent_conversation_id, + comment=comment, + context=context, + conversation_id=conversation_id, + prompt_call_id=prompt_call_id, + ) + + ai_assistant_feedback_request.additional_properties = d + return ai_assistant_feedback_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/ai_assistant_feedback_request_context_type_0.py b/seclai/_generated/models/ai_assistant_feedback_request_context_type_0.py new file mode 100644 index 0000000..e584ecb --- /dev/null +++ b/seclai/_generated/models/ai_assistant_feedback_request_context_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AiAssistantFeedbackRequestContextType0") + + +@_attrs_define +class AiAssistantFeedbackRequestContextType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + ai_assistant_feedback_request_context_type_0 = cls() + + ai_assistant_feedback_request_context_type_0.additional_properties = d + return ai_assistant_feedback_request_context_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/ai_assistant_feedback_response.py b/seclai/_generated/models/ai_assistant_feedback_response.py new file mode 100644 index 0000000..58adeee --- /dev/null +++ b/seclai/_generated/models/ai_assistant_feedback_response.py @@ -0,0 +1,93 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AiAssistantFeedbackResponse") + + +@_attrs_define +class AiAssistantFeedbackResponse: + """Response after submitting feedback. + + Attributes: + feedback_id (UUID): + flagged (bool): + flag_reason (None | str | Unset): + """ + + feedback_id: UUID + flagged: bool + flag_reason: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + feedback_id = str(self.feedback_id) + + flagged = self.flagged + + flag_reason: None | str | Unset + if isinstance(self.flag_reason, Unset): + flag_reason = UNSET + else: + flag_reason = self.flag_reason + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "feedback_id": feedback_id, + "flagged": flagged, + } + ) + if flag_reason is not UNSET: + field_dict["flag_reason"] = flag_reason + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + feedback_id = UUID(d.pop("feedback_id")) + + flagged = d.pop("flagged") + + def _parse_flag_reason(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + flag_reason = _parse_flag_reason(d.pop("flag_reason", UNSET)) + + ai_assistant_feedback_response = cls( + feedback_id=feedback_id, + flagged=flagged, + flag_reason=flag_reason, + ) + + ai_assistant_feedback_response.additional_properties = d + return ai_assistant_feedback_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/ai_assistant_generate_request.py b/seclai/_generated/models/ai_assistant_generate_request.py new file mode 100644 index 0000000..f692149 --- /dev/null +++ b/seclai/_generated/models/ai_assistant_generate_request.py @@ -0,0 +1,62 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AiAssistantGenerateRequest") + + +@_attrs_define +class AiAssistantGenerateRequest: + """Request body for AI assistant generate endpoints. + + Attributes: + user_input (str): User input describing what to do + """ + + user_input: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + user_input = self.user_input + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "user_input": user_input, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + user_input = d.pop("user_input") + + ai_assistant_generate_request = cls( + user_input=user_input, + ) + + ai_assistant_generate_request.additional_properties = d + return ai_assistant_generate_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/ai_assistant_generate_response.py b/seclai/_generated/models/ai_assistant_generate_response.py new file mode 100644 index 0000000..bd0c016 --- /dev/null +++ b/seclai/_generated/models/ai_assistant_generate_response.py @@ -0,0 +1,142 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.example_prompt import ExamplePrompt + from ..models.proposed_action_response import ProposedActionResponse + + +T = TypeVar("T", bound="AiAssistantGenerateResponse") + + +@_attrs_define +class AiAssistantGenerateResponse: + """Response from an AI assistant generate endpoint. + + Attributes: + conversation_id (UUID): Conversation ID for accept/decline. + note (str): AI-generated note about the plan. + proposed_actions (list[ProposedActionResponse]): List of proposed actions. + example_prompts (list[ExamplePrompt] | Unset): Example natural-language prompts that demonstrate the + capabilities of this AI assistant. + requires_delete_confirmation (bool | Unset): Whether destructive actions require explicit confirmation. Default: + False. + success (bool | Unset): Whether plan generation succeeded. Default: False. + """ + + conversation_id: UUID + note: str + proposed_actions: list[ProposedActionResponse] + example_prompts: list[ExamplePrompt] | Unset = UNSET + requires_delete_confirmation: bool | Unset = False + success: bool | Unset = False + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + conversation_id = str(self.conversation_id) + + note = self.note + + proposed_actions = [] + for proposed_actions_item_data in self.proposed_actions: + proposed_actions_item = proposed_actions_item_data.to_dict() + proposed_actions.append(proposed_actions_item) + + example_prompts: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.example_prompts, Unset): + example_prompts = [] + for example_prompts_item_data in self.example_prompts: + example_prompts_item = example_prompts_item_data.to_dict() + example_prompts.append(example_prompts_item) + + requires_delete_confirmation = self.requires_delete_confirmation + + success = self.success + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "conversation_id": conversation_id, + "note": note, + "proposed_actions": proposed_actions, + } + ) + if example_prompts is not UNSET: + field_dict["example_prompts"] = example_prompts + if requires_delete_confirmation is not UNSET: + field_dict["requires_delete_confirmation"] = requires_delete_confirmation + if success is not UNSET: + field_dict["success"] = success + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.example_prompt import ExamplePrompt + from ..models.proposed_action_response import ProposedActionResponse + + d = dict(src_dict) + conversation_id = UUID(d.pop("conversation_id")) + + note = d.pop("note") + + proposed_actions = [] + _proposed_actions = d.pop("proposed_actions") + for proposed_actions_item_data in _proposed_actions: + proposed_actions_item = ProposedActionResponse.from_dict( + proposed_actions_item_data + ) + + proposed_actions.append(proposed_actions_item) + + _example_prompts = d.pop("example_prompts", UNSET) + example_prompts: list[ExamplePrompt] | Unset = UNSET + if _example_prompts is not UNSET: + example_prompts = [] + for example_prompts_item_data in _example_prompts: + example_prompts_item = ExamplePrompt.from_dict( + example_prompts_item_data + ) + + example_prompts.append(example_prompts_item) + + requires_delete_confirmation = d.pop("requires_delete_confirmation", UNSET) + + success = d.pop("success", UNSET) + + ai_assistant_generate_response = cls( + conversation_id=conversation_id, + note=note, + proposed_actions=proposed_actions, + example_prompts=example_prompts, + requires_delete_confirmation=requires_delete_confirmation, + success=success, + ) + + ai_assistant_generate_response.additional_properties = d + return ai_assistant_generate_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/ai_conversation_history_response.py b/seclai/_generated/models/ai_conversation_history_response.py new file mode 100644 index 0000000..3c63b63 --- /dev/null +++ b/seclai/_generated/models/ai_conversation_history_response.py @@ -0,0 +1,83 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.ai_conversation_turn_response import AiConversationTurnResponse + + +T = TypeVar("T", bound="AiConversationHistoryResponse") + + +@_attrs_define +class AiConversationHistoryResponse: + """ + Attributes: + total (int): Total number of conversation turns available. + turns (list[AiConversationTurnResponse]): Conversation turns, ordered oldest first. + """ + + total: int + turns: list[AiConversationTurnResponse] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + total = self.total + + turns = [] + for turns_item_data in self.turns: + turns_item = turns_item_data.to_dict() + turns.append(turns_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "total": total, + "turns": turns, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.ai_conversation_turn_response import AiConversationTurnResponse + + d = dict(src_dict) + total = d.pop("total") + + turns = [] + _turns = d.pop("turns") + for turns_item_data in _turns: + turns_item = AiConversationTurnResponse.from_dict(turns_item_data) + + turns.append(turns_item) + + ai_conversation_history_response = cls( + total=total, + turns=turns, + ) + + ai_conversation_history_response.additional_properties = d + return ai_conversation_history_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/ai_conversation_turn_response.py b/seclai/_generated/models/ai_conversation_turn_response.py new file mode 100644 index 0000000..c944173 --- /dev/null +++ b/seclai/_generated/models/ai_conversation_turn_response.py @@ -0,0 +1,172 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.ai_conversation_turn_response_resulting_config_type_0 import ( + AiConversationTurnResponseResultingConfigType0, + ) + + +T = TypeVar("T", bound="AiConversationTurnResponse") + + +@_attrs_define +class AiConversationTurnResponse: + """ + Attributes: + accepted (bool | None): Whether the user accepted this proposal (null if pending). + ai_note (None | str): AI explanation from this turn. + conversation_id (str): Unique conversation turn ID. + resulting_config (AiConversationTurnResponseResultingConfigType0 | None): The proposed configuration from this + turn. + step_id (None | str): Step ID for this conversation. + step_type (None | str): Step type for this conversation. + user_input (str): User input for this turn. + """ + + accepted: bool | None + ai_note: None | str + conversation_id: str + resulting_config: AiConversationTurnResponseResultingConfigType0 | None + step_id: None | str + step_type: None | str + user_input: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.ai_conversation_turn_response_resulting_config_type_0 import ( + AiConversationTurnResponseResultingConfigType0, + ) + + accepted: bool | None + accepted = self.accepted + + ai_note: None | str + ai_note = self.ai_note + + conversation_id = self.conversation_id + + resulting_config: dict[str, Any] | None + if isinstance( + self.resulting_config, AiConversationTurnResponseResultingConfigType0 + ): + resulting_config = self.resulting_config.to_dict() + else: + resulting_config = self.resulting_config + + step_id: None | str + step_id = self.step_id + + step_type: None | str + step_type = self.step_type + + user_input = self.user_input + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "accepted": accepted, + "ai_note": ai_note, + "conversation_id": conversation_id, + "resulting_config": resulting_config, + "step_id": step_id, + "step_type": step_type, + "user_input": user_input, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.ai_conversation_turn_response_resulting_config_type_0 import ( + AiConversationTurnResponseResultingConfigType0, + ) + + d = dict(src_dict) + + def _parse_accepted(data: object) -> bool | None: + if data is None: + return data + return cast(bool | None, data) + + accepted = _parse_accepted(d.pop("accepted")) + + def _parse_ai_note(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + ai_note = _parse_ai_note(d.pop("ai_note")) + + conversation_id = d.pop("conversation_id") + + def _parse_resulting_config( + data: object, + ) -> AiConversationTurnResponseResultingConfigType0 | None: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + resulting_config_type_0 = ( + AiConversationTurnResponseResultingConfigType0.from_dict(data) + ) + + return resulting_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(AiConversationTurnResponseResultingConfigType0 | None, data) + + resulting_config = _parse_resulting_config(d.pop("resulting_config")) + + def _parse_step_id(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + step_id = _parse_step_id(d.pop("step_id")) + + def _parse_step_type(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + step_type = _parse_step_type(d.pop("step_type")) + + user_input = d.pop("user_input") + + ai_conversation_turn_response = cls( + accepted=accepted, + ai_note=ai_note, + conversation_id=conversation_id, + resulting_config=resulting_config, + step_id=step_id, + step_type=step_type, + user_input=user_input, + ) + + ai_conversation_turn_response.additional_properties = d + return ai_conversation_turn_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/ai_conversation_turn_response_resulting_config_type_0.py b/seclai/_generated/models/ai_conversation_turn_response_resulting_config_type_0.py new file mode 100644 index 0000000..99a4182 --- /dev/null +++ b/seclai/_generated/models/ai_conversation_turn_response_resulting_config_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AiConversationTurnResponseResultingConfigType0") + + +@_attrs_define +class AiConversationTurnResponseResultingConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + ai_conversation_turn_response_resulting_config_type_0 = cls() + + ai_conversation_turn_response_resulting_config_type_0.additional_properties = d + return ai_conversation_turn_response_resulting_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch_response_api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch.py b/seclai/_generated/models/api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch_response_api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch.py new file mode 100644 index 0000000..5e2032a --- /dev/null +++ b/seclai/_generated/models/api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch_response_api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch", +) + + +@_attrs_define +class ApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatchResponseApiAiMemoryBankAcceptApiAiAssistantMemoryBankConversationIdPatch: + """ """ + + additional_properties: dict[str, bool] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch_response_api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch = ( + cls() + ) + + api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch_response_api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch.additional_properties = ( + d + ) + return api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch_response_api_ai_memory_bank_accept_api_ai_assistant_memory_bank_conversation_id_patch + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> bool: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: bool) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/applied_action_response.py b/seclai/_generated/models/applied_action_response.py new file mode 100644 index 0000000..c2be996 --- /dev/null +++ b/seclai/_generated/models/applied_action_response.py @@ -0,0 +1,120 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AppliedActionResponse") + + +@_attrs_define +class AppliedActionResponse: + """Result of a single executed governance action. + + Attributes: + action_type (str): Type of action that was executed. + description (str): Human-readable description of the executed action. + success (bool): Whether this individual action succeeded. + error (None | str | Unset): Error message if this action failed, or null. + policy_id (None | str | Unset): ID of the policy that was created or modified, or null. + """ + + action_type: str + description: str + success: bool + error: None | str | Unset = UNSET + policy_id: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + action_type = self.action_type + + description = self.description + + success = self.success + + error: None | str | Unset + if isinstance(self.error, Unset): + error = UNSET + else: + error = self.error + + policy_id: None | str | Unset + if isinstance(self.policy_id, Unset): + policy_id = UNSET + else: + policy_id = self.policy_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "action_type": action_type, + "description": description, + "success": success, + } + ) + if error is not UNSET: + field_dict["error"] = error + if policy_id is not UNSET: + field_dict["policy_id"] = policy_id + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + action_type = d.pop("action_type") + + description = d.pop("description") + + success = d.pop("success") + + def _parse_error(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + error = _parse_error(d.pop("error", UNSET)) + + def _parse_policy_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + policy_id = _parse_policy_id(d.pop("policy_id", UNSET)) + + applied_action_response = cls( + action_type=action_type, + description=description, + success=success, + error=error, + policy_id=policy_id, + ) + + applied_action_response.additional_properties = d + return applied_action_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/change_alert_status_api_alerts_alert_id_status_post_response_change_alert_status_api_alerts_alert_id_status_post.py b/seclai/_generated/models/change_alert_status_api_alerts_alert_id_status_post_response_change_alert_status_api_alerts_alert_id_status_post.py new file mode 100644 index 0000000..8dc9206 --- /dev/null +++ b/seclai/_generated/models/change_alert_status_api_alerts_alert_id_status_post_response_change_alert_status_api_alerts_alert_id_status_post.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost", +) + + +@_attrs_define +class ChangeAlertStatusApiAlertsAlertIdStatusPostResponseChangeAlertStatusApiAlertsAlertIdStatusPost: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + change_alert_status_api_alerts_alert_id_status_post_response_change_alert_status_api_alerts_alert_id_status_post = ( + cls() + ) + + change_alert_status_api_alerts_alert_id_status_post_response_change_alert_status_api_alerts_alert_id_status_post.additional_properties = ( + d + ) + return change_alert_status_api_alerts_alert_id_status_post_response_change_alert_status_api_alerts_alert_id_status_post + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/change_status_request.py b/seclai/_generated/models/change_status_request.py new file mode 100644 index 0000000..cccac3e --- /dev/null +++ b/seclai/_generated/models/change_status_request.py @@ -0,0 +1,83 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ChangeStatusRequest") + + +@_attrs_define +class ChangeStatusRequest: + """ + Attributes: + status (str): New alert status + note (None | str | Unset): Optional note + """ + + status: str + note: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + status = self.status + + note: None | str | Unset + if isinstance(self.note, Unset): + note = UNSET + else: + note = self.note + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "status": status, + } + ) + if note is not UNSET: + field_dict["note"] = note + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + status = d.pop("status") + + def _parse_note(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + note = _parse_note(d.pop("note", UNSET)) + + change_status_request = cls( + status=status, + note=note, + ) + + change_status_request.additional_properties = d + return change_status_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/compact_memory_bank_api_memory_banks_memory_bank_id_compact_post_response_compact_memory_bank_api_memory_banks_memory_bank_id_compact_post.py b/seclai/_generated/models/compact_memory_bank_api_memory_banks_memory_bank_id_compact_post_response_compact_memory_bank_api_memory_banks_memory_bank_id_compact_post.py new file mode 100644 index 0000000..59bf038 --- /dev/null +++ b/seclai/_generated/models/compact_memory_bank_api_memory_banks_memory_bank_id_compact_post_response_compact_memory_bank_api_memory_banks_memory_bank_id_compact_post.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost", +) + + +@_attrs_define +class CompactMemoryBankApiMemoryBanksMemoryBankIdCompactPostResponseCompactMemoryBankApiMemoryBanksMemoryBankIdCompactPost: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + compact_memory_bank_api_memory_banks_memory_bank_id_compact_post_response_compact_memory_bank_api_memory_banks_memory_bank_id_compact_post = ( + cls() + ) + + compact_memory_bank_api_memory_banks_memory_bank_id_compact_post_response_compact_memory_bank_api_memory_banks_memory_bank_id_compact_post.additional_properties = ( + d + ) + return compact_memory_bank_api_memory_banks_memory_bank_id_compact_post_response_compact_memory_bank_api_memory_banks_memory_bank_id_compact_post + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/compaction_evaluation_model.py b/seclai/_generated/models/compaction_evaluation_model.py new file mode 100644 index 0000000..b40409f --- /dev/null +++ b/seclai/_generated/models/compaction_evaluation_model.py @@ -0,0 +1,78 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CompactionEvaluationModel") + + +@_attrs_define +class CompactionEvaluationModel: + """Structured LLM-as-judge evaluation result. + + Attributes: + reasoning (str): Explanation of the evaluation. + score (int): Quality score from 1 to 5. + verdict (str): 'pass' or 'fail'. + """ + + reasoning: str + score: int + verdict: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + reasoning = self.reasoning + + score = self.score + + verdict = self.verdict + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "reasoning": reasoning, + "score": score, + "verdict": verdict, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + reasoning = d.pop("reasoning") + + score = d.pop("score") + + verdict = d.pop("verdict") + + compaction_evaluation_model = cls( + reasoning=reasoning, + score=score, + verdict=verdict, + ) + + compaction_evaluation_model.additional_properties = d + return compaction_evaluation_model + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/compaction_test_response_model.py b/seclai/_generated/models/compaction_test_response_model.py new file mode 100644 index 0000000..4f56a0e --- /dev/null +++ b/seclai/_generated/models/compaction_test_response_model.py @@ -0,0 +1,107 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.compaction_evaluation_model import CompactionEvaluationModel + + +T = TypeVar("T", bound="CompactionTestResponseModel") + + +@_attrs_define +class CompactionTestResponseModel: + """Response from a compaction prompt test. + + Attributes: + compaction_summary (None | str): The generated compaction summary. + evaluation (CompactionEvaluationModel): Structured LLM-as-judge evaluation result. + generated (bool): True when entries were LLM-generated rather than real. + original_entries (list[str]): Entries fed into the compactor. + surviving_entries (list[str]): Entries that survived after compaction. + """ + + compaction_summary: None | str + evaluation: CompactionEvaluationModel + generated: bool + original_entries: list[str] + surviving_entries: list[str] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + compaction_summary: None | str + compaction_summary = self.compaction_summary + + evaluation = self.evaluation.to_dict() + + generated = self.generated + + original_entries = self.original_entries + + surviving_entries = self.surviving_entries + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "compaction_summary": compaction_summary, + "evaluation": evaluation, + "generated": generated, + "original_entries": original_entries, + "surviving_entries": surviving_entries, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.compaction_evaluation_model import CompactionEvaluationModel + + d = dict(src_dict) + + def _parse_compaction_summary(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + compaction_summary = _parse_compaction_summary(d.pop("compaction_summary")) + + evaluation = CompactionEvaluationModel.from_dict(d.pop("evaluation")) + + generated = d.pop("generated") + + original_entries = cast(list[str], d.pop("original_entries")) + + surviving_entries = cast(list[str], d.pop("surviving_entries")) + + compaction_test_response_model = cls( + compaction_summary=compaction_summary, + evaluation=evaluation, + generated=generated, + original_entries=original_entries, + surviving_entries=surviving_entries, + ) + + compaction_test_response_model.additional_properties = d + return compaction_test_response_model + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/compatible_run_list_response.py b/seclai/_generated/models/compatible_run_list_response.py new file mode 100644 index 0000000..9901b90 --- /dev/null +++ b/seclai/_generated/models/compatible_run_list_response.py @@ -0,0 +1,100 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.compatible_run_response import CompatibleRunResponse + + +T = TypeVar("T", bound="CompatibleRunListResponse") + + +@_attrs_define +class CompatibleRunListResponse: + """Paginated list of compatible runs. + + Attributes: + data (list[CompatibleRunResponse]): + limit (int): + page (int): + total (int): + """ + + data: list[CompatibleRunResponse] + limit: int + page: int + total: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data = [] + for data_item_data in self.data: + data_item = data_item_data.to_dict() + data.append(data_item) + + limit = self.limit + + page = self.page + + total = self.total + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "data": data, + "limit": limit, + "page": page, + "total": total, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.compatible_run_response import CompatibleRunResponse + + d = dict(src_dict) + data = [] + _data = d.pop("data") + for data_item_data in _data: + data_item = CompatibleRunResponse.from_dict(data_item_data) + + data.append(data_item) + + limit = d.pop("limit") + + page = d.pop("page") + + total = d.pop("total") + + compatible_run_list_response = cls( + data=data, + limit=limit, + page=page, + total=total, + ) + + compatible_run_list_response.additional_properties = d + return compatible_run_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/compatible_run_response.py b/seclai/_generated/models/compatible_run_response.py new file mode 100644 index 0000000..5274568 --- /dev/null +++ b/seclai/_generated/models/compatible_run_response.py @@ -0,0 +1,161 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CompatibleRunResponse") + + +@_attrs_define +class CompatibleRunResponse: + """A run that has a completed step matching a criteria's step_id. + + Attributes: + agent_run_id (UUID): + agent_step_run_id (UUID): + completed_at (None | str): + output_storage_key (None | str): + input_preview (None | str | Unset): + run_status (None | str | Unset): + started_at (None | str | Unset): + """ + + agent_run_id: UUID + agent_step_run_id: UUID + completed_at: None | str + output_storage_key: None | str + input_preview: None | str | Unset = UNSET + run_status: None | str | Unset = UNSET + started_at: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + agent_run_id = str(self.agent_run_id) + + agent_step_run_id = str(self.agent_step_run_id) + + completed_at: None | str + completed_at = self.completed_at + + output_storage_key: None | str + output_storage_key = self.output_storage_key + + input_preview: None | str | Unset + if isinstance(self.input_preview, Unset): + input_preview = UNSET + else: + input_preview = self.input_preview + + run_status: None | str | Unset + if isinstance(self.run_status, Unset): + run_status = UNSET + else: + run_status = self.run_status + + started_at: None | str | Unset + if isinstance(self.started_at, Unset): + started_at = UNSET + else: + started_at = self.started_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "agent_run_id": agent_run_id, + "agent_step_run_id": agent_step_run_id, + "completed_at": completed_at, + "output_storage_key": output_storage_key, + } + ) + if input_preview is not UNSET: + field_dict["input_preview"] = input_preview + if run_status is not UNSET: + field_dict["run_status"] = run_status + if started_at is not UNSET: + field_dict["started_at"] = started_at + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_run_id = UUID(d.pop("agent_run_id")) + + agent_step_run_id = UUID(d.pop("agent_step_run_id")) + + def _parse_completed_at(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + completed_at = _parse_completed_at(d.pop("completed_at")) + + def _parse_output_storage_key(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + output_storage_key = _parse_output_storage_key(d.pop("output_storage_key")) + + def _parse_input_preview(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + input_preview = _parse_input_preview(d.pop("input_preview", UNSET)) + + def _parse_run_status(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + run_status = _parse_run_status(d.pop("run_status", UNSET)) + + def _parse_started_at(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + started_at = _parse_started_at(d.pop("started_at", UNSET)) + + compatible_run_response = cls( + agent_run_id=agent_run_id, + agent_step_run_id=agent_step_run_id, + completed_at=completed_at, + output_storage_key=output_storage_key, + input_preview=input_preview, + run_status=run_status, + started_at=started_at, + ) + + compatible_run_response.additional_properties = d + return compatible_run_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_agent_request.py b/seclai/_generated/models/create_agent_request.py new file mode 100644 index 0000000..a3579fc --- /dev/null +++ b/seclai/_generated/models/create_agent_request.py @@ -0,0 +1,114 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CreateAgentRequest") + + +@_attrs_define +class CreateAgentRequest: + """ + Attributes: + name (str): Name for the new agent. + agent_template (None | str | Unset): Template to initialize the agent from. Values: blank, retrieval_example, + simple_qa, summarizer, json_extractor, content_change_notifier, scheduled_report, webhook_pipeline. + description (None | str | Unset): Optional description. + trigger_type (str | Unset): Trigger type: dynamic_input, template_input, schedule, new_content. Default: + 'dynamic_input'. + """ + + name: str + agent_template: None | str | Unset = UNSET + description: None | str | Unset = UNSET + trigger_type: str | Unset = "dynamic_input" + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + agent_template: None | str | Unset + if isinstance(self.agent_template, Unset): + agent_template = UNSET + else: + agent_template = self.agent_template + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + trigger_type = self.trigger_type + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + } + ) + if agent_template is not UNSET: + field_dict["agent_template"] = agent_template + if description is not UNSET: + field_dict["description"] = description + if trigger_type is not UNSET: + field_dict["trigger_type"] = trigger_type + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + def _parse_agent_template(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + agent_template = _parse_agent_template(d.pop("agent_template", UNSET)) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + trigger_type = d.pop("trigger_type", UNSET) + + create_agent_request = cls( + name=name, + agent_template=agent_template, + description=description, + trigger_type=trigger_type, + ) + + create_agent_request.additional_properties = d + return create_agent_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_alert_config_api_alerts_configs_post_response_create_alert_config_api_alerts_configs_post.py b/seclai/_generated/models/create_alert_config_api_alerts_configs_post_response_create_alert_config_api_alerts_configs_post.py new file mode 100644 index 0000000..99df818 --- /dev/null +++ b/seclai/_generated/models/create_alert_config_api_alerts_configs_post_response_create_alert_config_api_alerts_configs_post.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost", +) + + +@_attrs_define +class CreateAlertConfigApiAlertsConfigsPostResponseCreateAlertConfigApiAlertsConfigsPost: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + create_alert_config_api_alerts_configs_post_response_create_alert_config_api_alerts_configs_post = ( + cls() + ) + + create_alert_config_api_alerts_configs_post_response_create_alert_config_api_alerts_configs_post.additional_properties = ( + d + ) + return create_alert_config_api_alerts_configs_post_response_create_alert_config_api_alerts_configs_post + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_alert_config_request.py b/seclai/_generated/models/create_alert_config_request.py new file mode 100644 index 0000000..aacc073 --- /dev/null +++ b/seclai/_generated/models/create_alert_config_request.py @@ -0,0 +1,213 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.create_alert_config_request_threshold_type_0 import ( + CreateAlertConfigRequestThresholdType0, + ) + + +T = TypeVar("T", bound="CreateAlertConfigRequest") + + +@_attrs_define +class CreateAlertConfigRequest: + """ + Attributes: + alert_type (str): Alert type + agent_id (None | str | Unset): Agent ID (for agent alerts) + cooldown_minutes (int | Unset): Cooldown period in minutes Default: 60. + distribution_type (str | Unset): Distribution type (owner, owner_admins, selected_members) Default: 'owner'. + enabled (bool | Unset): Whether the alert config is enabled Default: True. + recipient_user_ids (list[str] | None | Unset): User IDs for selected_members distribution + source_connection_id (None | str | Unset): Source connection ID (for source alerts) + threshold (CreateAlertConfigRequestThresholdType0 | None | Unset): Threshold configuration + """ + + alert_type: str + agent_id: None | str | Unset = UNSET + cooldown_minutes: int | Unset = 60 + distribution_type: str | Unset = "owner" + enabled: bool | Unset = True + recipient_user_ids: list[str] | None | Unset = UNSET + source_connection_id: None | str | Unset = UNSET + threshold: CreateAlertConfigRequestThresholdType0 | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.create_alert_config_request_threshold_type_0 import ( + CreateAlertConfigRequestThresholdType0, + ) + + alert_type = self.alert_type + + agent_id: None | str | Unset + if isinstance(self.agent_id, Unset): + agent_id = UNSET + else: + agent_id = self.agent_id + + cooldown_minutes = self.cooldown_minutes + + distribution_type = self.distribution_type + + enabled = self.enabled + + recipient_user_ids: list[str] | None | Unset + if isinstance(self.recipient_user_ids, Unset): + recipient_user_ids = UNSET + elif isinstance(self.recipient_user_ids, list): + recipient_user_ids = self.recipient_user_ids + + else: + recipient_user_ids = self.recipient_user_ids + + source_connection_id: None | str | Unset + if isinstance(self.source_connection_id, Unset): + source_connection_id = UNSET + else: + source_connection_id = self.source_connection_id + + threshold: dict[str, Any] | None | Unset + if isinstance(self.threshold, Unset): + threshold = UNSET + elif isinstance(self.threshold, CreateAlertConfigRequestThresholdType0): + threshold = self.threshold.to_dict() + else: + threshold = self.threshold + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "alert_type": alert_type, + } + ) + if agent_id is not UNSET: + field_dict["agent_id"] = agent_id + if cooldown_minutes is not UNSET: + field_dict["cooldown_minutes"] = cooldown_minutes + if distribution_type is not UNSET: + field_dict["distribution_type"] = distribution_type + if enabled is not UNSET: + field_dict["enabled"] = enabled + if recipient_user_ids is not UNSET: + field_dict["recipient_user_ids"] = recipient_user_ids + if source_connection_id is not UNSET: + field_dict["source_connection_id"] = source_connection_id + if threshold is not UNSET: + field_dict["threshold"] = threshold + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.create_alert_config_request_threshold_type_0 import ( + CreateAlertConfigRequestThresholdType0, + ) + + d = dict(src_dict) + alert_type = d.pop("alert_type") + + def _parse_agent_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + agent_id = _parse_agent_id(d.pop("agent_id", UNSET)) + + cooldown_minutes = d.pop("cooldown_minutes", UNSET) + + distribution_type = d.pop("distribution_type", UNSET) + + enabled = d.pop("enabled", UNSET) + + def _parse_recipient_user_ids(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + recipient_user_ids_type_0 = cast(list[str], data) + + return recipient_user_ids_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + recipient_user_ids = _parse_recipient_user_ids( + d.pop("recipient_user_ids", UNSET) + ) + + def _parse_source_connection_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + source_connection_id = _parse_source_connection_id( + d.pop("source_connection_id", UNSET) + ) + + def _parse_threshold( + data: object, + ) -> CreateAlertConfigRequestThresholdType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + threshold_type_0 = CreateAlertConfigRequestThresholdType0.from_dict( + data + ) + + return threshold_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(CreateAlertConfigRequestThresholdType0 | None | Unset, data) + + threshold = _parse_threshold(d.pop("threshold", UNSET)) + + create_alert_config_request = cls( + alert_type=alert_type, + agent_id=agent_id, + cooldown_minutes=cooldown_minutes, + distribution_type=distribution_type, + enabled=enabled, + recipient_user_ids=recipient_user_ids, + source_connection_id=source_connection_id, + threshold=threshold, + ) + + create_alert_config_request.additional_properties = d + return create_alert_config_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_alert_config_request_threshold_type_0.py b/seclai/_generated/models/create_alert_config_request_threshold_type_0.py new file mode 100644 index 0000000..d0a52c2 --- /dev/null +++ b/seclai/_generated/models/create_alert_config_request_threshold_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateAlertConfigRequestThresholdType0") + + +@_attrs_define +class CreateAlertConfigRequestThresholdType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + create_alert_config_request_threshold_type_0 = cls() + + create_alert_config_request_threshold_type_0.additional_properties = d + return create_alert_config_request_threshold_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_evaluation_criteria_request.py b/seclai/_generated/models/create_evaluation_criteria_request.py new file mode 100644 index 0000000..110106f --- /dev/null +++ b/seclai/_generated/models/create_evaluation_criteria_request.py @@ -0,0 +1,216 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.agent_evaluation_tier import AgentEvaluationTier +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.create_evaluation_criteria_request_expectation_config_type_0 import ( + CreateEvaluationCriteriaRequestExpectationConfigType0, + ) + + +T = TypeVar("T", bound="CreateEvaluationCriteriaRequest") + + +@_attrs_define +class CreateEvaluationCriteriaRequest: + """Request body for creating an evaluation criteria. + + The evaluation mode, retry settings, and sample frequency are set at the + agent level, not per-criteria. + + Attributes: + step_id (str): + description (None | str | Unset): + enabled (bool | Unset): Default: True. + evaluation_prompt (None | str | Unset): + evaluation_tier (AgentEvaluationTier | None | Unset): + expectation_config (CreateEvaluationCriteriaRequestExpectationConfigType0 | None | Unset): + pass_threshold (float | Unset): Default: 0.5. + """ + + step_id: str + description: None | str | Unset = UNSET + enabled: bool | Unset = True + evaluation_prompt: None | str | Unset = UNSET + evaluation_tier: AgentEvaluationTier | None | Unset = UNSET + expectation_config: ( + CreateEvaluationCriteriaRequestExpectationConfigType0 | None | Unset + ) = UNSET + pass_threshold: float | Unset = 0.5 + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.create_evaluation_criteria_request_expectation_config_type_0 import ( + CreateEvaluationCriteriaRequestExpectationConfigType0, + ) + + step_id = self.step_id + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + enabled = self.enabled + + evaluation_prompt: None | str | Unset + if isinstance(self.evaluation_prompt, Unset): + evaluation_prompt = UNSET + else: + evaluation_prompt = self.evaluation_prompt + + evaluation_tier: None | str | Unset + if isinstance(self.evaluation_tier, Unset): + evaluation_tier = UNSET + elif isinstance(self.evaluation_tier, AgentEvaluationTier): + evaluation_tier = self.evaluation_tier.value + else: + evaluation_tier = self.evaluation_tier + + expectation_config: dict[str, Any] | None | Unset + if isinstance(self.expectation_config, Unset): + expectation_config = UNSET + elif isinstance( + self.expectation_config, + CreateEvaluationCriteriaRequestExpectationConfigType0, + ): + expectation_config = self.expectation_config.to_dict() + else: + expectation_config = self.expectation_config + + pass_threshold = self.pass_threshold + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "step_id": step_id, + } + ) + if description is not UNSET: + field_dict["description"] = description + if enabled is not UNSET: + field_dict["enabled"] = enabled + if evaluation_prompt is not UNSET: + field_dict["evaluation_prompt"] = evaluation_prompt + if evaluation_tier is not UNSET: + field_dict["evaluation_tier"] = evaluation_tier + if expectation_config is not UNSET: + field_dict["expectation_config"] = expectation_config + if pass_threshold is not UNSET: + field_dict["pass_threshold"] = pass_threshold + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.create_evaluation_criteria_request_expectation_config_type_0 import ( + CreateEvaluationCriteriaRequestExpectationConfigType0, + ) + + d = dict(src_dict) + step_id = d.pop("step_id") + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + enabled = d.pop("enabled", UNSET) + + def _parse_evaluation_prompt(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + evaluation_prompt = _parse_evaluation_prompt(d.pop("evaluation_prompt", UNSET)) + + def _parse_evaluation_tier(data: object) -> AgentEvaluationTier | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + evaluation_tier_type_0 = AgentEvaluationTier(data) + + return evaluation_tier_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(AgentEvaluationTier | None | Unset, data) + + evaluation_tier = _parse_evaluation_tier(d.pop("evaluation_tier", UNSET)) + + def _parse_expectation_config( + data: object, + ) -> CreateEvaluationCriteriaRequestExpectationConfigType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + expectation_config_type_0 = ( + CreateEvaluationCriteriaRequestExpectationConfigType0.from_dict( + data + ) + ) + + return expectation_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + CreateEvaluationCriteriaRequestExpectationConfigType0 | None | Unset, + data, + ) + + expectation_config = _parse_expectation_config( + d.pop("expectation_config", UNSET) + ) + + pass_threshold = d.pop("pass_threshold", UNSET) + + create_evaluation_criteria_request = cls( + step_id=step_id, + description=description, + enabled=enabled, + evaluation_prompt=evaluation_prompt, + evaluation_tier=evaluation_tier, + expectation_config=expectation_config, + pass_threshold=pass_threshold, + ) + + create_evaluation_criteria_request.additional_properties = d + return create_evaluation_criteria_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_evaluation_criteria_request_expectation_config_type_0.py b/seclai/_generated/models/create_evaluation_criteria_request_expectation_config_type_0.py new file mode 100644 index 0000000..342c5e3 --- /dev/null +++ b/seclai/_generated/models/create_evaluation_criteria_request_expectation_config_type_0.py @@ -0,0 +1,48 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateEvaluationCriteriaRequestExpectationConfigType0") + + +@_attrs_define +class CreateEvaluationCriteriaRequestExpectationConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + create_evaluation_criteria_request_expectation_config_type_0 = cls() + + create_evaluation_criteria_request_expectation_config_type_0.additional_properties = ( + d + ) + return create_evaluation_criteria_request_expectation_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_evaluation_result_request.py b/seclai/_generated/models/create_evaluation_result_request.py new file mode 100644 index 0000000..549c9ff --- /dev/null +++ b/seclai/_generated/models/create_evaluation_result_request.py @@ -0,0 +1,199 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.evaluation_status import EvaluationStatus +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.create_evaluation_result_request_details_type_0 import ( + CreateEvaluationResultRequestDetailsType0, + ) + + +T = TypeVar("T", bound="CreateEvaluationResultRequest") + + +@_attrs_define +class CreateEvaluationResultRequest: + """Request body for recording an evaluation result. + + Attributes: + agent_run_id (UUID): + status (EvaluationStatus): Result status of a single evaluation run. + agent_step_run_id (None | Unset | UUID): + details (CreateEvaluationResultRequestDetailsType0 | None | Unset): + flagged (bool | Unset): Default: False. + retry_count (int | Unset): Default: 0. + retry_triggered (bool | Unset): Default: False. + score (float | None | Unset): + """ + + agent_run_id: UUID + status: EvaluationStatus + agent_step_run_id: None | Unset | UUID = UNSET + details: CreateEvaluationResultRequestDetailsType0 | None | Unset = UNSET + flagged: bool | Unset = False + retry_count: int | Unset = 0 + retry_triggered: bool | Unset = False + score: float | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.create_evaluation_result_request_details_type_0 import ( + CreateEvaluationResultRequestDetailsType0, + ) + + agent_run_id = str(self.agent_run_id) + + status = self.status.value + + agent_step_run_id: None | str | Unset + if isinstance(self.agent_step_run_id, Unset): + agent_step_run_id = UNSET + elif isinstance(self.agent_step_run_id, UUID): + agent_step_run_id = str(self.agent_step_run_id) + else: + agent_step_run_id = self.agent_step_run_id + + details: dict[str, Any] | None | Unset + if isinstance(self.details, Unset): + details = UNSET + elif isinstance(self.details, CreateEvaluationResultRequestDetailsType0): + details = self.details.to_dict() + else: + details = self.details + + flagged = self.flagged + + retry_count = self.retry_count + + retry_triggered = self.retry_triggered + + score: float | None | Unset + if isinstance(self.score, Unset): + score = UNSET + else: + score = self.score + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "agent_run_id": agent_run_id, + "status": status, + } + ) + if agent_step_run_id is not UNSET: + field_dict["agent_step_run_id"] = agent_step_run_id + if details is not UNSET: + field_dict["details"] = details + if flagged is not UNSET: + field_dict["flagged"] = flagged + if retry_count is not UNSET: + field_dict["retry_count"] = retry_count + if retry_triggered is not UNSET: + field_dict["retry_triggered"] = retry_triggered + if score is not UNSET: + field_dict["score"] = score + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.create_evaluation_result_request_details_type_0 import ( + CreateEvaluationResultRequestDetailsType0, + ) + + d = dict(src_dict) + agent_run_id = UUID(d.pop("agent_run_id")) + + status = EvaluationStatus(d.pop("status")) + + def _parse_agent_step_run_id(data: object) -> None | Unset | UUID: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + agent_step_run_id_type_0 = UUID(data) + + return agent_step_run_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) + + agent_step_run_id = _parse_agent_step_run_id(d.pop("agent_step_run_id", UNSET)) + + def _parse_details( + data: object, + ) -> CreateEvaluationResultRequestDetailsType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + details_type_0 = CreateEvaluationResultRequestDetailsType0.from_dict( + data + ) + + return details_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(CreateEvaluationResultRequestDetailsType0 | None | Unset, data) + + details = _parse_details(d.pop("details", UNSET)) + + flagged = d.pop("flagged", UNSET) + + retry_count = d.pop("retry_count", UNSET) + + retry_triggered = d.pop("retry_triggered", UNSET) + + def _parse_score(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + score = _parse_score(d.pop("score", UNSET)) + + create_evaluation_result_request = cls( + agent_run_id=agent_run_id, + status=status, + agent_step_run_id=agent_step_run_id, + details=details, + flagged=flagged, + retry_count=retry_count, + retry_triggered=retry_triggered, + score=score, + ) + + create_evaluation_result_request.additional_properties = d + return create_evaluation_result_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_evaluation_result_request_details_type_0.py b/seclai/_generated/models/create_evaluation_result_request_details_type_0.py new file mode 100644 index 0000000..ba4470b --- /dev/null +++ b/seclai/_generated/models/create_evaluation_result_request_details_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateEvaluationResultRequestDetailsType0") + + +@_attrs_define +class CreateEvaluationResultRequestDetailsType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + create_evaluation_result_request_details_type_0 = cls() + + create_evaluation_result_request_details_type_0.additional_properties = d + return create_evaluation_result_request_details_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_export_request.py b/seclai/_generated/models/create_export_request.py new file mode 100644 index 0000000..ac8b3b5 --- /dev/null +++ b/seclai/_generated/models/create_export_request.py @@ -0,0 +1,196 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..models.export_format import ExportFormat +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.create_export_request_metadata_filter_type_0 import ( + CreateExportRequestMetadataFilterType0, + ) + + +T = TypeVar("T", bound="CreateExportRequest") + + +@_attrs_define +class CreateExportRequest: + """Parameters for creating a new export job. + + Attributes: + format_ (ExportFormat): Supported export file formats. + date_from (datetime.datetime | None | Unset): Only include content created on or after this timestamp. + date_to (datetime.datetime | None | Unset): Only include content created on or before this timestamp. + metadata_filter (CreateExportRequestMetadataFilterType0 | None | Unset): JSONB containment filter applied to + content metadata. + query_filter (None | str | Unset): Title substring filter (case-insensitive ILIKE). + """ + + format_: ExportFormat + date_from: datetime.datetime | None | Unset = UNSET + date_to: datetime.datetime | None | Unset = UNSET + metadata_filter: CreateExportRequestMetadataFilterType0 | None | Unset = UNSET + query_filter: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.create_export_request_metadata_filter_type_0 import ( + CreateExportRequestMetadataFilterType0, + ) + + format_ = self.format_.value + + date_from: None | str | Unset + if isinstance(self.date_from, Unset): + date_from = UNSET + elif isinstance(self.date_from, datetime.datetime): + date_from = self.date_from.isoformat() + else: + date_from = self.date_from + + date_to: None | str | Unset + if isinstance(self.date_to, Unset): + date_to = UNSET + elif isinstance(self.date_to, datetime.datetime): + date_to = self.date_to.isoformat() + else: + date_to = self.date_to + + metadata_filter: dict[str, Any] | None | Unset + if isinstance(self.metadata_filter, Unset): + metadata_filter = UNSET + elif isinstance(self.metadata_filter, CreateExportRequestMetadataFilterType0): + metadata_filter = self.metadata_filter.to_dict() + else: + metadata_filter = self.metadata_filter + + query_filter: None | str | Unset + if isinstance(self.query_filter, Unset): + query_filter = UNSET + else: + query_filter = self.query_filter + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "format": format_, + } + ) + if date_from is not UNSET: + field_dict["date_from"] = date_from + if date_to is not UNSET: + field_dict["date_to"] = date_to + if metadata_filter is not UNSET: + field_dict["metadata_filter"] = metadata_filter + if query_filter is not UNSET: + field_dict["query_filter"] = query_filter + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.create_export_request_metadata_filter_type_0 import ( + CreateExportRequestMetadataFilterType0, + ) + + d = dict(src_dict) + format_ = ExportFormat(d.pop("format")) + + def _parse_date_from(data: object) -> datetime.datetime | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + date_from_type_0 = isoparse(data) + + return date_from_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.datetime | None | Unset, data) + + date_from = _parse_date_from(d.pop("date_from", UNSET)) + + def _parse_date_to(data: object) -> datetime.datetime | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + date_to_type_0 = isoparse(data) + + return date_to_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.datetime | None | Unset, data) + + date_to = _parse_date_to(d.pop("date_to", UNSET)) + + def _parse_metadata_filter( + data: object, + ) -> CreateExportRequestMetadataFilterType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + metadata_filter_type_0 = ( + CreateExportRequestMetadataFilterType0.from_dict(data) + ) + + return metadata_filter_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(CreateExportRequestMetadataFilterType0 | None | Unset, data) + + metadata_filter = _parse_metadata_filter(d.pop("metadata_filter", UNSET)) + + def _parse_query_filter(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + query_filter = _parse_query_filter(d.pop("query_filter", UNSET)) + + create_export_request = cls( + format_=format_, + date_from=date_from, + date_to=date_to, + metadata_filter=metadata_filter, + query_filter=query_filter, + ) + + create_export_request.additional_properties = d + return create_export_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_export_request_metadata_filter_type_0.py b/seclai/_generated/models/create_export_request_metadata_filter_type_0.py new file mode 100644 index 0000000..9273162 --- /dev/null +++ b/seclai/_generated/models/create_export_request_metadata_filter_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CreateExportRequestMetadataFilterType0") + + +@_attrs_define +class CreateExportRequestMetadataFilterType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + create_export_request_metadata_filter_type_0 = cls() + + create_export_request_metadata_filter_type_0.additional_properties = d + return create_export_request_metadata_filter_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_knowledge_base_body.py b/seclai/_generated/models/create_knowledge_base_body.py new file mode 100644 index 0000000..ab3e793 --- /dev/null +++ b/seclai/_generated/models/create_knowledge_base_body.py @@ -0,0 +1,174 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CreateKnowledgeBaseBody") + + +@_attrs_define +class CreateKnowledgeBaseBody: + """Request body for creating a knowledge base. + + Attributes: + name (str): Knowledge base name. + source_ids (list[str]): List of source connection IDs to link. + default_score_threshold (float | None | Unset): Default minimum rerank score threshold. + default_top_k (int | None | Unset): Default results after reranking. + default_top_n (int | None | Unset): Default number of results. + description (None | str | Unset): Optional description. + reranker_model (None | str | Unset): Reranker model to use (null for no reranking). + """ + + name: str + source_ids: list[str] + default_score_threshold: float | None | Unset = UNSET + default_top_k: int | None | Unset = UNSET + default_top_n: int | None | Unset = UNSET + description: None | str | Unset = UNSET + reranker_model: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + source_ids = self.source_ids + + default_score_threshold: float | None | Unset + if isinstance(self.default_score_threshold, Unset): + default_score_threshold = UNSET + else: + default_score_threshold = self.default_score_threshold + + default_top_k: int | None | Unset + if isinstance(self.default_top_k, Unset): + default_top_k = UNSET + else: + default_top_k = self.default_top_k + + default_top_n: int | None | Unset + if isinstance(self.default_top_n, Unset): + default_top_n = UNSET + else: + default_top_n = self.default_top_n + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + reranker_model: None | str | Unset + if isinstance(self.reranker_model, Unset): + reranker_model = UNSET + else: + reranker_model = self.reranker_model + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "source_ids": source_ids, + } + ) + if default_score_threshold is not UNSET: + field_dict["default_score_threshold"] = default_score_threshold + if default_top_k is not UNSET: + field_dict["default_top_k"] = default_top_k + if default_top_n is not UNSET: + field_dict["default_top_n"] = default_top_n + if description is not UNSET: + field_dict["description"] = description + if reranker_model is not UNSET: + field_dict["reranker_model"] = reranker_model + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + source_ids = cast(list[str], d.pop("source_ids")) + + def _parse_default_score_threshold(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + default_score_threshold = _parse_default_score_threshold( + d.pop("default_score_threshold", UNSET) + ) + + def _parse_default_top_k(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + default_top_k = _parse_default_top_k(d.pop("default_top_k", UNSET)) + + def _parse_default_top_n(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + default_top_n = _parse_default_top_n(d.pop("default_top_n", UNSET)) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_reranker_model(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + reranker_model = _parse_reranker_model(d.pop("reranker_model", UNSET)) + + create_knowledge_base_body = cls( + name=name, + source_ids=source_ids, + default_score_threshold=default_score_threshold, + default_top_k=default_top_k, + default_top_n=default_top_n, + description=description, + reranker_model=reranker_model, + ) + + create_knowledge_base_body.additional_properties = d + return create_knowledge_base_body + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_memory_bank_body.py b/seclai/_generated/models/create_memory_bank_body.py new file mode 100644 index 0000000..9526b45 --- /dev/null +++ b/seclai/_generated/models/create_memory_bank_body.py @@ -0,0 +1,288 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CreateMemoryBankBody") + + +@_attrs_define +class CreateMemoryBankBody: + """Request body for creating a memory bank. + + Attributes: + name (str): Memory bank name. + chunk_overlap (int | None | Unset): Chunk overlap (custom mode only). + chunk_size (int | None | Unset): Chunk size (custom mode only). + compaction_prompt (None | str | Unset): Custom prompt used when compacting older entries. When set, entries that + exceed a threshold are summarized into a new entry before being soft-deleted. + description (None | str | Unset): Optional description of the bank's purpose. + dimensions (int | None | Unset): Embedding dimensions (custom mode only). + embedding_model (None | str | Unset): Custom embedding model (custom mode only). + max_age_days (int | None | Unset): Max entry age in days before compaction. Checked inline after each write and + by the hourly background sweep. + max_size_tokens (int | None | Unset): Max total tokens (per partition) before compaction. Checked inline after + each write and by the hourly background sweep. + max_turns (int | None | Unset): Max conversation turns (per partition) before compaction. Checked inline after + each write and by the hourly background sweep. + mode (str | Unset): Embedding quality / cost trade-off. One of: fast_and_cheap, balanced, slow_and_thorough, + custom. Default: 'fast_and_cheap'. + retention_days (int | None | Unset): Content source retention in days. Default: 30. + type_ (str | Unset): Bank type. 'conversation' for chat-turn data with conversation_key + speaker; 'general' for + flat entries with optional group_key. Default: 'conversation'. + """ + + name: str + chunk_overlap: int | None | Unset = UNSET + chunk_size: int | None | Unset = UNSET + compaction_prompt: None | str | Unset = UNSET + description: None | str | Unset = UNSET + dimensions: int | None | Unset = UNSET + embedding_model: None | str | Unset = UNSET + max_age_days: int | None | Unset = UNSET + max_size_tokens: int | None | Unset = UNSET + max_turns: int | None | Unset = UNSET + mode: str | Unset = "fast_and_cheap" + retention_days: int | None | Unset = 30 + type_: str | Unset = "conversation" + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + chunk_overlap: int | None | Unset + if isinstance(self.chunk_overlap, Unset): + chunk_overlap = UNSET + else: + chunk_overlap = self.chunk_overlap + + chunk_size: int | None | Unset + if isinstance(self.chunk_size, Unset): + chunk_size = UNSET + else: + chunk_size = self.chunk_size + + compaction_prompt: None | str | Unset + if isinstance(self.compaction_prompt, Unset): + compaction_prompt = UNSET + else: + compaction_prompt = self.compaction_prompt + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + dimensions: int | None | Unset + if isinstance(self.dimensions, Unset): + dimensions = UNSET + else: + dimensions = self.dimensions + + embedding_model: None | str | Unset + if isinstance(self.embedding_model, Unset): + embedding_model = UNSET + else: + embedding_model = self.embedding_model + + max_age_days: int | None | Unset + if isinstance(self.max_age_days, Unset): + max_age_days = UNSET + else: + max_age_days = self.max_age_days + + max_size_tokens: int | None | Unset + if isinstance(self.max_size_tokens, Unset): + max_size_tokens = UNSET + else: + max_size_tokens = self.max_size_tokens + + max_turns: int | None | Unset + if isinstance(self.max_turns, Unset): + max_turns = UNSET + else: + max_turns = self.max_turns + + mode = self.mode + + retention_days: int | None | Unset + if isinstance(self.retention_days, Unset): + retention_days = UNSET + else: + retention_days = self.retention_days + + type_ = self.type_ + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + } + ) + if chunk_overlap is not UNSET: + field_dict["chunk_overlap"] = chunk_overlap + if chunk_size is not UNSET: + field_dict["chunk_size"] = chunk_size + if compaction_prompt is not UNSET: + field_dict["compaction_prompt"] = compaction_prompt + if description is not UNSET: + field_dict["description"] = description + if dimensions is not UNSET: + field_dict["dimensions"] = dimensions + if embedding_model is not UNSET: + field_dict["embedding_model"] = embedding_model + if max_age_days is not UNSET: + field_dict["max_age_days"] = max_age_days + if max_size_tokens is not UNSET: + field_dict["max_size_tokens"] = max_size_tokens + if max_turns is not UNSET: + field_dict["max_turns"] = max_turns + if mode is not UNSET: + field_dict["mode"] = mode + if retention_days is not UNSET: + field_dict["retention_days"] = retention_days + if type_ is not UNSET: + field_dict["type"] = type_ + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + def _parse_chunk_overlap(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + chunk_overlap = _parse_chunk_overlap(d.pop("chunk_overlap", UNSET)) + + def _parse_chunk_size(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + chunk_size = _parse_chunk_size(d.pop("chunk_size", UNSET)) + + def _parse_compaction_prompt(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + compaction_prompt = _parse_compaction_prompt(d.pop("compaction_prompt", UNSET)) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_dimensions(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + dimensions = _parse_dimensions(d.pop("dimensions", UNSET)) + + def _parse_embedding_model(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + embedding_model = _parse_embedding_model(d.pop("embedding_model", UNSET)) + + def _parse_max_age_days(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_age_days = _parse_max_age_days(d.pop("max_age_days", UNSET)) + + def _parse_max_size_tokens(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_size_tokens = _parse_max_size_tokens(d.pop("max_size_tokens", UNSET)) + + def _parse_max_turns(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_turns = _parse_max_turns(d.pop("max_turns", UNSET)) + + mode = d.pop("mode", UNSET) + + def _parse_retention_days(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + retention_days = _parse_retention_days(d.pop("retention_days", UNSET)) + + type_ = d.pop("type", UNSET) + + create_memory_bank_body = cls( + name=name, + chunk_overlap=chunk_overlap, + chunk_size=chunk_size, + compaction_prompt=compaction_prompt, + description=description, + dimensions=dimensions, + embedding_model=embedding_model, + max_age_days=max_age_days, + max_size_tokens=max_size_tokens, + max_turns=max_turns, + mode=mode, + retention_days=retention_days, + type_=type_, + ) + + create_memory_bank_body.additional_properties = d + return create_memory_bank_body + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_solution_request.py b/seclai/_generated/models/create_solution_request.py new file mode 100644 index 0000000..5a6691a --- /dev/null +++ b/seclai/_generated/models/create_solution_request.py @@ -0,0 +1,73 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CreateSolutionRequest") + + +@_attrs_define +class CreateSolutionRequest: + """Request model for creating a new solution + + Attributes: + name (str): Name of the solution + description (str | Unset): Description of the solution Default: ''. + """ + + name: str + description: str | Unset = "" + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + description = self.description + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + } + ) + if description is not UNSET: + field_dict["description"] = description + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + description = d.pop("description", UNSET) + + create_solution_request = cls( + name=name, + description=description, + ) + + create_solution_request.additional_properties = d + return create_solution_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/create_source_body.py b/seclai/_generated/models/create_source_body.py new file mode 100644 index 0000000..21a9479 --- /dev/null +++ b/seclai/_generated/models/create_source_body.py @@ -0,0 +1,272 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CreateSourceBody") + + +@_attrs_define +class CreateSourceBody: + """Request body for creating a content source. + + Attributes: + name (str): Source name. + source_type (str): Source type: rss, website, file_uploads, or custom_index. + chunk_overlap (int | None | Unset): Chunk overlap for content processing. + chunk_size (int | None | Unset): Chunk size for content processing. + content_filter (None | str | Unset): Content filter type. + dimensions (int | None | Unset): Embedding dimensions override. + embedding_model (None | str | Unset): Embedding model override. + polling (None | str | Unset): Polling interval (e.g. hourly, daily). + polling_action (None | str | Unset): Polling action. + polling_max_items (int | None | Unset): Max items per poll. + retention (int | None | Unset): Retention period in days. + url_id (None | str | Unset): URL record ID (required for rss/website sources). + """ + + name: str + source_type: str + chunk_overlap: int | None | Unset = UNSET + chunk_size: int | None | Unset = UNSET + content_filter: None | str | Unset = UNSET + dimensions: int | None | Unset = UNSET + embedding_model: None | str | Unset = UNSET + polling: None | str | Unset = UNSET + polling_action: None | str | Unset = UNSET + polling_max_items: int | None | Unset = UNSET + retention: int | None | Unset = UNSET + url_id: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + source_type = self.source_type + + chunk_overlap: int | None | Unset + if isinstance(self.chunk_overlap, Unset): + chunk_overlap = UNSET + else: + chunk_overlap = self.chunk_overlap + + chunk_size: int | None | Unset + if isinstance(self.chunk_size, Unset): + chunk_size = UNSET + else: + chunk_size = self.chunk_size + + content_filter: None | str | Unset + if isinstance(self.content_filter, Unset): + content_filter = UNSET + else: + content_filter = self.content_filter + + dimensions: int | None | Unset + if isinstance(self.dimensions, Unset): + dimensions = UNSET + else: + dimensions = self.dimensions + + embedding_model: None | str | Unset + if isinstance(self.embedding_model, Unset): + embedding_model = UNSET + else: + embedding_model = self.embedding_model + + polling: None | str | Unset + if isinstance(self.polling, Unset): + polling = UNSET + else: + polling = self.polling + + polling_action: None | str | Unset + if isinstance(self.polling_action, Unset): + polling_action = UNSET + else: + polling_action = self.polling_action + + polling_max_items: int | None | Unset + if isinstance(self.polling_max_items, Unset): + polling_max_items = UNSET + else: + polling_max_items = self.polling_max_items + + retention: int | None | Unset + if isinstance(self.retention, Unset): + retention = UNSET + else: + retention = self.retention + + url_id: None | str | Unset + if isinstance(self.url_id, Unset): + url_id = UNSET + else: + url_id = self.url_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "source_type": source_type, + } + ) + if chunk_overlap is not UNSET: + field_dict["chunk_overlap"] = chunk_overlap + if chunk_size is not UNSET: + field_dict["chunk_size"] = chunk_size + if content_filter is not UNSET: + field_dict["content_filter"] = content_filter + if dimensions is not UNSET: + field_dict["dimensions"] = dimensions + if embedding_model is not UNSET: + field_dict["embedding_model"] = embedding_model + if polling is not UNSET: + field_dict["polling"] = polling + if polling_action is not UNSET: + field_dict["polling_action"] = polling_action + if polling_max_items is not UNSET: + field_dict["polling_max_items"] = polling_max_items + if retention is not UNSET: + field_dict["retention"] = retention + if url_id is not UNSET: + field_dict["url_id"] = url_id + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + source_type = d.pop("source_type") + + def _parse_chunk_overlap(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + chunk_overlap = _parse_chunk_overlap(d.pop("chunk_overlap", UNSET)) + + def _parse_chunk_size(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + chunk_size = _parse_chunk_size(d.pop("chunk_size", UNSET)) + + def _parse_content_filter(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + content_filter = _parse_content_filter(d.pop("content_filter", UNSET)) + + def _parse_dimensions(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + dimensions = _parse_dimensions(d.pop("dimensions", UNSET)) + + def _parse_embedding_model(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + embedding_model = _parse_embedding_model(d.pop("embedding_model", UNSET)) + + def _parse_polling(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + polling = _parse_polling(d.pop("polling", UNSET)) + + def _parse_polling_action(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + polling_action = _parse_polling_action(d.pop("polling_action", UNSET)) + + def _parse_polling_max_items(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + polling_max_items = _parse_polling_max_items(d.pop("polling_max_items", UNSET)) + + def _parse_retention(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + retention = _parse_retention(d.pop("retention", UNSET)) + + def _parse_url_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + url_id = _parse_url_id(d.pop("url_id", UNSET)) + + create_source_body = cls( + name=name, + source_type=source_type, + chunk_overlap=chunk_overlap, + chunk_size=chunk_size, + content_filter=content_filter, + dimensions=dimensions, + embedding_model=embedding_model, + polling=polling, + polling_action=polling_action, + polling_max_items=polling_max_items, + retention=retention, + url_id=url_id, + ) + + create_source_body.additional_properties = d + return create_source_body + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/estimate_export_request.py b/seclai/_generated/models/estimate_export_request.py new file mode 100644 index 0000000..0283300 --- /dev/null +++ b/seclai/_generated/models/estimate_export_request.py @@ -0,0 +1,196 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..models.export_format import ExportFormat +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.estimate_export_request_metadata_filter_type_0 import ( + EstimateExportRequestMetadataFilterType0, + ) + + +T = TypeVar("T", bound="EstimateExportRequest") + + +@_attrs_define +class EstimateExportRequest: + """Parameters for estimating export size. + + Attributes: + format_ (ExportFormat): Supported export file formats. + date_from (datetime.datetime | None | Unset): Only include content created on or after this timestamp. + date_to (datetime.datetime | None | Unset): Only include content created on or before this timestamp. + metadata_filter (EstimateExportRequestMetadataFilterType0 | None | Unset): JSONB containment filter applied to + content metadata. + query_filter (None | str | Unset): Title substring filter (case-insensitive ILIKE). + """ + + format_: ExportFormat + date_from: datetime.datetime | None | Unset = UNSET + date_to: datetime.datetime | None | Unset = UNSET + metadata_filter: EstimateExportRequestMetadataFilterType0 | None | Unset = UNSET + query_filter: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.estimate_export_request_metadata_filter_type_0 import ( + EstimateExportRequestMetadataFilterType0, + ) + + format_ = self.format_.value + + date_from: None | str | Unset + if isinstance(self.date_from, Unset): + date_from = UNSET + elif isinstance(self.date_from, datetime.datetime): + date_from = self.date_from.isoformat() + else: + date_from = self.date_from + + date_to: None | str | Unset + if isinstance(self.date_to, Unset): + date_to = UNSET + elif isinstance(self.date_to, datetime.datetime): + date_to = self.date_to.isoformat() + else: + date_to = self.date_to + + metadata_filter: dict[str, Any] | None | Unset + if isinstance(self.metadata_filter, Unset): + metadata_filter = UNSET + elif isinstance(self.metadata_filter, EstimateExportRequestMetadataFilterType0): + metadata_filter = self.metadata_filter.to_dict() + else: + metadata_filter = self.metadata_filter + + query_filter: None | str | Unset + if isinstance(self.query_filter, Unset): + query_filter = UNSET + else: + query_filter = self.query_filter + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "format": format_, + } + ) + if date_from is not UNSET: + field_dict["date_from"] = date_from + if date_to is not UNSET: + field_dict["date_to"] = date_to + if metadata_filter is not UNSET: + field_dict["metadata_filter"] = metadata_filter + if query_filter is not UNSET: + field_dict["query_filter"] = query_filter + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.estimate_export_request_metadata_filter_type_0 import ( + EstimateExportRequestMetadataFilterType0, + ) + + d = dict(src_dict) + format_ = ExportFormat(d.pop("format")) + + def _parse_date_from(data: object) -> datetime.datetime | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + date_from_type_0 = isoparse(data) + + return date_from_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.datetime | None | Unset, data) + + date_from = _parse_date_from(d.pop("date_from", UNSET)) + + def _parse_date_to(data: object) -> datetime.datetime | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + date_to_type_0 = isoparse(data) + + return date_to_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(datetime.datetime | None | Unset, data) + + date_to = _parse_date_to(d.pop("date_to", UNSET)) + + def _parse_metadata_filter( + data: object, + ) -> EstimateExportRequestMetadataFilterType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + metadata_filter_type_0 = ( + EstimateExportRequestMetadataFilterType0.from_dict(data) + ) + + return metadata_filter_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(EstimateExportRequestMetadataFilterType0 | None | Unset, data) + + metadata_filter = _parse_metadata_filter(d.pop("metadata_filter", UNSET)) + + def _parse_query_filter(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + query_filter = _parse_query_filter(d.pop("query_filter", UNSET)) + + estimate_export_request = cls( + format_=format_, + date_from=date_from, + date_to=date_to, + metadata_filter=metadata_filter, + query_filter=query_filter, + ) + + estimate_export_request.additional_properties = d + return estimate_export_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/estimate_export_request_metadata_filter_type_0.py b/seclai/_generated/models/estimate_export_request_metadata_filter_type_0.py new file mode 100644 index 0000000..726cf8e --- /dev/null +++ b/seclai/_generated/models/estimate_export_request_metadata_filter_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="EstimateExportRequestMetadataFilterType0") + + +@_attrs_define +class EstimateExportRequestMetadataFilterType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + estimate_export_request_metadata_filter_type_0 = cls() + + estimate_export_request_metadata_filter_type_0.additional_properties = d + return estimate_export_request_metadata_filter_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/estimate_export_response.py b/seclai/_generated/models/estimate_export_response.py new file mode 100644 index 0000000..35c199e --- /dev/null +++ b/seclai/_generated/models/estimate_export_response.py @@ -0,0 +1,70 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="EstimateExportResponse") + + +@_attrs_define +class EstimateExportResponse: + """Rough size estimate for a potential export. + + Attributes: + estimated_size_bytes (int): Estimated export file size in bytes. + source_connection_id (str): Source connection ID. + """ + + estimated_size_bytes: int + source_connection_id: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + estimated_size_bytes = self.estimated_size_bytes + + source_connection_id = self.source_connection_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "estimated_size_bytes": estimated_size_bytes, + "source_connection_id": source_connection_id, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + estimated_size_bytes = d.pop("estimated_size_bytes") + + source_connection_id = d.pop("source_connection_id") + + estimate_export_response = cls( + estimated_size_bytes=estimated_size_bytes, + source_connection_id=source_connection_id, + ) + + estimate_export_response.additional_properties = d + return estimate_export_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_criteria_response.py b/seclai/_generated/models/evaluation_criteria_response.py new file mode 100644 index 0000000..ca56eee --- /dev/null +++ b/seclai/_generated/models/evaluation_criteria_response.py @@ -0,0 +1,253 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.evaluation_criteria_response_expectation_config_type_0 import ( + EvaluationCriteriaResponseExpectationConfigType0, + ) + from ..models.evaluation_criteria_response_result_summary import ( + EvaluationCriteriaResponseResultSummary, + ) + + +T = TypeVar("T", bound="EvaluationCriteriaResponse") + + +@_attrs_define +class EvaluationCriteriaResponse: + """Response schema for evaluation criteria. + + Attributes: + account_id (UUID): + agent_id (UUID): + created_at (str): + description (None | str): + enabled (bool): + evaluation_mode (str): Runtime behavior mode. output_expectation (manual validation), eval_and_retry (every run + + retry), sample_and_flag (sampled monitoring). + evaluation_prompt (None | str): + evaluation_tier (None | str): + expectation_config (EvaluationCriteriaResponseExpectationConfigType0 | None): + id (UUID): + max_retries (int): + pass_threshold (float): Score cutoff for pass/fail, inclusive (0.0 to 1.0). + result_summary (EvaluationCriteriaResponseResultSummary): + retry_on_failure (bool): + step_id (None | str): + updated_at (str): + """ + + account_id: UUID + agent_id: UUID + created_at: str + description: None | str + enabled: bool + evaluation_mode: str + evaluation_prompt: None | str + evaluation_tier: None | str + expectation_config: EvaluationCriteriaResponseExpectationConfigType0 | None + id: UUID + max_retries: int + pass_threshold: float + result_summary: EvaluationCriteriaResponseResultSummary + retry_on_failure: bool + step_id: None | str + updated_at: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.evaluation_criteria_response_expectation_config_type_0 import ( + EvaluationCriteriaResponseExpectationConfigType0, + ) + + account_id = str(self.account_id) + + agent_id = str(self.agent_id) + + created_at = self.created_at + + description: None | str + description = self.description + + enabled = self.enabled + + evaluation_mode = self.evaluation_mode + + evaluation_prompt: None | str + evaluation_prompt = self.evaluation_prompt + + evaluation_tier: None | str + evaluation_tier = self.evaluation_tier + + expectation_config: dict[str, Any] | None + if isinstance( + self.expectation_config, EvaluationCriteriaResponseExpectationConfigType0 + ): + expectation_config = self.expectation_config.to_dict() + else: + expectation_config = self.expectation_config + + id = str(self.id) + + max_retries = self.max_retries + + pass_threshold = self.pass_threshold + + result_summary = self.result_summary.to_dict() + + retry_on_failure = self.retry_on_failure + + step_id: None | str + step_id = self.step_id + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "account_id": account_id, + "agent_id": agent_id, + "created_at": created_at, + "description": description, + "enabled": enabled, + "evaluation_mode": evaluation_mode, + "evaluation_prompt": evaluation_prompt, + "evaluation_tier": evaluation_tier, + "expectation_config": expectation_config, + "id": id, + "max_retries": max_retries, + "pass_threshold": pass_threshold, + "result_summary": result_summary, + "retry_on_failure": retry_on_failure, + "step_id": step_id, + "updated_at": updated_at, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.evaluation_criteria_response_expectation_config_type_0 import ( + EvaluationCriteriaResponseExpectationConfigType0, + ) + from ..models.evaluation_criteria_response_result_summary import ( + EvaluationCriteriaResponseResultSummary, + ) + + d = dict(src_dict) + account_id = UUID(d.pop("account_id")) + + agent_id = UUID(d.pop("agent_id")) + + created_at = d.pop("created_at") + + def _parse_description(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + description = _parse_description(d.pop("description")) + + enabled = d.pop("enabled") + + evaluation_mode = d.pop("evaluation_mode") + + def _parse_evaluation_prompt(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + evaluation_prompt = _parse_evaluation_prompt(d.pop("evaluation_prompt")) + + def _parse_evaluation_tier(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + evaluation_tier = _parse_evaluation_tier(d.pop("evaluation_tier")) + + def _parse_expectation_config( + data: object, + ) -> EvaluationCriteriaResponseExpectationConfigType0 | None: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + expectation_config_type_0 = ( + EvaluationCriteriaResponseExpectationConfigType0.from_dict(data) + ) + + return expectation_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(EvaluationCriteriaResponseExpectationConfigType0 | None, data) + + expectation_config = _parse_expectation_config(d.pop("expectation_config")) + + id = UUID(d.pop("id")) + + max_retries = d.pop("max_retries") + + pass_threshold = d.pop("pass_threshold") + + result_summary = EvaluationCriteriaResponseResultSummary.from_dict( + d.pop("result_summary") + ) + + retry_on_failure = d.pop("retry_on_failure") + + def _parse_step_id(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + step_id = _parse_step_id(d.pop("step_id")) + + updated_at = d.pop("updated_at") + + evaluation_criteria_response = cls( + account_id=account_id, + agent_id=agent_id, + created_at=created_at, + description=description, + enabled=enabled, + evaluation_mode=evaluation_mode, + evaluation_prompt=evaluation_prompt, + evaluation_tier=evaluation_tier, + expectation_config=expectation_config, + id=id, + max_retries=max_retries, + pass_threshold=pass_threshold, + result_summary=result_summary, + retry_on_failure=retry_on_failure, + step_id=step_id, + updated_at=updated_at, + ) + + evaluation_criteria_response.additional_properties = d + return evaluation_criteria_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_criteria_response_expectation_config_type_0.py b/seclai/_generated/models/evaluation_criteria_response_expectation_config_type_0.py new file mode 100644 index 0000000..7c16940 --- /dev/null +++ b/seclai/_generated/models/evaluation_criteria_response_expectation_config_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="EvaluationCriteriaResponseExpectationConfigType0") + + +@_attrs_define +class EvaluationCriteriaResponseExpectationConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + evaluation_criteria_response_expectation_config_type_0 = cls() + + evaluation_criteria_response_expectation_config_type_0.additional_properties = d + return evaluation_criteria_response_expectation_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_criteria_response_result_summary.py b/seclai/_generated/models/evaluation_criteria_response_result_summary.py new file mode 100644 index 0000000..1ad881c --- /dev/null +++ b/seclai/_generated/models/evaluation_criteria_response_result_summary.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="EvaluationCriteriaResponseResultSummary") + + +@_attrs_define +class EvaluationCriteriaResponseResultSummary: + """ """ + + additional_properties: dict[str, int] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + evaluation_criteria_response_result_summary = cls() + + evaluation_criteria_response_result_summary.additional_properties = d + return evaluation_criteria_response_result_summary + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> int: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: int) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_result_list_response.py b/seclai/_generated/models/evaluation_result_list_response.py new file mode 100644 index 0000000..8dff281 --- /dev/null +++ b/seclai/_generated/models/evaluation_result_list_response.py @@ -0,0 +1,100 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.evaluation_result_response import EvaluationResultResponse + + +T = TypeVar("T", bound="EvaluationResultListResponse") + + +@_attrs_define +class EvaluationResultListResponse: + """Paginated list of evaluation results. + + Attributes: + data (list[EvaluationResultResponse]): + limit (int): + page (int): + total (int): + """ + + data: list[EvaluationResultResponse] + limit: int + page: int + total: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data = [] + for data_item_data in self.data: + data_item = data_item_data.to_dict() + data.append(data_item) + + limit = self.limit + + page = self.page + + total = self.total + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "data": data, + "limit": limit, + "page": page, + "total": total, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.evaluation_result_response import EvaluationResultResponse + + d = dict(src_dict) + data = [] + _data = d.pop("data") + for data_item_data in _data: + data_item = EvaluationResultResponse.from_dict(data_item_data) + + data.append(data_item) + + limit = d.pop("limit") + + page = d.pop("page") + + total = d.pop("total") + + evaluation_result_list_response = cls( + data=data, + limit=limit, + page=page, + total=total, + ) + + evaluation_result_list_response.additional_properties = d + return evaluation_result_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_result_response.py b/seclai/_generated/models/evaluation_result_response.py new file mode 100644 index 0000000..fc9e029 --- /dev/null +++ b/seclai/_generated/models/evaluation_result_response.py @@ -0,0 +1,221 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.evaluation_result_response_details_type_0 import ( + EvaluationResultResponseDetailsType0, + ) + + +T = TypeVar("T", bound="EvaluationResultResponse") + + +@_attrs_define +class EvaluationResultResponse: + """Response schema for a single evaluation result. + + Attributes: + agent_run_id (UUID): + agent_step_run_id (None | UUID): + created_at (str): + criteria_id (UUID): + evaluated_at (str): + flagged (bool): True when the result was flagged for human review. + id (UUID): + retry_count (int): + retry_triggered (bool): + status (str): Outcome status: pending, passed, failed, skipped, or error. + details (EvaluationResultResponseDetailsType0 | None | Unset): Evaluation details including explanation and raw + LLM response. + score (float | None | Unset): LLM-assigned quality score between 0.0 (worst) and 1.0 (best). + """ + + agent_run_id: UUID + agent_step_run_id: None | UUID + created_at: str + criteria_id: UUID + evaluated_at: str + flagged: bool + id: UUID + retry_count: int + retry_triggered: bool + status: str + details: EvaluationResultResponseDetailsType0 | None | Unset = UNSET + score: float | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.evaluation_result_response_details_type_0 import ( + EvaluationResultResponseDetailsType0, + ) + + agent_run_id = str(self.agent_run_id) + + agent_step_run_id: None | str + if isinstance(self.agent_step_run_id, UUID): + agent_step_run_id = str(self.agent_step_run_id) + else: + agent_step_run_id = self.agent_step_run_id + + created_at = self.created_at + + criteria_id = str(self.criteria_id) + + evaluated_at = self.evaluated_at + + flagged = self.flagged + + id = str(self.id) + + retry_count = self.retry_count + + retry_triggered = self.retry_triggered + + status = self.status + + details: dict[str, Any] | None | Unset + if isinstance(self.details, Unset): + details = UNSET + elif isinstance(self.details, EvaluationResultResponseDetailsType0): + details = self.details.to_dict() + else: + details = self.details + + score: float | None | Unset + if isinstance(self.score, Unset): + score = UNSET + else: + score = self.score + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "agent_run_id": agent_run_id, + "agent_step_run_id": agent_step_run_id, + "created_at": created_at, + "criteria_id": criteria_id, + "evaluated_at": evaluated_at, + "flagged": flagged, + "id": id, + "retry_count": retry_count, + "retry_triggered": retry_triggered, + "status": status, + } + ) + if details is not UNSET: + field_dict["details"] = details + if score is not UNSET: + field_dict["score"] = score + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.evaluation_result_response_details_type_0 import ( + EvaluationResultResponseDetailsType0, + ) + + d = dict(src_dict) + agent_run_id = UUID(d.pop("agent_run_id")) + + def _parse_agent_step_run_id(data: object) -> None | UUID: + if data is None: + return data + try: + if not isinstance(data, str): + raise TypeError() + agent_step_run_id_type_0 = UUID(data) + + return agent_step_run_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | UUID, data) + + agent_step_run_id = _parse_agent_step_run_id(d.pop("agent_step_run_id")) + + created_at = d.pop("created_at") + + criteria_id = UUID(d.pop("criteria_id")) + + evaluated_at = d.pop("evaluated_at") + + flagged = d.pop("flagged") + + id = UUID(d.pop("id")) + + retry_count = d.pop("retry_count") + + retry_triggered = d.pop("retry_triggered") + + status = d.pop("status") + + def _parse_details( + data: object, + ) -> EvaluationResultResponseDetailsType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + details_type_0 = EvaluationResultResponseDetailsType0.from_dict(data) + + return details_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(EvaluationResultResponseDetailsType0 | None | Unset, data) + + details = _parse_details(d.pop("details", UNSET)) + + def _parse_score(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + score = _parse_score(d.pop("score", UNSET)) + + evaluation_result_response = cls( + agent_run_id=agent_run_id, + agent_step_run_id=agent_step_run_id, + created_at=created_at, + criteria_id=criteria_id, + evaluated_at=evaluated_at, + flagged=flagged, + id=id, + retry_count=retry_count, + retry_triggered=retry_triggered, + status=status, + details=details, + score=score, + ) + + evaluation_result_response.additional_properties = d + return evaluation_result_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_result_response_details_type_0.py b/seclai/_generated/models/evaluation_result_response_details_type_0.py new file mode 100644 index 0000000..b44abc0 --- /dev/null +++ b/seclai/_generated/models/evaluation_result_response_details_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="EvaluationResultResponseDetailsType0") + + +@_attrs_define +class EvaluationResultResponseDetailsType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + evaluation_result_response_details_type_0 = cls() + + evaluation_result_response_details_type_0.additional_properties = d + return evaluation_result_response_details_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_result_summary_response.py b/seclai/_generated/models/evaluation_result_summary_response.py new file mode 100644 index 0000000..da5ef4e --- /dev/null +++ b/seclai/_generated/models/evaluation_result_summary_response.py @@ -0,0 +1,116 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="EvaluationResultSummaryResponse") + + +@_attrs_define +class EvaluationResultSummaryResponse: + """Aggregated pass/fail/error counts and average score for a criteria. + + Attributes: + error (int): + failed (int): + flagged (int): + passed (int): + total (int): + average_score (float | None | Unset): Mean score across all evaluated results, or null if none. + """ + + error: int + failed: int + flagged: int + passed: int + total: int + average_score: float | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + error = self.error + + failed = self.failed + + flagged = self.flagged + + passed = self.passed + + total = self.total + + average_score: float | None | Unset + if isinstance(self.average_score, Unset): + average_score = UNSET + else: + average_score = self.average_score + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "error": error, + "failed": failed, + "flagged": flagged, + "passed": passed, + "total": total, + } + ) + if average_score is not UNSET: + field_dict["average_score"] = average_score + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + error = d.pop("error") + + failed = d.pop("failed") + + flagged = d.pop("flagged") + + passed = d.pop("passed") + + total = d.pop("total") + + def _parse_average_score(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + average_score = _parse_average_score(d.pop("average_score", UNSET)) + + evaluation_result_summary_response = cls( + error=error, + failed=failed, + flagged=flagged, + passed=passed, + total=total, + average_score=average_score, + ) + + evaluation_result_summary_response.additional_properties = d + return evaluation_result_summary_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_result_with_criteria_list_response.py b/seclai/_generated/models/evaluation_result_with_criteria_list_response.py new file mode 100644 index 0000000..dd9c896 --- /dev/null +++ b/seclai/_generated/models/evaluation_result_with_criteria_list_response.py @@ -0,0 +1,104 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.evaluation_result_with_criteria_response import ( + EvaluationResultWithCriteriaResponse, + ) + + +T = TypeVar("T", bound="EvaluationResultWithCriteriaListResponse") + + +@_attrs_define +class EvaluationResultWithCriteriaListResponse: + """Paginated list of evaluation results with criteria context. + + Attributes: + data (list[EvaluationResultWithCriteriaResponse]): + limit (int): + page (int): + total (int): + """ + + data: list[EvaluationResultWithCriteriaResponse] + limit: int + page: int + total: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data = [] + for data_item_data in self.data: + data_item = data_item_data.to_dict() + data.append(data_item) + + limit = self.limit + + page = self.page + + total = self.total + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "data": data, + "limit": limit, + "page": page, + "total": total, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.evaluation_result_with_criteria_response import ( + EvaluationResultWithCriteriaResponse, + ) + + d = dict(src_dict) + data = [] + _data = d.pop("data") + for data_item_data in _data: + data_item = EvaluationResultWithCriteriaResponse.from_dict(data_item_data) + + data.append(data_item) + + limit = d.pop("limit") + + page = d.pop("page") + + total = d.pop("total") + + evaluation_result_with_criteria_list_response = cls( + data=data, + limit=limit, + page=page, + total=total, + ) + + evaluation_result_with_criteria_list_response.additional_properties = d + return evaluation_result_with_criteria_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_result_with_criteria_response.py b/seclai/_generated/models/evaluation_result_with_criteria_response.py new file mode 100644 index 0000000..0f3ce13 --- /dev/null +++ b/seclai/_generated/models/evaluation_result_with_criteria_response.py @@ -0,0 +1,255 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.evaluation_result_with_criteria_response_details_type_0 import ( + EvaluationResultWithCriteriaResponseDetailsType0, + ) + + +T = TypeVar("T", bound="EvaluationResultWithCriteriaResponse") + + +@_attrs_define +class EvaluationResultWithCriteriaResponse: + """Evaluation result including criteria context for aggregated listing. + + Attributes: + agent_run_id (UUID): + agent_step_run_id (None | UUID): + created_at (str): + criteria_description (None | str): + criteria_id (UUID): + evaluated_at (str): + flagged (bool): True when the result was flagged for human review. + id (UUID): + retry_count (int): + retry_triggered (bool): + status (str): Outcome status: pending, passed, failed, skipped, or error. + step_id (None | str): + details (EvaluationResultWithCriteriaResponseDetailsType0 | None | Unset): Evaluation details including + explanation and raw LLM response. + score (float | None | Unset): LLM-assigned quality score between 0.0 (worst) and 1.0 (best). + """ + + agent_run_id: UUID + agent_step_run_id: None | UUID + created_at: str + criteria_description: None | str + criteria_id: UUID + evaluated_at: str + flagged: bool + id: UUID + retry_count: int + retry_triggered: bool + status: str + step_id: None | str + details: EvaluationResultWithCriteriaResponseDetailsType0 | None | Unset = UNSET + score: float | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.evaluation_result_with_criteria_response_details_type_0 import ( + EvaluationResultWithCriteriaResponseDetailsType0, + ) + + agent_run_id = str(self.agent_run_id) + + agent_step_run_id: None | str + if isinstance(self.agent_step_run_id, UUID): + agent_step_run_id = str(self.agent_step_run_id) + else: + agent_step_run_id = self.agent_step_run_id + + created_at = self.created_at + + criteria_description: None | str + criteria_description = self.criteria_description + + criteria_id = str(self.criteria_id) + + evaluated_at = self.evaluated_at + + flagged = self.flagged + + id = str(self.id) + + retry_count = self.retry_count + + retry_triggered = self.retry_triggered + + status = self.status + + step_id: None | str + step_id = self.step_id + + details: dict[str, Any] | None | Unset + if isinstance(self.details, Unset): + details = UNSET + elif isinstance(self.details, EvaluationResultWithCriteriaResponseDetailsType0): + details = self.details.to_dict() + else: + details = self.details + + score: float | None | Unset + if isinstance(self.score, Unset): + score = UNSET + else: + score = self.score + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "agent_run_id": agent_run_id, + "agent_step_run_id": agent_step_run_id, + "created_at": created_at, + "criteria_description": criteria_description, + "criteria_id": criteria_id, + "evaluated_at": evaluated_at, + "flagged": flagged, + "id": id, + "retry_count": retry_count, + "retry_triggered": retry_triggered, + "status": status, + "step_id": step_id, + } + ) + if details is not UNSET: + field_dict["details"] = details + if score is not UNSET: + field_dict["score"] = score + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.evaluation_result_with_criteria_response_details_type_0 import ( + EvaluationResultWithCriteriaResponseDetailsType0, + ) + + d = dict(src_dict) + agent_run_id = UUID(d.pop("agent_run_id")) + + def _parse_agent_step_run_id(data: object) -> None | UUID: + if data is None: + return data + try: + if not isinstance(data, str): + raise TypeError() + agent_step_run_id_type_0 = UUID(data) + + return agent_step_run_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | UUID, data) + + agent_step_run_id = _parse_agent_step_run_id(d.pop("agent_step_run_id")) + + created_at = d.pop("created_at") + + def _parse_criteria_description(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + criteria_description = _parse_criteria_description( + d.pop("criteria_description") + ) + + criteria_id = UUID(d.pop("criteria_id")) + + evaluated_at = d.pop("evaluated_at") + + flagged = d.pop("flagged") + + id = UUID(d.pop("id")) + + retry_count = d.pop("retry_count") + + retry_triggered = d.pop("retry_triggered") + + status = d.pop("status") + + def _parse_step_id(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + step_id = _parse_step_id(d.pop("step_id")) + + def _parse_details( + data: object, + ) -> EvaluationResultWithCriteriaResponseDetailsType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + details_type_0 = ( + EvaluationResultWithCriteriaResponseDetailsType0.from_dict(data) + ) + + return details_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + EvaluationResultWithCriteriaResponseDetailsType0 | None | Unset, data + ) + + details = _parse_details(d.pop("details", UNSET)) + + def _parse_score(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + score = _parse_score(d.pop("score", UNSET)) + + evaluation_result_with_criteria_response = cls( + agent_run_id=agent_run_id, + agent_step_run_id=agent_step_run_id, + created_at=created_at, + criteria_description=criteria_description, + criteria_id=criteria_id, + evaluated_at=evaluated_at, + flagged=flagged, + id=id, + retry_count=retry_count, + retry_triggered=retry_triggered, + status=status, + step_id=step_id, + details=details, + score=score, + ) + + evaluation_result_with_criteria_response.additional_properties = d + return evaluation_result_with_criteria_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_result_with_criteria_response_details_type_0.py b/seclai/_generated/models/evaluation_result_with_criteria_response_details_type_0.py new file mode 100644 index 0000000..c5a5e1c --- /dev/null +++ b/seclai/_generated/models/evaluation_result_with_criteria_response_details_type_0.py @@ -0,0 +1,48 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="EvaluationResultWithCriteriaResponseDetailsType0") + + +@_attrs_define +class EvaluationResultWithCriteriaResponseDetailsType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + evaluation_result_with_criteria_response_details_type_0 = cls() + + evaluation_result_with_criteria_response_details_type_0.additional_properties = ( + d + ) + return evaluation_result_with_criteria_response_details_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_run_summary_list_response.py b/seclai/_generated/models/evaluation_run_summary_list_response.py new file mode 100644 index 0000000..6eef1fe --- /dev/null +++ b/seclai/_generated/models/evaluation_run_summary_list_response.py @@ -0,0 +1,102 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.evaluation_run_summary_response import EvaluationRunSummaryResponse + + +T = TypeVar("T", bound="EvaluationRunSummaryListResponse") + + +@_attrs_define +class EvaluationRunSummaryListResponse: + """Paginated list of per-run evaluation summaries. + + Attributes: + data (list[EvaluationRunSummaryResponse]): + limit (int): + page (int): + total (int): + """ + + data: list[EvaluationRunSummaryResponse] + limit: int + page: int + total: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data = [] + for data_item_data in self.data: + data_item = data_item_data.to_dict() + data.append(data_item) + + limit = self.limit + + page = self.page + + total = self.total + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "data": data, + "limit": limit, + "page": page, + "total": total, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.evaluation_run_summary_response import ( + EvaluationRunSummaryResponse, + ) + + d = dict(src_dict) + data = [] + _data = d.pop("data") + for data_item_data in _data: + data_item = EvaluationRunSummaryResponse.from_dict(data_item_data) + + data.append(data_item) + + limit = d.pop("limit") + + page = d.pop("page") + + total = d.pop("total") + + evaluation_run_summary_list_response = cls( + data=data, + limit=limit, + page=page, + total=total, + ) + + evaluation_run_summary_list_response.additional_properties = d + return evaluation_run_summary_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_run_summary_response.py b/seclai/_generated/models/evaluation_run_summary_response.py new file mode 100644 index 0000000..f8f3163 --- /dev/null +++ b/seclai/_generated/models/evaluation_run_summary_response.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="EvaluationRunSummaryResponse") + + +@_attrs_define +class EvaluationRunSummaryResponse: + """Per-run evaluation summary with pass/fail/error breakdown. + + Attributes: + agent_run_id (UUID): + error_count (int): + failed_count (int): + flagged_count (int): + passed_count (int): + run_created_at (str): + run_status (str): Status of the agent run (processing, completed, failed). + skipped_count (int): + total_evaluations (int): + """ + + agent_run_id: UUID + error_count: int + failed_count: int + flagged_count: int + passed_count: int + run_created_at: str + run_status: str + skipped_count: int + total_evaluations: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + agent_run_id = str(self.agent_run_id) + + error_count = self.error_count + + failed_count = self.failed_count + + flagged_count = self.flagged_count + + passed_count = self.passed_count + + run_created_at = self.run_created_at + + run_status = self.run_status + + skipped_count = self.skipped_count + + total_evaluations = self.total_evaluations + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "agent_run_id": agent_run_id, + "error_count": error_count, + "failed_count": failed_count, + "flagged_count": flagged_count, + "passed_count": passed_count, + "run_created_at": run_created_at, + "run_status": run_status, + "skipped_count": skipped_count, + "total_evaluations": total_evaluations, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_run_id = UUID(d.pop("agent_run_id")) + + error_count = d.pop("error_count") + + failed_count = d.pop("failed_count") + + flagged_count = d.pop("flagged_count") + + passed_count = d.pop("passed_count") + + run_created_at = d.pop("run_created_at") + + run_status = d.pop("run_status") + + skipped_count = d.pop("skipped_count") + + total_evaluations = d.pop("total_evaluations") + + evaluation_run_summary_response = cls( + agent_run_id=agent_run_id, + error_count=error_count, + failed_count=failed_count, + flagged_count=flagged_count, + passed_count=passed_count, + run_created_at=run_created_at, + run_status=run_status, + skipped_count=skipped_count, + total_evaluations=total_evaluations, + ) + + evaluation_run_summary_response.additional_properties = d + return evaluation_run_summary_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/evaluation_status.py b/seclai/_generated/models/evaluation_status.py new file mode 100644 index 0000000..39a9c8c --- /dev/null +++ b/seclai/_generated/models/evaluation_status.py @@ -0,0 +1,12 @@ +from enum import Enum + + +class EvaluationStatus(str, Enum): + ERROR = "error" + FAILED = "failed" + PASSED = "passed" + PENDING = "pending" + SKIPPED = "skipped" + + def __str__(self) -> str: + return str(self.value) diff --git a/seclai/_generated/models/example_prompt.py b/seclai/_generated/models/example_prompt.py new file mode 100644 index 0000000..2923aea --- /dev/null +++ b/seclai/_generated/models/example_prompt.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ExamplePrompt") + + +@_attrs_define +class ExamplePrompt: + """ """ + + additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + example_prompt = cls() + + example_prompt.additional_properties = d + return example_prompt + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> str: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: str) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/executed_action_response.py b/seclai/_generated/models/executed_action_response.py new file mode 100644 index 0000000..7c1ba69 --- /dev/null +++ b/seclai/_generated/models/executed_action_response.py @@ -0,0 +1,141 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ExecutedActionResponse") + + +@_attrs_define +class ExecutedActionResponse: + """A single executed action result. + + Attributes: + action_type (str): Type of the executed action. + description (str): Human-readable description. + error (None | str | Unset): Error message if failed. + resource_id (None | str | Unset): ID of the affected resource. + resource_type (None | str | Unset): Type of the affected resource. + success (bool | Unset): Whether the action succeeded. Default: True. + """ + + action_type: str + description: str + error: None | str | Unset = UNSET + resource_id: None | str | Unset = UNSET + resource_type: None | str | Unset = UNSET + success: bool | Unset = True + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + action_type = self.action_type + + description = self.description + + error: None | str | Unset + if isinstance(self.error, Unset): + error = UNSET + else: + error = self.error + + resource_id: None | str | Unset + if isinstance(self.resource_id, Unset): + resource_id = UNSET + else: + resource_id = self.resource_id + + resource_type: None | str | Unset + if isinstance(self.resource_type, Unset): + resource_type = UNSET + else: + resource_type = self.resource_type + + success = self.success + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "action_type": action_type, + "description": description, + } + ) + if error is not UNSET: + field_dict["error"] = error + if resource_id is not UNSET: + field_dict["resource_id"] = resource_id + if resource_type is not UNSET: + field_dict["resource_type"] = resource_type + if success is not UNSET: + field_dict["success"] = success + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + action_type = d.pop("action_type") + + description = d.pop("description") + + def _parse_error(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + error = _parse_error(d.pop("error", UNSET)) + + def _parse_resource_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + resource_id = _parse_resource_id(d.pop("resource_id", UNSET)) + + def _parse_resource_type(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + resource_type = _parse_resource_type(d.pop("resource_type", UNSET)) + + success = d.pop("success", UNSET) + + executed_action_response = cls( + action_type=action_type, + description=description, + error=error, + resource_id=resource_id, + resource_type=resource_type, + success=success, + ) + + executed_action_response.additional_properties = d + return executed_action_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/export_format.py b/seclai/_generated/models/export_format.py new file mode 100644 index 0000000..b19f1bb --- /dev/null +++ b/seclai/_generated/models/export_format.py @@ -0,0 +1,11 @@ +from enum import Enum + + +class ExportFormat(str, Enum): + CSV = "csv" + JSONL = "jsonl" + PARQUET = "parquet" + ZIP = "zip" + + def __str__(self) -> str: + return str(self.value) diff --git a/seclai/_generated/models/export_list_response.py b/seclai/_generated/models/export_list_response.py new file mode 100644 index 0000000..d9f0788 --- /dev/null +++ b/seclai/_generated/models/export_list_response.py @@ -0,0 +1,76 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.pagination_response import PaginationResponse + + +T = TypeVar("T", bound="ExportListResponse") + + +@_attrs_define +class ExportListResponse: + """Paginated list of export jobs. + + Attributes: + data (list[Any]): + pagination (PaginationResponse): Pagination information. + """ + + data: list[Any] + pagination: PaginationResponse + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data = self.data + + pagination = self.pagination.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "data": data, + "pagination": pagination, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.pagination_response import PaginationResponse + + d = dict(src_dict) + data = cast(list[Any], d.pop("data")) + + pagination = PaginationResponse.from_dict(d.pop("pagination")) + + export_list_response = cls( + data=data, + pagination=pagination, + ) + + export_list_response.additional_properties = d + return export_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/export_response.py b/seclai/_generated/models/export_response.py new file mode 100644 index 0000000..fa0a4c1 --- /dev/null +++ b/seclai/_generated/models/export_response.py @@ -0,0 +1,474 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.export_response_metadata_filter_type_0 import ( + ExportResponseMetadataFilterType0, + ) + + +T = TypeVar("T", bound="ExportResponse") + + +@_attrs_define +class ExportResponse: + """Status and metadata for a content source export job. + + Attributes: + account_id (str): Owning account ID. + created_at (str): Creation time. + destination (str): Storage destination. + format_ (str): Output format. + id (str): Export job ID. + source_connection_id (str): Source connection ID. + status (str): Job status. + updated_at (str): Last update time. + completed_at (None | str | Unset): Completion time. + date_from (None | str | Unset): Date-from filter applied to this export. + date_to (None | str | Unset): Date-to filter applied to this export. + error (None | str | Unset): Error message if failed. + estimated_size_bytes (int | None | Unset): Pre-run size estimate. + expires_at (None | str | Unset): Download expiry time. + file_size_bytes (int | None | Unset): File size in bytes. + item_count (int | None | Unset): Items exported. + metadata_filter (ExportResponseMetadataFilterType0 | None | Unset): Metadata filter applied to this export. + progress_current (int | None | Unset): Items processed so far. + progress_total (int | None | Unset): Total items to process. + query_filter (None | str | Unset): Query filter applied to this export. + requested_by_user_id (None | str | Unset): ID of the user who requested this export. + requested_by_user_name (None | str | Unset): Name of the user who requested this export. + started_at (None | str | Unset): Processing start time. + storage_key (None | str | Unset): S3 key of exported file. + """ + + account_id: str + created_at: str + destination: str + format_: str + id: str + source_connection_id: str + status: str + updated_at: str + completed_at: None | str | Unset = UNSET + date_from: None | str | Unset = UNSET + date_to: None | str | Unset = UNSET + error: None | str | Unset = UNSET + estimated_size_bytes: int | None | Unset = UNSET + expires_at: None | str | Unset = UNSET + file_size_bytes: int | None | Unset = UNSET + item_count: int | None | Unset = UNSET + metadata_filter: ExportResponseMetadataFilterType0 | None | Unset = UNSET + progress_current: int | None | Unset = UNSET + progress_total: int | None | Unset = UNSET + query_filter: None | str | Unset = UNSET + requested_by_user_id: None | str | Unset = UNSET + requested_by_user_name: None | str | Unset = UNSET + started_at: None | str | Unset = UNSET + storage_key: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.export_response_metadata_filter_type_0 import ( + ExportResponseMetadataFilterType0, + ) + + account_id = self.account_id + + created_at = self.created_at + + destination = self.destination + + format_ = self.format_ + + id = self.id + + source_connection_id = self.source_connection_id + + status = self.status + + updated_at = self.updated_at + + completed_at: None | str | Unset + if isinstance(self.completed_at, Unset): + completed_at = UNSET + else: + completed_at = self.completed_at + + date_from: None | str | Unset + if isinstance(self.date_from, Unset): + date_from = UNSET + else: + date_from = self.date_from + + date_to: None | str | Unset + if isinstance(self.date_to, Unset): + date_to = UNSET + else: + date_to = self.date_to + + error: None | str | Unset + if isinstance(self.error, Unset): + error = UNSET + else: + error = self.error + + estimated_size_bytes: int | None | Unset + if isinstance(self.estimated_size_bytes, Unset): + estimated_size_bytes = UNSET + else: + estimated_size_bytes = self.estimated_size_bytes + + expires_at: None | str | Unset + if isinstance(self.expires_at, Unset): + expires_at = UNSET + else: + expires_at = self.expires_at + + file_size_bytes: int | None | Unset + if isinstance(self.file_size_bytes, Unset): + file_size_bytes = UNSET + else: + file_size_bytes = self.file_size_bytes + + item_count: int | None | Unset + if isinstance(self.item_count, Unset): + item_count = UNSET + else: + item_count = self.item_count + + metadata_filter: dict[str, Any] | None | Unset + if isinstance(self.metadata_filter, Unset): + metadata_filter = UNSET + elif isinstance(self.metadata_filter, ExportResponseMetadataFilterType0): + metadata_filter = self.metadata_filter.to_dict() + else: + metadata_filter = self.metadata_filter + + progress_current: int | None | Unset + if isinstance(self.progress_current, Unset): + progress_current = UNSET + else: + progress_current = self.progress_current + + progress_total: int | None | Unset + if isinstance(self.progress_total, Unset): + progress_total = UNSET + else: + progress_total = self.progress_total + + query_filter: None | str | Unset + if isinstance(self.query_filter, Unset): + query_filter = UNSET + else: + query_filter = self.query_filter + + requested_by_user_id: None | str | Unset + if isinstance(self.requested_by_user_id, Unset): + requested_by_user_id = UNSET + else: + requested_by_user_id = self.requested_by_user_id + + requested_by_user_name: None | str | Unset + if isinstance(self.requested_by_user_name, Unset): + requested_by_user_name = UNSET + else: + requested_by_user_name = self.requested_by_user_name + + started_at: None | str | Unset + if isinstance(self.started_at, Unset): + started_at = UNSET + else: + started_at = self.started_at + + storage_key: None | str | Unset + if isinstance(self.storage_key, Unset): + storage_key = UNSET + else: + storage_key = self.storage_key + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "account_id": account_id, + "created_at": created_at, + "destination": destination, + "format": format_, + "id": id, + "source_connection_id": source_connection_id, + "status": status, + "updated_at": updated_at, + } + ) + if completed_at is not UNSET: + field_dict["completed_at"] = completed_at + if date_from is not UNSET: + field_dict["date_from"] = date_from + if date_to is not UNSET: + field_dict["date_to"] = date_to + if error is not UNSET: + field_dict["error"] = error + if estimated_size_bytes is not UNSET: + field_dict["estimated_size_bytes"] = estimated_size_bytes + if expires_at is not UNSET: + field_dict["expires_at"] = expires_at + if file_size_bytes is not UNSET: + field_dict["file_size_bytes"] = file_size_bytes + if item_count is not UNSET: + field_dict["item_count"] = item_count + if metadata_filter is not UNSET: + field_dict["metadata_filter"] = metadata_filter + if progress_current is not UNSET: + field_dict["progress_current"] = progress_current + if progress_total is not UNSET: + field_dict["progress_total"] = progress_total + if query_filter is not UNSET: + field_dict["query_filter"] = query_filter + if requested_by_user_id is not UNSET: + field_dict["requested_by_user_id"] = requested_by_user_id + if requested_by_user_name is not UNSET: + field_dict["requested_by_user_name"] = requested_by_user_name + if started_at is not UNSET: + field_dict["started_at"] = started_at + if storage_key is not UNSET: + field_dict["storage_key"] = storage_key + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.export_response_metadata_filter_type_0 import ( + ExportResponseMetadataFilterType0, + ) + + d = dict(src_dict) + account_id = d.pop("account_id") + + created_at = d.pop("created_at") + + destination = d.pop("destination") + + format_ = d.pop("format") + + id = d.pop("id") + + source_connection_id = d.pop("source_connection_id") + + status = d.pop("status") + + updated_at = d.pop("updated_at") + + def _parse_completed_at(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + completed_at = _parse_completed_at(d.pop("completed_at", UNSET)) + + def _parse_date_from(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + date_from = _parse_date_from(d.pop("date_from", UNSET)) + + def _parse_date_to(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + date_to = _parse_date_to(d.pop("date_to", UNSET)) + + def _parse_error(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + error = _parse_error(d.pop("error", UNSET)) + + def _parse_estimated_size_bytes(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + estimated_size_bytes = _parse_estimated_size_bytes( + d.pop("estimated_size_bytes", UNSET) + ) + + def _parse_expires_at(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + expires_at = _parse_expires_at(d.pop("expires_at", UNSET)) + + def _parse_file_size_bytes(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + file_size_bytes = _parse_file_size_bytes(d.pop("file_size_bytes", UNSET)) + + def _parse_item_count(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + item_count = _parse_item_count(d.pop("item_count", UNSET)) + + def _parse_metadata_filter( + data: object, + ) -> ExportResponseMetadataFilterType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + metadata_filter_type_0 = ExportResponseMetadataFilterType0.from_dict( + data + ) + + return metadata_filter_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(ExportResponseMetadataFilterType0 | None | Unset, data) + + metadata_filter = _parse_metadata_filter(d.pop("metadata_filter", UNSET)) + + def _parse_progress_current(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + progress_current = _parse_progress_current(d.pop("progress_current", UNSET)) + + def _parse_progress_total(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + progress_total = _parse_progress_total(d.pop("progress_total", UNSET)) + + def _parse_query_filter(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + query_filter = _parse_query_filter(d.pop("query_filter", UNSET)) + + def _parse_requested_by_user_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + requested_by_user_id = _parse_requested_by_user_id( + d.pop("requested_by_user_id", UNSET) + ) + + def _parse_requested_by_user_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + requested_by_user_name = _parse_requested_by_user_name( + d.pop("requested_by_user_name", UNSET) + ) + + def _parse_started_at(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + started_at = _parse_started_at(d.pop("started_at", UNSET)) + + def _parse_storage_key(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + storage_key = _parse_storage_key(d.pop("storage_key", UNSET)) + + export_response = cls( + account_id=account_id, + created_at=created_at, + destination=destination, + format_=format_, + id=id, + source_connection_id=source_connection_id, + status=status, + updated_at=updated_at, + completed_at=completed_at, + date_from=date_from, + date_to=date_to, + error=error, + estimated_size_bytes=estimated_size_bytes, + expires_at=expires_at, + file_size_bytes=file_size_bytes, + item_count=item_count, + metadata_filter=metadata_filter, + progress_current=progress_current, + progress_total=progress_total, + query_filter=query_filter, + requested_by_user_id=requested_by_user_id, + requested_by_user_name=requested_by_user_name, + started_at=started_at, + storage_key=storage_key, + ) + + export_response.additional_properties = d + return export_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/export_response_metadata_filter_type_0.py b/seclai/_generated/models/export_response_metadata_filter_type_0.py new file mode 100644 index 0000000..a12d8a7 --- /dev/null +++ b/seclai/_generated/models/export_response_metadata_filter_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ExportResponseMetadataFilterType0") + + +@_attrs_define +class ExportResponseMetadataFilterType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + export_response_metadata_filter_type_0 = cls() + + export_response_metadata_filter_type_0.additional_properties = d + return export_response_metadata_filter_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/generate_agent_steps_request.py b/seclai/_generated/models/generate_agent_steps_request.py new file mode 100644 index 0000000..7302739 --- /dev/null +++ b/seclai/_generated/models/generate_agent_steps_request.py @@ -0,0 +1,173 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.generate_agent_steps_request_agent_steps_type_0_item import ( + GenerateAgentStepsRequestAgentStepsType0Item, + ) + + +T = TypeVar("T", bound="GenerateAgentStepsRequest") + + +@_attrs_define +class GenerateAgentStepsRequest: + """ + Attributes: + user_input (str): Natural language description of the desired agent workflow. + agent_description (None | str | Unset): Agent description for additional AI context. + agent_steps (list[GenerateAgentStepsRequestAgentStepsType0Item] | None | Unset): Current agent step hierarchy + for context when modifying. + mode (str | Unset): 'generate_full' to create from scratch, 'modify_workflow' to refine. Default: + 'generate_full'. + trigger_type (None | str | Unset): Agent trigger type for context (e.g. 'dynamic_input', 'content_added'). + """ + + user_input: str + agent_description: None | str | Unset = UNSET + agent_steps: list[GenerateAgentStepsRequestAgentStepsType0Item] | None | Unset = ( + UNSET + ) + mode: str | Unset = "generate_full" + trigger_type: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + user_input = self.user_input + + agent_description: None | str | Unset + if isinstance(self.agent_description, Unset): + agent_description = UNSET + else: + agent_description = self.agent_description + + agent_steps: list[dict[str, Any]] | None | Unset + if isinstance(self.agent_steps, Unset): + agent_steps = UNSET + elif isinstance(self.agent_steps, list): + agent_steps = [] + for agent_steps_type_0_item_data in self.agent_steps: + agent_steps_type_0_item = agent_steps_type_0_item_data.to_dict() + agent_steps.append(agent_steps_type_0_item) + + else: + agent_steps = self.agent_steps + + mode = self.mode + + trigger_type: None | str | Unset + if isinstance(self.trigger_type, Unset): + trigger_type = UNSET + else: + trigger_type = self.trigger_type + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "user_input": user_input, + } + ) + if agent_description is not UNSET: + field_dict["agent_description"] = agent_description + if agent_steps is not UNSET: + field_dict["agent_steps"] = agent_steps + if mode is not UNSET: + field_dict["mode"] = mode + if trigger_type is not UNSET: + field_dict["trigger_type"] = trigger_type + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.generate_agent_steps_request_agent_steps_type_0_item import ( + GenerateAgentStepsRequestAgentStepsType0Item, + ) + + d = dict(src_dict) + user_input = d.pop("user_input") + + def _parse_agent_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + agent_description = _parse_agent_description(d.pop("agent_description", UNSET)) + + def _parse_agent_steps( + data: object, + ) -> list[GenerateAgentStepsRequestAgentStepsType0Item] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + agent_steps_type_0 = [] + _agent_steps_type_0 = data + for agent_steps_type_0_item_data in _agent_steps_type_0: + agent_steps_type_0_item = ( + GenerateAgentStepsRequestAgentStepsType0Item.from_dict( + agent_steps_type_0_item_data + ) + ) + + agent_steps_type_0.append(agent_steps_type_0_item) + + return agent_steps_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + list[GenerateAgentStepsRequestAgentStepsType0Item] | None | Unset, data + ) + + agent_steps = _parse_agent_steps(d.pop("agent_steps", UNSET)) + + mode = d.pop("mode", UNSET) + + def _parse_trigger_type(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + trigger_type = _parse_trigger_type(d.pop("trigger_type", UNSET)) + + generate_agent_steps_request = cls( + user_input=user_input, + agent_description=agent_description, + agent_steps=agent_steps, + mode=mode, + trigger_type=trigger_type, + ) + + generate_agent_steps_request.additional_properties = d + return generate_agent_steps_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/generate_agent_steps_request_agent_steps_type_0_item.py b/seclai/_generated/models/generate_agent_steps_request_agent_steps_type_0_item.py new file mode 100644 index 0000000..d33fe96 --- /dev/null +++ b/seclai/_generated/models/generate_agent_steps_request_agent_steps_type_0_item.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="GenerateAgentStepsRequestAgentStepsType0Item") + + +@_attrs_define +class GenerateAgentStepsRequestAgentStepsType0Item: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + generate_agent_steps_request_agent_steps_type_0_item = cls() + + generate_agent_steps_request_agent_steps_type_0_item.additional_properties = d + return generate_agent_steps_request_agent_steps_type_0_item + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/generate_agent_steps_response.py b/seclai/_generated/models/generate_agent_steps_response.py new file mode 100644 index 0000000..393aa54 --- /dev/null +++ b/seclai/_generated/models/generate_agent_steps_response.py @@ -0,0 +1,176 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.example_prompt import ExamplePrompt + from ..models.generate_agent_steps_response_agent_config_type_0 import ( + GenerateAgentStepsResponseAgentConfigType0, + ) + from ..models.generate_agent_steps_response_steps_item import ( + GenerateAgentStepsResponseStepsItem, + ) + + +T = TypeVar("T", bound="GenerateAgentStepsResponse") + + +@_attrs_define +class GenerateAgentStepsResponse: + """ + Attributes: + conversation_id (str): Conversation turn ID for tracking. + note (str): AI explanation of the proposed workflow. + steps (list[GenerateAgentStepsResponseStepsItem]): Generated agent steps. + success (bool): Whether steps were successfully generated. + agent_config (GenerateAgentStepsResponseAgentConfigType0 | None | Unset): Suggested agent-level configuration, + if any. + example_prompts (list[ExamplePrompt] | Unset): Example natural-language prompts that demonstrate the + capabilities of this AI assistant for the given mode. + """ + + conversation_id: str + note: str + steps: list[GenerateAgentStepsResponseStepsItem] + success: bool + agent_config: GenerateAgentStepsResponseAgentConfigType0 | None | Unset = UNSET + example_prompts: list[ExamplePrompt] | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.generate_agent_steps_response_agent_config_type_0 import ( + GenerateAgentStepsResponseAgentConfigType0, + ) + + conversation_id = self.conversation_id + + note = self.note + + steps = [] + for steps_item_data in self.steps: + steps_item = steps_item_data.to_dict() + steps.append(steps_item) + + success = self.success + + agent_config: dict[str, Any] | None | Unset + if isinstance(self.agent_config, Unset): + agent_config = UNSET + elif isinstance(self.agent_config, GenerateAgentStepsResponseAgentConfigType0): + agent_config = self.agent_config.to_dict() + else: + agent_config = self.agent_config + + example_prompts: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.example_prompts, Unset): + example_prompts = [] + for example_prompts_item_data in self.example_prompts: + example_prompts_item = example_prompts_item_data.to_dict() + example_prompts.append(example_prompts_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "conversation_id": conversation_id, + "note": note, + "steps": steps, + "success": success, + } + ) + if agent_config is not UNSET: + field_dict["agent_config"] = agent_config + if example_prompts is not UNSET: + field_dict["example_prompts"] = example_prompts + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.example_prompt import ExamplePrompt + from ..models.generate_agent_steps_response_agent_config_type_0 import ( + GenerateAgentStepsResponseAgentConfigType0, + ) + from ..models.generate_agent_steps_response_steps_item import ( + GenerateAgentStepsResponseStepsItem, + ) + + d = dict(src_dict) + conversation_id = d.pop("conversation_id") + + note = d.pop("note") + + steps = [] + _steps = d.pop("steps") + for steps_item_data in _steps: + steps_item = GenerateAgentStepsResponseStepsItem.from_dict(steps_item_data) + + steps.append(steps_item) + + success = d.pop("success") + + def _parse_agent_config( + data: object, + ) -> GenerateAgentStepsResponseAgentConfigType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + agent_config_type_0 = ( + GenerateAgentStepsResponseAgentConfigType0.from_dict(data) + ) + + return agent_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(GenerateAgentStepsResponseAgentConfigType0 | None | Unset, data) + + agent_config = _parse_agent_config(d.pop("agent_config", UNSET)) + + _example_prompts = d.pop("example_prompts", UNSET) + example_prompts: list[ExamplePrompt] | Unset = UNSET + if _example_prompts is not UNSET: + example_prompts = [] + for example_prompts_item_data in _example_prompts: + example_prompts_item = ExamplePrompt.from_dict( + example_prompts_item_data + ) + + example_prompts.append(example_prompts_item) + + generate_agent_steps_response = cls( + conversation_id=conversation_id, + note=note, + steps=steps, + success=success, + agent_config=agent_config, + example_prompts=example_prompts, + ) + + generate_agent_steps_response.additional_properties = d + return generate_agent_steps_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/generate_agent_steps_response_agent_config_type_0.py b/seclai/_generated/models/generate_agent_steps_response_agent_config_type_0.py new file mode 100644 index 0000000..bfea7a5 --- /dev/null +++ b/seclai/_generated/models/generate_agent_steps_response_agent_config_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="GenerateAgentStepsResponseAgentConfigType0") + + +@_attrs_define +class GenerateAgentStepsResponseAgentConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + generate_agent_steps_response_agent_config_type_0 = cls() + + generate_agent_steps_response_agent_config_type_0.additional_properties = d + return generate_agent_steps_response_agent_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/generate_agent_steps_response_steps_item.py b/seclai/_generated/models/generate_agent_steps_response_steps_item.py new file mode 100644 index 0000000..cfcb2ae --- /dev/null +++ b/seclai/_generated/models/generate_agent_steps_response_steps_item.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="GenerateAgentStepsResponseStepsItem") + + +@_attrs_define +class GenerateAgentStepsResponseStepsItem: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + generate_agent_steps_response_steps_item = cls() + + generate_agent_steps_response_steps_item.additional_properties = d + return generate_agent_steps_response_steps_item + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/generate_step_config_request.py b/seclai/_generated/models/generate_step_config_request.py new file mode 100644 index 0000000..6807cfe --- /dev/null +++ b/seclai/_generated/models/generate_step_config_request.py @@ -0,0 +1,201 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.generate_step_config_request_agent_steps_type_0_item import ( + GenerateStepConfigRequestAgentStepsType0Item, + ) + from ..models.generate_step_config_request_current_config_type_0 import ( + GenerateStepConfigRequestCurrentConfigType0, + ) + + +T = TypeVar("T", bound="GenerateStepConfigRequest") + + +@_attrs_define +class GenerateStepConfigRequest: + """ + Attributes: + step_type (str): The step type to generate config for (e.g. 'transform', 'gate', 'text', 'prompt_call', + 'retrieval'). + user_input (str): Natural language description of what the step should do. + agent_steps (list[GenerateStepConfigRequestAgentStepsType0Item] | None | Unset): Current agent step hierarchy + for context. + current_config (GenerateStepConfigRequestCurrentConfigType0 | None | Unset): Current step configuration to + refine, if any. + step_id (None | str | Unset): ID of the specific step to refine. Omit for new steps. + """ + + step_type: str + user_input: str + agent_steps: list[GenerateStepConfigRequestAgentStepsType0Item] | None | Unset = ( + UNSET + ) + current_config: GenerateStepConfigRequestCurrentConfigType0 | None | Unset = UNSET + step_id: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.generate_step_config_request_current_config_type_0 import ( + GenerateStepConfigRequestCurrentConfigType0, + ) + + step_type = self.step_type + + user_input = self.user_input + + agent_steps: list[dict[str, Any]] | None | Unset + if isinstance(self.agent_steps, Unset): + agent_steps = UNSET + elif isinstance(self.agent_steps, list): + agent_steps = [] + for agent_steps_type_0_item_data in self.agent_steps: + agent_steps_type_0_item = agent_steps_type_0_item_data.to_dict() + agent_steps.append(agent_steps_type_0_item) + + else: + agent_steps = self.agent_steps + + current_config: dict[str, Any] | None | Unset + if isinstance(self.current_config, Unset): + current_config = UNSET + elif isinstance( + self.current_config, GenerateStepConfigRequestCurrentConfigType0 + ): + current_config = self.current_config.to_dict() + else: + current_config = self.current_config + + step_id: None | str | Unset + if isinstance(self.step_id, Unset): + step_id = UNSET + else: + step_id = self.step_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "step_type": step_type, + "user_input": user_input, + } + ) + if agent_steps is not UNSET: + field_dict["agent_steps"] = agent_steps + if current_config is not UNSET: + field_dict["current_config"] = current_config + if step_id is not UNSET: + field_dict["step_id"] = step_id + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.generate_step_config_request_agent_steps_type_0_item import ( + GenerateStepConfigRequestAgentStepsType0Item, + ) + from ..models.generate_step_config_request_current_config_type_0 import ( + GenerateStepConfigRequestCurrentConfigType0, + ) + + d = dict(src_dict) + step_type = d.pop("step_type") + + user_input = d.pop("user_input") + + def _parse_agent_steps( + data: object, + ) -> list[GenerateStepConfigRequestAgentStepsType0Item] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + agent_steps_type_0 = [] + _agent_steps_type_0 = data + for agent_steps_type_0_item_data in _agent_steps_type_0: + agent_steps_type_0_item = ( + GenerateStepConfigRequestAgentStepsType0Item.from_dict( + agent_steps_type_0_item_data + ) + ) + + agent_steps_type_0.append(agent_steps_type_0_item) + + return agent_steps_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + list[GenerateStepConfigRequestAgentStepsType0Item] | None | Unset, data + ) + + agent_steps = _parse_agent_steps(d.pop("agent_steps", UNSET)) + + def _parse_current_config( + data: object, + ) -> GenerateStepConfigRequestCurrentConfigType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + current_config_type_0 = ( + GenerateStepConfigRequestCurrentConfigType0.from_dict(data) + ) + + return current_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + GenerateStepConfigRequestCurrentConfigType0 | None | Unset, data + ) + + current_config = _parse_current_config(d.pop("current_config", UNSET)) + + def _parse_step_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + step_id = _parse_step_id(d.pop("step_id", UNSET)) + + generate_step_config_request = cls( + step_type=step_type, + user_input=user_input, + agent_steps=agent_steps, + current_config=current_config, + step_id=step_id, + ) + + generate_step_config_request.additional_properties = d + return generate_step_config_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/generate_step_config_request_agent_steps_type_0_item.py b/seclai/_generated/models/generate_step_config_request_agent_steps_type_0_item.py new file mode 100644 index 0000000..e0878d6 --- /dev/null +++ b/seclai/_generated/models/generate_step_config_request_agent_steps_type_0_item.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="GenerateStepConfigRequestAgentStepsType0Item") + + +@_attrs_define +class GenerateStepConfigRequestAgentStepsType0Item: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + generate_step_config_request_agent_steps_type_0_item = cls() + + generate_step_config_request_agent_steps_type_0_item.additional_properties = d + return generate_step_config_request_agent_steps_type_0_item + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/generate_step_config_request_current_config_type_0.py b/seclai/_generated/models/generate_step_config_request_current_config_type_0.py new file mode 100644 index 0000000..f01a11e --- /dev/null +++ b/seclai/_generated/models/generate_step_config_request_current_config_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="GenerateStepConfigRequestCurrentConfigType0") + + +@_attrs_define +class GenerateStepConfigRequestCurrentConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + generate_step_config_request_current_config_type_0 = cls() + + generate_step_config_request_current_config_type_0.additional_properties = d + return generate_step_config_request_current_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/generate_step_config_response.py b/seclai/_generated/models/generate_step_config_response.py new file mode 100644 index 0000000..8459ef5 --- /dev/null +++ b/seclai/_generated/models/generate_step_config_response.py @@ -0,0 +1,168 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.example_prompt import ExamplePrompt + from ..models.generate_step_config_response_resulting_config_type_0 import ( + GenerateStepConfigResponseResultingConfigType0, + ) + + +T = TypeVar("T", bound="GenerateStepConfigResponse") + + +@_attrs_define +class GenerateStepConfigResponse: + """ + Attributes: + conversation_id (str): Conversation turn ID for tracking. + note (str): AI explanation of the proposed configuration. + step_type (str): The step type that was generated. + success (bool): Whether a valid configuration was generated. + example_prompts (list[ExamplePrompt] | Unset): Example natural-language prompts that demonstrate the + capabilities of this AI assistant for the given step type. + resulting_config (GenerateStepConfigResponseResultingConfigType0 | None | Unset): The proposed step + configuration. + """ + + conversation_id: str + note: str + step_type: str + success: bool + example_prompts: list[ExamplePrompt] | Unset = UNSET + resulting_config: GenerateStepConfigResponseResultingConfigType0 | None | Unset = ( + UNSET + ) + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.generate_step_config_response_resulting_config_type_0 import ( + GenerateStepConfigResponseResultingConfigType0, + ) + + conversation_id = self.conversation_id + + note = self.note + + step_type = self.step_type + + success = self.success + + example_prompts: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.example_prompts, Unset): + example_prompts = [] + for example_prompts_item_data in self.example_prompts: + example_prompts_item = example_prompts_item_data.to_dict() + example_prompts.append(example_prompts_item) + + resulting_config: dict[str, Any] | None | Unset + if isinstance(self.resulting_config, Unset): + resulting_config = UNSET + elif isinstance( + self.resulting_config, GenerateStepConfigResponseResultingConfigType0 + ): + resulting_config = self.resulting_config.to_dict() + else: + resulting_config = self.resulting_config + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "conversation_id": conversation_id, + "note": note, + "step_type": step_type, + "success": success, + } + ) + if example_prompts is not UNSET: + field_dict["example_prompts"] = example_prompts + if resulting_config is not UNSET: + field_dict["resulting_config"] = resulting_config + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.example_prompt import ExamplePrompt + from ..models.generate_step_config_response_resulting_config_type_0 import ( + GenerateStepConfigResponseResultingConfigType0, + ) + + d = dict(src_dict) + conversation_id = d.pop("conversation_id") + + note = d.pop("note") + + step_type = d.pop("step_type") + + success = d.pop("success") + + _example_prompts = d.pop("example_prompts", UNSET) + example_prompts: list[ExamplePrompt] | Unset = UNSET + if _example_prompts is not UNSET: + example_prompts = [] + for example_prompts_item_data in _example_prompts: + example_prompts_item = ExamplePrompt.from_dict( + example_prompts_item_data + ) + + example_prompts.append(example_prompts_item) + + def _parse_resulting_config( + data: object, + ) -> GenerateStepConfigResponseResultingConfigType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + resulting_config_type_0 = ( + GenerateStepConfigResponseResultingConfigType0.from_dict(data) + ) + + return resulting_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + GenerateStepConfigResponseResultingConfigType0 | None | Unset, data + ) + + resulting_config = _parse_resulting_config(d.pop("resulting_config", UNSET)) + + generate_step_config_response = cls( + conversation_id=conversation_id, + note=note, + step_type=step_type, + success=success, + example_prompts=example_prompts, + resulting_config=resulting_config, + ) + + generate_step_config_response.additional_properties = d + return generate_step_config_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/generate_step_config_response_resulting_config_type_0.py b/seclai/_generated/models/generate_step_config_response_resulting_config_type_0.py new file mode 100644 index 0000000..20497e6 --- /dev/null +++ b/seclai/_generated/models/generate_step_config_response_resulting_config_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="GenerateStepConfigResponseResultingConfigType0") + + +@_attrs_define +class GenerateStepConfigResponseResultingConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + generate_step_config_response_resulting_config_type_0 = cls() + + generate_step_config_response_resulting_config_type_0.additional_properties = d + return generate_step_config_response_resulting_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get_response_200_item.py b/seclai/_generated/models/get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get_response_200_item.py new file mode 100644 index 0000000..380c824 --- /dev/null +++ b/seclai/_generated/models/get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get_response_200_item.py @@ -0,0 +1,52 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", bound="GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item" +) + + +@_attrs_define +class GetAgentsUsingBankApiMemoryBanksMemoryBankIdAgentsGetResponse200Item: + """ """ + + additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get_response_200_item = ( + cls() + ) + + get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get_response_200_item.additional_properties = ( + d + ) + return get_agents_using_bank_api_memory_banks_memory_bank_id_agents_get_response_200_item + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> str: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: str) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/get_alert_config_api_alerts_configs_config_id_get_response_get_alert_config_api_alerts_configs_config_id_get.py b/seclai/_generated/models/get_alert_config_api_alerts_configs_config_id_get_response_get_alert_config_api_alerts_configs_config_id_get.py new file mode 100644 index 0000000..8c0c481 --- /dev/null +++ b/seclai/_generated/models/get_alert_config_api_alerts_configs_config_id_get_response_get_alert_config_api_alerts_configs_config_id_get.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet", +) + + +@_attrs_define +class GetAlertConfigApiAlertsConfigsConfigIdGetResponseGetAlertConfigApiAlertsConfigsConfigIdGet: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + get_alert_config_api_alerts_configs_config_id_get_response_get_alert_config_api_alerts_configs_config_id_get = ( + cls() + ) + + get_alert_config_api_alerts_configs_config_id_get_response_get_alert_config_api_alerts_configs_config_id_get.additional_properties = ( + d + ) + return get_alert_config_api_alerts_configs_config_id_get_response_get_alert_config_api_alerts_configs_config_id_get + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/get_alert_detail_api_alerts_alert_id_get_response_get_alert_detail_api_alerts_alert_id_get.py b/seclai/_generated/models/get_alert_detail_api_alerts_alert_id_get_response_get_alert_detail_api_alerts_alert_id_get.py new file mode 100644 index 0000000..459db9a --- /dev/null +++ b/seclai/_generated/models/get_alert_detail_api_alerts_alert_id_get_response_get_alert_detail_api_alerts_alert_id_get.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet", +) + + +@_attrs_define +class GetAlertDetailApiAlertsAlertIdGetResponseGetAlertDetailApiAlertsAlertIdGet: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + get_alert_detail_api_alerts_alert_id_get_response_get_alert_detail_api_alerts_alert_id_get = ( + cls() + ) + + get_alert_detail_api_alerts_alert_id_get_response_get_alert_detail_api_alerts_alert_id_get.additional_properties = ( + d + ) + return get_alert_detail_api_alerts_alert_id_get_response_get_alert_detail_api_alerts_alert_id_get + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/get_alert_unread_count_api_models_alerts_unread_count_get_response_get_alert_unread_count_api_models_alerts_unread_count_get.py b/seclai/_generated/models/get_alert_unread_count_api_models_alerts_unread_count_get_response_get_alert_unread_count_api_models_alerts_unread_count_get.py new file mode 100644 index 0000000..856460c --- /dev/null +++ b/seclai/_generated/models/get_alert_unread_count_api_models_alerts_unread_count_get_response_get_alert_unread_count_api_models_alerts_unread_count_get.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet", +) + + +@_attrs_define +class GetAlertUnreadCountApiModelsAlertsUnreadCountGetResponseGetAlertUnreadCountApiModelsAlertsUnreadCountGet: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + get_alert_unread_count_api_models_alerts_unread_count_get_response_get_alert_unread_count_api_models_alerts_unread_count_get = ( + cls() + ) + + get_alert_unread_count_api_models_alerts_unread_count_get_response_get_alert_unread_count_api_models_alerts_unread_count_get.additional_properties = ( + d + ) + return get_alert_unread_count_api_models_alerts_unread_count_get_response_get_alert_unread_count_api_models_alerts_unread_count_get + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get_response_get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get.py b/seclai/_generated/models/get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get_response_get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get.py new file mode 100644 index 0000000..ca17f73 --- /dev/null +++ b/seclai/_generated/models/get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get_response_get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet", +) + + +@_attrs_define +class GetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGetResponseGetMemoryBankEntryStatsApiMemoryBanksMemoryBankIdStatsGet: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get_response_get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get = ( + cls() + ) + + get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get_response_get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get.additional_properties = ( + d + ) + return get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get_response_get_memory_bank_entry_stats_api_memory_banks_memory_bank_id_stats_get + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/get_recommendations_api_models_model_id_recommendations_get_response_get_recommendations_api_models_model_id_recommendations_get.py b/seclai/_generated/models/get_recommendations_api_models_model_id_recommendations_get_response_get_recommendations_api_models_model_id_recommendations_get.py new file mode 100644 index 0000000..ed5a92b --- /dev/null +++ b/seclai/_generated/models/get_recommendations_api_models_model_id_recommendations_get_response_get_recommendations_api_models_model_id_recommendations_get.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet", +) + + +@_attrs_define +class GetRecommendationsApiModelsModelIdRecommendationsGetResponseGetRecommendationsApiModelsModelIdRecommendationsGet: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + get_recommendations_api_models_model_id_recommendations_get_response_get_recommendations_api_models_model_id_recommendations_get = ( + cls() + ) + + get_recommendations_api_models_model_id_recommendations_get_response_get_recommendations_api_models_model_id_recommendations_get.additional_properties = ( + d + ) + return get_recommendations_api_models_model_id_recommendations_get_response_get_recommendations_api_models_model_id_recommendations_get + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/governance_ai_accept_response.py b/seclai/_generated/models/governance_ai_accept_response.py new file mode 100644 index 0000000..19323d5 --- /dev/null +++ b/seclai/_generated/models/governance_ai_accept_response.py @@ -0,0 +1,116 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.applied_action_response import AppliedActionResponse + + +T = TypeVar("T", bound="GovernanceAiAcceptResponse") + + +@_attrs_define +class GovernanceAiAcceptResponse: + """Response from accepting a governance AI assistant plan. + + Attributes: + actions_applied (list[AppliedActionResponse]): Results of each action that was executed. + conversation_id (str): Conversation ID that was accepted. + success (bool): Whether all actions were applied successfully. + error (None | str | Unset): Overall error message if the plan failed, or null. + """ + + actions_applied: list[AppliedActionResponse] + conversation_id: str + success: bool + error: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + actions_applied = [] + for actions_applied_item_data in self.actions_applied: + actions_applied_item = actions_applied_item_data.to_dict() + actions_applied.append(actions_applied_item) + + conversation_id = self.conversation_id + + success = self.success + + error: None | str | Unset + if isinstance(self.error, Unset): + error = UNSET + else: + error = self.error + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "actions_applied": actions_applied, + "conversation_id": conversation_id, + "success": success, + } + ) + if error is not UNSET: + field_dict["error"] = error + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.applied_action_response import AppliedActionResponse + + d = dict(src_dict) + actions_applied = [] + _actions_applied = d.pop("actions_applied") + for actions_applied_item_data in _actions_applied: + actions_applied_item = AppliedActionResponse.from_dict( + actions_applied_item_data + ) + + actions_applied.append(actions_applied_item) + + conversation_id = d.pop("conversation_id") + + success = d.pop("success") + + def _parse_error(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + error = _parse_error(d.pop("error", UNSET)) + + governance_ai_accept_response = cls( + actions_applied=actions_applied, + conversation_id=conversation_id, + success=success, + error=error, + ) + + governance_ai_accept_response.additional_properties = d + return governance_ai_accept_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/governance_ai_assistant_request.py b/seclai/_generated/models/governance_ai_assistant_request.py new file mode 100644 index 0000000..89edb06 --- /dev/null +++ b/seclai/_generated/models/governance_ai_assistant_request.py @@ -0,0 +1,62 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="GovernanceAiAssistantRequest") + + +@_attrs_define +class GovernanceAiAssistantRequest: + """Request body for the governance AI assistant. + + Attributes: + user_input (str): Natural-language request for the governance AI assistant. + """ + + user_input: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + user_input = self.user_input + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "user_input": user_input, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + user_input = d.pop("user_input") + + governance_ai_assistant_request = cls( + user_input=user_input, + ) + + governance_ai_assistant_request.additional_properties = d + return governance_ai_assistant_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/governance_ai_assistant_response.py b/seclai/_generated/models/governance_ai_assistant_response.py new file mode 100644 index 0000000..6cf38d3 --- /dev/null +++ b/seclai/_generated/models/governance_ai_assistant_response.py @@ -0,0 +1,153 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.example_prompt import ExamplePrompt + from ..models.proposed_policy_action_response import ProposedPolicyActionResponse + + +T = TypeVar("T", bound="GovernanceAiAssistantResponse") + + +@_attrs_define +class GovernanceAiAssistantResponse: + """Response from the governance AI assistant generate endpoint. + + Attributes: + conversation_id (str): Conversation ID to accept or decline this plan. + note (str): AI-generated summary of the proposed changes. + proposed_actions (list[ProposedPolicyActionResponse]): Ordered list of policy actions the AI proposes to + execute. + success (bool): Whether the plan was generated successfully. + example_prompts (list[ExamplePrompt] | Unset): Example natural-language prompts that demonstrate the + capabilities of the governance AI assistant. + prompt_call_id (None | str | Unset): Prompt call ID for credit tracking, or null. + """ + + conversation_id: str + note: str + proposed_actions: list[ProposedPolicyActionResponse] + success: bool + example_prompts: list[ExamplePrompt] | Unset = UNSET + prompt_call_id: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + conversation_id = self.conversation_id + + note = self.note + + proposed_actions = [] + for proposed_actions_item_data in self.proposed_actions: + proposed_actions_item = proposed_actions_item_data.to_dict() + proposed_actions.append(proposed_actions_item) + + success = self.success + + example_prompts: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.example_prompts, Unset): + example_prompts = [] + for example_prompts_item_data in self.example_prompts: + example_prompts_item = example_prompts_item_data.to_dict() + example_prompts.append(example_prompts_item) + + prompt_call_id: None | str | Unset + if isinstance(self.prompt_call_id, Unset): + prompt_call_id = UNSET + else: + prompt_call_id = self.prompt_call_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "conversation_id": conversation_id, + "note": note, + "proposed_actions": proposed_actions, + "success": success, + } + ) + if example_prompts is not UNSET: + field_dict["example_prompts"] = example_prompts + if prompt_call_id is not UNSET: + field_dict["prompt_call_id"] = prompt_call_id + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.example_prompt import ExamplePrompt + from ..models.proposed_policy_action_response import ( + ProposedPolicyActionResponse, + ) + + d = dict(src_dict) + conversation_id = d.pop("conversation_id") + + note = d.pop("note") + + proposed_actions = [] + _proposed_actions = d.pop("proposed_actions") + for proposed_actions_item_data in _proposed_actions: + proposed_actions_item = ProposedPolicyActionResponse.from_dict( + proposed_actions_item_data + ) + + proposed_actions.append(proposed_actions_item) + + success = d.pop("success") + + _example_prompts = d.pop("example_prompts", UNSET) + example_prompts: list[ExamplePrompt] | Unset = UNSET + if _example_prompts is not UNSET: + example_prompts = [] + for example_prompts_item_data in _example_prompts: + example_prompts_item = ExamplePrompt.from_dict( + example_prompts_item_data + ) + + example_prompts.append(example_prompts_item) + + def _parse_prompt_call_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + prompt_call_id = _parse_prompt_call_id(d.pop("prompt_call_id", UNSET)) + + governance_ai_assistant_response = cls( + conversation_id=conversation_id, + note=note, + proposed_actions=proposed_actions, + success=success, + example_prompts=example_prompts, + prompt_call_id=prompt_call_id, + ) + + governance_ai_assistant_response.additional_properties = d + return governance_ai_assistant_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/governance_conversation_response.py b/seclai/_generated/models/governance_conversation_response.py new file mode 100644 index 0000000..818faa7 --- /dev/null +++ b/seclai/_generated/models/governance_conversation_response.py @@ -0,0 +1,152 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.governance_conversation_response_proposed_actions_type_0 import ( + GovernanceConversationResponseProposedActionsType0, + ) + + +T = TypeVar("T", bound="GovernanceConversationResponse") + + +@_attrs_define +class GovernanceConversationResponse: + """A governance AI assistant conversation entry. + + Attributes: + accepted (bool | None): True if accepted, false if declined, null if pending. + ai_response (None | str): The AI assistant's response note, or null. + created_at (str): ISO 8601 creation timestamp. + id (str): Conversation ID. + proposed_actions (GovernanceConversationResponseProposedActionsType0 | None): JSON of proposed actions, or null. + user_input (str): The original user request. + """ + + accepted: bool | None + ai_response: None | str + created_at: str + id: str + proposed_actions: GovernanceConversationResponseProposedActionsType0 | None + user_input: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.governance_conversation_response_proposed_actions_type_0 import ( + GovernanceConversationResponseProposedActionsType0, + ) + + accepted: bool | None + accepted = self.accepted + + ai_response: None | str + ai_response = self.ai_response + + created_at = self.created_at + + id = self.id + + proposed_actions: dict[str, Any] | None + if isinstance( + self.proposed_actions, GovernanceConversationResponseProposedActionsType0 + ): + proposed_actions = self.proposed_actions.to_dict() + else: + proposed_actions = self.proposed_actions + + user_input = self.user_input + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "accepted": accepted, + "ai_response": ai_response, + "created_at": created_at, + "id": id, + "proposed_actions": proposed_actions, + "user_input": user_input, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.governance_conversation_response_proposed_actions_type_0 import ( + GovernanceConversationResponseProposedActionsType0, + ) + + d = dict(src_dict) + + def _parse_accepted(data: object) -> bool | None: + if data is None: + return data + return cast(bool | None, data) + + accepted = _parse_accepted(d.pop("accepted")) + + def _parse_ai_response(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + ai_response = _parse_ai_response(d.pop("ai_response")) + + created_at = d.pop("created_at") + + id = d.pop("id") + + def _parse_proposed_actions( + data: object, + ) -> GovernanceConversationResponseProposedActionsType0 | None: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + proposed_actions_type_0 = ( + GovernanceConversationResponseProposedActionsType0.from_dict(data) + ) + + return proposed_actions_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(GovernanceConversationResponseProposedActionsType0 | None, data) + + proposed_actions = _parse_proposed_actions(d.pop("proposed_actions")) + + user_input = d.pop("user_input") + + governance_conversation_response = cls( + accepted=accepted, + ai_response=ai_response, + created_at=created_at, + id=id, + proposed_actions=proposed_actions, + user_input=user_input, + ) + + governance_conversation_response.additional_properties = d + return governance_conversation_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/governance_conversation_response_proposed_actions_type_0.py b/seclai/_generated/models/governance_conversation_response_proposed_actions_type_0.py new file mode 100644 index 0000000..b6f23c5 --- /dev/null +++ b/seclai/_generated/models/governance_conversation_response_proposed_actions_type_0.py @@ -0,0 +1,48 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="GovernanceConversationResponseProposedActionsType0") + + +@_attrs_define +class GovernanceConversationResponseProposedActionsType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + governance_conversation_response_proposed_actions_type_0 = cls() + + governance_conversation_response_proposed_actions_type_0.additional_properties = ( + d + ) + return governance_conversation_response_proposed_actions_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/inline_text_replace_request.py b/seclai/_generated/models/inline_text_replace_request.py new file mode 100644 index 0000000..e47e25c --- /dev/null +++ b/seclai/_generated/models/inline_text_replace_request.py @@ -0,0 +1,150 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.inline_text_replace_request_metadata_type_0 import ( + InlineTextReplaceRequestMetadataType0, + ) + + +T = TypeVar("T", bound="InlineTextReplaceRequest") + + +@_attrs_define +class InlineTextReplaceRequest: + """Request model for inline text content replacement. + + Attributes: + text (str): Text content to upload + content_type (None | str | Unset): MIME type for the text content Default: 'text/plain'. + metadata (InlineTextReplaceRequestMetadataType0 | None | Unset): Optional metadata object + title (None | str | Unset): Optional title + """ + + text: str + content_type: None | str | Unset = "text/plain" + metadata: InlineTextReplaceRequestMetadataType0 | None | Unset = UNSET + title: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.inline_text_replace_request_metadata_type_0 import ( + InlineTextReplaceRequestMetadataType0, + ) + + text = self.text + + content_type: None | str | Unset + if isinstance(self.content_type, Unset): + content_type = UNSET + else: + content_type = self.content_type + + metadata: dict[str, Any] | None | Unset + if isinstance(self.metadata, Unset): + metadata = UNSET + elif isinstance(self.metadata, InlineTextReplaceRequestMetadataType0): + metadata = self.metadata.to_dict() + else: + metadata = self.metadata + + title: None | str | Unset + if isinstance(self.title, Unset): + title = UNSET + else: + title = self.title + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "text": text, + } + ) + if content_type is not UNSET: + field_dict["content_type"] = content_type + if metadata is not UNSET: + field_dict["metadata"] = metadata + if title is not UNSET: + field_dict["title"] = title + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.inline_text_replace_request_metadata_type_0 import ( + InlineTextReplaceRequestMetadataType0, + ) + + d = dict(src_dict) + text = d.pop("text") + + def _parse_content_type(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + content_type = _parse_content_type(d.pop("content_type", UNSET)) + + def _parse_metadata( + data: object, + ) -> InlineTextReplaceRequestMetadataType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + metadata_type_0 = InlineTextReplaceRequestMetadataType0.from_dict(data) + + return metadata_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(InlineTextReplaceRequestMetadataType0 | None | Unset, data) + + metadata = _parse_metadata(d.pop("metadata", UNSET)) + + def _parse_title(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + title = _parse_title(d.pop("title", UNSET)) + + inline_text_replace_request = cls( + text=text, + content_type=content_type, + metadata=metadata, + title=title, + ) + + inline_text_replace_request.additional_properties = d + return inline_text_replace_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/inline_text_replace_request_metadata_type_0.py b/seclai/_generated/models/inline_text_replace_request_metadata_type_0.py new file mode 100644 index 0000000..927d87f --- /dev/null +++ b/seclai/_generated/models/inline_text_replace_request_metadata_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="InlineTextReplaceRequestMetadataType0") + + +@_attrs_define +class InlineTextReplaceRequestMetadataType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + inline_text_replace_request_metadata_type_0 = cls() + + inline_text_replace_request_metadata_type_0.additional_properties = d + return inline_text_replace_request_metadata_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/inline_text_upload_request.py b/seclai/_generated/models/inline_text_upload_request.py new file mode 100644 index 0000000..64f19db --- /dev/null +++ b/seclai/_generated/models/inline_text_upload_request.py @@ -0,0 +1,150 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.inline_text_upload_request_metadata_type_0 import ( + InlineTextUploadRequestMetadataType0, + ) + + +T = TypeVar("T", bound="InlineTextUploadRequest") + + +@_attrs_define +class InlineTextUploadRequest: + """Request model for inline text uploads. + + Attributes: + text (str): Text content to upload + content_type (None | str | Unset): MIME type for the text content Default: 'text/plain'. + metadata (InlineTextUploadRequestMetadataType0 | None | Unset): Optional metadata object + title (None | str | Unset): Optional title + """ + + text: str + content_type: None | str | Unset = "text/plain" + metadata: InlineTextUploadRequestMetadataType0 | None | Unset = UNSET + title: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.inline_text_upload_request_metadata_type_0 import ( + InlineTextUploadRequestMetadataType0, + ) + + text = self.text + + content_type: None | str | Unset + if isinstance(self.content_type, Unset): + content_type = UNSET + else: + content_type = self.content_type + + metadata: dict[str, Any] | None | Unset + if isinstance(self.metadata, Unset): + metadata = UNSET + elif isinstance(self.metadata, InlineTextUploadRequestMetadataType0): + metadata = self.metadata.to_dict() + else: + metadata = self.metadata + + title: None | str | Unset + if isinstance(self.title, Unset): + title = UNSET + else: + title = self.title + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "text": text, + } + ) + if content_type is not UNSET: + field_dict["content_type"] = content_type + if metadata is not UNSET: + field_dict["metadata"] = metadata + if title is not UNSET: + field_dict["title"] = title + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.inline_text_upload_request_metadata_type_0 import ( + InlineTextUploadRequestMetadataType0, + ) + + d = dict(src_dict) + text = d.pop("text") + + def _parse_content_type(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + content_type = _parse_content_type(d.pop("content_type", UNSET)) + + def _parse_metadata( + data: object, + ) -> InlineTextUploadRequestMetadataType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + metadata_type_0 = InlineTextUploadRequestMetadataType0.from_dict(data) + + return metadata_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(InlineTextUploadRequestMetadataType0 | None | Unset, data) + + metadata = _parse_metadata(d.pop("metadata", UNSET)) + + def _parse_title(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + title = _parse_title(d.pop("title", UNSET)) + + inline_text_upload_request = cls( + text=text, + content_type=content_type, + metadata=metadata, + title=title, + ) + + inline_text_upload_request.additional_properties = d + return inline_text_upload_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/inline_text_upload_request_metadata_type_0.py b/seclai/_generated/models/inline_text_upload_request_metadata_type_0.py new file mode 100644 index 0000000..1d33a4f --- /dev/null +++ b/seclai/_generated/models/inline_text_upload_request_metadata_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="InlineTextUploadRequestMetadataType0") + + +@_attrs_define +class InlineTextUploadRequestMetadataType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + inline_text_upload_request_metadata_type_0 = cls() + + inline_text_upload_request_metadata_type_0.additional_properties = d + return inline_text_upload_request_metadata_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/knowledge_base.py b/seclai/_generated/models/knowledge_base.py new file mode 100644 index 0000000..a2dfc00 --- /dev/null +++ b/seclai/_generated/models/knowledge_base.py @@ -0,0 +1,230 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.source_connection_response_model import SourceConnectionResponseModel + + +T = TypeVar("T", bound="KnowledgeBase") + + +@_attrs_define +class KnowledgeBase: + """Response model for a single knowledge base. + + Attributes: + created_at (str): ISO-8601 creation timestamp. + id (str): Unique knowledge base identifier. + name (str): Human-readable name. + updated_at (str): ISO-8601 last-update timestamp. + default_score_threshold (float | None | Unset): Default minimum rerank score. + default_top_k (int | None | Unset): Default results after reranking. + default_top_n (int | None | Unset): Default number of results to return. + description (None | str | Unset): Optional description. + readonly (bool | Unset): Whether the knowledge base is read-only. Default: False. + reranker_model (None | str | Unset): Reranker model in use. + sources (list[SourceConnectionResponseModel] | Unset): Linked source connections. + """ + + created_at: str + id: str + name: str + updated_at: str + default_score_threshold: float | None | Unset = UNSET + default_top_k: int | None | Unset = UNSET + default_top_n: int | None | Unset = UNSET + description: None | str | Unset = UNSET + readonly: bool | Unset = False + reranker_model: None | str | Unset = UNSET + sources: list[SourceConnectionResponseModel] | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + created_at = self.created_at + + id = self.id + + name = self.name + + updated_at = self.updated_at + + default_score_threshold: float | None | Unset + if isinstance(self.default_score_threshold, Unset): + default_score_threshold = UNSET + else: + default_score_threshold = self.default_score_threshold + + default_top_k: int | None | Unset + if isinstance(self.default_top_k, Unset): + default_top_k = UNSET + else: + default_top_k = self.default_top_k + + default_top_n: int | None | Unset + if isinstance(self.default_top_n, Unset): + default_top_n = UNSET + else: + default_top_n = self.default_top_n + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + readonly = self.readonly + + reranker_model: None | str | Unset + if isinstance(self.reranker_model, Unset): + reranker_model = UNSET + else: + reranker_model = self.reranker_model + + sources: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.sources, Unset): + sources = [] + for sources_item_data in self.sources: + sources_item = sources_item_data.to_dict() + sources.append(sources_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "created_at": created_at, + "id": id, + "name": name, + "updated_at": updated_at, + } + ) + if default_score_threshold is not UNSET: + field_dict["default_score_threshold"] = default_score_threshold + if default_top_k is not UNSET: + field_dict["default_top_k"] = default_top_k + if default_top_n is not UNSET: + field_dict["default_top_n"] = default_top_n + if description is not UNSET: + field_dict["description"] = description + if readonly is not UNSET: + field_dict["readonly"] = readonly + if reranker_model is not UNSET: + field_dict["reranker_model"] = reranker_model + if sources is not UNSET: + field_dict["sources"] = sources + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.source_connection_response_model import ( + SourceConnectionResponseModel, + ) + + d = dict(src_dict) + created_at = d.pop("created_at") + + id = d.pop("id") + + name = d.pop("name") + + updated_at = d.pop("updated_at") + + def _parse_default_score_threshold(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + default_score_threshold = _parse_default_score_threshold( + d.pop("default_score_threshold", UNSET) + ) + + def _parse_default_top_k(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + default_top_k = _parse_default_top_k(d.pop("default_top_k", UNSET)) + + def _parse_default_top_n(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + default_top_n = _parse_default_top_n(d.pop("default_top_n", UNSET)) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + readonly = d.pop("readonly", UNSET) + + def _parse_reranker_model(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + reranker_model = _parse_reranker_model(d.pop("reranker_model", UNSET)) + + _sources = d.pop("sources", UNSET) + sources: list[SourceConnectionResponseModel] | Unset = UNSET + if _sources is not UNSET: + sources = [] + for sources_item_data in _sources: + sources_item = SourceConnectionResponseModel.from_dict( + sources_item_data + ) + + sources.append(sources_item) + + knowledge_base = cls( + created_at=created_at, + id=id, + name=name, + updated_at=updated_at, + default_score_threshold=default_score_threshold, + default_top_k=default_top_k, + default_top_n=default_top_n, + description=description, + readonly=readonly, + reranker_model=reranker_model, + sources=sources, + ) + + knowledge_base.additional_properties = d + return knowledge_base + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/knowledge_base_list_response_model.py b/seclai/_generated/models/knowledge_base_list_response_model.py new file mode 100644 index 0000000..b2936b5 --- /dev/null +++ b/seclai/_generated/models/knowledge_base_list_response_model.py @@ -0,0 +1,100 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.knowledge_base import KnowledgeBase + + +T = TypeVar("T", bound="KnowledgeBaseListResponseModel") + + +@_attrs_define +class KnowledgeBaseListResponseModel: + """Paginated list of knowledge bases. + + Attributes: + knowledge_bases (list[KnowledgeBase]): List of knowledge bases on this page. + limit (int): Items per page. + page (int): Current page number (1-based). + total (int): Total number of knowledge bases. + """ + + knowledge_bases: list[KnowledgeBase] + limit: int + page: int + total: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + knowledge_bases = [] + for knowledge_bases_item_data in self.knowledge_bases: + knowledge_bases_item = knowledge_bases_item_data.to_dict() + knowledge_bases.append(knowledge_bases_item) + + limit = self.limit + + page = self.page + + total = self.total + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "knowledge_bases": knowledge_bases, + "limit": limit, + "page": page, + "total": total, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.knowledge_base import KnowledgeBase + + d = dict(src_dict) + knowledge_bases = [] + _knowledge_bases = d.pop("knowledge_bases") + for knowledge_bases_item_data in _knowledge_bases: + knowledge_bases_item = KnowledgeBase.from_dict(knowledge_bases_item_data) + + knowledge_bases.append(knowledge_bases_item) + + limit = d.pop("limit") + + page = d.pop("page") + + total = d.pop("total") + + knowledge_base_list_response_model = cls( + knowledge_bases=knowledge_bases, + limit=limit, + page=page, + total=total, + ) + + knowledge_base_list_response_model.additional_properties = d + return knowledge_base_list_response_model + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/link_resources_request.py b/seclai/_generated/models/link_resources_request.py new file mode 100644 index 0000000..0b3de03 --- /dev/null +++ b/seclai/_generated/models/link_resources_request.py @@ -0,0 +1,70 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="LinkResourcesRequest") + + +@_attrs_define +class LinkResourcesRequest: + """ + Attributes: + ids (list[UUID]): Resource IDs to link + """ + + ids: list[UUID] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + ids = [] + for ids_item_data in self.ids: + ids_item = str(ids_item_data) + ids.append(ids_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "ids": ids, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + ids = [] + _ids = d.pop("ids") + for ids_item_data in _ids: + ids_item = UUID(ids_item_data) + + ids.append(ids_item) + + link_resources_request = cls( + ids=ids, + ) + + link_resources_request.additional_properties = d + return link_resources_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/list_alert_configs_api_alerts_configs_get_response_list_alert_configs_api_alerts_configs_get.py b/seclai/_generated/models/list_alert_configs_api_alerts_configs_get_response_list_alert_configs_api_alerts_configs_get.py new file mode 100644 index 0000000..b893f24 --- /dev/null +++ b/seclai/_generated/models/list_alert_configs_api_alerts_configs_get_response_list_alert_configs_api_alerts_configs_get.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet", +) + + +@_attrs_define +class ListAlertConfigsApiAlertsConfigsGetResponseListAlertConfigsApiAlertsConfigsGet: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + list_alert_configs_api_alerts_configs_get_response_list_alert_configs_api_alerts_configs_get = ( + cls() + ) + + list_alert_configs_api_alerts_configs_get_response_list_alert_configs_api_alerts_configs_get.additional_properties = ( + d + ) + return list_alert_configs_api_alerts_configs_get_response_list_alert_configs_api_alerts_configs_get + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/list_alerts_api_alerts_get_response_list_alerts_api_alerts_get.py b/seclai/_generated/models/list_alerts_api_alerts_get_response_list_alerts_api_alerts_get.py new file mode 100644 index 0000000..6d6f55f --- /dev/null +++ b/seclai/_generated/models/list_alerts_api_alerts_get_response_list_alerts_api_alerts_get.py @@ -0,0 +1,48 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet") + + +@_attrs_define +class ListAlertsApiAlertsGetResponseListAlertsApiAlertsGet: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + list_alerts_api_alerts_get_response_list_alerts_api_alerts_get = cls() + + list_alerts_api_alerts_get_response_list_alerts_api_alerts_get.additional_properties = ( + d + ) + return list_alerts_api_alerts_get_response_list_alerts_api_alerts_get + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/list_alerts_api_models_alerts_get_response_list_alerts_api_models_alerts_get.py b/seclai/_generated/models/list_alerts_api_models_alerts_get_response_list_alerts_api_models_alerts_get.py new file mode 100644 index 0000000..27ab008 --- /dev/null +++ b/seclai/_generated/models/list_alerts_api_models_alerts_get_response_list_alerts_api_models_alerts_get.py @@ -0,0 +1,54 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", bound="ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet" +) + + +@_attrs_define +class ListAlertsApiModelsAlertsGetResponseListAlertsApiModelsAlertsGet: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + list_alerts_api_models_alerts_get_response_list_alerts_api_models_alerts_get = ( + cls() + ) + + list_alerts_api_models_alerts_get_response_list_alerts_api_models_alerts_get.additional_properties = ( + d + ) + return ( + list_alerts_api_models_alerts_get_response_list_alerts_api_models_alerts_get + ) + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/list_templates_api_memory_banks_templates_get_response_200_item.py b/seclai/_generated/models/list_templates_api_memory_banks_templates_get_response_200_item.py new file mode 100644 index 0000000..c11efc8 --- /dev/null +++ b/seclai/_generated/models/list_templates_api_memory_banks_templates_get_response_200_item.py @@ -0,0 +1,48 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ListTemplatesApiMemoryBanksTemplatesGetResponse200Item") + + +@_attrs_define +class ListTemplatesApiMemoryBanksTemplatesGetResponse200Item: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + list_templates_api_memory_banks_templates_get_response_200_item = cls() + + list_templates_api_memory_banks_templates_get_response_200_item.additional_properties = ( + d + ) + return list_templates_api_memory_banks_templates_get_response_200_item + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch_response_mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch.py b/seclai/_generated/models/mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch_response_mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch.py new file mode 100644 index 0000000..753f675 --- /dev/null +++ b/seclai/_generated/models/mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch_response_mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch", +) + + +@_attrs_define +class MarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatchResponseMarkAiSuggestionApiAgentsAgentIdAiAssistantConversationIdPatch: + """ """ + + additional_properties: dict[str, bool] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch_response_mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch = ( + cls() + ) + + mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch_response_mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch.additional_properties = ( + d + ) + return mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch_response_mark_ai_suggestion_api_agents_agent_id_ai_assistant_conversation_id_patch + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> bool: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: bool) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/mark_ai_suggestion_request.py b/seclai/_generated/models/mark_ai_suggestion_request.py new file mode 100644 index 0000000..6542bd2 --- /dev/null +++ b/seclai/_generated/models/mark_ai_suggestion_request.py @@ -0,0 +1,61 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="MarkAiSuggestionRequest") + + +@_attrs_define +class MarkAiSuggestionRequest: + """ + Attributes: + accepted (bool): True to accept the suggestion, false to decline it. + """ + + accepted: bool + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + accepted = self.accepted + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "accepted": accepted, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + accepted = d.pop("accepted") + + mark_ai_suggestion_request = cls( + accepted=accepted, + ) + + mark_ai_suggestion_request.additional_properties = d + return mark_ai_suggestion_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/mark_conversation_turn_request.py b/seclai/_generated/models/mark_conversation_turn_request.py new file mode 100644 index 0000000..e311978 --- /dev/null +++ b/seclai/_generated/models/mark_conversation_turn_request.py @@ -0,0 +1,61 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="MarkConversationTurnRequest") + + +@_attrs_define +class MarkConversationTurnRequest: + """ + Attributes: + accepted (bool): Whether the suggestion was accepted + """ + + accepted: bool + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + accepted = self.accepted + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "accepted": accepted, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + accepted = d.pop("accepted") + + mark_conversation_turn_request = cls( + accepted=accepted, + ) + + mark_conversation_turn_request.additional_properties = d + return mark_conversation_turn_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/me_response.py b/seclai/_generated/models/me_response.py new file mode 100644 index 0000000..00e8caa --- /dev/null +++ b/seclai/_generated/models/me_response.py @@ -0,0 +1,86 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.organization_info_response import OrganizationInfoResponse + + +T = TypeVar("T", bound="MeResponse") + + +@_attrs_define +class MeResponse: + """ + Attributes: + account_id (UUID): + organizations (list[OrganizationInfoResponse]): + """ + + account_id: UUID + organizations: list[OrganizationInfoResponse] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + account_id = str(self.account_id) + + organizations = [] + for organizations_item_data in self.organizations: + organizations_item = organizations_item_data.to_dict() + organizations.append(organizations_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "account_id": account_id, + "organizations": organizations, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.organization_info_response import OrganizationInfoResponse + + d = dict(src_dict) + account_id = UUID(d.pop("account_id")) + + organizations = [] + _organizations = d.pop("organizations") + for organizations_item_data in _organizations: + organizations_item = OrganizationInfoResponse.from_dict( + organizations_item_data + ) + + organizations.append(organizations_item) + + me_response = cls( + account_id=account_id, + organizations=organizations, + ) + + me_response.additional_properties = d + return me_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank.py b/seclai/_generated/models/memory_bank.py new file mode 100644 index 0000000..e420e28 --- /dev/null +++ b/seclai/_generated/models/memory_bank.py @@ -0,0 +1,330 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="MemoryBank") + + +@_attrs_define +class MemoryBank: + """Response model for a single memory bank. + + Attributes: + created_at (str): ISO-8601 creation timestamp. + id (str): Unique memory bank identifier. + mode (str): Embedding mode: fast_and_cheap, balanced, slow_and_thorough, or custom. + name (str): Human-readable name. + type_ (str): Bank type: conversation (chat-turn with speaker) or general (flat entries). + updated_at (str): ISO-8601 last-update timestamp. + chunk_overlap (int | None | Unset): Character overlap between chunks. + chunk_size (int | None | Unset): Characters per chunk. + compaction_prompt (None | str | Unset): Custom prompt used when compacting older entries. When set, entries that + exceed a threshold are summarized into a new entry before being soft-deleted. + description (None | str | Unset): Optional description of the memory bank's purpose. + dimensions (int | None | Unset): Vector embedding dimensions. + embedding_model (None | str | Unset): Embedding model identifier. + max_age_days (int | None | Unset): Max entry age in days before compaction. Checked both inline after each write + and by the hourly background sweep. + max_size_tokens (int | None | Unset): Max total tokens (per partition) before compaction. Checked both inline + after each write and by the hourly background sweep. + max_turns (int | None | Unset): Max conversation turns (per partition) before compaction. Checked both inline + after each write and by the hourly background sweep. + retention_days (int | None | Unset): Content retention period in days (null = indefinite). + source_connection_id (None | str | Unset): Linked content source ID (null if not yet provisioned). + """ + + created_at: str + id: str + mode: str + name: str + type_: str + updated_at: str + chunk_overlap: int | None | Unset = UNSET + chunk_size: int | None | Unset = UNSET + compaction_prompt: None | str | Unset = UNSET + description: None | str | Unset = UNSET + dimensions: int | None | Unset = UNSET + embedding_model: None | str | Unset = UNSET + max_age_days: int | None | Unset = UNSET + max_size_tokens: int | None | Unset = UNSET + max_turns: int | None | Unset = UNSET + retention_days: int | None | Unset = UNSET + source_connection_id: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + created_at = self.created_at + + id = self.id + + mode = self.mode + + name = self.name + + type_ = self.type_ + + updated_at = self.updated_at + + chunk_overlap: int | None | Unset + if isinstance(self.chunk_overlap, Unset): + chunk_overlap = UNSET + else: + chunk_overlap = self.chunk_overlap + + chunk_size: int | None | Unset + if isinstance(self.chunk_size, Unset): + chunk_size = UNSET + else: + chunk_size = self.chunk_size + + compaction_prompt: None | str | Unset + if isinstance(self.compaction_prompt, Unset): + compaction_prompt = UNSET + else: + compaction_prompt = self.compaction_prompt + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + dimensions: int | None | Unset + if isinstance(self.dimensions, Unset): + dimensions = UNSET + else: + dimensions = self.dimensions + + embedding_model: None | str | Unset + if isinstance(self.embedding_model, Unset): + embedding_model = UNSET + else: + embedding_model = self.embedding_model + + max_age_days: int | None | Unset + if isinstance(self.max_age_days, Unset): + max_age_days = UNSET + else: + max_age_days = self.max_age_days + + max_size_tokens: int | None | Unset + if isinstance(self.max_size_tokens, Unset): + max_size_tokens = UNSET + else: + max_size_tokens = self.max_size_tokens + + max_turns: int | None | Unset + if isinstance(self.max_turns, Unset): + max_turns = UNSET + else: + max_turns = self.max_turns + + retention_days: int | None | Unset + if isinstance(self.retention_days, Unset): + retention_days = UNSET + else: + retention_days = self.retention_days + + source_connection_id: None | str | Unset + if isinstance(self.source_connection_id, Unset): + source_connection_id = UNSET + else: + source_connection_id = self.source_connection_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "created_at": created_at, + "id": id, + "mode": mode, + "name": name, + "type": type_, + "updated_at": updated_at, + } + ) + if chunk_overlap is not UNSET: + field_dict["chunk_overlap"] = chunk_overlap + if chunk_size is not UNSET: + field_dict["chunk_size"] = chunk_size + if compaction_prompt is not UNSET: + field_dict["compaction_prompt"] = compaction_prompt + if description is not UNSET: + field_dict["description"] = description + if dimensions is not UNSET: + field_dict["dimensions"] = dimensions + if embedding_model is not UNSET: + field_dict["embedding_model"] = embedding_model + if max_age_days is not UNSET: + field_dict["max_age_days"] = max_age_days + if max_size_tokens is not UNSET: + field_dict["max_size_tokens"] = max_size_tokens + if max_turns is not UNSET: + field_dict["max_turns"] = max_turns + if retention_days is not UNSET: + field_dict["retention_days"] = retention_days + if source_connection_id is not UNSET: + field_dict["source_connection_id"] = source_connection_id + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + created_at = d.pop("created_at") + + id = d.pop("id") + + mode = d.pop("mode") + + name = d.pop("name") + + type_ = d.pop("type") + + updated_at = d.pop("updated_at") + + def _parse_chunk_overlap(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + chunk_overlap = _parse_chunk_overlap(d.pop("chunk_overlap", UNSET)) + + def _parse_chunk_size(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + chunk_size = _parse_chunk_size(d.pop("chunk_size", UNSET)) + + def _parse_compaction_prompt(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + compaction_prompt = _parse_compaction_prompt(d.pop("compaction_prompt", UNSET)) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_dimensions(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + dimensions = _parse_dimensions(d.pop("dimensions", UNSET)) + + def _parse_embedding_model(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + embedding_model = _parse_embedding_model(d.pop("embedding_model", UNSET)) + + def _parse_max_age_days(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_age_days = _parse_max_age_days(d.pop("max_age_days", UNSET)) + + def _parse_max_size_tokens(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_size_tokens = _parse_max_size_tokens(d.pop("max_size_tokens", UNSET)) + + def _parse_max_turns(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_turns = _parse_max_turns(d.pop("max_turns", UNSET)) + + def _parse_retention_days(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + retention_days = _parse_retention_days(d.pop("retention_days", UNSET)) + + def _parse_source_connection_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + source_connection_id = _parse_source_connection_id( + d.pop("source_connection_id", UNSET) + ) + + memory_bank = cls( + created_at=created_at, + id=id, + mode=mode, + name=name, + type_=type_, + updated_at=updated_at, + chunk_overlap=chunk_overlap, + chunk_size=chunk_size, + compaction_prompt=compaction_prompt, + description=description, + dimensions=dimensions, + embedding_model=embedding_model, + max_age_days=max_age_days, + max_size_tokens=max_size_tokens, + max_turns=max_turns, + retention_days=retention_days, + source_connection_id=source_connection_id, + ) + + memory_bank.additional_properties = d + return memory_bank + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank_accept_request.py b/seclai/_generated/models/memory_bank_accept_request.py new file mode 100644 index 0000000..30308a9 --- /dev/null +++ b/seclai/_generated/models/memory_bank_accept_request.py @@ -0,0 +1,62 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="MemoryBankAcceptRequest") + + +@_attrs_define +class MemoryBankAcceptRequest: + """Accept or decline a memory bank AI suggestion. + + Attributes: + accepted (bool): Whether the user accepted the proposed configuration. + """ + + accepted: bool + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + accepted = self.accepted + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "accepted": accepted, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + accepted = d.pop("accepted") + + memory_bank_accept_request = cls( + accepted=accepted, + ) + + memory_bank_accept_request.additional_properties = d + return memory_bank_accept_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch_response_memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch.py b/seclai/_generated/models/memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch_response_memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch.py new file mode 100644 index 0000000..60b49d8 --- /dev/null +++ b/seclai/_generated/models/memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch_response_memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch", +) + + +@_attrs_define +class MemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatchResponseMemoryBankAiAcceptApiMemoryBanksAiAssistantConversationIdPatch: + """ """ + + additional_properties: dict[str, bool] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch_response_memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch = ( + cls() + ) + + memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch_response_memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch.additional_properties = ( + d + ) + return memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch_response_memory_bank_ai_accept_api_memory_banks_ai_assistant_conversation_id_patch + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> bool: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: bool) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank_ai_assistant_request.py b/seclai/_generated/models/memory_bank_ai_assistant_request.py new file mode 100644 index 0000000..adacf0b --- /dev/null +++ b/seclai/_generated/models/memory_bank_ai_assistant_request.py @@ -0,0 +1,139 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.memory_bank_ai_assistant_request_current_config_type_0 import ( + MemoryBankAiAssistantRequestCurrentConfigType0, + ) + + +T = TypeVar("T", bound="MemoryBankAiAssistantRequest") + + +@_attrs_define +class MemoryBankAiAssistantRequest: + """Request body for the memory bank AI assistant. + + Attributes: + user_input (str): Natural-language description of the memory bank. + conversation_id (None | str | Unset): Previous conversation ID to continue. + current_config (MemoryBankAiAssistantRequestCurrentConfigType0 | None | Unset): Current configuration to refine, + if any. + """ + + user_input: str + conversation_id: None | str | Unset = UNSET + current_config: MemoryBankAiAssistantRequestCurrentConfigType0 | None | Unset = ( + UNSET + ) + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.memory_bank_ai_assistant_request_current_config_type_0 import ( + MemoryBankAiAssistantRequestCurrentConfigType0, + ) + + user_input = self.user_input + + conversation_id: None | str | Unset + if isinstance(self.conversation_id, Unset): + conversation_id = UNSET + else: + conversation_id = self.conversation_id + + current_config: dict[str, Any] | None | Unset + if isinstance(self.current_config, Unset): + current_config = UNSET + elif isinstance( + self.current_config, MemoryBankAiAssistantRequestCurrentConfigType0 + ): + current_config = self.current_config.to_dict() + else: + current_config = self.current_config + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "user_input": user_input, + } + ) + if conversation_id is not UNSET: + field_dict["conversation_id"] = conversation_id + if current_config is not UNSET: + field_dict["current_config"] = current_config + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.memory_bank_ai_assistant_request_current_config_type_0 import ( + MemoryBankAiAssistantRequestCurrentConfigType0, + ) + + d = dict(src_dict) + user_input = d.pop("user_input") + + def _parse_conversation_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + conversation_id = _parse_conversation_id(d.pop("conversation_id", UNSET)) + + def _parse_current_config( + data: object, + ) -> MemoryBankAiAssistantRequestCurrentConfigType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + current_config_type_0 = ( + MemoryBankAiAssistantRequestCurrentConfigType0.from_dict(data) + ) + + return current_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + MemoryBankAiAssistantRequestCurrentConfigType0 | None | Unset, data + ) + + current_config = _parse_current_config(d.pop("current_config", UNSET)) + + memory_bank_ai_assistant_request = cls( + user_input=user_input, + conversation_id=conversation_id, + current_config=current_config, + ) + + memory_bank_ai_assistant_request.additional_properties = d + return memory_bank_ai_assistant_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank_ai_assistant_request_current_config_type_0.py b/seclai/_generated/models/memory_bank_ai_assistant_request_current_config_type_0.py new file mode 100644 index 0000000..e33ab51 --- /dev/null +++ b/seclai/_generated/models/memory_bank_ai_assistant_request_current_config_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="MemoryBankAiAssistantRequestCurrentConfigType0") + + +@_attrs_define +class MemoryBankAiAssistantRequestCurrentConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + memory_bank_ai_assistant_request_current_config_type_0 = cls() + + memory_bank_ai_assistant_request_current_config_type_0.additional_properties = d + return memory_bank_ai_assistant_request_current_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank_ai_assistant_response.py b/seclai/_generated/models/memory_bank_ai_assistant_response.py new file mode 100644 index 0000000..586f602 --- /dev/null +++ b/seclai/_generated/models/memory_bank_ai_assistant_response.py @@ -0,0 +1,165 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.example_prompt import ExamplePrompt + from ..models.memory_bank_config_response import MemoryBankConfigResponse + + +T = TypeVar("T", bound="MemoryBankAiAssistantResponse") + + +@_attrs_define +class MemoryBankAiAssistantResponse: + """Response from the memory bank AI assistant. + + Attributes: + conversation_id (str): Conversation ID for follow-up. + note (str): AI-generated explanation. + config (MemoryBankConfigResponse | None | Unset): Proposed configuration, or null. + example_prompts (list[ExamplePrompt] | Unset): Example natural-language prompts that demonstrate the + capabilities of the memory bank AI assistant. + prompt_call_id (None | str | Unset): Prompt call ID for credit tracking. + success (bool | Unset): Whether generation succeeded. Default: False. + """ + + conversation_id: str + note: str + config: MemoryBankConfigResponse | None | Unset = UNSET + example_prompts: list[ExamplePrompt] | Unset = UNSET + prompt_call_id: None | str | Unset = UNSET + success: bool | Unset = False + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.memory_bank_config_response import MemoryBankConfigResponse + + conversation_id = self.conversation_id + + note = self.note + + config: dict[str, Any] | None | Unset + if isinstance(self.config, Unset): + config = UNSET + elif isinstance(self.config, MemoryBankConfigResponse): + config = self.config.to_dict() + else: + config = self.config + + example_prompts: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.example_prompts, Unset): + example_prompts = [] + for example_prompts_item_data in self.example_prompts: + example_prompts_item = example_prompts_item_data.to_dict() + example_prompts.append(example_prompts_item) + + prompt_call_id: None | str | Unset + if isinstance(self.prompt_call_id, Unset): + prompt_call_id = UNSET + else: + prompt_call_id = self.prompt_call_id + + success = self.success + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "conversation_id": conversation_id, + "note": note, + } + ) + if config is not UNSET: + field_dict["config"] = config + if example_prompts is not UNSET: + field_dict["example_prompts"] = example_prompts + if prompt_call_id is not UNSET: + field_dict["prompt_call_id"] = prompt_call_id + if success is not UNSET: + field_dict["success"] = success + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.example_prompt import ExamplePrompt + from ..models.memory_bank_config_response import MemoryBankConfigResponse + + d = dict(src_dict) + conversation_id = d.pop("conversation_id") + + note = d.pop("note") + + def _parse_config(data: object) -> MemoryBankConfigResponse | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + config_type_0 = MemoryBankConfigResponse.from_dict(data) + + return config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(MemoryBankConfigResponse | None | Unset, data) + + config = _parse_config(d.pop("config", UNSET)) + + _example_prompts = d.pop("example_prompts", UNSET) + example_prompts: list[ExamplePrompt] | Unset = UNSET + if _example_prompts is not UNSET: + example_prompts = [] + for example_prompts_item_data in _example_prompts: + example_prompts_item = ExamplePrompt.from_dict( + example_prompts_item_data + ) + + example_prompts.append(example_prompts_item) + + def _parse_prompt_call_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + prompt_call_id = _parse_prompt_call_id(d.pop("prompt_call_id", UNSET)) + + success = d.pop("success", UNSET) + + memory_bank_ai_assistant_response = cls( + conversation_id=conversation_id, + note=note, + config=config, + example_prompts=example_prompts, + prompt_call_id=prompt_call_id, + success=success, + ) + + memory_bank_ai_assistant_response.additional_properties = d + return memory_bank_ai_assistant_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank_config_response.py b/seclai/_generated/models/memory_bank_config_response.py new file mode 100644 index 0000000..246cdfa --- /dev/null +++ b/seclai/_generated/models/memory_bank_config_response.py @@ -0,0 +1,200 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="MemoryBankConfigResponse") + + +@_attrs_define +class MemoryBankConfigResponse: + """Suggested memory bank configuration from the AI assistant. + + Attributes: + mode (str): Memory bank mode. + name (str): Suggested name. + type_ (str): Memory bank type: conversation or general. + compaction_prompt (None | str | Unset): Suggested compaction prompt. + description (None | str | Unset): Suggested description. + max_age_days (int | None | Unset): Max age in days. + max_size_tokens (int | None | Unset): Max size in tokens. + max_turns (int | None | Unset): Max conversation turns. + retention_days (int | None | Unset): Retention in days. + """ + + mode: str + name: str + type_: str + compaction_prompt: None | str | Unset = UNSET + description: None | str | Unset = UNSET + max_age_days: int | None | Unset = UNSET + max_size_tokens: int | None | Unset = UNSET + max_turns: int | None | Unset = UNSET + retention_days: int | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + mode = self.mode + + name = self.name + + type_ = self.type_ + + compaction_prompt: None | str | Unset + if isinstance(self.compaction_prompt, Unset): + compaction_prompt = UNSET + else: + compaction_prompt = self.compaction_prompt + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + max_age_days: int | None | Unset + if isinstance(self.max_age_days, Unset): + max_age_days = UNSET + else: + max_age_days = self.max_age_days + + max_size_tokens: int | None | Unset + if isinstance(self.max_size_tokens, Unset): + max_size_tokens = UNSET + else: + max_size_tokens = self.max_size_tokens + + max_turns: int | None | Unset + if isinstance(self.max_turns, Unset): + max_turns = UNSET + else: + max_turns = self.max_turns + + retention_days: int | None | Unset + if isinstance(self.retention_days, Unset): + retention_days = UNSET + else: + retention_days = self.retention_days + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "mode": mode, + "name": name, + "type": type_, + } + ) + if compaction_prompt is not UNSET: + field_dict["compaction_prompt"] = compaction_prompt + if description is not UNSET: + field_dict["description"] = description + if max_age_days is not UNSET: + field_dict["max_age_days"] = max_age_days + if max_size_tokens is not UNSET: + field_dict["max_size_tokens"] = max_size_tokens + if max_turns is not UNSET: + field_dict["max_turns"] = max_turns + if retention_days is not UNSET: + field_dict["retention_days"] = retention_days + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + mode = d.pop("mode") + + name = d.pop("name") + + type_ = d.pop("type") + + def _parse_compaction_prompt(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + compaction_prompt = _parse_compaction_prompt(d.pop("compaction_prompt", UNSET)) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_max_age_days(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_age_days = _parse_max_age_days(d.pop("max_age_days", UNSET)) + + def _parse_max_size_tokens(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_size_tokens = _parse_max_size_tokens(d.pop("max_size_tokens", UNSET)) + + def _parse_max_turns(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_turns = _parse_max_turns(d.pop("max_turns", UNSET)) + + def _parse_retention_days(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + retention_days = _parse_retention_days(d.pop("retention_days", UNSET)) + + memory_bank_config_response = cls( + mode=mode, + name=name, + type_=type_, + compaction_prompt=compaction_prompt, + description=description, + max_age_days=max_age_days, + max_size_tokens=max_size_tokens, + max_turns=max_turns, + retention_days=retention_days, + ) + + memory_bank_config_response.additional_properties = d + return memory_bank_config_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank_conversation_turn_response.py b/seclai/_generated/models/memory_bank_conversation_turn_response.py new file mode 100644 index 0000000..afb879e --- /dev/null +++ b/seclai/_generated/models/memory_bank_conversation_turn_response.py @@ -0,0 +1,171 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.memory_bank_conversation_turn_response_resulting_config_type_0 import ( + MemoryBankConversationTurnResponseResultingConfigType0, + ) + + +T = TypeVar("T", bound="MemoryBankConversationTurnResponse") + + +@_attrs_define +class MemoryBankConversationTurnResponse: + """A single turn of memory bank AI assistant conversation. + + Attributes: + conversation_id (str): Unique ID for this conversation turn. + user_input (str): User input for this turn. + accepted (bool | None | Unset): Whether the user accepted this proposal. + ai_note (None | str | Unset): AI note from this turn. + resulting_config (MemoryBankConversationTurnResponseResultingConfigType0 | None | Unset): The proposed + configuration from this turn. + """ + + conversation_id: str + user_input: str + accepted: bool | None | Unset = UNSET + ai_note: None | str | Unset = UNSET + resulting_config: ( + MemoryBankConversationTurnResponseResultingConfigType0 | None | Unset + ) = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.memory_bank_conversation_turn_response_resulting_config_type_0 import ( + MemoryBankConversationTurnResponseResultingConfigType0, + ) + + conversation_id = self.conversation_id + + user_input = self.user_input + + accepted: bool | None | Unset + if isinstance(self.accepted, Unset): + accepted = UNSET + else: + accepted = self.accepted + + ai_note: None | str | Unset + if isinstance(self.ai_note, Unset): + ai_note = UNSET + else: + ai_note = self.ai_note + + resulting_config: dict[str, Any] | None | Unset + if isinstance(self.resulting_config, Unset): + resulting_config = UNSET + elif isinstance( + self.resulting_config, + MemoryBankConversationTurnResponseResultingConfigType0, + ): + resulting_config = self.resulting_config.to_dict() + else: + resulting_config = self.resulting_config + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "conversation_id": conversation_id, + "user_input": user_input, + } + ) + if accepted is not UNSET: + field_dict["accepted"] = accepted + if ai_note is not UNSET: + field_dict["ai_note"] = ai_note + if resulting_config is not UNSET: + field_dict["resulting_config"] = resulting_config + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.memory_bank_conversation_turn_response_resulting_config_type_0 import ( + MemoryBankConversationTurnResponseResultingConfigType0, + ) + + d = dict(src_dict) + conversation_id = d.pop("conversation_id") + + user_input = d.pop("user_input") + + def _parse_accepted(data: object) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + accepted = _parse_accepted(d.pop("accepted", UNSET)) + + def _parse_ai_note(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + ai_note = _parse_ai_note(d.pop("ai_note", UNSET)) + + def _parse_resulting_config( + data: object, + ) -> MemoryBankConversationTurnResponseResultingConfigType0 | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + resulting_config_type_0 = ( + MemoryBankConversationTurnResponseResultingConfigType0.from_dict( + data + ) + ) + + return resulting_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + MemoryBankConversationTurnResponseResultingConfigType0 | None | Unset, + data, + ) + + resulting_config = _parse_resulting_config(d.pop("resulting_config", UNSET)) + + memory_bank_conversation_turn_response = cls( + conversation_id=conversation_id, + user_input=user_input, + accepted=accepted, + ai_note=ai_note, + resulting_config=resulting_config, + ) + + memory_bank_conversation_turn_response.additional_properties = d + return memory_bank_conversation_turn_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank_conversation_turn_response_resulting_config_type_0.py b/seclai/_generated/models/memory_bank_conversation_turn_response_resulting_config_type_0.py new file mode 100644 index 0000000..fb3e5bf --- /dev/null +++ b/seclai/_generated/models/memory_bank_conversation_turn_response_resulting_config_type_0.py @@ -0,0 +1,48 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="MemoryBankConversationTurnResponseResultingConfigType0") + + +@_attrs_define +class MemoryBankConversationTurnResponseResultingConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + memory_bank_conversation_turn_response_resulting_config_type_0 = cls() + + memory_bank_conversation_turn_response_resulting_config_type_0.additional_properties = ( + d + ) + return memory_bank_conversation_turn_response_resulting_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank_last_conversation_response.py b/seclai/_generated/models/memory_bank_last_conversation_response.py new file mode 100644 index 0000000..70fbd1e --- /dev/null +++ b/seclai/_generated/models/memory_bank_last_conversation_response.py @@ -0,0 +1,156 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.memory_bank_conversation_turn_response import ( + MemoryBankConversationTurnResponse, + ) + + +T = TypeVar("T", bound="MemoryBankLastConversationResponse") + + +@_attrs_define +class MemoryBankLastConversationResponse: + """Response for fetching memory bank conversation history. + + Attributes: + accepted (bool | None | Unset): Whether the user accepted the last proposal. + ai_note (None | str | Unset): AI note from the most recent turn. + total (int | Unset): Total conversation turns. Default: 0. + turns (list[MemoryBankConversationTurnResponse] | Unset): Recent conversation turns (oldest first). + user_input (None | str | Unset): Most recent user input. + """ + + accepted: bool | None | Unset = UNSET + ai_note: None | str | Unset = UNSET + total: int | Unset = 0 + turns: list[MemoryBankConversationTurnResponse] | Unset = UNSET + user_input: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + accepted: bool | None | Unset + if isinstance(self.accepted, Unset): + accepted = UNSET + else: + accepted = self.accepted + + ai_note: None | str | Unset + if isinstance(self.ai_note, Unset): + ai_note = UNSET + else: + ai_note = self.ai_note + + total = self.total + + turns: list[dict[str, Any]] | Unset = UNSET + if not isinstance(self.turns, Unset): + turns = [] + for turns_item_data in self.turns: + turns_item = turns_item_data.to_dict() + turns.append(turns_item) + + user_input: None | str | Unset + if isinstance(self.user_input, Unset): + user_input = UNSET + else: + user_input = self.user_input + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if accepted is not UNSET: + field_dict["accepted"] = accepted + if ai_note is not UNSET: + field_dict["ai_note"] = ai_note + if total is not UNSET: + field_dict["total"] = total + if turns is not UNSET: + field_dict["turns"] = turns + if user_input is not UNSET: + field_dict["user_input"] = user_input + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.memory_bank_conversation_turn_response import ( + MemoryBankConversationTurnResponse, + ) + + d = dict(src_dict) + + def _parse_accepted(data: object) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + accepted = _parse_accepted(d.pop("accepted", UNSET)) + + def _parse_ai_note(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + ai_note = _parse_ai_note(d.pop("ai_note", UNSET)) + + total = d.pop("total", UNSET) + + _turns = d.pop("turns", UNSET) + turns: list[MemoryBankConversationTurnResponse] | Unset = UNSET + if _turns is not UNSET: + turns = [] + for turns_item_data in _turns: + turns_item = MemoryBankConversationTurnResponse.from_dict( + turns_item_data + ) + + turns.append(turns_item) + + def _parse_user_input(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + user_input = _parse_user_input(d.pop("user_input", UNSET)) + + memory_bank_last_conversation_response = cls( + accepted=accepted, + ai_note=ai_note, + total=total, + turns=turns, + user_input=user_input, + ) + + memory_bank_last_conversation_response.additional_properties = d + return memory_bank_last_conversation_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/memory_bank_list_response_model.py b/seclai/_generated/models/memory_bank_list_response_model.py new file mode 100644 index 0000000..58c9d5c --- /dev/null +++ b/seclai/_generated/models/memory_bank_list_response_model.py @@ -0,0 +1,100 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.memory_bank import MemoryBank + + +T = TypeVar("T", bound="MemoryBankListResponseModel") + + +@_attrs_define +class MemoryBankListResponseModel: + """Paginated list of memory banks. + + Attributes: + limit (int): Items per page. + memory_banks (list[MemoryBank]): List of memory banks on this page. + page (int): Current page number (1-based). + total (int): Total number of memory banks. + """ + + limit: int + memory_banks: list[MemoryBank] + page: int + total: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + limit = self.limit + + memory_banks = [] + for memory_banks_item_data in self.memory_banks: + memory_banks_item = memory_banks_item_data.to_dict() + memory_banks.append(memory_banks_item) + + page = self.page + + total = self.total + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "limit": limit, + "memory_banks": memory_banks, + "page": page, + "total": total, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.memory_bank import MemoryBank + + d = dict(src_dict) + limit = d.pop("limit") + + memory_banks = [] + _memory_banks = d.pop("memory_banks") + for memory_banks_item_data in _memory_banks: + memory_banks_item = MemoryBank.from_dict(memory_banks_item_data) + + memory_banks.append(memory_banks_item) + + page = d.pop("page") + + total = d.pop("total") + + memory_bank_list_response_model = cls( + limit=limit, + memory_banks=memory_banks, + page=page, + total=total, + ) + + memory_bank_list_response_model.additional_properties = d + return memory_bank_list_response_model + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/non_manual_evaluation_mode_stat_response.py b/seclai/_generated/models/non_manual_evaluation_mode_stat_response.py new file mode 100644 index 0000000..e811d5f --- /dev/null +++ b/seclai/_generated/models/non_manual_evaluation_mode_stat_response.py @@ -0,0 +1,110 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="NonManualEvaluationModeStatResponse") + + +@_attrs_define +class NonManualEvaluationModeStatResponse: + """Per-mode rollup for evaluation activity. + + Attributes: + failed (int): + failure_rate (float): + flagged (int): + mode (str): + pass_rate (float): + passed (int): + total (int): + """ + + failed: int + failure_rate: float + flagged: int + mode: str + pass_rate: float + passed: int + total: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + failed = self.failed + + failure_rate = self.failure_rate + + flagged = self.flagged + + mode = self.mode + + pass_rate = self.pass_rate + + passed = self.passed + + total = self.total + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "failed": failed, + "failure_rate": failure_rate, + "flagged": flagged, + "mode": mode, + "pass_rate": pass_rate, + "passed": passed, + "total": total, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + failed = d.pop("failed") + + failure_rate = d.pop("failure_rate") + + flagged = d.pop("flagged") + + mode = d.pop("mode") + + pass_rate = d.pop("pass_rate") + + passed = d.pop("passed") + + total = d.pop("total") + + non_manual_evaluation_mode_stat_response = cls( + failed=failed, + failure_rate=failure_rate, + flagged=flagged, + mode=mode, + pass_rate=pass_rate, + passed=passed, + total=total, + ) + + non_manual_evaluation_mode_stat_response.additional_properties = d + return non_manual_evaluation_mode_stat_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/non_manual_evaluation_summary_response.py b/seclai/_generated/models/non_manual_evaluation_summary_response.py new file mode 100644 index 0000000..d760e08 --- /dev/null +++ b/seclai/_generated/models/non_manual_evaluation_summary_response.py @@ -0,0 +1,130 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.non_manual_evaluation_mode_stat_response import ( + NonManualEvaluationModeStatResponse, + ) + + +T = TypeVar("T", bound="NonManualEvaluationSummaryResponse") + + +@_attrs_define +class NonManualEvaluationSummaryResponse: + """Account-level summary for evaluations. + + Attributes: + by_mode (list[NonManualEvaluationModeStatResponse]): + failed (int): + failure_rate (float): + flagged (int): + pass_rate (float): + passed (int): + total (int): + """ + + by_mode: list[NonManualEvaluationModeStatResponse] + failed: int + failure_rate: float + flagged: int + pass_rate: float + passed: int + total: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + by_mode = [] + for by_mode_item_data in self.by_mode: + by_mode_item = by_mode_item_data.to_dict() + by_mode.append(by_mode_item) + + failed = self.failed + + failure_rate = self.failure_rate + + flagged = self.flagged + + pass_rate = self.pass_rate + + passed = self.passed + + total = self.total + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "by_mode": by_mode, + "failed": failed, + "failure_rate": failure_rate, + "flagged": flagged, + "pass_rate": pass_rate, + "passed": passed, + "total": total, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.non_manual_evaluation_mode_stat_response import ( + NonManualEvaluationModeStatResponse, + ) + + d = dict(src_dict) + by_mode = [] + _by_mode = d.pop("by_mode") + for by_mode_item_data in _by_mode: + by_mode_item = NonManualEvaluationModeStatResponse.from_dict( + by_mode_item_data + ) + + by_mode.append(by_mode_item) + + failed = d.pop("failed") + + failure_rate = d.pop("failure_rate") + + flagged = d.pop("flagged") + + pass_rate = d.pop("pass_rate") + + passed = d.pop("passed") + + total = d.pop("total") + + non_manual_evaluation_summary_response = cls( + by_mode=by_mode, + failed=failed, + failure_rate=failure_rate, + flagged=flagged, + pass_rate=pass_rate, + passed=passed, + total=total, + ) + + non_manual_evaluation_summary_response.additional_properties = d + return non_manual_evaluation_summary_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/organization_alert_preference_list_response.py b/seclai/_generated/models/organization_alert_preference_list_response.py new file mode 100644 index 0000000..63a2215 --- /dev/null +++ b/seclai/_generated/models/organization_alert_preference_list_response.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.organization_alert_preference_response import ( + OrganizationAlertPreferenceResponse, + ) + + +T = TypeVar("T", bound="OrganizationAlertPreferenceListResponse") + + +@_attrs_define +class OrganizationAlertPreferenceListResponse: + """ + Attributes: + preferences (list[OrganizationAlertPreferenceResponse]): + total (int): + """ + + preferences: list[OrganizationAlertPreferenceResponse] + total: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + preferences = [] + for preferences_item_data in self.preferences: + preferences_item = preferences_item_data.to_dict() + preferences.append(preferences_item) + + total = self.total + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "preferences": preferences, + "total": total, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.organization_alert_preference_response import ( + OrganizationAlertPreferenceResponse, + ) + + d = dict(src_dict) + preferences = [] + _preferences = d.pop("preferences") + for preferences_item_data in _preferences: + preferences_item = OrganizationAlertPreferenceResponse.from_dict( + preferences_item_data + ) + + preferences.append(preferences_item) + + total = d.pop("total") + + organization_alert_preference_list_response = cls( + preferences=preferences, + total=total, + ) + + organization_alert_preference_list_response.additional_properties = d + return organization_alert_preference_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/organization_alert_preference_response.py b/seclai/_generated/models/organization_alert_preference_response.py new file mode 100644 index 0000000..1a8fdd4 --- /dev/null +++ b/seclai/_generated/models/organization_alert_preference_response.py @@ -0,0 +1,85 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="OrganizationAlertPreferenceResponse") + + +@_attrs_define +class OrganizationAlertPreferenceResponse: + """ + Attributes: + alert_type (str): + is_override (bool): + organization_id (str): + subscribed (bool): + """ + + alert_type: str + is_override: bool + organization_id: str + subscribed: bool + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + alert_type = self.alert_type + + is_override = self.is_override + + organization_id = self.organization_id + + subscribed = self.subscribed + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "alert_type": alert_type, + "is_override": is_override, + "organization_id": organization_id, + "subscribed": subscribed, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + alert_type = d.pop("alert_type") + + is_override = d.pop("is_override") + + organization_id = d.pop("organization_id") + + subscribed = d.pop("subscribed") + + organization_alert_preference_response = cls( + alert_type=alert_type, + is_override=is_override, + organization_id=organization_id, + subscribed=subscribed, + ) + + organization_alert_preference_response.additional_properties = d + return organization_alert_preference_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/organization_info_response.py b/seclai/_generated/models/organization_info_response.py new file mode 100644 index 0000000..4a8ece7 --- /dev/null +++ b/seclai/_generated/models/organization_info_response.py @@ -0,0 +1,78 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="OrganizationInfoResponse") + + +@_attrs_define +class OrganizationInfoResponse: + """ + Attributes: + account_id (UUID): + id (UUID): + name (str): + """ + + account_id: UUID + id: UUID + name: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + account_id = str(self.account_id) + + id = str(self.id) + + name = self.name + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "account_id": account_id, + "id": id, + "name": name, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + account_id = UUID(d.pop("account_id")) + + id = UUID(d.pop("id")) + + name = d.pop("name") + + organization_info_response = cls( + account_id=account_id, + id=id, + name=name, + ) + + organization_info_response.additional_properties = d + return organization_info_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/prompt_model_auto_upgrade_strategy.py b/seclai/_generated/models/prompt_model_auto_upgrade_strategy.py new file mode 100644 index 0000000..24b8327 --- /dev/null +++ b/seclai/_generated/models/prompt_model_auto_upgrade_strategy.py @@ -0,0 +1,11 @@ +from enum import Enum + + +class PromptModelAutoUpgradeStrategy(str, Enum): + CAUTIOUS_ADOPTER = "cautious_adopter" + EARLY_ADOPTER = "early_adopter" + MIDDLE_OF_ROAD = "middle_of_road" + NONE = "none" + + def __str__(self) -> str: + return str(self.value) diff --git a/seclai/_generated/models/proposed_action_response.py b/seclai/_generated/models/proposed_action_response.py new file mode 100644 index 0000000..733a169 --- /dev/null +++ b/seclai/_generated/models/proposed_action_response.py @@ -0,0 +1,97 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.proposed_action_response_params import ProposedActionResponseParams + + +T = TypeVar("T", bound="ProposedActionResponse") + + +@_attrs_define +class ProposedActionResponse: + """A single proposed action. + + Attributes: + action_type (str): Type of the proposed action. + description (str): Human-readable description of the action. + params (ProposedActionResponseParams): Parameters for the action. + is_destructive (bool | Unset): Whether the action is destructive. Default: False. + """ + + action_type: str + description: str + params: ProposedActionResponseParams + is_destructive: bool | Unset = False + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + action_type = self.action_type + + description = self.description + + params = self.params.to_dict() + + is_destructive = self.is_destructive + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "action_type": action_type, + "description": description, + "params": params, + } + ) + if is_destructive is not UNSET: + field_dict["is_destructive"] = is_destructive + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.proposed_action_response_params import ( + ProposedActionResponseParams, + ) + + d = dict(src_dict) + action_type = d.pop("action_type") + + description = d.pop("description") + + params = ProposedActionResponseParams.from_dict(d.pop("params")) + + is_destructive = d.pop("is_destructive", UNSET) + + proposed_action_response = cls( + action_type=action_type, + description=description, + params=params, + is_destructive=is_destructive, + ) + + proposed_action_response.additional_properties = d + return proposed_action_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/proposed_action_response_params.py b/seclai/_generated/models/proposed_action_response_params.py new file mode 100644 index 0000000..411d7ab --- /dev/null +++ b/seclai/_generated/models/proposed_action_response_params.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ProposedActionResponseParams") + + +@_attrs_define +class ProposedActionResponseParams: + """Parameters for the action.""" + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + proposed_action_response_params = cls() + + proposed_action_response_params.additional_properties = d + return proposed_action_response_params + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/proposed_policy_action_response.py b/seclai/_generated/models/proposed_policy_action_response.py new file mode 100644 index 0000000..2a67b06 --- /dev/null +++ b/seclai/_generated/models/proposed_policy_action_response.py @@ -0,0 +1,88 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.proposed_policy_action_response_params import ( + ProposedPolicyActionResponseParams, + ) + + +T = TypeVar("T", bound="ProposedPolicyActionResponse") + + +@_attrs_define +class ProposedPolicyActionResponse: + """A single proposed governance policy action. + + Attributes: + action_type (str): Type of action: create, update, delete, enable, or disable. + description (str): Human-readable description of what this action will do. + params (ProposedPolicyActionResponseParams): Parameters for the action (e.g. policy_document_id, thresholds). + """ + + action_type: str + description: str + params: ProposedPolicyActionResponseParams + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + action_type = self.action_type + + description = self.description + + params = self.params.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "action_type": action_type, + "description": description, + "params": params, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.proposed_policy_action_response_params import ( + ProposedPolicyActionResponseParams, + ) + + d = dict(src_dict) + action_type = d.pop("action_type") + + description = d.pop("description") + + params = ProposedPolicyActionResponseParams.from_dict(d.pop("params")) + + proposed_policy_action_response = cls( + action_type=action_type, + description=description, + params=params, + ) + + proposed_policy_action_response.additional_properties = d + return proposed_policy_action_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/proposed_policy_action_response_params.py b/seclai/_generated/models/proposed_policy_action_response_params.py new file mode 100644 index 0000000..182db68 --- /dev/null +++ b/seclai/_generated/models/proposed_policy_action_response_params.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ProposedPolicyActionResponseParams") + + +@_attrs_define +class ProposedPolicyActionResponseParams: + """Parameters for the action (e.g. policy_document_id, thresholds).""" + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + proposed_policy_action_response_params = cls() + + proposed_policy_action_response_params.additional_properties = d + return proposed_policy_action_response_params + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/search_api_search_get_response_search_api_search_get.py b/seclai/_generated/models/search_api_search_get_response_search_api_search_get.py new file mode 100644 index 0000000..225508d --- /dev/null +++ b/seclai/_generated/models/search_api_search_get_response_search_api_search_get.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="SearchApiSearchGetResponseSearchApiSearchGet") + + +@_attrs_define +class SearchApiSearchGetResponseSearchApiSearchGet: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + search_api_search_get_response_search_api_search_get = cls() + + search_api_search_get_response_search_api_search_get.additional_properties = d + return search_api_search_get_response_search_api_search_get + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/solution_agent_response.py b/seclai/_generated/models/solution_agent_response.py new file mode 100644 index 0000000..f2cc973 --- /dev/null +++ b/seclai/_generated/models/solution_agent_response.py @@ -0,0 +1,93 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="SolutionAgentResponse") + + +@_attrs_define +class SolutionAgentResponse: + """ + Attributes: + id (UUID): + name (str): + knowledge_base_ids (list[UUID] | Unset): Knowledge base IDs connected to this agent via triggers. + """ + + id: UUID + name: str + knowledge_base_ids: list[UUID] | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + id = str(self.id) + + name = self.name + + knowledge_base_ids: list[str] | Unset = UNSET + if not isinstance(self.knowledge_base_ids, Unset): + knowledge_base_ids = [] + for knowledge_base_ids_item_data in self.knowledge_base_ids: + knowledge_base_ids_item = str(knowledge_base_ids_item_data) + knowledge_base_ids.append(knowledge_base_ids_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + } + ) + if knowledge_base_ids is not UNSET: + field_dict["knowledge_base_ids"] = knowledge_base_ids + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + id = UUID(d.pop("id")) + + name = d.pop("name") + + _knowledge_base_ids = d.pop("knowledge_base_ids", UNSET) + knowledge_base_ids: list[UUID] | Unset = UNSET + if _knowledge_base_ids is not UNSET: + knowledge_base_ids = [] + for knowledge_base_ids_item_data in _knowledge_base_ids: + knowledge_base_ids_item = UUID(knowledge_base_ids_item_data) + + knowledge_base_ids.append(knowledge_base_ids_item) + + solution_agent_response = cls( + id=id, + name=name, + knowledge_base_ids=knowledge_base_ids, + ) + + solution_agent_response.additional_properties = d + return solution_agent_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/solution_conversation_response.py b/seclai/_generated/models/solution_conversation_response.py new file mode 100644 index 0000000..f383d0b --- /dev/null +++ b/seclai/_generated/models/solution_conversation_response.py @@ -0,0 +1,153 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.solution_conversation_response_actions_taken_type_0 import ( + SolutionConversationResponseActionsTakenType0, + ) + + +T = TypeVar("T", bound="SolutionConversationResponse") + + +@_attrs_define +class SolutionConversationResponse: + """Response model for a conversation turn. + + Attributes: + accepted (bool | None): Whether the suggestion was accepted or declined. + actions_taken (None | SolutionConversationResponseActionsTakenType0): Actions taken by the AI. + ai_response (None | str): AI response text. + created_at (str): Timestamp when the conversation was created. + id (UUID): Unique identifier for the conversation turn. + user_input (str): User input text. + """ + + accepted: bool | None + actions_taken: None | SolutionConversationResponseActionsTakenType0 + ai_response: None | str + created_at: str + id: UUID + user_input: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.solution_conversation_response_actions_taken_type_0 import ( + SolutionConversationResponseActionsTakenType0, + ) + + accepted: bool | None + accepted = self.accepted + + actions_taken: dict[str, Any] | None + if isinstance( + self.actions_taken, SolutionConversationResponseActionsTakenType0 + ): + actions_taken = self.actions_taken.to_dict() + else: + actions_taken = self.actions_taken + + ai_response: None | str + ai_response = self.ai_response + + created_at = self.created_at + + id = str(self.id) + + user_input = self.user_input + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "accepted": accepted, + "actions_taken": actions_taken, + "ai_response": ai_response, + "created_at": created_at, + "id": id, + "user_input": user_input, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.solution_conversation_response_actions_taken_type_0 import ( + SolutionConversationResponseActionsTakenType0, + ) + + d = dict(src_dict) + + def _parse_accepted(data: object) -> bool | None: + if data is None: + return data + return cast(bool | None, data) + + accepted = _parse_accepted(d.pop("accepted")) + + def _parse_actions_taken( + data: object, + ) -> None | SolutionConversationResponseActionsTakenType0: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + actions_taken_type_0 = ( + SolutionConversationResponseActionsTakenType0.from_dict(data) + ) + + return actions_taken_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | SolutionConversationResponseActionsTakenType0, data) + + actions_taken = _parse_actions_taken(d.pop("actions_taken")) + + def _parse_ai_response(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + ai_response = _parse_ai_response(d.pop("ai_response")) + + created_at = d.pop("created_at") + + id = UUID(d.pop("id")) + + user_input = d.pop("user_input") + + solution_conversation_response = cls( + accepted=accepted, + actions_taken=actions_taken, + ai_response=ai_response, + created_at=created_at, + id=id, + user_input=user_input, + ) + + solution_conversation_response.additional_properties = d + return solution_conversation_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/solution_conversation_response_actions_taken_type_0.py b/seclai/_generated/models/solution_conversation_response_actions_taken_type_0.py new file mode 100644 index 0000000..dbbbb93 --- /dev/null +++ b/seclai/_generated/models/solution_conversation_response_actions_taken_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="SolutionConversationResponseActionsTakenType0") + + +@_attrs_define +class SolutionConversationResponseActionsTakenType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + solution_conversation_response_actions_taken_type_0 = cls() + + solution_conversation_response_actions_taken_type_0.additional_properties = d + return solution_conversation_response_actions_taken_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/solution_knowledge_base_response.py b/seclai/_generated/models/solution_knowledge_base_response.py new file mode 100644 index 0000000..50c126c --- /dev/null +++ b/seclai/_generated/models/solution_knowledge_base_response.py @@ -0,0 +1,93 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="SolutionKnowledgeBaseResponse") + + +@_attrs_define +class SolutionKnowledgeBaseResponse: + """ + Attributes: + id (UUID): + name (str): + source_connection_ids (list[UUID] | Unset): Source connection IDs linked to this knowledge base. + """ + + id: UUID + name: str + source_connection_ids: list[UUID] | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + id = str(self.id) + + name = self.name + + source_connection_ids: list[str] | Unset = UNSET + if not isinstance(self.source_connection_ids, Unset): + source_connection_ids = [] + for source_connection_ids_item_data in self.source_connection_ids: + source_connection_ids_item = str(source_connection_ids_item_data) + source_connection_ids.append(source_connection_ids_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + } + ) + if source_connection_ids is not UNSET: + field_dict["source_connection_ids"] = source_connection_ids + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + id = UUID(d.pop("id")) + + name = d.pop("name") + + _source_connection_ids = d.pop("source_connection_ids", UNSET) + source_connection_ids: list[UUID] | Unset = UNSET + if _source_connection_ids is not UNSET: + source_connection_ids = [] + for source_connection_ids_item_data in _source_connection_ids: + source_connection_ids_item = UUID(source_connection_ids_item_data) + + source_connection_ids.append(source_connection_ids_item) + + solution_knowledge_base_response = cls( + id=id, + name=name, + source_connection_ids=source_connection_ids, + ) + + solution_knowledge_base_response.additional_properties = d + return solution_knowledge_base_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/solution_list_response.py b/seclai/_generated/models/solution_list_response.py new file mode 100644 index 0000000..a32f88b --- /dev/null +++ b/seclai/_generated/models/solution_list_response.py @@ -0,0 +1,86 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.pagination_response import PaginationResponse + from ..models.solution_summary_response import SolutionSummaryResponse + + +T = TypeVar("T", bound="SolutionListResponse") + + +@_attrs_define +class SolutionListResponse: + """Response model for paginated solution list. + + Attributes: + data (list[SolutionSummaryResponse]): + pagination (PaginationResponse): Pagination information. + """ + + data: list[SolutionSummaryResponse] + pagination: PaginationResponse + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + data = [] + for data_item_data in self.data: + data_item = data_item_data.to_dict() + data.append(data_item) + + pagination = self.pagination.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "data": data, + "pagination": pagination, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.pagination_response import PaginationResponse + from ..models.solution_summary_response import SolutionSummaryResponse + + d = dict(src_dict) + data = [] + _data = d.pop("data") + for data_item_data in _data: + data_item = SolutionSummaryResponse.from_dict(data_item_data) + + data.append(data_item) + + pagination = PaginationResponse.from_dict(d.pop("pagination")) + + solution_list_response = cls( + data=data, + pagination=pagination, + ) + + solution_list_response.additional_properties = d + return solution_list_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/solution_response.py b/seclai/_generated/models/solution_response.py new file mode 100644 index 0000000..5fba4d9 --- /dev/null +++ b/seclai/_generated/models/solution_response.py @@ -0,0 +1,163 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.solution_agent_response import SolutionAgentResponse + from ..models.solution_knowledge_base_response import SolutionKnowledgeBaseResponse + from ..models.solution_source_connection_response import ( + SolutionSourceConnectionResponse, + ) + + +T = TypeVar("T", bound="SolutionResponse") + + +@_attrs_define +class SolutionResponse: + """Response model for solution data. + + Attributes: + agents (list[SolutionAgentResponse]): Agents linked to the solution. + created_at (str): Timestamp when the solution was created. + description (str): Description of the solution. + id (UUID): Unique identifier for the solution. + knowledge_bases (list[SolutionKnowledgeBaseResponse]): Knowledge bases linked to the solution. + name (str): Name of the solution. + source_connections (list[SolutionSourceConnectionResponse]): Source connections linked to the solution. + updated_at (str): Timestamp when the solution was last updated. + """ + + agents: list[SolutionAgentResponse] + created_at: str + description: str + id: UUID + knowledge_bases: list[SolutionKnowledgeBaseResponse] + name: str + source_connections: list[SolutionSourceConnectionResponse] + updated_at: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + agents = [] + for agents_item_data in self.agents: + agents_item = agents_item_data.to_dict() + agents.append(agents_item) + + created_at = self.created_at + + description = self.description + + id = str(self.id) + + knowledge_bases = [] + for knowledge_bases_item_data in self.knowledge_bases: + knowledge_bases_item = knowledge_bases_item_data.to_dict() + knowledge_bases.append(knowledge_bases_item) + + name = self.name + + source_connections = [] + for source_connections_item_data in self.source_connections: + source_connections_item = source_connections_item_data.to_dict() + source_connections.append(source_connections_item) + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "agents": agents, + "created_at": created_at, + "description": description, + "id": id, + "knowledge_bases": knowledge_bases, + "name": name, + "source_connections": source_connections, + "updated_at": updated_at, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.solution_agent_response import SolutionAgentResponse + from ..models.solution_knowledge_base_response import ( + SolutionKnowledgeBaseResponse, + ) + from ..models.solution_source_connection_response import ( + SolutionSourceConnectionResponse, + ) + + d = dict(src_dict) + agents = [] + _agents = d.pop("agents") + for agents_item_data in _agents: + agents_item = SolutionAgentResponse.from_dict(agents_item_data) + + agents.append(agents_item) + + created_at = d.pop("created_at") + + description = d.pop("description") + + id = UUID(d.pop("id")) + + knowledge_bases = [] + _knowledge_bases = d.pop("knowledge_bases") + for knowledge_bases_item_data in _knowledge_bases: + knowledge_bases_item = SolutionKnowledgeBaseResponse.from_dict( + knowledge_bases_item_data + ) + + knowledge_bases.append(knowledge_bases_item) + + name = d.pop("name") + + source_connections = [] + _source_connections = d.pop("source_connections") + for source_connections_item_data in _source_connections: + source_connections_item = SolutionSourceConnectionResponse.from_dict( + source_connections_item_data + ) + + source_connections.append(source_connections_item) + + updated_at = d.pop("updated_at") + + solution_response = cls( + agents=agents, + created_at=created_at, + description=description, + id=id, + knowledge_bases=knowledge_bases, + name=name, + source_connections=source_connections, + updated_at=updated_at, + ) + + solution_response.additional_properties = d + return solution_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/solution_source_connection_response.py b/seclai/_generated/models/solution_source_connection_response.py new file mode 100644 index 0000000..679c190 --- /dev/null +++ b/seclai/_generated/models/solution_source_connection_response.py @@ -0,0 +1,70 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="SolutionSourceConnectionResponse") + + +@_attrs_define +class SolutionSourceConnectionResponse: + """ + Attributes: + id (UUID): + name (str): + """ + + id: UUID + name: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + id = str(self.id) + + name = self.name + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + id = UUID(d.pop("id")) + + name = d.pop("name") + + solution_source_connection_response = cls( + id=id, + name=name, + ) + + solution_source_connection_response.additional_properties = d + return solution_source_connection_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/solution_summary_response.py b/seclai/_generated/models/solution_summary_response.py new file mode 100644 index 0000000..4b6f326 --- /dev/null +++ b/seclai/_generated/models/solution_summary_response.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="SolutionSummaryResponse") + + +@_attrs_define +class SolutionSummaryResponse: + """Response model for solution summary. + + Attributes: + agent_count (int): Number of linked agents. + created_at (str): Timestamp when the solution was created. + description (str): Description of the solution. + id (UUID): Unique identifier for the solution. + knowledge_base_count (int): Number of linked knowledge bases. + memory_bank_count (int): Number of linked memory banks. + name (str): Name of the solution. + source_connection_count (int): Number of linked source connections. + updated_at (str): Timestamp when the solution was last updated. + """ + + agent_count: int + created_at: str + description: str + id: UUID + knowledge_base_count: int + memory_bank_count: int + name: str + source_connection_count: int + updated_at: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + agent_count = self.agent_count + + created_at = self.created_at + + description = self.description + + id = str(self.id) + + knowledge_base_count = self.knowledge_base_count + + memory_bank_count = self.memory_bank_count + + name = self.name + + source_connection_count = self.source_connection_count + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "agent_count": agent_count, + "created_at": created_at, + "description": description, + "id": id, + "knowledge_base_count": knowledge_base_count, + "memory_bank_count": memory_bank_count, + "name": name, + "source_connection_count": source_connection_count, + "updated_at": updated_at, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + agent_count = d.pop("agent_count") + + created_at = d.pop("created_at") + + description = d.pop("description") + + id = UUID(d.pop("id")) + + knowledge_base_count = d.pop("knowledge_base_count") + + memory_bank_count = d.pop("memory_bank_count") + + name = d.pop("name") + + source_connection_count = d.pop("source_connection_count") + + updated_at = d.pop("updated_at") + + solution_summary_response = cls( + agent_count=agent_count, + created_at=created_at, + description=description, + id=id, + knowledge_base_count=knowledge_base_count, + memory_bank_count=memory_bank_count, + name=name, + source_connection_count=source_connection_count, + updated_at=updated_at, + ) + + solution_summary_response.additional_properties = d + return solution_summary_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/source_connection_response_model.py b/seclai/_generated/models/source_connection_response_model.py new file mode 100644 index 0000000..9262d23 --- /dev/null +++ b/seclai/_generated/models/source_connection_response_model.py @@ -0,0 +1,108 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="SourceConnectionResponseModel") + + +@_attrs_define +class SourceConnectionResponseModel: + """Nested source connection summary within a knowledge base response. + + Attributes: + id (str): Source connection identifier. + name (str): Source connection name. + source_type (str): Type of source (rss, website, etc.). + url (str): Source URL. + polling (None | str | Unset): Polling configuration. + """ + + id: str + name: str + source_type: str + url: str + polling: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + id = self.id + + name = self.name + + source_type = self.source_type + + url = self.url + + polling: None | str | Unset + if isinstance(self.polling, Unset): + polling = UNSET + else: + polling = self.polling + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "id": id, + "name": name, + "source_type": source_type, + "url": url, + } + ) + if polling is not UNSET: + field_dict["polling"] = polling + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + id = d.pop("id") + + name = d.pop("name") + + source_type = d.pop("source_type") + + url = d.pop("url") + + def _parse_polling(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + polling = _parse_polling(d.pop("polling", UNSET)) + + source_connection_response_model = cls( + id=id, + name=name, + source_type=source_type, + url=url, + polling=polling, + ) + + source_connection_response_model.additional_properties = d + return source_connection_response_model + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/source_embedding_migration_response.py b/seclai/_generated/models/source_embedding_migration_response.py new file mode 100644 index 0000000..a5a1c20 --- /dev/null +++ b/seclai/_generated/models/source_embedding_migration_response.py @@ -0,0 +1,249 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="SourceEmbeddingMigrationResponse") + + +@_attrs_define +class SourceEmbeddingMigrationResponse: + """Response model for source embedding migration status. + + Attributes: + completed_at (None | str): + created_at (str): + failure_message (None | str): + id (str): + notification_recipients (list[str] | None): + phase (str): + progress_current (int): + progress_message (None | str): + progress_total (int): + source_connection_id (str): + source_id_new (str): + source_id_old (str): + started_at (None | str): + status (str): + target_dimensions (int): + target_embedding_model (str): + task_execution_id (None | str): + updated_at (str): + """ + + completed_at: None | str + created_at: str + failure_message: None | str + id: str + notification_recipients: list[str] | None + phase: str + progress_current: int + progress_message: None | str + progress_total: int + source_connection_id: str + source_id_new: str + source_id_old: str + started_at: None | str + status: str + target_dimensions: int + target_embedding_model: str + task_execution_id: None | str + updated_at: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + completed_at: None | str + completed_at = self.completed_at + + created_at = self.created_at + + failure_message: None | str + failure_message = self.failure_message + + id = self.id + + notification_recipients: list[str] | None + if isinstance(self.notification_recipients, list): + notification_recipients = self.notification_recipients + + else: + notification_recipients = self.notification_recipients + + phase = self.phase + + progress_current = self.progress_current + + progress_message: None | str + progress_message = self.progress_message + + progress_total = self.progress_total + + source_connection_id = self.source_connection_id + + source_id_new = self.source_id_new + + source_id_old = self.source_id_old + + started_at: None | str + started_at = self.started_at + + status = self.status + + target_dimensions = self.target_dimensions + + target_embedding_model = self.target_embedding_model + + task_execution_id: None | str + task_execution_id = self.task_execution_id + + updated_at = self.updated_at + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "completed_at": completed_at, + "created_at": created_at, + "failure_message": failure_message, + "id": id, + "notification_recipients": notification_recipients, + "phase": phase, + "progress_current": progress_current, + "progress_message": progress_message, + "progress_total": progress_total, + "source_connection_id": source_connection_id, + "source_id_new": source_id_new, + "source_id_old": source_id_old, + "started_at": started_at, + "status": status, + "target_dimensions": target_dimensions, + "target_embedding_model": target_embedding_model, + "task_execution_id": task_execution_id, + "updated_at": updated_at, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_completed_at(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + completed_at = _parse_completed_at(d.pop("completed_at")) + + created_at = d.pop("created_at") + + def _parse_failure_message(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + failure_message = _parse_failure_message(d.pop("failure_message")) + + id = d.pop("id") + + def _parse_notification_recipients(data: object) -> list[str] | None: + if data is None: + return data + try: + if not isinstance(data, list): + raise TypeError() + notification_recipients_type_0 = cast(list[str], data) + + return notification_recipients_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None, data) + + notification_recipients = _parse_notification_recipients( + d.pop("notification_recipients") + ) + + phase = d.pop("phase") + + progress_current = d.pop("progress_current") + + def _parse_progress_message(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + progress_message = _parse_progress_message(d.pop("progress_message")) + + progress_total = d.pop("progress_total") + + source_connection_id = d.pop("source_connection_id") + + source_id_new = d.pop("source_id_new") + + source_id_old = d.pop("source_id_old") + + def _parse_started_at(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + started_at = _parse_started_at(d.pop("started_at")) + + status = d.pop("status") + + target_dimensions = d.pop("target_dimensions") + + target_embedding_model = d.pop("target_embedding_model") + + def _parse_task_execution_id(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + task_execution_id = _parse_task_execution_id(d.pop("task_execution_id")) + + updated_at = d.pop("updated_at") + + source_embedding_migration_response = cls( + completed_at=completed_at, + created_at=created_at, + failure_message=failure_message, + id=id, + notification_recipients=notification_recipients, + phase=phase, + progress_current=progress_current, + progress_message=progress_message, + progress_total=progress_total, + source_connection_id=source_connection_id, + source_id_new=source_id_new, + source_id_old=source_id_old, + started_at=started_at, + status=status, + target_dimensions=target_dimensions, + target_embedding_model=target_embedding_model, + task_execution_id=task_execution_id, + updated_at=updated_at, + ) + + source_embedding_migration_response.additional_properties = d + return source_embedding_migration_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/source_response.py b/seclai/_generated/models/source_response.py index fc9d4f9..b5c7e0b 100644 --- a/seclai/_generated/models/source_response.py +++ b/seclai/_generated/models/source_response.py @@ -42,8 +42,11 @@ class SourceResponse: dimensions (int | None | Unset): Dimensions of the embedding model. embedding_model (None | str | Unset): Embedding model used for the source connection. embedding_model_type (None | str | Unset): Type of the embedding model. + free_retention_days (int | None | Unset): Number of days content is stored for free before billing applies. has_historical_data (bool | Unset): Indicates if the source connection has historical data. Default: False. readonly (bool | Unset): Indicates if the source connection is read-only. Default: False. + system_managed (bool | Unset): Indicates if this source is automatically managed by the system (e.g., agent + traces). Default: False. """ account_id: UUID @@ -71,8 +74,10 @@ class SourceResponse: dimensions: int | None | Unset = UNSET embedding_model: None | str | Unset = UNSET embedding_model_type: None | str | Unset = UNSET + free_retention_days: int | None | Unset = UNSET has_historical_data: bool | Unset = False readonly: bool | Unset = False + system_managed: bool | Unset = False additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -173,10 +178,18 @@ def to_dict(self) -> dict[str, Any]: else: embedding_model_type = self.embedding_model_type + free_retention_days: int | None | Unset + if isinstance(self.free_retention_days, Unset): + free_retention_days = UNSET + else: + free_retention_days = self.free_retention_days + has_historical_data = self.has_historical_data readonly = self.readonly + system_managed = self.system_managed + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( @@ -219,10 +232,14 @@ def to_dict(self) -> dict[str, Any]: field_dict["embedding_model"] = embedding_model if embedding_model_type is not UNSET: field_dict["embedding_model_type"] = embedding_model_type + if free_retention_days is not UNSET: + field_dict["free_retention_days"] = free_retention_days if has_historical_data is not UNSET: field_dict["has_historical_data"] = has_historical_data if readonly is not UNSET: field_dict["readonly"] = readonly + if system_managed is not UNSET: + field_dict["system_managed"] = system_managed return field_dict @@ -392,10 +409,23 @@ def _parse_embedding_model_type(data: object) -> None | str | Unset: d.pop("embedding_model_type", UNSET) ) + def _parse_free_retention_days(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + free_retention_days = _parse_free_retention_days( + d.pop("free_retention_days", UNSET) + ) + has_historical_data = d.pop("has_historical_data", UNSET) readonly = d.pop("readonly", UNSET) + system_managed = d.pop("system_managed", UNSET) + source_response = cls( account_id=account_id, content_filter=content_filter, @@ -422,8 +452,10 @@ def _parse_embedding_model_type(data: object) -> None | str | Unset: dimensions=dimensions, embedding_model=embedding_model, embedding_model_type=embedding_model_type, + free_retention_days=free_retention_days, has_historical_data=has_historical_data, readonly=readonly, + system_managed=system_managed, ) source_response.additional_properties = d diff --git a/seclai/_generated/models/standalone_test_compaction_request.py b/seclai/_generated/models/standalone_test_compaction_request.py new file mode 100644 index 0000000..b26dad6 --- /dev/null +++ b/seclai/_generated/models/standalone_test_compaction_request.py @@ -0,0 +1,141 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="StandaloneTestCompactionRequest") + + +@_attrs_define +class StandaloneTestCompactionRequest: + """Request body for testing a compaction prompt *without* an existing bank. + + Used on the create-memory-bank page where no bank ID exists yet. + ``compaction_prompt`` is required (no bank to fall back to). + Content must come from ``sample_entries`` or ``generate_direction`` + (no existing entries to fetch). + + Attributes: + compaction_prompt (str): Compaction prompt to test. + bank_type (str | Unset): Memory bank type ('conversation' or 'general') — controls the style of generated + entries. Default: 'conversation'. + entry_count (int | Unset): Number of entries to generate when using generate_direction. Default: 5. + generate_direction (None | str | Unset): Direction for the LLM to generate sample entries. + sample_entries (list[str] | None | Unset): Explicit sample entries to compact. + """ + + compaction_prompt: str + bank_type: str | Unset = "conversation" + entry_count: int | Unset = 5 + generate_direction: None | str | Unset = UNSET + sample_entries: list[str] | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + compaction_prompt = self.compaction_prompt + + bank_type = self.bank_type + + entry_count = self.entry_count + + generate_direction: None | str | Unset + if isinstance(self.generate_direction, Unset): + generate_direction = UNSET + else: + generate_direction = self.generate_direction + + sample_entries: list[str] | None | Unset + if isinstance(self.sample_entries, Unset): + sample_entries = UNSET + elif isinstance(self.sample_entries, list): + sample_entries = self.sample_entries + + else: + sample_entries = self.sample_entries + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "compaction_prompt": compaction_prompt, + } + ) + if bank_type is not UNSET: + field_dict["bank_type"] = bank_type + if entry_count is not UNSET: + field_dict["entry_count"] = entry_count + if generate_direction is not UNSET: + field_dict["generate_direction"] = generate_direction + if sample_entries is not UNSET: + field_dict["sample_entries"] = sample_entries + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + compaction_prompt = d.pop("compaction_prompt") + + bank_type = d.pop("bank_type", UNSET) + + entry_count = d.pop("entry_count", UNSET) + + def _parse_generate_direction(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + generate_direction = _parse_generate_direction( + d.pop("generate_direction", UNSET) + ) + + def _parse_sample_entries(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + sample_entries_type_0 = cast(list[str], data) + + return sample_entries_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + sample_entries = _parse_sample_entries(d.pop("sample_entries", UNSET)) + + standalone_test_compaction_request = cls( + compaction_prompt=compaction_prompt, + bank_type=bank_type, + entry_count=entry_count, + generate_direction=generate_direction, + sample_entries=sample_entries, + ) + + standalone_test_compaction_request.additional_properties = d + return standalone_test_compaction_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/start_source_embedding_migration_request.py b/seclai/_generated/models/start_source_embedding_migration_request.py new file mode 100644 index 0000000..74eb819 --- /dev/null +++ b/seclai/_generated/models/start_source_embedding_migration_request.py @@ -0,0 +1,207 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="StartSourceEmbeddingMigrationRequest") + + +@_attrs_define +class StartSourceEmbeddingMigrationRequest: + """Request payload to start a source embedding migration. + + Attributes: + target_dimensions (int): Target embedding dimensions + target_embedding_model (str): Target embedding model enum + chunk_language (None | str | Unset): Language-specific chunking language code + chunk_overlap (int | None | Unset): Override chunk overlap (characters) + chunk_regex_separators (bool | None | Unset): Whether chunk separators are regex patterns + chunk_separators (None | str | Unset): Custom chunk separators (JSON-encoded list) + chunk_size (int | None | Unset): Override chunk size (characters per chunk) + notification_recipients (list[str] | None | Unset): Optional notification recipient emails + """ + + target_dimensions: int + target_embedding_model: str + chunk_language: None | str | Unset = UNSET + chunk_overlap: int | None | Unset = UNSET + chunk_regex_separators: bool | None | Unset = UNSET + chunk_separators: None | str | Unset = UNSET + chunk_size: int | None | Unset = UNSET + notification_recipients: list[str] | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + target_dimensions = self.target_dimensions + + target_embedding_model = self.target_embedding_model + + chunk_language: None | str | Unset + if isinstance(self.chunk_language, Unset): + chunk_language = UNSET + else: + chunk_language = self.chunk_language + + chunk_overlap: int | None | Unset + if isinstance(self.chunk_overlap, Unset): + chunk_overlap = UNSET + else: + chunk_overlap = self.chunk_overlap + + chunk_regex_separators: bool | None | Unset + if isinstance(self.chunk_regex_separators, Unset): + chunk_regex_separators = UNSET + else: + chunk_regex_separators = self.chunk_regex_separators + + chunk_separators: None | str | Unset + if isinstance(self.chunk_separators, Unset): + chunk_separators = UNSET + else: + chunk_separators = self.chunk_separators + + chunk_size: int | None | Unset + if isinstance(self.chunk_size, Unset): + chunk_size = UNSET + else: + chunk_size = self.chunk_size + + notification_recipients: list[str] | None | Unset + if isinstance(self.notification_recipients, Unset): + notification_recipients = UNSET + elif isinstance(self.notification_recipients, list): + notification_recipients = self.notification_recipients + + else: + notification_recipients = self.notification_recipients + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "target_dimensions": target_dimensions, + "target_embedding_model": target_embedding_model, + } + ) + if chunk_language is not UNSET: + field_dict["chunk_language"] = chunk_language + if chunk_overlap is not UNSET: + field_dict["chunk_overlap"] = chunk_overlap + if chunk_regex_separators is not UNSET: + field_dict["chunk_regex_separators"] = chunk_regex_separators + if chunk_separators is not UNSET: + field_dict["chunk_separators"] = chunk_separators + if chunk_size is not UNSET: + field_dict["chunk_size"] = chunk_size + if notification_recipients is not UNSET: + field_dict["notification_recipients"] = notification_recipients + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + target_dimensions = d.pop("target_dimensions") + + target_embedding_model = d.pop("target_embedding_model") + + def _parse_chunk_language(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + chunk_language = _parse_chunk_language(d.pop("chunk_language", UNSET)) + + def _parse_chunk_overlap(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + chunk_overlap = _parse_chunk_overlap(d.pop("chunk_overlap", UNSET)) + + def _parse_chunk_regex_separators(data: object) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + chunk_regex_separators = _parse_chunk_regex_separators( + d.pop("chunk_regex_separators", UNSET) + ) + + def _parse_chunk_separators(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + chunk_separators = _parse_chunk_separators(d.pop("chunk_separators", UNSET)) + + def _parse_chunk_size(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + chunk_size = _parse_chunk_size(d.pop("chunk_size", UNSET)) + + def _parse_notification_recipients(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + notification_recipients_type_0 = cast(list[str], data) + + return notification_recipients_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + notification_recipients = _parse_notification_recipients( + d.pop("notification_recipients", UNSET) + ) + + start_source_embedding_migration_request = cls( + target_dimensions=target_dimensions, + target_embedding_model=target_embedding_model, + chunk_language=chunk_language, + chunk_overlap=chunk_overlap, + chunk_regex_separators=chunk_regex_separators, + chunk_separators=chunk_separators, + chunk_size=chunk_size, + notification_recipients=notification_recipients, + ) + + start_source_embedding_migration_request.additional_properties = d + return start_source_embedding_migration_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/subscribe_to_alert_api_alerts_alert_id_subscribe_post_response_subscribe_to_alert_api_alerts_alert_id_subscribe_post.py b/seclai/_generated/models/subscribe_to_alert_api_alerts_alert_id_subscribe_post_response_subscribe_to_alert_api_alerts_alert_id_subscribe_post.py new file mode 100644 index 0000000..8ba2a2b --- /dev/null +++ b/seclai/_generated/models/subscribe_to_alert_api_alerts_alert_id_subscribe_post_response_subscribe_to_alert_api_alerts_alert_id_subscribe_post.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost", +) + + +@_attrs_define +class SubscribeToAlertApiAlertsAlertIdSubscribePostResponseSubscribeToAlertApiAlertsAlertIdSubscribePost: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + subscribe_to_alert_api_alerts_alert_id_subscribe_post_response_subscribe_to_alert_api_alerts_alert_id_subscribe_post = ( + cls() + ) + + subscribe_to_alert_api_alerts_alert_id_subscribe_post_response_subscribe_to_alert_api_alerts_alert_id_subscribe_post.additional_properties = ( + d + ) + return subscribe_to_alert_api_alerts_alert_id_subscribe_post_response_subscribe_to_alert_api_alerts_alert_id_subscribe_post + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/test_compaction_request.py b/seclai/_generated/models/test_compaction_request.py new file mode 100644 index 0000000..a5abfb9 --- /dev/null +++ b/seclai/_generated/models/test_compaction_request.py @@ -0,0 +1,149 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="TestCompactionRequest") + + +@_attrs_define +class TestCompactionRequest: + """Request body for testing a compaction prompt against an existing bank. + + The user may supply a ``compaction_prompt`` to override (or provide when + the bank has none). Content can come from three sources: + + 1. Existing entries in the bank (default when neither field is set). + 2. ``sample_entries`` – caller-provided list of strings. + 3. ``generate_direction`` – an instruction to the LLM to generate sample + memory entries. Useful for trying a prompt before any real data + exists. + + At most one of ``sample_entries`` / ``generate_direction`` may be given. + + Attributes: + compaction_prompt (None | str | Unset): Compaction prompt to test. Falls back to the bank's current prompt when + omitted. + entry_count (int | Unset): Number of entries to generate when using generate_direction. Default: 5. + generate_direction (None | str | Unset): Direction for the LLM to generate sample entries (e.g. 'Generate 5 + entries about a customer support interaction'). + sample_entries (list[str] | None | Unset): Explicit sample entries to compact. + """ + + compaction_prompt: None | str | Unset = UNSET + entry_count: int | Unset = 5 + generate_direction: None | str | Unset = UNSET + sample_entries: list[str] | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + compaction_prompt: None | str | Unset + if isinstance(self.compaction_prompt, Unset): + compaction_prompt = UNSET + else: + compaction_prompt = self.compaction_prompt + + entry_count = self.entry_count + + generate_direction: None | str | Unset + if isinstance(self.generate_direction, Unset): + generate_direction = UNSET + else: + generate_direction = self.generate_direction + + sample_entries: list[str] | None | Unset + if isinstance(self.sample_entries, Unset): + sample_entries = UNSET + elif isinstance(self.sample_entries, list): + sample_entries = self.sample_entries + + else: + sample_entries = self.sample_entries + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if compaction_prompt is not UNSET: + field_dict["compaction_prompt"] = compaction_prompt + if entry_count is not UNSET: + field_dict["entry_count"] = entry_count + if generate_direction is not UNSET: + field_dict["generate_direction"] = generate_direction + if sample_entries is not UNSET: + field_dict["sample_entries"] = sample_entries + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_compaction_prompt(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + compaction_prompt = _parse_compaction_prompt(d.pop("compaction_prompt", UNSET)) + + entry_count = d.pop("entry_count", UNSET) + + def _parse_generate_direction(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + generate_direction = _parse_generate_direction( + d.pop("generate_direction", UNSET) + ) + + def _parse_sample_entries(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + sample_entries_type_0 = cast(list[str], data) + + return sample_entries_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + sample_entries = _parse_sample_entries(d.pop("sample_entries", UNSET)) + + test_compaction_request = cls( + compaction_prompt=compaction_prompt, + entry_count=entry_count, + generate_direction=generate_direction, + sample_entries=sample_entries, + ) + + test_compaction_request.additional_properties = d + return test_compaction_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/test_draft_evaluation_request.py b/seclai/_generated/models/test_draft_evaluation_request.py new file mode 100644 index 0000000..749cc14 --- /dev/null +++ b/seclai/_generated/models/test_draft_evaluation_request.py @@ -0,0 +1,246 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.agent_evaluation_tier import AgentEvaluationTier +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.test_draft_evaluation_request_expectation_config_type_0 import ( + TestDraftEvaluationRequestExpectationConfigType0, + ) + + +T = TypeVar("T", bound="TestDraftEvaluationRequest") + + +@_attrs_define +class TestDraftEvaluationRequest: + """Request body for ephemeral (non-persisted) evaluation testing. + + Provide either ``step_output`` (raw text) **or** ``agent_step_run_id`` + (to load output from storage). Exactly one must be supplied. + + Attributes: + agent_input (None | str | Unset): The original agent run input for context. When agent_step_run_id is supplied + this is loaded automatically from the parent run if omitted. + agent_step_run_id (None | Unset | UUID): Load step output from this completed step run instead of supplying + text. + evaluation_prompt (None | str | Unset): + evaluation_tier (AgentEvaluationTier | None | Unset): + expectation_config (None | TestDraftEvaluationRequestExpectationConfigType0 | Unset): + pass_threshold (float | Unset): Default: 0.5. + step_output (None | str | Unset): The step output text to evaluate. Omit if agent_step_run_id is supplied. + """ + + agent_input: None | str | Unset = UNSET + agent_step_run_id: None | Unset | UUID = UNSET + evaluation_prompt: None | str | Unset = UNSET + evaluation_tier: AgentEvaluationTier | None | Unset = UNSET + expectation_config: ( + None | TestDraftEvaluationRequestExpectationConfigType0 | Unset + ) = UNSET + pass_threshold: float | Unset = 0.5 + step_output: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.test_draft_evaluation_request_expectation_config_type_0 import ( + TestDraftEvaluationRequestExpectationConfigType0, + ) + + agent_input: None | str | Unset + if isinstance(self.agent_input, Unset): + agent_input = UNSET + else: + agent_input = self.agent_input + + agent_step_run_id: None | str | Unset + if isinstance(self.agent_step_run_id, Unset): + agent_step_run_id = UNSET + elif isinstance(self.agent_step_run_id, UUID): + agent_step_run_id = str(self.agent_step_run_id) + else: + agent_step_run_id = self.agent_step_run_id + + evaluation_prompt: None | str | Unset + if isinstance(self.evaluation_prompt, Unset): + evaluation_prompt = UNSET + else: + evaluation_prompt = self.evaluation_prompt + + evaluation_tier: None | str | Unset + if isinstance(self.evaluation_tier, Unset): + evaluation_tier = UNSET + elif isinstance(self.evaluation_tier, AgentEvaluationTier): + evaluation_tier = self.evaluation_tier.value + else: + evaluation_tier = self.evaluation_tier + + expectation_config: dict[str, Any] | None | Unset + if isinstance(self.expectation_config, Unset): + expectation_config = UNSET + elif isinstance( + self.expectation_config, TestDraftEvaluationRequestExpectationConfigType0 + ): + expectation_config = self.expectation_config.to_dict() + else: + expectation_config = self.expectation_config + + pass_threshold = self.pass_threshold + + step_output: None | str | Unset + if isinstance(self.step_output, Unset): + step_output = UNSET + else: + step_output = self.step_output + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if agent_input is not UNSET: + field_dict["agent_input"] = agent_input + if agent_step_run_id is not UNSET: + field_dict["agent_step_run_id"] = agent_step_run_id + if evaluation_prompt is not UNSET: + field_dict["evaluation_prompt"] = evaluation_prompt + if evaluation_tier is not UNSET: + field_dict["evaluation_tier"] = evaluation_tier + if expectation_config is not UNSET: + field_dict["expectation_config"] = expectation_config + if pass_threshold is not UNSET: + field_dict["pass_threshold"] = pass_threshold + if step_output is not UNSET: + field_dict["step_output"] = step_output + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.test_draft_evaluation_request_expectation_config_type_0 import ( + TestDraftEvaluationRequestExpectationConfigType0, + ) + + d = dict(src_dict) + + def _parse_agent_input(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + agent_input = _parse_agent_input(d.pop("agent_input", UNSET)) + + def _parse_agent_step_run_id(data: object) -> None | Unset | UUID: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + agent_step_run_id_type_0 = UUID(data) + + return agent_step_run_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) + + agent_step_run_id = _parse_agent_step_run_id(d.pop("agent_step_run_id", UNSET)) + + def _parse_evaluation_prompt(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + evaluation_prompt = _parse_evaluation_prompt(d.pop("evaluation_prompt", UNSET)) + + def _parse_evaluation_tier(data: object) -> AgentEvaluationTier | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + evaluation_tier_type_0 = AgentEvaluationTier(data) + + return evaluation_tier_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(AgentEvaluationTier | None | Unset, data) + + evaluation_tier = _parse_evaluation_tier(d.pop("evaluation_tier", UNSET)) + + def _parse_expectation_config( + data: object, + ) -> None | TestDraftEvaluationRequestExpectationConfigType0 | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + expectation_config_type_0 = ( + TestDraftEvaluationRequestExpectationConfigType0.from_dict(data) + ) + + return expectation_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + None | TestDraftEvaluationRequestExpectationConfigType0 | Unset, data + ) + + expectation_config = _parse_expectation_config( + d.pop("expectation_config", UNSET) + ) + + pass_threshold = d.pop("pass_threshold", UNSET) + + def _parse_step_output(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + step_output = _parse_step_output(d.pop("step_output", UNSET)) + + test_draft_evaluation_request = cls( + agent_input=agent_input, + agent_step_run_id=agent_step_run_id, + evaluation_prompt=evaluation_prompt, + evaluation_tier=evaluation_tier, + expectation_config=expectation_config, + pass_threshold=pass_threshold, + step_output=step_output, + ) + + test_draft_evaluation_request.additional_properties = d + return test_draft_evaluation_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/test_draft_evaluation_request_expectation_config_type_0.py b/seclai/_generated/models/test_draft_evaluation_request_expectation_config_type_0.py new file mode 100644 index 0000000..0dce88e --- /dev/null +++ b/seclai/_generated/models/test_draft_evaluation_request_expectation_config_type_0.py @@ -0,0 +1,48 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="TestDraftEvaluationRequestExpectationConfigType0") + + +@_attrs_define +class TestDraftEvaluationRequestExpectationConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + test_draft_evaluation_request_expectation_config_type_0 = cls() + + test_draft_evaluation_request_expectation_config_type_0.additional_properties = ( + d + ) + return test_draft_evaluation_request_expectation_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/test_draft_evaluation_response.py b/seclai/_generated/models/test_draft_evaluation_response.py new file mode 100644 index 0000000..6b294fc --- /dev/null +++ b/seclai/_generated/models/test_draft_evaluation_response.py @@ -0,0 +1,85 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="TestDraftEvaluationResponse") + + +@_attrs_define +class TestDraftEvaluationResponse: + """Response for an ephemeral evaluation test. + + Attributes: + explanation (None | str): + passed (bool): + score (float): + """ + + explanation: None | str + passed: bool + score: float + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + explanation: None | str + explanation = self.explanation + + passed = self.passed + + score = self.score + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "explanation": explanation, + "passed": passed, + "score": score, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_explanation(data: object) -> None | str: + if data is None: + return data + return cast(None | str, data) + + explanation = _parse_explanation(d.pop("explanation")) + + passed = d.pop("passed") + + score = d.pop("score") + + test_draft_evaluation_response = cls( + explanation=explanation, + passed=passed, + score=score, + ) + + test_draft_evaluation_response.additional_properties = d + return test_draft_evaluation_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/unlink_resources_request.py b/seclai/_generated/models/unlink_resources_request.py new file mode 100644 index 0000000..db6dfc2 --- /dev/null +++ b/seclai/_generated/models/unlink_resources_request.py @@ -0,0 +1,70 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="UnlinkResourcesRequest") + + +@_attrs_define +class UnlinkResourcesRequest: + """ + Attributes: + ids (list[UUID]): Resource IDs to unlink + """ + + ids: list[UUID] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + ids = [] + for ids_item_data in self.ids: + ids_item = str(ids_item_data) + ids.append(ids_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "ids": ids, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + ids = [] + _ids = d.pop("ids") + for ids_item_data in _ids: + ids_item = UUID(ids_item_data) + + ids.append(ids_item) + + unlink_resources_request = cls( + ids=ids, + ) + + unlink_resources_request.additional_properties = d + return unlink_resources_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post_response_unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post.py b/seclai/_generated/models/unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post_response_unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post.py new file mode 100644 index 0000000..573f44a --- /dev/null +++ b/seclai/_generated/models/unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post_response_unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost", +) + + +@_attrs_define +class UnsubscribeFromAlertApiAlertsAlertIdUnsubscribePostResponseUnsubscribeFromAlertApiAlertsAlertIdUnsubscribePost: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post_response_unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post = ( + cls() + ) + + unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post_response_unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post.additional_properties = ( + d + ) + return unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post_response_unsubscribe_from_alert_api_alerts_alert_id_unsubscribe_post + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_agent_definition_request.py b/seclai/_generated/models/update_agent_definition_request.py new file mode 100644 index 0000000..b259795 --- /dev/null +++ b/seclai/_generated/models/update_agent_definition_request.py @@ -0,0 +1,84 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from ..models.update_agent_definition_request_definition import ( + UpdateAgentDefinitionRequestDefinition, + ) + + +T = TypeVar("T", bound="UpdateAgentDefinitionRequest") + + +@_attrs_define +class UpdateAgentDefinitionRequest: + """ + Attributes: + definition (UpdateAgentDefinitionRequestDefinition): The full agent definition (name, description, tags, steps). + Steps form a tree workflow. Each step has a `step_type`, `id`, `name`, and type-specific config. Content + enrichment steps (write_metadata, write_content_attachment, load_content_attachment, load_content) require + content-triggered agents. + expected_change_id (str): The change_id from the last GET, for optimistic locking. + """ + + definition: UpdateAgentDefinitionRequestDefinition + expected_change_id: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + definition = self.definition.to_dict() + + expected_change_id = self.expected_change_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "definition": definition, + "expected_change_id": expected_change_id, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.update_agent_definition_request_definition import ( + UpdateAgentDefinitionRequestDefinition, + ) + + d = dict(src_dict) + definition = UpdateAgentDefinitionRequestDefinition.from_dict( + d.pop("definition") + ) + + expected_change_id = d.pop("expected_change_id") + + update_agent_definition_request = cls( + definition=definition, + expected_change_id=expected_change_id, + ) + + update_agent_definition_request.additional_properties = d + return update_agent_definition_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_agent_definition_request_definition.py b/seclai/_generated/models/update_agent_definition_request_definition.py new file mode 100644 index 0000000..83e0026 --- /dev/null +++ b/seclai/_generated/models/update_agent_definition_request_definition.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="UpdateAgentDefinitionRequestDefinition") + + +@_attrs_define +class UpdateAgentDefinitionRequestDefinition: + """The full agent definition (name, description, tags, steps). Steps form a tree workflow. Each step has a `step_type`, + `id`, `name`, and type-specific config. Content enrichment steps (write_metadata, write_content_attachment, + load_content_attachment, load_content) require content-triggered agents. + + """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + update_agent_definition_request_definition = cls() + + update_agent_definition_request_definition.additional_properties = d + return update_agent_definition_request_definition + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_agent_request.py b/seclai/_generated/models/update_agent_request.py new file mode 100644 index 0000000..6fcb8e1 --- /dev/null +++ b/seclai/_generated/models/update_agent_request.py @@ -0,0 +1,378 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.prompt_model_auto_upgrade_strategy import PromptModelAutoUpgradeStrategy +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.update_agent_request_sampling_config_type_0 import ( + UpdateAgentRequestSamplingConfigType0, + ) + + +T = TypeVar("T", bound="UpdateAgentRequest") + + +@_attrs_define +class UpdateAgentRequest: + """ + Attributes: + default_evaluation_tier (None | str | Unset): Default evaluation tier: 'fast', 'balanced', or 'thorough'. + description (None | str | Unset): New description for the agent. + evaluation_mode (None | str | Unset): Evaluation mode: 'output_expectation', 'eval_and_retry', or + 'sample_and_flag'. + max_retries (int | None | Unset): Max retries for eval_and_retry mode (1-10). + name (None | str | Unset): New name for the agent. + prompt_model_auto_rollback_enabled (bool | None | Unset): Enable or disable automatic rollback for upgraded + models. + prompt_model_auto_rollback_triggers (list[str] | None | Unset): Failure signals that trigger rollback: + agent_eval_fail, governance_flag, governance_block, agent_run_failed. + prompt_model_auto_upgrade_strategy (None | PromptModelAutoUpgradeStrategy | Unset): Auto-upgrade strategy: none, + early_adopter, middle_of_road, cautious_adopter. + retry_on_failure (bool | None | Unset): Whether to retry on evaluation failure. + sampling_config (None | Unset | UpdateAgentRequestSamplingConfigType0): Sampling configuration for + sample_and_flag mode. Format: {combinator: 'and'|'or', rules: [...]}. + set_default_evaluation_tier (bool | Unset): When true and default_evaluation_tier is omitted, clears the tier to + null (system default). Default: False. + set_prompt_model_auto_rollback_triggers (bool | Unset): When true and prompt_model_auto_rollback_triggers is + omitted, clears the list to null (revert to system defaults). Default: False. + set_sampling_config (bool | Unset): When true and sampling_config is omitted, clears the config to null. + Default: False. + """ + + default_evaluation_tier: None | str | Unset = UNSET + description: None | str | Unset = UNSET + evaluation_mode: None | str | Unset = UNSET + max_retries: int | None | Unset = UNSET + name: None | str | Unset = UNSET + prompt_model_auto_rollback_enabled: bool | None | Unset = UNSET + prompt_model_auto_rollback_triggers: list[str] | None | Unset = UNSET + prompt_model_auto_upgrade_strategy: ( + None | PromptModelAutoUpgradeStrategy | Unset + ) = UNSET + retry_on_failure: bool | None | Unset = UNSET + sampling_config: None | Unset | UpdateAgentRequestSamplingConfigType0 = UNSET + set_default_evaluation_tier: bool | Unset = False + set_prompt_model_auto_rollback_triggers: bool | Unset = False + set_sampling_config: bool | Unset = False + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.update_agent_request_sampling_config_type_0 import ( + UpdateAgentRequestSamplingConfigType0, + ) + + default_evaluation_tier: None | str | Unset + if isinstance(self.default_evaluation_tier, Unset): + default_evaluation_tier = UNSET + else: + default_evaluation_tier = self.default_evaluation_tier + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + evaluation_mode: None | str | Unset + if isinstance(self.evaluation_mode, Unset): + evaluation_mode = UNSET + else: + evaluation_mode = self.evaluation_mode + + max_retries: int | None | Unset + if isinstance(self.max_retries, Unset): + max_retries = UNSET + else: + max_retries = self.max_retries + + name: None | str | Unset + if isinstance(self.name, Unset): + name = UNSET + else: + name = self.name + + prompt_model_auto_rollback_enabled: bool | None | Unset + if isinstance(self.prompt_model_auto_rollback_enabled, Unset): + prompt_model_auto_rollback_enabled = UNSET + else: + prompt_model_auto_rollback_enabled = self.prompt_model_auto_rollback_enabled + + prompt_model_auto_rollback_triggers: list[str] | None | Unset + if isinstance(self.prompt_model_auto_rollback_triggers, Unset): + prompt_model_auto_rollback_triggers = UNSET + elif isinstance(self.prompt_model_auto_rollback_triggers, list): + prompt_model_auto_rollback_triggers = ( + self.prompt_model_auto_rollback_triggers + ) + + else: + prompt_model_auto_rollback_triggers = ( + self.prompt_model_auto_rollback_triggers + ) + + prompt_model_auto_upgrade_strategy: None | str | Unset + if isinstance(self.prompt_model_auto_upgrade_strategy, Unset): + prompt_model_auto_upgrade_strategy = UNSET + elif isinstance( + self.prompt_model_auto_upgrade_strategy, PromptModelAutoUpgradeStrategy + ): + prompt_model_auto_upgrade_strategy = ( + self.prompt_model_auto_upgrade_strategy.value + ) + else: + prompt_model_auto_upgrade_strategy = self.prompt_model_auto_upgrade_strategy + + retry_on_failure: bool | None | Unset + if isinstance(self.retry_on_failure, Unset): + retry_on_failure = UNSET + else: + retry_on_failure = self.retry_on_failure + + sampling_config: dict[str, Any] | None | Unset + if isinstance(self.sampling_config, Unset): + sampling_config = UNSET + elif isinstance(self.sampling_config, UpdateAgentRequestSamplingConfigType0): + sampling_config = self.sampling_config.to_dict() + else: + sampling_config = self.sampling_config + + set_default_evaluation_tier = self.set_default_evaluation_tier + + set_prompt_model_auto_rollback_triggers = ( + self.set_prompt_model_auto_rollback_triggers + ) + + set_sampling_config = self.set_sampling_config + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if default_evaluation_tier is not UNSET: + field_dict["default_evaluation_tier"] = default_evaluation_tier + if description is not UNSET: + field_dict["description"] = description + if evaluation_mode is not UNSET: + field_dict["evaluation_mode"] = evaluation_mode + if max_retries is not UNSET: + field_dict["max_retries"] = max_retries + if name is not UNSET: + field_dict["name"] = name + if prompt_model_auto_rollback_enabled is not UNSET: + field_dict["prompt_model_auto_rollback_enabled"] = ( + prompt_model_auto_rollback_enabled + ) + if prompt_model_auto_rollback_triggers is not UNSET: + field_dict["prompt_model_auto_rollback_triggers"] = ( + prompt_model_auto_rollback_triggers + ) + if prompt_model_auto_upgrade_strategy is not UNSET: + field_dict["prompt_model_auto_upgrade_strategy"] = ( + prompt_model_auto_upgrade_strategy + ) + if retry_on_failure is not UNSET: + field_dict["retry_on_failure"] = retry_on_failure + if sampling_config is not UNSET: + field_dict["sampling_config"] = sampling_config + if set_default_evaluation_tier is not UNSET: + field_dict["set_default_evaluation_tier"] = set_default_evaluation_tier + if set_prompt_model_auto_rollback_triggers is not UNSET: + field_dict["set_prompt_model_auto_rollback_triggers"] = ( + set_prompt_model_auto_rollback_triggers + ) + if set_sampling_config is not UNSET: + field_dict["set_sampling_config"] = set_sampling_config + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.update_agent_request_sampling_config_type_0 import ( + UpdateAgentRequestSamplingConfigType0, + ) + + d = dict(src_dict) + + def _parse_default_evaluation_tier(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + default_evaluation_tier = _parse_default_evaluation_tier( + d.pop("default_evaluation_tier", UNSET) + ) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_evaluation_mode(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + evaluation_mode = _parse_evaluation_mode(d.pop("evaluation_mode", UNSET)) + + def _parse_max_retries(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_retries = _parse_max_retries(d.pop("max_retries", UNSET)) + + def _parse_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + name = _parse_name(d.pop("name", UNSET)) + + def _parse_prompt_model_auto_rollback_enabled( + data: object, + ) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + prompt_model_auto_rollback_enabled = _parse_prompt_model_auto_rollback_enabled( + d.pop("prompt_model_auto_rollback_enabled", UNSET) + ) + + def _parse_prompt_model_auto_rollback_triggers( + data: object, + ) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + prompt_model_auto_rollback_triggers_type_0 = cast(list[str], data) + + return prompt_model_auto_rollback_triggers_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + prompt_model_auto_rollback_triggers = ( + _parse_prompt_model_auto_rollback_triggers( + d.pop("prompt_model_auto_rollback_triggers", UNSET) + ) + ) + + def _parse_prompt_model_auto_upgrade_strategy( + data: object, + ) -> None | PromptModelAutoUpgradeStrategy | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + prompt_model_auto_upgrade_strategy_type_0 = ( + PromptModelAutoUpgradeStrategy(data) + ) + + return prompt_model_auto_upgrade_strategy_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | PromptModelAutoUpgradeStrategy | Unset, data) + + prompt_model_auto_upgrade_strategy = _parse_prompt_model_auto_upgrade_strategy( + d.pop("prompt_model_auto_upgrade_strategy", UNSET) + ) + + def _parse_retry_on_failure(data: object) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + retry_on_failure = _parse_retry_on_failure(d.pop("retry_on_failure", UNSET)) + + def _parse_sampling_config( + data: object, + ) -> None | Unset | UpdateAgentRequestSamplingConfigType0: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + sampling_config_type_0 = ( + UpdateAgentRequestSamplingConfigType0.from_dict(data) + ) + + return sampling_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UpdateAgentRequestSamplingConfigType0, data) + + sampling_config = _parse_sampling_config(d.pop("sampling_config", UNSET)) + + set_default_evaluation_tier = d.pop("set_default_evaluation_tier", UNSET) + + set_prompt_model_auto_rollback_triggers = d.pop( + "set_prompt_model_auto_rollback_triggers", UNSET + ) + + set_sampling_config = d.pop("set_sampling_config", UNSET) + + update_agent_request = cls( + default_evaluation_tier=default_evaluation_tier, + description=description, + evaluation_mode=evaluation_mode, + max_retries=max_retries, + name=name, + prompt_model_auto_rollback_enabled=prompt_model_auto_rollback_enabled, + prompt_model_auto_rollback_triggers=prompt_model_auto_rollback_triggers, + prompt_model_auto_upgrade_strategy=prompt_model_auto_upgrade_strategy, + retry_on_failure=retry_on_failure, + sampling_config=sampling_config, + set_default_evaluation_tier=set_default_evaluation_tier, + set_prompt_model_auto_rollback_triggers=set_prompt_model_auto_rollback_triggers, + set_sampling_config=set_sampling_config, + ) + + update_agent_request.additional_properties = d + return update_agent_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_agent_request_sampling_config_type_0.py b/seclai/_generated/models/update_agent_request_sampling_config_type_0.py new file mode 100644 index 0000000..d9cced7 --- /dev/null +++ b/seclai/_generated/models/update_agent_request_sampling_config_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="UpdateAgentRequestSamplingConfigType0") + + +@_attrs_define +class UpdateAgentRequestSamplingConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + update_agent_request_sampling_config_type_0 = cls() + + update_agent_request_sampling_config_type_0.additional_properties = d + return update_agent_request_sampling_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_alert_config_api_alerts_configs_config_id_patch_response_update_alert_config_api_alerts_configs_config_id_patch.py b/seclai/_generated/models/update_alert_config_api_alerts_configs_config_id_patch_response_update_alert_config_api_alerts_configs_config_id_patch.py new file mode 100644 index 0000000..f38a9a1 --- /dev/null +++ b/seclai/_generated/models/update_alert_config_api_alerts_configs_config_id_patch_response_update_alert_config_api_alerts_configs_config_id_patch.py @@ -0,0 +1,53 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar( + "T", + bound="UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch", +) + + +@_attrs_define +class UpdateAlertConfigApiAlertsConfigsConfigIdPatchResponseUpdateAlertConfigApiAlertsConfigsConfigIdPatch: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + update_alert_config_api_alerts_configs_config_id_patch_response_update_alert_config_api_alerts_configs_config_id_patch = ( + cls() + ) + + update_alert_config_api_alerts_configs_config_id_patch_response_update_alert_config_api_alerts_configs_config_id_patch.additional_properties = ( + d + ) + return update_alert_config_api_alerts_configs_config_id_patch_response_update_alert_config_api_alerts_configs_config_id_patch + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_alert_config_request.py b/seclai/_generated/models/update_alert_config_request.py new file mode 100644 index 0000000..8d610d4 --- /dev/null +++ b/seclai/_generated/models/update_alert_config_request.py @@ -0,0 +1,194 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.update_alert_config_request_threshold_type_0 import ( + UpdateAlertConfigRequestThresholdType0, + ) + + +T = TypeVar("T", bound="UpdateAlertConfigRequest") + + +@_attrs_define +class UpdateAlertConfigRequest: + """ + Attributes: + cooldown_minutes (int | None | Unset): Cooldown period in minutes + distribution_type (None | str | Unset): Distribution type + enabled (bool | None | Unset): Whether the alert config is enabled + recipient_user_ids (list[str] | None | Unset): User IDs for selected_members distribution + threshold (None | Unset | UpdateAlertConfigRequestThresholdType0): Threshold configuration + """ + + cooldown_minutes: int | None | Unset = UNSET + distribution_type: None | str | Unset = UNSET + enabled: bool | None | Unset = UNSET + recipient_user_ids: list[str] | None | Unset = UNSET + threshold: None | Unset | UpdateAlertConfigRequestThresholdType0 = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.update_alert_config_request_threshold_type_0 import ( + UpdateAlertConfigRequestThresholdType0, + ) + + cooldown_minutes: int | None | Unset + if isinstance(self.cooldown_minutes, Unset): + cooldown_minutes = UNSET + else: + cooldown_minutes = self.cooldown_minutes + + distribution_type: None | str | Unset + if isinstance(self.distribution_type, Unset): + distribution_type = UNSET + else: + distribution_type = self.distribution_type + + enabled: bool | None | Unset + if isinstance(self.enabled, Unset): + enabled = UNSET + else: + enabled = self.enabled + + recipient_user_ids: list[str] | None | Unset + if isinstance(self.recipient_user_ids, Unset): + recipient_user_ids = UNSET + elif isinstance(self.recipient_user_ids, list): + recipient_user_ids = self.recipient_user_ids + + else: + recipient_user_ids = self.recipient_user_ids + + threshold: dict[str, Any] | None | Unset + if isinstance(self.threshold, Unset): + threshold = UNSET + elif isinstance(self.threshold, UpdateAlertConfigRequestThresholdType0): + threshold = self.threshold.to_dict() + else: + threshold = self.threshold + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if cooldown_minutes is not UNSET: + field_dict["cooldown_minutes"] = cooldown_minutes + if distribution_type is not UNSET: + field_dict["distribution_type"] = distribution_type + if enabled is not UNSET: + field_dict["enabled"] = enabled + if recipient_user_ids is not UNSET: + field_dict["recipient_user_ids"] = recipient_user_ids + if threshold is not UNSET: + field_dict["threshold"] = threshold + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.update_alert_config_request_threshold_type_0 import ( + UpdateAlertConfigRequestThresholdType0, + ) + + d = dict(src_dict) + + def _parse_cooldown_minutes(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + cooldown_minutes = _parse_cooldown_minutes(d.pop("cooldown_minutes", UNSET)) + + def _parse_distribution_type(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + distribution_type = _parse_distribution_type(d.pop("distribution_type", UNSET)) + + def _parse_enabled(data: object) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + enabled = _parse_enabled(d.pop("enabled", UNSET)) + + def _parse_recipient_user_ids(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + recipient_user_ids_type_0 = cast(list[str], data) + + return recipient_user_ids_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + recipient_user_ids = _parse_recipient_user_ids( + d.pop("recipient_user_ids", UNSET) + ) + + def _parse_threshold( + data: object, + ) -> None | Unset | UpdateAlertConfigRequestThresholdType0: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + threshold_type_0 = UpdateAlertConfigRequestThresholdType0.from_dict( + data + ) + + return threshold_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UpdateAlertConfigRequestThresholdType0, data) + + threshold = _parse_threshold(d.pop("threshold", UNSET)) + + update_alert_config_request = cls( + cooldown_minutes=cooldown_minutes, + distribution_type=distribution_type, + enabled=enabled, + recipient_user_ids=recipient_user_ids, + threshold=threshold, + ) + + update_alert_config_request.additional_properties = d + return update_alert_config_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_alert_config_request_threshold_type_0.py b/seclai/_generated/models/update_alert_config_request_threshold_type_0.py new file mode 100644 index 0000000..ecfa59d --- /dev/null +++ b/seclai/_generated/models/update_alert_config_request_threshold_type_0.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="UpdateAlertConfigRequestThresholdType0") + + +@_attrs_define +class UpdateAlertConfigRequestThresholdType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + update_alert_config_request_threshold_type_0 = cls() + + update_alert_config_request_threshold_type_0.additional_properties = d + return update_alert_config_request_threshold_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_evaluation_criteria_request.py b/seclai/_generated/models/update_evaluation_criteria_request.py new file mode 100644 index 0000000..fa2f1c7 --- /dev/null +++ b/seclai/_generated/models/update_evaluation_criteria_request.py @@ -0,0 +1,247 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..models.agent_evaluation_tier import AgentEvaluationTier +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from ..models.update_evaluation_criteria_request_expectation_config_type_0 import ( + UpdateEvaluationCriteriaRequestExpectationConfigType0, + ) + + +T = TypeVar("T", bound="UpdateEvaluationCriteriaRequest") + + +@_attrs_define +class UpdateEvaluationCriteriaRequest: + """Request body for updating an evaluation criteria. + + Retry settings and sample frequency are set at the agent level. + + Attributes: + description (None | str | Unset): + enabled (bool | None | Unset): + evaluation_prompt (None | str | Unset): + evaluation_tier (AgentEvaluationTier | None | Unset): + expectation_config (None | Unset | UpdateEvaluationCriteriaRequestExpectationConfigType0): + pass_threshold (float | None | Unset): + step_id (None | str | Unset): + """ + + description: None | str | Unset = UNSET + enabled: bool | None | Unset = UNSET + evaluation_prompt: None | str | Unset = UNSET + evaluation_tier: AgentEvaluationTier | None | Unset = UNSET + expectation_config: ( + None | Unset | UpdateEvaluationCriteriaRequestExpectationConfigType0 + ) = UNSET + pass_threshold: float | None | Unset = UNSET + step_id: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from ..models.update_evaluation_criteria_request_expectation_config_type_0 import ( + UpdateEvaluationCriteriaRequestExpectationConfigType0, + ) + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + enabled: bool | None | Unset + if isinstance(self.enabled, Unset): + enabled = UNSET + else: + enabled = self.enabled + + evaluation_prompt: None | str | Unset + if isinstance(self.evaluation_prompt, Unset): + evaluation_prompt = UNSET + else: + evaluation_prompt = self.evaluation_prompt + + evaluation_tier: None | str | Unset + if isinstance(self.evaluation_tier, Unset): + evaluation_tier = UNSET + elif isinstance(self.evaluation_tier, AgentEvaluationTier): + evaluation_tier = self.evaluation_tier.value + else: + evaluation_tier = self.evaluation_tier + + expectation_config: dict[str, Any] | None | Unset + if isinstance(self.expectation_config, Unset): + expectation_config = UNSET + elif isinstance( + self.expectation_config, + UpdateEvaluationCriteriaRequestExpectationConfigType0, + ): + expectation_config = self.expectation_config.to_dict() + else: + expectation_config = self.expectation_config + + pass_threshold: float | None | Unset + if isinstance(self.pass_threshold, Unset): + pass_threshold = UNSET + else: + pass_threshold = self.pass_threshold + + step_id: None | str | Unset + if isinstance(self.step_id, Unset): + step_id = UNSET + else: + step_id = self.step_id + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if description is not UNSET: + field_dict["description"] = description + if enabled is not UNSET: + field_dict["enabled"] = enabled + if evaluation_prompt is not UNSET: + field_dict["evaluation_prompt"] = evaluation_prompt + if evaluation_tier is not UNSET: + field_dict["evaluation_tier"] = evaluation_tier + if expectation_config is not UNSET: + field_dict["expectation_config"] = expectation_config + if pass_threshold is not UNSET: + field_dict["pass_threshold"] = pass_threshold + if step_id is not UNSET: + field_dict["step_id"] = step_id + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from ..models.update_evaluation_criteria_request_expectation_config_type_0 import ( + UpdateEvaluationCriteriaRequestExpectationConfigType0, + ) + + d = dict(src_dict) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_enabled(data: object) -> bool | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(bool | None | Unset, data) + + enabled = _parse_enabled(d.pop("enabled", UNSET)) + + def _parse_evaluation_prompt(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + evaluation_prompt = _parse_evaluation_prompt(d.pop("evaluation_prompt", UNSET)) + + def _parse_evaluation_tier(data: object) -> AgentEvaluationTier | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + evaluation_tier_type_0 = AgentEvaluationTier(data) + + return evaluation_tier_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(AgentEvaluationTier | None | Unset, data) + + evaluation_tier = _parse_evaluation_tier(d.pop("evaluation_tier", UNSET)) + + def _parse_expectation_config( + data: object, + ) -> None | Unset | UpdateEvaluationCriteriaRequestExpectationConfigType0: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + expectation_config_type_0 = ( + UpdateEvaluationCriteriaRequestExpectationConfigType0.from_dict( + data + ) + ) + + return expectation_config_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast( + None | Unset | UpdateEvaluationCriteriaRequestExpectationConfigType0, + data, + ) + + expectation_config = _parse_expectation_config( + d.pop("expectation_config", UNSET) + ) + + def _parse_pass_threshold(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + pass_threshold = _parse_pass_threshold(d.pop("pass_threshold", UNSET)) + + def _parse_step_id(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + step_id = _parse_step_id(d.pop("step_id", UNSET)) + + update_evaluation_criteria_request = cls( + description=description, + enabled=enabled, + evaluation_prompt=evaluation_prompt, + evaluation_tier=evaluation_tier, + expectation_config=expectation_config, + pass_threshold=pass_threshold, + step_id=step_id, + ) + + update_evaluation_criteria_request.additional_properties = d + return update_evaluation_criteria_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_evaluation_criteria_request_expectation_config_type_0.py b/seclai/_generated/models/update_evaluation_criteria_request_expectation_config_type_0.py new file mode 100644 index 0000000..ac385a4 --- /dev/null +++ b/seclai/_generated/models/update_evaluation_criteria_request_expectation_config_type_0.py @@ -0,0 +1,48 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="UpdateEvaluationCriteriaRequestExpectationConfigType0") + + +@_attrs_define +class UpdateEvaluationCriteriaRequestExpectationConfigType0: + """ """ + + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + update_evaluation_criteria_request_expectation_config_type_0 = cls() + + update_evaluation_criteria_request_expectation_config_type_0.additional_properties = ( + d + ) + return update_evaluation_criteria_request_expectation_config_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_knowledge_base_body.py b/seclai/_generated/models/update_knowledge_base_body.py new file mode 100644 index 0000000..82f4048 --- /dev/null +++ b/seclai/_generated/models/update_knowledge_base_body.py @@ -0,0 +1,207 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="UpdateKnowledgeBaseBody") + + +@_attrs_define +class UpdateKnowledgeBaseBody: + """Request body for updating a knowledge base. + + Attributes: + default_score_threshold (float | None | Unset): Default score threshold (-1 to clear). + default_top_k (int | None | Unset): Default reranked results (0 to clear). + default_top_n (int | None | Unset): Default results (0 to clear). + description (None | str | Unset): New description. + name (None | str | Unset): New name. + reranker_model (None | str | Unset): Reranker model (empty string for no reranking). + source_ids (list[str] | None | Unset): New list of source connection IDs. + """ + + default_score_threshold: float | None | Unset = UNSET + default_top_k: int | None | Unset = UNSET + default_top_n: int | None | Unset = UNSET + description: None | str | Unset = UNSET + name: None | str | Unset = UNSET + reranker_model: None | str | Unset = UNSET + source_ids: list[str] | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + default_score_threshold: float | None | Unset + if isinstance(self.default_score_threshold, Unset): + default_score_threshold = UNSET + else: + default_score_threshold = self.default_score_threshold + + default_top_k: int | None | Unset + if isinstance(self.default_top_k, Unset): + default_top_k = UNSET + else: + default_top_k = self.default_top_k + + default_top_n: int | None | Unset + if isinstance(self.default_top_n, Unset): + default_top_n = UNSET + else: + default_top_n = self.default_top_n + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + name: None | str | Unset + if isinstance(self.name, Unset): + name = UNSET + else: + name = self.name + + reranker_model: None | str | Unset + if isinstance(self.reranker_model, Unset): + reranker_model = UNSET + else: + reranker_model = self.reranker_model + + source_ids: list[str] | None | Unset + if isinstance(self.source_ids, Unset): + source_ids = UNSET + elif isinstance(self.source_ids, list): + source_ids = self.source_ids + + else: + source_ids = self.source_ids + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if default_score_threshold is not UNSET: + field_dict["default_score_threshold"] = default_score_threshold + if default_top_k is not UNSET: + field_dict["default_top_k"] = default_top_k + if default_top_n is not UNSET: + field_dict["default_top_n"] = default_top_n + if description is not UNSET: + field_dict["description"] = description + if name is not UNSET: + field_dict["name"] = name + if reranker_model is not UNSET: + field_dict["reranker_model"] = reranker_model + if source_ids is not UNSET: + field_dict["source_ids"] = source_ids + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_default_score_threshold(data: object) -> float | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(float | None | Unset, data) + + default_score_threshold = _parse_default_score_threshold( + d.pop("default_score_threshold", UNSET) + ) + + def _parse_default_top_k(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + default_top_k = _parse_default_top_k(d.pop("default_top_k", UNSET)) + + def _parse_default_top_n(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + default_top_n = _parse_default_top_n(d.pop("default_top_n", UNSET)) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + name = _parse_name(d.pop("name", UNSET)) + + def _parse_reranker_model(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + reranker_model = _parse_reranker_model(d.pop("reranker_model", UNSET)) + + def _parse_source_ids(data: object) -> list[str] | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + source_ids_type_0 = cast(list[str], data) + + return source_ids_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(list[str] | None | Unset, data) + + source_ids = _parse_source_ids(d.pop("source_ids", UNSET)) + + update_knowledge_base_body = cls( + default_score_threshold=default_score_threshold, + default_top_k=default_top_k, + default_top_n=default_top_n, + description=description, + name=name, + reranker_model=reranker_model, + source_ids=source_ids, + ) + + update_knowledge_base_body.additional_properties = d + return update_knowledge_base_body + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_memory_bank_body.py b/seclai/_generated/models/update_memory_bank_body.py new file mode 100644 index 0000000..30fa14d --- /dev/null +++ b/seclai/_generated/models/update_memory_bank_body.py @@ -0,0 +1,202 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="UpdateMemoryBankBody") + + +@_attrs_define +class UpdateMemoryBankBody: + """Request body for updating a memory bank. + + Omitted fields are left unchanged. To **clear** a field back to null, + send a zero-value sentinel: ``0`` for integers, ``""`` for strings. + + Attributes: + compaction_prompt (None | str | Unset): Custom prompt used when compacting older entries. When set, entries that + exceed a threshold are summarized into a new entry before being soft-deleted. Send empty string "" to clear and + disable summarisation. + description (None | str | Unset): Optional description. Send empty string "" to clear. + max_age_days (int | None | Unset): Max entry age in days before compaction. Checked inline after each write and + by the hourly background sweep. Send 0 to disable. + max_size_tokens (int | None | Unset): Max total tokens (per partition) before compaction. Checked inline after + each write and by the hourly background sweep. Send 0 to disable. + max_turns (int | None | Unset): Max conversation turns (per partition) before compaction. Checked inline after + each write and by the hourly background sweep. Send 0 to disable. + name (None | str | Unset): New name. + retention_days (int | None | Unset): Content source retention in days. Send 0 to clear (indefinite). + """ + + compaction_prompt: None | str | Unset = UNSET + description: None | str | Unset = UNSET + max_age_days: int | None | Unset = UNSET + max_size_tokens: int | None | Unset = UNSET + max_turns: int | None | Unset = UNSET + name: None | str | Unset = UNSET + retention_days: int | None | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + compaction_prompt: None | str | Unset + if isinstance(self.compaction_prompt, Unset): + compaction_prompt = UNSET + else: + compaction_prompt = self.compaction_prompt + + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + max_age_days: int | None | Unset + if isinstance(self.max_age_days, Unset): + max_age_days = UNSET + else: + max_age_days = self.max_age_days + + max_size_tokens: int | None | Unset + if isinstance(self.max_size_tokens, Unset): + max_size_tokens = UNSET + else: + max_size_tokens = self.max_size_tokens + + max_turns: int | None | Unset + if isinstance(self.max_turns, Unset): + max_turns = UNSET + else: + max_turns = self.max_turns + + name: None | str | Unset + if isinstance(self.name, Unset): + name = UNSET + else: + name = self.name + + retention_days: int | None | Unset + if isinstance(self.retention_days, Unset): + retention_days = UNSET + else: + retention_days = self.retention_days + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if compaction_prompt is not UNSET: + field_dict["compaction_prompt"] = compaction_prompt + if description is not UNSET: + field_dict["description"] = description + if max_age_days is not UNSET: + field_dict["max_age_days"] = max_age_days + if max_size_tokens is not UNSET: + field_dict["max_size_tokens"] = max_size_tokens + if max_turns is not UNSET: + field_dict["max_turns"] = max_turns + if name is not UNSET: + field_dict["name"] = name + if retention_days is not UNSET: + field_dict["retention_days"] = retention_days + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_compaction_prompt(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + compaction_prompt = _parse_compaction_prompt(d.pop("compaction_prompt", UNSET)) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_max_age_days(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_age_days = _parse_max_age_days(d.pop("max_age_days", UNSET)) + + def _parse_max_size_tokens(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_size_tokens = _parse_max_size_tokens(d.pop("max_size_tokens", UNSET)) + + def _parse_max_turns(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + max_turns = _parse_max_turns(d.pop("max_turns", UNSET)) + + def _parse_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + name = _parse_name(d.pop("name", UNSET)) + + def _parse_retention_days(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + retention_days = _parse_retention_days(d.pop("retention_days", UNSET)) + + update_memory_bank_body = cls( + compaction_prompt=compaction_prompt, + description=description, + max_age_days=max_age_days, + max_size_tokens=max_size_tokens, + max_turns=max_turns, + name=name, + retention_days=retention_days, + ) + + update_memory_bank_body.additional_properties = d + return update_memory_bank_body + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_organization_alert_preference_request.py b/seclai/_generated/models/update_organization_alert_preference_request.py new file mode 100644 index 0000000..fed7ef5 --- /dev/null +++ b/seclai/_generated/models/update_organization_alert_preference_request.py @@ -0,0 +1,61 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="UpdateOrganizationAlertPreferenceRequest") + + +@_attrs_define +class UpdateOrganizationAlertPreferenceRequest: + """ + Attributes: + subscribed (bool): Whether the user should receive this alert for the organization + """ + + subscribed: bool + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + subscribed = self.subscribed + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "subscribed": subscribed, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + subscribed = d.pop("subscribed") + + update_organization_alert_preference_request = cls( + subscribed=subscribed, + ) + + update_organization_alert_preference_request.additional_properties = d + return update_organization_alert_preference_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_solution_request.py b/seclai/_generated/models/update_solution_request.py new file mode 100644 index 0000000..3e0e382 --- /dev/null +++ b/seclai/_generated/models/update_solution_request.py @@ -0,0 +1,94 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="UpdateSolutionRequest") + + +@_attrs_define +class UpdateSolutionRequest: + """Request model for updating a solution + + Attributes: + description (None | str | Unset): Description of the solution + name (None | str | Unset): Name of the solution + """ + + description: None | str | Unset = UNSET + name: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + description: None | str | Unset + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + name: None | str | Unset + if isinstance(self.name, Unset): + name = UNSET + else: + name = self.name + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if description is not UNSET: + field_dict["description"] = description + if name is not UNSET: + field_dict["name"] = name + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_description(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + name = _parse_name(d.pop("name", UNSET)) + + update_solution_request = cls( + description=description, + name=name, + ) + + update_solution_request.additional_properties = d + return update_solution_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/update_source_body.py b/seclai/_generated/models/update_source_body.py new file mode 100644 index 0000000..74d630c --- /dev/null +++ b/seclai/_generated/models/update_source_body.py @@ -0,0 +1,114 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="UpdateSourceBody") + + +@_attrs_define +class UpdateSourceBody: + """Request body for updating a content source. + + Attributes: + name (None | str | Unset): New name. + polling (None | str | Unset): New polling interval. + retention_days (int | None | Unset): New retention period in days (null for unlimited). Default: -1. + """ + + name: None | str | Unset = UNSET + polling: None | str | Unset = UNSET + retention_days: int | None | Unset = -1 + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name: None | str | Unset + if isinstance(self.name, Unset): + name = UNSET + else: + name = self.name + + polling: None | str | Unset + if isinstance(self.polling, Unset): + polling = UNSET + else: + polling = self.polling + + retention_days: int | None | Unset + if isinstance(self.retention_days, Unset): + retention_days = UNSET + else: + retention_days = self.retention_days + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if name is not UNSET: + field_dict["name"] = name + if polling is not UNSET: + field_dict["polling"] = polling + if retention_days is not UNSET: + field_dict["retention_days"] = retention_days + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + + def _parse_name(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + name = _parse_name(d.pop("name", UNSET)) + + def _parse_polling(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + polling = _parse_polling(d.pop("polling", UNSET)) + + def _parse_retention_days(data: object) -> int | None | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(int | None | Unset, data) + + retention_days = _parse_retention_days(d.pop("retention_days", UNSET)) + + update_source_body = cls( + name=name, + polling=polling, + retention_days=retention_days, + ) + + update_source_body.additional_properties = d + return update_source_body + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/_generated/models/upload_agent_input_api_response.py b/seclai/_generated/models/upload_agent_input_api_response.py new file mode 100644 index 0000000..2ca38eb --- /dev/null +++ b/seclai/_generated/models/upload_agent_input_api_response.py @@ -0,0 +1,115 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="UploadAgentInputApiResponse") + + +@_attrs_define +class UploadAgentInputApiResponse: + """ + Attributes: + content_type (str): Resolved MIME type. + file_size (int): Size in bytes. + filename (str): Original filename. + id (str): Unique identifier for the upload. + status (str): processing, ready, or failed. + error (None | str | Unset): Error message if status is failed. + """ + + content_type: str + file_size: int + filename: str + id: str + status: str + error: None | str | Unset = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + content_type = self.content_type + + file_size = self.file_size + + filename = self.filename + + id = self.id + + status = self.status + + error: None | str | Unset + if isinstance(self.error, Unset): + error = UNSET + else: + error = self.error + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "content_type": content_type, + "file_size": file_size, + "filename": filename, + "id": id, + "status": status, + } + ) + if error is not UNSET: + field_dict["error"] = error + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + content_type = d.pop("content_type") + + file_size = d.pop("file_size") + + filename = d.pop("filename") + + id = d.pop("id") + + status = d.pop("status") + + def _parse_error(data: object) -> None | str | Unset: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(None | str | Unset, data) + + error = _parse_error(d.pop("error", UNSET)) + + upload_agent_input_api_response = cls( + content_type=content_type, + file_size=file_size, + filename=filename, + id=id, + status=status, + error=error, + ) + + upload_agent_input_api_response.additional_properties = d + return upload_agent_input_api_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/seclai/seclai.py b/seclai/seclai.py index b218585..24c186b 100644 --- a/seclai/seclai.py +++ b/seclai/seclai.py @@ -1603,6 +1603,24 @@ def delete_agent(self, agent_id: str) -> None: """ self.request("DELETE", f"/agents/{agent_id}") + # ── Agent Export ──────────────────────────────────────────────────────────── + + def export_agent(self, agent_id: str, *, download: bool = True) -> dict[str, Any]: + """Export an agent definition as a portable JSON snapshot. + + Args: + agent_id: Agent identifier. + download: When True (default), the server sets Content-Disposition: attachment. + + Returns: + The exported agent snapshot. + """ + params = _strip_none({"download": download}) + return cast( + dict[str, Any], + self.request("GET", f"/agents/{agent_id}/export", params=params), + ) + # ── Agent Definitions ───────────────────────────────────────────────────── def get_agent_definition(self, agent_id: str) -> dict[str, Any]: @@ -4774,6 +4792,26 @@ async def delete_agent(self, agent_id: str) -> None: """ await self.request("DELETE", f"/agents/{agent_id}") + # ── Agent Export ────────────────────────────────────────────────────────── + + async def export_agent( + self, agent_id: str, *, download: bool = True + ) -> dict[str, Any]: + """Export an agent definition as a portable JSON snapshot. + + Args: + agent_id: Agent identifier. + download: When True (default), the server sets Content-Disposition: attachment. + + Returns: + The exported agent snapshot. + """ + params = _strip_none({"download": download}) + return cast( + dict[str, Any], + await self.request("GET", f"/agents/{agent_id}/export", params=params), + ) + # ── Agent Definitions ───────────────────────────────────────────────────── async def get_agent_definition(self, agent_id: str) -> dict[str, Any]: