-
Notifications
You must be signed in to change notification settings - Fork 0
@ralphschuler.ai function caller.index.<internal>.PagePromise
index.<internal>.PagePromise
This subclass of Promise will resolve to an instantiated Page once the request completes.
It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
for await (const item of client.items.list()) { console.log(item) }
Name | Type |
---|---|
PageClass |
extends AbstractPage <Item > |
Item |
ReturnType <PageClass ["getPaginatedItems" ]>[number ] |
-
APIPromise
<PageClass
>↳
PagePromise
-
AsyncIterable
<Item
>
- [asyncIterator]
- _thenUnwrap
- asResponse
- catch
- finally
- then
- withResponse
- all
- allSettled
- any
- race
- reject
- resolve
• new PagePromise<PageClass
, Item
>(client
, request
, Page
): PagePromise
<PageClass
, Item
>
Name | Type |
---|---|
PageClass |
extends AbstractPage <Item > |
Item |
ReturnType <PageClass ["getPaginatedItems" ]>[number ] |
Name | Type |
---|---|
client |
APIClient |
request |
Promise <APIResponseProps > |
Page |
(...args : [client: APIClient, response: Response, body: unknown, options: FinalRequestOptions<Readable | Record<string, unknown>>]) => PageClass
|
PagePromise
<PageClass
, Item
>
node_modules/openai/core.d.ts:161
• Readonly
[toStringTag]: string
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:176
▪ Static
Readonly
[species]: PromiseConstructor
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:180
▸ [asyncIterator](): AsyncGenerator
<Awaited
<Item
>, void
, unknown
>
Allow auto-paginating iteration on an unawaited list call, eg:
for await (const item of client.items.list()) { console.log(item) }
AsyncGenerator
<Awaited
<Item
>, void
, unknown
>
node_modules/openai/core.d.ts:169
▸ _thenUnwrap<U
>(transform
): APIPromise
<U
>
Name |
---|
U |
Name | Type |
---|---|
transform |
(data : PageClass ) => U
|
APIPromise
<U
>
node_modules/openai/core.d.ts:24
▸ asResponse(): Promise
<Response
>
Gets the raw Response
instance instead of parsing the response
data.
If you want to parse the response body but still get the Response
instance, you can use ().
👋 Getting the wrong TypeScript type for Response
?
Try setting "moduleResolution": "NodeNext"
if you can,
or add one of these imports before your first import … from 'openai'
:
-
import 'openai/shims/node'
(if you're running on Node) -
import 'openai/shims/web'
(otherwise)
Promise
<Response
>
node_modules/openai/core.d.ts:38
▸ catch<TResult
>(onrejected?
): Promise
<PageClass
| TResult
>
Name | Type |
---|---|
TResult |
never |
Name | Type |
---|---|
onrejected? |
null | (reason : any ) => TResult | PromiseLike <TResult > |
Promise
<PageClass
| TResult
>
node_modules/openai/core.d.ts:58
▸ finally(onfinally?
): Promise
<PageClass
>
Name | Type |
---|---|
onfinally? |
null | () => void
|
Promise
<PageClass
>
node_modules/openai/core.d.ts:59
▸ then<TResult1
, TResult2
>(onfulfilled?
, onrejected?
): Promise
<TResult1
| TResult2
>
Name | Type |
---|---|
TResult1 |
PageClass |
TResult2 |
never |
Name | Type |
---|---|
onfulfilled? |
null | (value : PageClass ) => TResult1 | PromiseLike <TResult1 > |
onrejected? |
null | (reason : any ) => TResult2 | PromiseLike <TResult2 > |
Promise
<TResult1
| TResult2
>
node_modules/openai/core.d.ts:57
▸ withResponse(): Promise
<{ data
: PageClass
; response
: Response
}>
Gets the parsed response data and the raw Response
instance.
If you just want to get the raw Response
instance without parsing it,
you can use ().
👋 Getting the wrong TypeScript type for Response
?
Try setting "moduleResolution": "NodeNext"
if you can,
or add one of these imports before your first import … from 'openai'
:
-
import 'openai/shims/node'
(if you're running on Node) -
import 'openai/shims/web'
(otherwise)
Promise
<{ data
: PageClass
; response
: Response
}>
node_modules/openai/core.d.ts:52
▸ all<T
>(values
): Promise
<Awaited
<T
>[]>
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
Name |
---|
T |
Name | Type | Description |
---|---|---|
values |
Iterable <T | PromiseLike <T >> |
An iterable of Promises. |
Promise
<Awaited
<T
>[]>
A new Promise.
node_modules/typescript/lib/lib.es2015.iterable.d.ts:225
▸ all<T
>(values
): Promise
<{ -readonly [P in string | number | symbol]: Awaited<T[P]> }>
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
Name | Type |
---|---|
T |
extends [] | readonly unknown [] |
Name | Type | Description |
---|---|---|
values |
T |
An array of Promises. |
Promise
<{ -readonly [P in string | number | symbol]: Awaited<T[P]> }>
A new Promise.
node_modules/typescript/lib/lib.es2015.promise.d.ts:39
▸ allSettled<T
>(values
): Promise
<{ -readonly [P in string | number | symbol]: PromiseSettledResult<Awaited<T[P]>> }>
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.
Name | Type |
---|---|
T |
extends [] | readonly unknown [] |
Name | Type | Description |
---|---|---|
values |
T |
An array of Promises. |
Promise
<{ -readonly [P in string | number | symbol]: PromiseSettledResult<Awaited<T[P]>> }>
A new Promise.
node_modules/typescript/lib/lib.es2020.promise.d.ts:38
▸ allSettled<T
>(values
): Promise
<PromiseSettledResult
<Awaited
<T
>>[]>
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.
Name |
---|
T |
Name | Type | Description |
---|---|---|
values |
Iterable <T | PromiseLike <T >> |
An array of Promises. |
Promise
<PromiseSettledResult
<Awaited
<T
>>[]>
A new Promise.
node_modules/typescript/lib/lib.es2020.promise.d.ts:46
▸ any<T
>(values
): Promise
<Awaited
<T
[number
]>>
The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
Name | Type |
---|---|
T |
extends [] | readonly unknown [] |
Name | Type | Description |
---|---|---|
values |
T |
An array or iterable of Promises. |
Promise
<Awaited
<T
[number
]>>
A new Promise.
node_modules/typescript/lib/lib.es2021.promise.d.ts:40
▸ any<T
>(values
): Promise
<Awaited
<T
>>
The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
Name |
---|
T |
Name | Type | Description |
---|---|---|
values |
Iterable <T | PromiseLike <T >> |
An array or iterable of Promises. |
Promise
<Awaited
<T
>>
A new Promise.
node_modules/typescript/lib/lib.es2021.promise.d.ts:47
▸ race<T
>(values
): Promise
<Awaited
<T
>>
Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
Name |
---|
T |
Name | Type | Description |
---|---|---|
values |
Iterable <T | PromiseLike <T >> |
An iterable of Promises. |
Promise
<Awaited
<T
>>
A new Promise.
node_modules/typescript/lib/lib.es2015.iterable.d.ts:233
▸ race<T
>(values
): Promise
<Awaited
<T
[number
]>>
Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
Name | Type |
---|---|
T |
extends [] | readonly unknown [] |
Name | Type | Description |
---|---|---|
values |
T |
An array of Promises. |
Promise
<Awaited
<T
[number
]>>
A new Promise.
node_modules/typescript/lib/lib.es2015.promise.d.ts:50
▸ reject<T
>(reason?
): Promise
<T
>
Creates a new rejected promise for the provided reason.
Name | Type |
---|---|
T |
never |
Name | Type | Description |
---|---|---|
reason? |
any |
The reason the promise was rejected. |
Promise
<T
>
A new rejected Promise.
node_modules/typescript/lib/lib.es2015.promise.d.ts:60
▸ resolve(): Promise
<void
>
Creates a new resolved promise.
Promise
<void
>
A resolved promise.
node_modules/typescript/lib/lib.es2015.promise.d.ts:66
▸ resolve<T
>(value
): Promise
<Awaited
<T
>>
Creates a new resolved promise for the provided value.
Name |
---|
T |
Name | Type | Description |
---|---|---|
value |
T |
A promise. |
Promise
<Awaited
<T
>>
A promise whose internal state matches the provided promise.
node_modules/typescript/lib/lib.es2015.promise.d.ts:72
▸ resolve<T
>(value
): Promise
<Awaited
<T
>>
Creates a new resolved promise for the provided value.
Name |
---|
T |
Name | Type | Description |
---|---|---|
value |
T | PromiseLike <T > |
A promise. |
Promise
<Awaited
<T
>>
A promise whose internal state matches the provided promise.
node_modules/typescript/lib/lib.es2015.promise.d.ts:78
- @ralphschuler/ai-function-caller
- index
- types/AIFunction
- types/Message
- @ralphschuler/assert
- assert
- assert
- assert
- assert
- assert
- assert
- assert
- assert
- assert
- assert
- assert
- assert
- assert
- error
- index
- util
- @ralphschuler/better-map
- @ralphschuler/better-set
- @ralphschuler/binary-serializer
- @ralphschuler/bit-mask
- @ralphschuler/complex-compare
- @ralphschuler/i811n
- @ralphschuler/logger
- Color
- ColorMap
- Logger
- animations/BallonAnimation
- animations/BaseAnimation
- animations/BombAnimation
- animations/BouncingBallAnimation
- animations/ClockAnimation
- animations/DotsAnimation
- animations/HorizontalBarAnimation
- animations/PongAnimation
- animations/ProgressAnimation
- animations/ProgressBarAnimation
- animations/SpinnerAnimation
- animations/VerticalBarAnimation
- enums/LogLevel
- index
- interfaces/IColor
- interfaces/IMessage
- types/ColorName
- types/Colors
- @ralphschuler/lsystem
- @ralphschuler/mixin-class-factory
- @ralphschuler/neuronal-network
- @ralphschuler/parser-combinator
- index
- inputTypes
- parser
- unicode
- @ralphschuler/prom-metrics-decorator
- @ralphschuler/prom-metrics-parser
- @ralphschuler/random
- PseudoRandomItemSelector
- PseudoRandomNumberGenerator
- Seed
- index
- strategies
- strategy
- strategy
- strategy
- strategy
- strategy
- strategy
- types
- type
- type
- type
- @ralphschuler/safe-array
- @ralphschuler/slot-mashine
- @ralphschuler/state-store
- StateStore
- index
- type
- type
- type
- type
- type
- type
- type
- type
- util
- @ralphschuler/stats-tracker
- @ralphschuler/ts-error
- error
- index
- type
- util
- util
- util
- util
- @ralphschuler/webgl-sand-engine
- index
- pixel-renderer
- @ralphschuler/webgl-shader-factory
- "node:stream/consumers"
- "node:stream/promises"
- ChatCompletionSnapshot
- Choice
- Message
- ToolCall
- EventEmitter
- FormData
- OpenAI
- OpenAI
- Audio
- Speech
- Transcriptions
- Translations
- Beta
- Assistants
- Assistant
- AssistantCreateParams
- AssistantUpdateParams
- Files
- Chat
- Threads
- Messages
- Files
- MessageContentImageFile
- MessageContentText
- Text
- FileCitation
- FilePath
- Runs
- RequiredActionFunctionToolCall
- Run
- RequiredAction
- RunCreateParams
- RunSubmitToolOutputsParams
- Steps
- CodeToolCall
- CodeInterpreter
- Image
- FunctionToolCall
- MessageCreationStepDetails
- RunStep
- ThreadCreateAndRunParams
- Thread
- ThreadCreateParams
- Chat
- Completions
- ChatCompletion
- ChatCompletionAssistantMessageParam
- ChatCompletionChunk
- Choice
- Delta
- ToolCall
- ChatCompletionContentPartImage
- ChatCompletionCreateParams
- ChatCompletionMessage
- ChatCompletionMessageToolCall
- ChatCompletionNamedToolChoice
- Completions
- CompletionChoice
- CompletionCreateParams
- Edits
- Edit
- Embeddings
- CreateEmbeddingResponse
- Files
- FineTunes
- FineTune
- FineTuneCreateParams
- FineTuneListEventsParams
- FineTuning
- Jobs
- FineTuningJob
- JobCreateParams
- Images
- Models
- Moderations
- Moderation
- internal
- finished
- pipeline
- "node:stream/consumers"
- "node:stream/promises"
- EventEmitter
- internal
- finished
- pipeline
- Counter
- Gauge
- Histogram
- Summary