Compare commits

...

4 Commits

2 changed files with 15 additions and 5 deletions
@@ -18,6 +18,8 @@ custom_edit_url: null
**new OpenAIEmbedding**(`init?`)
The constructor now retrieves the session from the parameters whether using Azure or not. If a session is not provided in the parameters, a new session will be created. If a session is provided in the parameters, it is used instead of creating a new session.
#### Parameters
| Name | Type |
+13 -5
View File
@@ -259,11 +259,19 @@ export class OpenAIEmbedding extends BaseEmbedding {
});
} else {
this.apiKey = init?.apiKey ?? undefined;
this.session = getOpenAISession({
apiKey: this.apiKey,
maxRetries: this.maxRetries,
timeout: this.timeout,
});
if (init?.session && typeof init?.session === 'object') {
this.session = init?.session;
} else {
if (init?.session && typeof init?.session === 'object') {
this.session = init?.session;
} else {
this.session = getOpenAISession({
apiKey: this.apiKey,
maxRetries: this.maxRetries,
timeout: this.timeout,
});
}
}
}
}