@chinmaymk/aikit / createEmbeddingsProvider
Function: createEmbeddingsProvider()
Call Signature
createEmbeddingsProvider(
type,options):OpenAIEmbeddingProvider
Defined in: factory.ts:187
Generic embeddings provider factory function with strong typing. Creates embedding providers with full type safety. Returns a narrowed type based on the provider type.
Parameters
type
"openai_embeddings"
options
WithApiKey<OpenAIEmbeddingOptions>
Returns
Example
// Strongly typed - options are specific to the provider type
const openaiEmbeddings = createEmbeddingsProvider('openai_embeddings', {
apiKey: 'sk-...',
model: 'text-embedding-3-large',
dimensions: 1024 // OpenAI-specific option
});
const googleEmbeddings = createEmbeddingsProvider('google_embeddings', {
apiKey: 'AIza...',
model: 'text-embedding-004'
});Call Signature
createEmbeddingsProvider(
type,options):GoogleEmbeddingProvider
Defined in: factory.ts:191
Generic embeddings provider factory function with strong typing. Creates embedding providers with full type safety. Returns a narrowed type based on the provider type.
Parameters
type
"google_embeddings"
options
WithApiKey<GoogleEmbeddingOptions>
Returns
Example
// Strongly typed - options are specific to the provider type
const openaiEmbeddings = createEmbeddingsProvider('openai_embeddings', {
apiKey: 'sk-...',
model: 'text-embedding-3-large',
dimensions: 1024 // OpenAI-specific option
});
const googleEmbeddings = createEmbeddingsProvider('google_embeddings', {
apiKey: 'AIza...',
model: 'text-embedding-004'
});Call Signature
createEmbeddingsProvider(
type,options):AnyEmbeddingProvider
Defined in: factory.ts:195
Generic embeddings provider factory function with strong typing. Creates embedding providers with full type safety. Returns a narrowed type based on the provider type.
Parameters
type
options
WithApiKey<OpenAIEmbeddingOptions | GoogleEmbeddingOptions>
Returns
Example
// Strongly typed - options are specific to the provider type
const openaiEmbeddings = createEmbeddingsProvider('openai_embeddings', {
apiKey: 'sk-...',
model: 'text-embedding-3-large',
dimensions: 1024 // OpenAI-specific option
});
const googleEmbeddings = createEmbeddingsProvider('google_embeddings', {
apiKey: 'AIza...',
model: 'text-embedding-004'
});