Skip to main content

Python SDK for Aionis Memory Graph API

Project description

aionis-sdk

Python SDK for Aionis Memory Graph API.

Install

pip install aionis-sdk

Usage

import os
from aionis_sdk import AionisClient

client = AionisClient(
    base_url="http://localhost:3001",
    timeout_s=10.0,
    api_key=os.getenv("API_KEY"),           # optional: X-Api-Key
    auth_bearer=os.getenv("AUTH_BEARER"),   # optional: Authorization: Bearer <token>
    admin_token=os.getenv("ADMIN_TOKEN"),   # optional: X-Admin-Token
)

out = client.write(
    {
        "scope": "default",
        "input_text": "python sdk write",
        "auto_embed": False,
        "nodes": [{"client_id": "py_evt_1", "type": "event", "text_summary": "hello python sdk"}],
        "edges": [],
    }
)

print(out["status"], out["request_id"], out["data"]["commit_id"])

Typed payloads

0.1.4+ exports TypedDict API payloads from aionis_sdk.types:

from aionis_sdk import AionisClient
from aionis_sdk.types import ToolsFeedbackInput, ToolsSelectInput

client = AionisClient(base_url="http://localhost:3001")

select_payload: ToolsSelectInput = {
    "scope": "default",
    "run_id": "run_001",
    "context": {"intent": "json", "provider": "minimax", "tool": {"name": "curl"}},
    "candidates": ["curl", "bash"],
    "strict": True,
}
select_out = client.tools_select(select_payload)
decision_id = (select_out.get("data") or {}).get("decision", {}).get("decision_id")

feedback_payload: ToolsFeedbackInput = {
    "scope": "default",
    "run_id": "run_001",
    "decision_id": decision_id,
    "outcome": "positive",
    "context": {"intent": "json", "provider": "minimax", "tool": {"name": "curl"}},
    "candidates": ["curl", "bash"],
    "selected_tool": "curl",
}
client.tools_feedback(feedback_payload)

Auth Options

  1. api_key: sends X-Api-Key.
  2. auth_bearer: sends Authorization: Bearer <token>.
  3. admin_token: sends X-Admin-Token (debug/admin flows).

Covered methods

  1. write
  2. recall
  3. recall_text
  4. rules_evaluate
  5. tools_select
  6. tools_feedback

Error model

  1. AionisApiError: API returned non-2xx response.
  2. AionisNetworkError: request timeout/network failure.

Smoke

cd /Users/lucio/Desktop/Aionis
set -a; source .env; set +a
npm run sdk:py:smoke

Build check (repo local)

cd /Users/lucio/Desktop/Aionis
npm run sdk:py:compile
npm run sdk:py:release-check

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aionis_sdk-0.1.4.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aionis_sdk-0.1.4-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file aionis_sdk-0.1.4.tar.gz.

File metadata

  • Download URL: aionis_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for aionis_sdk-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a58f95ee496074b59deb98ae85b2683831c99c2ebeaec6e927b0014a5543ead6
MD5 89d92227a6d3109cce9bef683fcffaa1
BLAKE2b-256 ebb845f71b7a5d384370940e6746555aba6751667e454215e87f3907d8628756

See more details on using hashes here.

File details

Details for the file aionis_sdk-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: aionis_sdk-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for aionis_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3323edf4eacd16d00ff7ae8af4d297fe7f67cffa093ff40d84d608fac4b918fc
MD5 15ec745ca0c6b80d8872594e9edaf007
BLAKE2b-256 b00f873b11d0fcc4e4dfd37d3687db53977326a282edafa54e286d964a0f8c8b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page