Add request timeout to OpenAI
This commit is contained in:
parent
cfd9bc4e31
commit
b970565f8c
1 changed files with 8 additions and 10 deletions
|
|
@ -18,11 +18,14 @@ import type {
|
|||
import { z } from "zod";
|
||||
import { OpenAIConfigSchema } from "../types.js";
|
||||
import {
|
||||
customFetch,
|
||||
chatChunk,
|
||||
usageChatChunk,
|
||||
chatChunkFromDelta,
|
||||
customFetch
|
||||
} from "../util.js";
|
||||
import {
|
||||
BaseLlmApi,
|
||||
CreateRerankResponse,
|
||||
FimCreateParamsStreaming,
|
||||
RerankCreateParams,
|
||||
} from "./base.js";
|
||||
import {
|
||||
createResponsesStreamState,
|
||||
fromResponsesChunk,
|
||||
|
|
@ -30,12 +33,6 @@ import {
|
|||
responseToChatCompletion,
|
||||
toResponsesParams,
|
||||
} from "./openaiResponses.js";
|
||||
import {
|
||||
BaseLlmApi,
|
||||
CreateRerankResponse,
|
||||
FimCreateParamsStreaming,
|
||||
RerankCreateParams,
|
||||
} from "./base.js";
|
||||
|
||||
export class OpenAIApi implements BaseLlmApi {
|
||||
openai: OpenAI;
|
||||
|
|
@ -53,6 +50,7 @@ export class OpenAIApi implements BaseLlmApi {
|
|||
apiKey: config.apiKey ?? "",
|
||||
baseURL: this.apiBase,
|
||||
fetch: customFetch(config.requestOptions),
|
||||
timeout: config?.requestOptions?.timeout || undefined
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue