Skip to content

Commit

Permalink
feat: Use correct type for runTools options so we can pass maxChatCom…
Browse files Browse the repository at this point in the history
…pletions with no TS error
  • Loading branch information
granmoe committed Sep 13, 2024
1 parent 8958d97 commit df664b4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/resources/beta/chat/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export {
ParsingFunction,
ParsingToolFunction,
} from '../../../lib/RunnableFunction';
import { RunnerOptions } from '../../../lib/AbstractChatCompletionRunner';
import { ChatCompletionToolRunnerParams } from '../../../lib/ChatCompletionRunner';
export { ChatCompletionToolRunnerParams } from '../../../lib/ChatCompletionRunner';
import { ChatCompletionStreamingToolRunnerParams } from '../../../lib/ChatCompletionStreamingRunner';
Expand Down Expand Up @@ -119,19 +120,19 @@ export class Completions extends APIResource {
runTools<
Params extends ChatCompletionToolRunnerParams<any>,
ParsedT = ExtractParsedContentFromParams<Params>,
>(body: Params, options?: Core.RequestOptions): ChatCompletionRunner<ParsedT>;
>(body: Params, options?: RunnerOptions): ChatCompletionRunner<ParsedT>;

runTools<
Params extends ChatCompletionStreamingToolRunnerParams<any>,
ParsedT = ExtractParsedContentFromParams<Params>,
>(body: Params, options?: Core.RequestOptions): ChatCompletionStreamingRunner<ParsedT>;
>(body: Params, options?: RunnerOptions): ChatCompletionStreamingRunner<ParsedT>;

runTools<
Params extends ChatCompletionToolRunnerParams<any> | ChatCompletionStreamingToolRunnerParams<any>,
ParsedT = ExtractParsedContentFromParams<Params>,
>(
body: Params,
options?: Core.RequestOptions,
options?: RunnerOptions,
): ChatCompletionRunner<ParsedT> | ChatCompletionStreamingRunner<ParsedT> {
if (body.stream) {
return ChatCompletionStreamingRunner.runTools(
Expand Down

0 comments on commit df664b4

Please sign in to comment.