-
Couldn't load subscription status.
- Fork 10
feat: add stream support for Bedrock #191
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
tests/integration_tests/clients/bedrock/test_chat_completions.py
Outdated
Show resolved
Hide resolved
| chunk_dict = {**chunk_dict, **bedrock_metrics_dict} | ||
| return json.dumps(chunk_dict) | ||
|
|
||
| def _process_chunks(self, event_stream_buffer, chunk): |
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.
Missing types
ai21/errors.py
Outdated
| class StreamingDecodeError(AI21Error): | ||
| def __init__(self, chunk: str, error_message: Optional[str] = None): | ||
| message = f"Failed to decode chunk: {chunk} in stream. Please check the stream format" | ||
| message = f"Failed to decode chunk: {chunk} in stream. Please check the stream format. " |
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 weird to add a space at the end of the string "just in case"
You can do something like -
if error_message:
message = f"{message} Error: {error_message}"
ai21/stream/stream_commons.py
Outdated
| pass | ||
|
|
||
|
|
||
| class _SSEDecoder(SSEDecoderBase): |
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.
If this class is protected then I assume the rest should be too no?
No description provided.