Skip to content

Getting requests.exceptions.ChunkedEncodingError when using TaskCompletion in stream mode or  #218

@WalidAxo

Description

@WalidAxo

Describe the bug

Hi,

I'm using the openaI python module and I'm experiencing some issues lately. I'm making a streaming completion task. Randomly I'm getting the following exception "requests.exceptions.ChunkedEncodingError : ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)".

def send_completion_task_stream(self):
prompt = """my prompt"""
response = self.completion_task.create(prompt=prompt, model=self.modal_name, stop=self.stop,
temperature=self.temperature,
top_p=self.top_p, frequency_penalty=self.frequency_penalty,
presence_penalty=self.presence_penalty,
max_tokens=3000,
stream=True
) return response `
do you know what can cause this error ?

Thank you

Best regards

To Reproduce

1- Send a streaming completion task and put max-token to 3000
2 - The errors appears (but randomly)

Code snippets

No response

OS

macOs

Python version

Python 3.10

Library version

openai-python-0.26.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions