Examples

Runnable curl, Python and SQL scripts for AOCore.

Runnable scripts for calling AOCore. Each one reads your AOCore-minted API key from the AOSENTRY_KEY environment variable and targets https://gateway.core.aocyber.ai/v1 (set AOSENTRY_BASE_URL to use your own gateway). Files open as plain text — save them with the name shown.

curl

Plain HTTP calls. Each script prints the response headers so you can see the quota headers.

  • chat-completion.sh — A chat completion, with response headers shown.
  • streaming.sh — A streaming chat completion over server-sent events (note the -N flag).
  • embeddings.sh — Embeddings for a single string or a list of strings.

Python — OpenAI SDK

The standard OpenAI Python SDK. The only AOCore-specific setting is base_url.

  • chat.py — A drop-in chat completion.
  • streaming.py — Streaming, with handling for 429 and 5xx responses.
  • embeddings.py — Embeddings for a single string or a list of strings.

Python — LangChain

LangChain's ChatOpenAI pointed at the gateway. No AOCore library required.

  • README.md — Install notes and tested version ranges.
  • chat.py — A chat call through LangChain.

AI SQL

Trino queries using the AOCore AI functions. See AI SQL functions for signatures and behaviour.

  • LLM_GENERATE — Per-row text generation.
  • EMBED — Embeddings, for example a document backfill.
  • LLM_CLASSIFY — Classification against a fixed label set.
  • LLM_EXTRACT — Structured JSON extraction from free text.
  • RERANK — Re-ranking candidate results.
  • SEMANTIC_SEARCH — Vector search over an indexed table.
  • AI-aware query patterns — Efficient query patterns: unnesting, NULL filtering, materialised tables, hybrid retrieval.

See also