Repository: openai/openai-python

Issue:
[0.26.0] openai/cli.py:440: RuntimeWarning: coroutine 'FineTune.stream_events' was never awaited
```
bash$ openai api fine_tunes.create -t ./train_test_prepared.jsonl -m davinci
Upload progress: 100%|██████████████████████████████████████████████████████████████████████████████| 112/112 [00:00<00:00, 88.5kit/s]
Uploaded file from ./train_test_prepared.jsonl: file-ppEDNe0p6EomteEp3JFbBoFp
Created fine-tune: ft-u9KskmmvSnBtVc4VDfbe7lyr
Streaming events until fine-tuning is complete...

(Ctrl-C will interrupt the stream, but not cancel the fine-tune)

Stream interrupted (client disconnected).
To resume the stream, run:

  openai api fine_tunes.follow -i ft-u9KskmmvSnBtVc4VDfbe7lyr

/usr/lib/python3.10/site-packages/openai/cli.py:406: RuntimeWarning: coroutine 'FineTune.stream_events' was never awaited
  cls._stream_events(resp["id"])
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

```

it is working fine with 0.25.0

may be related:  dev-python/aiohttp-3.8.3



Discussion:
Same here for me. I thought it might be incompatible with my Python version (3.10), but it only worked when I installed version 0.25 of the package (pip install openai==0.25.0)
I have this same problem with version 0.25.0. Is there any other solution to this?
Hi there, 
I have the same issue even with 0.25.0 and 0.24.0
C:\Users\admindev\GPT>openai api fine_tunes.follow -i ft-mM9Fk2xqRQTtqbt7clQLheRf
[2023-01-12 13:00:28] Created fine-tune: ft-mM9Fk2xqRQTtqbt7clQLheRf

Stream interrupted (client disconnected).
To resume the stream, run:

  openai api fine_tunes.follow -i ft-mM9Fk2xqRQTtqbt7clQLheRf

and pip list output
<img width="241" alt="image" src="https://user-images.githubusercontent.com/109635633/211947794-2f037ece-d0fa-42b5-9b89-6e9fa10f6307.png">

Is there any solution for this problem?

Hey folks, the `FineTune.stream_events` method was made async by mistake, rather than adding an additional async version. We'll have a fix shortly.
Hey @ddeville, Great, thanks for the update!

Resolving patch:
diff --git a/openai/api_resources/fine_tune.py b/openai/api_resources/fine_tune.py
--- a/openai/api_resources/fine_tune.py
+++ b/openai/api_resources/fine_tune.py
@@ -128,7 +128,45 @@ def _prepare_stream_events(
         return requestor, url
 
     @classmethod
-    async def stream_events(
+    def stream_events(
+        cls,
+        id,
+        api_key=None,
+        api_base=None,
+        api_type=None,
+        request_id=None,
+        api_version=None,
+        organization=None,
+        **params,
+    ):
+        requestor, url = cls._prepare_stream_events(
+            id,
+            api_key,
+            api_base,
+            api_type,
+            request_id,
+            api_version,
+            organization,
+            **params,
+        )
+
+        response, _, api_key = requestor.request(
+            "get", url, params, stream=True, request_id=request_id
+        )
+
+        assert not isinstance(response, OpenAIResponse)  # must be an iterator
+        return (
+            util.convert_to_openai_object(
+                line,
+                api_key,
+                api_version,
+                organization,
+            )
+            for line in response
+        )
+
+    @classmethod
+    async def astream_events(
         cls,
         id,
         api_key=None,


Test patch: