UltipaDocs
Products
Solutions
Resources
Company
Start Free Trial
UltipaDocs
Start Free Trial
  • Overview
  • Provider Configuration
  • AI Completion
  • Vectors
  • Vector Similarity Search
  • Vector Utilities
  1. Docs
  2. /
  3. AI Functions

Provider Configuration

Configure AI providers for embedding generation and completion. Use SHOW AI PROVIDERS to see all available providers and their current status.

ai.setapikey()

Sets the API key for an AI provider. Optionally activates it as the current provider.

Syntaxai.setapikey(<provider>, <apiKey> [, <activate>])
ArgumentsNameTypeDescription
<provider>STRINGProvider name (see Supported Providers)
<apiKey>STRINGThe API key
<activate>BOOLOptional. Whether to set this as the active provider (default: true)
Return TypeBOOL

By default, calling ai.setapikey() both sets the key and activates the provider:

GQL
RETURN ai.setapikey("openai", "sk-...")

Each provider stores one API key. Calling ai.setapikey() again for the same provider overwrites the previous key. To set keys for multiple providers without activating them, pass false as the third argument, then use ai.setprovider() to switch:

GQL
RETURN ai.setapikey("gemini", "AQ.za...", false)

Embedding Provider

ai.setprovider()

Sets the active embedding provider. The provider's API key must have been set first via ai.setapikey().

Syntaxai.setprovider(<provider>)
ArgumentsNameTypeDescription
<provider>STRINGEmbedding provider name (see Supported Providers)
Return TypeBOOL
GQL
RETURN ai.setprovider("openai")

ai.provider()

Returns the name of the current embedding provider.

Syntaxai.provider()
ArgumentsNone
Return TypeSTRING
GQL
RETURN ai.provider()

ai.embeddim()

Returns the embedding dimension of the current provider. Returns null if no embedding provider is active or the provider doesn't support embedding.

Syntaxai.embeddim()
ArgumentsNone
Return TypeINT
GQL
RETURN ai.embeddim()

Completion Provider

ai.setCompletionProvider()

Sets the active completion provider. The provider's API key must have been set first via ai.setapikey().

Syntaxai.setCompletionProvider(<provider>)
ArgumentsNameTypeDescription
<provider>STRINGProvider name (see Supported Providers)
Return TypeBOOL
GQL
RETURN ai.setCompletionProvider("anthropic")

ai.completionProvider()

Returns the name of the current completion provider.

Syntaxai.completionProvider()
ArgumentsNone
Return TypeSTRING
GQL
RETURN ai.completionProvider()