Discussion about this post

User's avatar
William Lees's avatar

Comments for Prof Morffis on How to Train Your Chatbot Chapter One

typos

You write that we won't use any additional libraries beyond openai. However, this example also uses streamlit.

uv

"thatl" -> "Astral"

use command "pip install uv" to install uv

"documentatiopn" should be "documentation"

"the opena Python package" -> the openai Python package

formatting

In your corresponding piece of code, the Python formatter changes single quote to double quote.

-- snip --

#after formatting

for msg in st.session_state.get("conversation", []):

with st.chat_message(msg["role"]):

st.write(msg["content"])

-- snip --

missing tags

Many of the code blocks in the article are missing their

<<tag-name>>

It is hard to type in the code from scratch based solely on the article because some of the code chunk tags are missing.

inconsistent terminology

Regarding the section of the article titled "rebuilding the conversation history" - does this correspond to the section of the code with the comment # <<regenerate the conversation history>>

Your terminology differs, between "rebuild" and "regenerate"

datatype mismatch

After I have re-assembled the program according to the article, I am left with one error

if msg := chunk.choices[0].delta.content:

The error is "incompatible types in assignment"

I am thinking the corrected code is:

-- code --

temp = chunk.choices[0].delta.content

if temp:

msg = temp

if msg:

yield msg

-- code --

missing run command

You might say that to run the app, use the command:

streamlit run basic.py

Expand full comment

No posts