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

Function buildAzureOpenAIProvider

apps/sim/lib/knowledge/embeddings.ts:123–145  ·  view source on GitHub ↗
(
  deployment: string,
  apiKey: string,
  endpoint: string,
  apiVersion: string
)

Source from the content-addressed store, hash-verified

121}
122
123function buildAzureOpenAIProvider(
124 deployment: string,
125 apiKey: string,
126 endpoint: string,
127 apiVersion: string
128): ResolvedProvider['buildRequest'] {
129 return (inputs) => ({
130 apiUrl: `${endpoint}/openai/deployments/${deployment}/embeddings?api-version=${apiVersion}`,
131 headers: {
132 'api-key': apiKey,
133 'Content-Type': 'application/json',
134 },
135 body: {
136 input: inputs,
137 encoding_format: 'float',
138 dimensions: EMBEDDING_DIMENSIONS,
139 },
140 parse: (json) => {
141 const data = json as { data: Array<{ embedding: number[] }> }
142 return data.data.map((item) => item.embedding)
143 },
144 })
145}
146
147/**
148 * Gemini does NOT auto-normalize embeddings when `outputDimensionality` is set below the

Callers 1

resolveProviderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected