fix OpenAI embedder baseurl (#4275)
This commit is contained in:
@@ -26,6 +26,7 @@ export class ConfigManager {
|
|||||||
? userConf.apiKey
|
? userConf.apiKey
|
||||||
: defaultConf.apiKey,
|
: defaultConf.apiKey,
|
||||||
model: finalModel,
|
model: finalModel,
|
||||||
|
baseURL: userConf?.baseURL,
|
||||||
url: userConf?.url,
|
url: userConf?.url,
|
||||||
embeddingDims: userConf?.embeddingDims,
|
embeddingDims: userConf?.embeddingDims,
|
||||||
modelProperties:
|
modelProperties:
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ export class OpenAIEmbedder implements Embedder {
|
|||||||
private embeddingDims?: number;
|
private embeddingDims?: number;
|
||||||
|
|
||||||
constructor(config: EmbeddingConfig) {
|
constructor(config: EmbeddingConfig) {
|
||||||
this.openai = new OpenAI({ apiKey: config.apiKey });
|
this.openai = new OpenAI({
|
||||||
|
apiKey: config.apiKey,
|
||||||
|
baseURL: config.baseURL || config.url,
|
||||||
|
});
|
||||||
this.model = config.model || "text-embedding-3-small";
|
this.model = config.model || "text-embedding-3-small";
|
||||||
this.embeddingDims = config.embeddingDims || 1536;
|
this.embeddingDims = config.embeddingDims || 1536;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export interface Message {
|
|||||||
export interface EmbeddingConfig {
|
export interface EmbeddingConfig {
|
||||||
apiKey?: string;
|
apiKey?: string;
|
||||||
model?: string | any;
|
model?: string | any;
|
||||||
|
baseURL?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
embeddingDims?: number;
|
embeddingDims?: number;
|
||||||
modelProperties?: Record<string, any>;
|
modelProperties?: Record<string, any>;
|
||||||
|
|||||||
Reference in New Issue
Block a user