v0.7.0

API Key

Last updated

This page explains where ToriiDB looks for the OpenAI API key and what happens when none is found.

Lookup Order

openai.New resolves the key in this order and trims whitespace at each step:

Order Source
1 The optional apiKey argument of store.New(dir, apiKey) / daemon.New(dir, apiKey)
2 OPENAI_API_KEY environment variable
3 OS keychain entry OPENAI_API_KEY under service ToriiDB

Passing more than one apiKey value makes store.New fail with just one api key. When no key is found the store still opens; vector operations return ErrNoEmbedder (no embedder: OPENAI_API_KEY not provided). Use Session.HasEmbedder() or Daemon.HasEmbedder(ctx) to check.

中文