hydeProviderForSession returns the embedding provider configured via CHATCLI_EMBED_PROVIDER, instantiating it on first use. Returns the null provider when nothing is configured or when construction fails (logged once per build).
()
| 34 | // the null provider when nothing is configured or when construction |
| 35 | // fails (logged once per build). |
| 36 | func (cli *ChatCLI) hydeProviderForSession() embedding.Provider { |
| 37 | hydeMu.Lock() |
| 38 | defer hydeMu.Unlock() |
| 39 | if !hydeProviderReady { |
| 40 | hydeProvider = cli.buildEmbeddingProviderLocked() |
| 41 | hydeProviderReady = true |
| 42 | } |
| 43 | return hydeProvider |
| 44 | } |
| 45 | |
| 46 | // buildEmbeddingProviderLocked constructs a provider from the current |
| 47 | // environment. Callers must hold hydeMu. |