autogen icon indicating copy to clipboard operation
autogen copied to clipboard

Using top level awaits in tutorial notebooks is confusing

Open jackgerrits opened this issue 1 year ago • 2 comments

Jupyter allows top level await which is very convenient - but when we then render these notebooks to a docs page is confusing for users as it is not confusing why there is a top level await when this isn't normally supported in python.

Not sure what the best solution is here but we need to improve/fix this

jackgerrits avatar Oct 22 '24 18:10 jackgerrits

Hi @jackgerrits , I agree and kinda feel the struggle when having to copy paste each code block and wrap the awaits inside an async function.

One proposal could be to have the full code of the notebook inside a dropdown at the bottom of the notebook.

```{dropdown} Full Code
:icon: code
```python
# Here goes the full code

Block of code with a handy copy button!

gziz avatar Nov 08 '24 07:11 gziz

I like it but unfortunately we lose the ability to easily check those codeblocks so they can become out of sync easily. The approach taken in this page feels like a potentially simple solution where we structure things such that running the main is nice and easy when a user does face the error

jackgerrits avatar Nov 15 '24 15:11 jackgerrits

Addressed all usages of top-level awaits in agentchat using comments.

Let's use #4378 to address notebook usability.

ekzhu avatar Dec 15 '24 06:12 ekzhu