I tried to set up embeddings with openAI as a proiveder. But, I run the connectivity test, it always tells me it doesn’t find the AI API key.
If I comment out the embeddings part, the connectivity test passes for the chat part.
Below is my setup (CONFIG page).
local openai_key = "sk-********************"
config.set {
ai = {
-- Provider-level configuration
providers = {
openai = {
apiKey = openai_key,
-- Could also be something like: apiKey = config.get("ai.keys.OPENAI_API_KEY"),
useProxy = false,
preferredModels = {"gpt-4o", "gpt-4o-mini"}
}
-- , ollama = {
-- baseUrl = "http://host.docker.internal:11434",
-- preferredModels = {"bge-m3"}
-- }
-- ,gemini = {
-- apiKey = "your-gemini-key",
-- preferredModels = {"gemini-2.0-flash"}
-- }
},
-- Default model to use (format: "provider:modelName")
-- This is auto-selected on startup if no model is already selected on this client
defaultTextModel = "openai:gpt-4o-mini",
-- Embedding
indexEmbeddings = true,
--indexEmbeddingsExcludePages = {"my_passwords"},
--indexEmbeddingsExcludeStrings = {"**user**:", "Daily Quote:"},
embeddingModels = {
-- Only the first model is currently used
{
name = "openaiemb",
modelName = "text-embedding-3-small",
provider = "openai",
-- baseUrl = "http://localhost:11434",
requireAuth = true,
secretName = ai.keys,
useProxy = false
}
},
-- Chat settings
chat = {
-- Enable AI tools (read/write notes, search, etc.)
enableTools = true,
-- Parse [[wiki-links]] and include their content as context
parseWikiLinks = true,
-- Search embeddings for relevant context (requires indexEmbeddings)
searchEmbeddings = true,
bakeMessages = true,
-- Default agent to use (by name)
defaultAgent = nil,
-- When using chat, the userInformation and userInstructions
-- are included in the system prompt.
userInformation = "I'm a italian IT Architect who likes taking notes.",
userInstructions = "Please give short and concise responses. When providing code, do so in python unless requested otherwise with comment in line in english. All other word must be in italian. ",
-- Dynamic context (Lua expression evaluated at chat time)
customContext = [["Today is " .. os.date("%Y-%m-%d")]],
-- Custom enrichment functions to run on messages
customEnrichFunctions = {},
-- Skip tool approval prompts (useful for benchmarks/automation)
skipToolApproval = false
}
}
}
Thanks in advance