MCPcopy Index your code
hub / github.com/simstudioai/sim / resolveGeminiKey

Function resolveGeminiKey

apps/sim/lib/knowledge/embeddings.ts:80–101  ·  view source on GitHub ↗
(workspaceId?: string | null)

Source from the content-addressed store, hash-verified

78}
79
80async function resolveGeminiKey(workspaceId?: string | null): Promise<{
81 apiKey: string
82 isBYOK: boolean
83}> {
84 if (workspaceId) {
85 const byokResult = await getBYOKKey(workspaceId, 'google')
86 if (byokResult) {
87 logger.info('Using workspace BYOK key for Gemini embeddings')
88 return { apiKey: byokResult.apiKey, isBYOK: true }
89 }
90 }
91 if (env.GEMINI_API_KEY) {
92 return { apiKey: env.GEMINI_API_KEY, isBYOK: false }
93 }
94 try {
95 return { apiKey: getRotatingApiKey('gemini'), isBYOK: false }
96 } catch {
97 throw new Error(
98 'GEMINI_API_KEY (or GEMINI_API_KEY_1/2/3 for rotation) must be configured for Gemini embeddings'
99 )
100 }
101}
102
103function buildOpenAIProvider(modelName: string, apiKey: string): ResolvedProvider['buildRequest'] {
104 return (inputs) => ({

Callers 1

resolveProviderFunction · 0.85

Calls 3

getBYOKKeyFunction · 0.90
getRotatingApiKeyFunction · 0.90
infoMethod · 0.80

Tested by

no test coverage detected