Skip to content

Commit 2db4f0a

Browse files
committed
fix more naming
1 parent 8eb6c3d commit 2db4f0a

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/lib/beta/BetaToolRunner.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ function promiseWithResolvers<T>(): {
3131
}
3232

3333
/**
34-
* A BetaToolRunner handles the automatic conversation loop between the assistant and tools.
34+
* A `BetaToolRunner` handles the automatic conversation loop between the assistant and tools.
3535
*
36-
* A BetaToolRunner is an async iterable that yields either ChatCompletion or
37-
* ChatCompletionStream objects depending on the streaming configuration.
36+
* A `BetaToolRunner` is an async iterable that yields either `ChatCompletion` or
37+
* `ChatCompletionStream` objects depending on the streaming configuration.
3838
*/
3939
export class BetaToolRunner<Stream extends boolean>
4040
implements AsyncIterable<Stream extends true ? ChatCompletionStream : ChatCompletion>
@@ -230,15 +230,15 @@ export class BetaToolRunner<Stream extends boolean>
230230
* Get the tool response for the last message from the assistant.
231231
* Avoids redundant tool executions by caching results.
232232
*
233-
* @returns A promise that resolves to a BetaMessageParam containing tool results, or null if no tools need to be executed
233+
* @returns A promise that resolves to a `ChatCompletionToolMessageParam` containing tool results, or null if no tools need to be executed
234234
*
235235
* @example
236236
* const toolResponse = await runner.generateToolResponse();
237237
* if (toolResponse) {
238238
* console.log('Tool results:', toolResponse.content);
239239
* }
240240
*/
241-
async generateToolResponse() {
241+
async generateToolResponse(): Promise<ChatCompletionToolMessageParam[] | null> {
242242
// The most recent message from the assistant.
243243
const message = await this.#message;
244244
if (!message) {
@@ -266,7 +266,7 @@ export class BetaToolRunner<Stream extends boolean>
266266
* Wait for the async iterator to complete. This works even if the async iterator hasn't yet started, and
267267
* will wait for an instance to start and go to completion.
268268
*
269-
* @returns A promise that resolves to the final BetaMessage when the iterator completes
269+
* @returns A promise that resolves to the final `ChatComletionMessage` when the iterator completes
270270
*
271271
* @example
272272
* // Start consuming the iterator
@@ -283,12 +283,14 @@ export class BetaToolRunner<Stream extends boolean>
283283
}
284284

285285
/**
286-
* Returns a promise indicating that the stream is done. Unlike .done(), this will eagerly read the stream:
287-
* * If the iterator has not been consumed, consume the entire iterator and return the final message from the
288-
* assistant.
289-
* * If the iterator has been consumed, waits for it to complete and returns the final message.
286+
* Returns a promise indicating that the stream is done. Unlike .done(), this
287+
* will eagerly read the stream:
290288
*
291-
* @returns A promise that resolves to the final BetaMessage from the conversation
289+
* - If the iterator has not been consumed, consume the entire iterator and
290+
* return the final message from the assistant.
291+
* - If the iterator has been consumed, waits for it to complete and returns the final message.
292+
*
293+
* @returns A promise that resolves to the final `ChatCompletionMessage` from the conversation
292294
* @throws {OpenAIError} If no messages were processed during the conversation
293295
*
294296
* @example

0 commit comments

Comments
 (0)