-
Notifications
You must be signed in to change notification settings - Fork 10
feat: Batch API in Beta #278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
**kwargs, | ||
} | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The below looks like a generic util func that can be used globally in the sdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its currently used only for this list
function. when we have a second list function that requires similar handling, i'll move it to the http client. but for now I think its okay to leave it here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Left a couple of small comments
class Batch(AI21BaseModel): | ||
id: str | ||
"""The ID of the batch.""" | ||
status: Literal["FAILED", "PROCESSING", "COMPLETED", "EXPIRED", "CANCELLED", "PENDING"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder - add STALE
|
||
ResponseT = TypeVar("_ResponseT", bound=Union["AI21BaseModel", str, httpx.Response, List[Any]]) | ||
StreamT = TypeVar("_StreamT", bound=Stream[Any]) | ||
AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PaginationT rename suggestion to be extra clear -> SyncPaginationT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
params: Dict[str, Any] | None = None, | ||
response_cls: Type[PageT] | None = None, | ||
**kwargs: Any, | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change self.request_method to self.or fetch_items_method (or similar) to make it clear what it does? (the first sounds like its http verb)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops rename was missed. I called it request_callback
is that ok with you?
self, | ||
after: str | NotGiven = NOT_GIVEN, | ||
limit: int | NotGiven = NOT_GIVEN, | ||
) -> AsyncPagination[Batch]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth a docstring that limit
will control the page_size of this paginated api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problemos
355986b
to
cc9d55a
Compare
No description provided.