Skip to content

Commit fca4306

Browse files
authored
fix unit 15 README.md final example code bug
Final example in unit 15 appears to have a bug. The python code retrieves relevant chunks and appends to history[], then finally appends the user query to history[], but then only sends the last entry of history[] (the user query) to the LLM. This means the RAG steps do not benefit the LLM query. I'm not sure the intent of the history[-1] line, but I am certain the intent is not what the code currently does. I made a reasonable assumption that the code would be closer or equal to the author's intent if the full history[] were joined and sent to the LLM.
1 parent 33b7cd4 commit fca4306

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

15-rag-and-vector-databases/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def chatbot(user_input):
208208
# create a message object
209209
messages=[
210210
{"role": "system", "content": "You are an AI assistant that helps with AI questions."},
211-
{"role": "user", "content": history[-1]}
211+
{"role": "user", "content": "\n\n".join(history) }
212212
]
213213

214214
# use chat completion to generate a response

0 commit comments

Comments
 (0)