Added new Edge inference API #47
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Added methods for consuming the new Modzy Edge Inference API. In the process, all the Python Protobuf/gRPC files have been regenerated using Protobuf v4.21.x and follow the new format using Python stub files (*.pyi).
The existing Job API methods on
EdgeClient
have been deprecated. The methods are now part of ajobs
property onEdgeClient
with the same method signatures. So, for example,EdgeClient.submit_text()
becomesEdgeClient.jobs.submit_text()
. The deprecated methods will be removed in the next release.The new Inference API methods are available under the
EdgeClient.inferences
property. Thestream
method is a simple iterator-based implementation and is not optimized. For optimized streaming, please use the underlying gRPC client library and use threading orasyncio
to support parallel input and output processing.The
EdgeClient
object now implements the dunder__enter__
and__exit__
methods so it can be used withwith
statements that automatically close the channel after completion. Recommended usage is now:If
with
cannot be used, you can initialize and close the connections using the following methods:Previously existing behavior with the now-deprecated methods is maintained. The deprecated methods will preserve the previous behavior where the connection is established automatically without requiring a separate step.
Checklist