Ultipa GQLDB provides built-in AI features for working with vectors, embeddings, similarity search, and natural language query generation. The vector and embedding utilities are scalar functions, while the natural-language pipeline (ai.gql) is exposed as a streaming procedure. All names use the ai. prefix.
List all registered AI providers with their configuration and status:
GQLSHOW AI PROVIDERS
Result:
| provider | supports | embedding_model | embedding_dim | completion_model | base_url | status | Description |
|---|---|---|---|---|---|---|---|
| openai | embedding,completion | text-embedding-3-small | 1536 | gpt-4o-mini | https://api.openai.com/v1 | configured | OpenAI (GPT, text-embedding-3 family) |
| gemini | embedding,completion | gemini-embedding-001 | 3072 | gemini-2.5-flash | https://generativelanguage.googleapis.com/v1beta | configured | Google Gemini (native GenerateContent/Embed API) |
| qwen | embedding,completion | text-embedding-v3 | 1024 | qwen3-max | https://dashscope-intl.aliyuncs.com/compatible-mode/v1 | unconfigured | Alibaba DashScope Qwen (OpenAI-compatible) |
| lmstudio | embedding,completion | null | null | null | http://localhost:1234/v1 | unconfigured | LM Studio (local OpenAI-compatible server) |
| anthropic | completion | null | null | claude-sonnet-4-5 | https://api.anthropic.com/v1 | unconfigured | Anthropic Claude (completion only) |
| xai | completion | null | null | grok-4-1-fast-reasoning | https://api.x.ai/v1 | unconfigured | xAI Grok (OpenAI-compatible, completion only) |
| deepseek | completion | null | null | deepseek-chat | https://api.deepseek.com/v1 | unconfigured | DeepSeek (OpenAI-compatible, completion only) |
| minimax | completion | null | null | MiniMax-M2 | https://api.minimax.io/v1 | unconfigured | MiniMax (OpenAI-compatible, completion only) |
Use this to verify which providers have API keys configured, which are active, and whether they support embedding, completion, or both.
AI functions rely on two types of AI providers:
Embedding providers convert text into high-dimensional vectors (embeddings) that capture semantic meaning. These vectors enable similarity search, recommendations, and clustering. Functions like ai.embed() and ai.cosine() use the embedding provider.
Completion providers use large language models to generate GQL queries from natural language. Functions like ai.gql() use the completion provider.
Some providers support both embedding and completion, while others support only one. You can configure different providers for each role (e.g., OpenAI for embeddings, Anthropic for completion).
| Function | Description |
|---|---|
| ai.set_api_key() | Sets the API key for an AI provider. |
| ai.set_provider() | Sets the active embedding provider. |
| ai.provider() | Returns the name of the current embedding provider. |
| ai.embed_dim() | Returns the embedding dimension of the current provider. |
| ai.set_embedding_model() | Overrides the embedding model for a provider at runtime. Warns and requires ai.rebuild_index() if the embedding dimension changes. |
| ai.set_completion_provider() | Sets the active completion provider. |
| ai.completion_provider() | Returns the name of the current completion provider. |
| ai.set_completion_model() | Overrides the completion model for a provider at runtime. |
| Procedure/Function | Description |
|---|---|
| ai.gql() | Streaming procedure. Converts natural language to a GQL query. |
| ai.explain() | Runs the NL-to-GQL pipeline and returns the generated query with a full reasoning trace (schema, generation steps, tool calls, validation, token usage). Does not execute. |
| ai.trace() | Returns the most recent NL-to-GQL pipeline trace, or NULL if none. |
| ai.traces() | Returns the most recent n traces (newest first). |
| ai.rate() | Attaches a 1–5 rating and optional comment to the most recent trace. Ratings of 1 or 2 also purge the (NL, GQL) pair from per-graph query memory. |
| ai.save_skill() | Saves a named NL template. Passing an empty NL deletes the skill. |
| ai.list_skills() | Lists every saved skill as records. |
| ai.drop_skill() | Removes a saved skill by name. |
| ai.skill_nl() | Returns the NL template of a saved skill so it can be piped into ai.gql(). |
| ai.ai_config() | Returns the current NL-to-GQL pipeline configuration. |
| ai.set_ai_config() | Sets a configuration parameter for the NL-to-GQL pipeline. |
| Function | Description |
|---|---|
| ai.vector() | Converts a list of numbers to a VECTOR type. |
| ai.embed() | Generates an embedding vector from text using the configured AI provider. |
| ai.embed_batch() | Generates embedding vectors for multiple texts in a single batched call. |
| Function | Description |
|---|---|
| ai.cosine() | Computes cosine similarity between two vectors. |
| ai.euclidean() | Computes Euclidean (L2) distance between two vectors. |
| ai.euclidean_squared() | Computes squared Euclidean distance — same ordering as Euclidean but skips the final sqrt, faster for nearest-neighbor ranking. |
| ai.dot() | Computes dot product of two vectors. |
| ai.distance() | Computes cosine distance (1 - cosine similarity). |
| ai.manhattan() | Computes Manhattan (L1) distance between two vectors. |
| ai.hamming() | Computes Hamming distance — count of coordinates that differ between two vectors. |
| vector_distance() | A single function call covers all six distance metrics. |
| Function | Description |
|---|---|
| ai.dimension() | Gets the number of dimensions in a vector. |
| ai.magnitude() | Gets the magnitude (L2 norm) of a vector. |
| ai.normalize() | Normalizes a vector to unit length. |
| ai.toList() | Converts a vector to a list of numbers. |
| vector_norm() | Returns the L2 or L1 norm of a vector under a metric. |
| vector_serialize() | Converts a vector to its textual list form ("[N1, N2, …]"). |
| ai.add() | Adds two vectors element-wise. |
| ai.subtract() | Subtracts two vectors element-wise. |
| ai.scale() | Multiplies a vector by a scalar. |
| ai.rebuild_index() | Rebuilds an HNSW vector index. |
| ai.set_index_option() | Updates a runtime vector index option. |