You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I love the abstraction in the pagination package and the ease of "GetNextPage()". Being able to check "has_ more" was a very simple way to manage whether I need to call the GetNextPage() or not.
Additionally, looking at the inner workings of GetNextPage, it itself utilizes a wasted API call to determine when the pagination itself has ended instead of checking the has_ more field to determine if the API call should be run. Ideally if I trust GetNextPage, I want to avoid unnecessary API calls so it would be great if that pagination abstraction could utilize the has_more field provided by the API.
Additionally it would be great if has_more was exposed in the struct as either a public field or a method accessible private field. Calling the raw json method and re-marshalling it into a complete struct isn't really a great option
EDIT:
I realize the documentation covers missing SDK fields which was good foresight hasMore, err :=strconv.ParseBool(res.JSON.ExtraFields["my_unexpected_field"].Raw())
It would be nice if ExtraFields had a ToBool helper
The issue still stands with the way GetNextPage does_not leverage this field and that it is important enough to be included in the actual struct
The text was updated successfully, but these errors were encountered:
Regarding https://github.com/openai/openai-go/blob/main/packages/pagination/pagination.go#L111
The API reference lists the pagination for every request with specific fields.
While I love the abstraction in the pagination package and the ease of "GetNextPage()". Being able to check "has_ more" was a very simple way to manage whether I need to call the GetNextPage() or not.
Additionally, looking at the inner workings of GetNextPage, it itself utilizes a wasted API call to determine when the pagination itself has ended instead of checking the has_ more field to determine if the API call should be run. Ideally if I trust GetNextPage, I want to avoid unnecessary API calls so it would be great if that pagination abstraction could utilize the has_more field provided by the API.
Additionally it would be great if has_more was exposed in the struct as either a public field or a method accessible private field. Calling the raw json method and re-marshalling it into a complete struct isn't really a great option
EDIT:
I realize the documentation covers missing SDK fields which was good foresight
hasMore, err :=strconv.ParseBool(res.JSON.ExtraFields["my_unexpected_field"].Raw())
It would be nice if ExtraFields had a ToBool helper
The issue still stands with the way GetNextPage does_not leverage this field and that it is important enough to be included in the actual struct
The text was updated successfully, but these errors were encountered: